Line data Source code
1 : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 : Copyright (c) 2016-2023 The plumed team 3 : (see the PEOPLE file at the root of the distribution for a list of names) 4 : 5 : See http://www.plumed.org for more information. 6 : 7 : This file is part of plumed, version 2. 8 : 9 : plumed is free software: you can redistribute it and/or modify 10 : it under the terms of the GNU Lesser General Public License as published by 11 : the Free Software Foundation, either version 3 of the License, or 12 : (at your option) any later version. 13 : 14 : plumed is distributed in the hope that it will be useful, 15 : but WITHOUT ANY WARRANTY; without even the implied warranty of 16 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 : GNU Lesser General Public License for more details. 18 : 19 : You should have received a copy of the GNU Lesser General Public License 20 : along with plumed. If not, see <http://www.gnu.org/licenses/>. 21 : +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ 22 : #include "ReweightBase.h" 23 : 24 : namespace PLMD { 25 : namespace bias { 26 : 27 14 : void ReweightBase::registerKeywords(Keywords& keys) { 28 14 : Action::registerKeywords( keys ); 29 14 : ActionWithValue::registerKeywords( keys ); 30 14 : ActionWithArguments::registerKeywords( keys ); 31 14 : keys.setComponentsIntroduction("This action calculates the logarithm of a weight for reweighting"); 32 28 : keys.add("optional","TEMP","the system temperature. This is not required if your MD code passes this quantity to PLUMED"); 33 14 : keys.remove("NUMERICAL_DERIVATIVES"); 34 14 : } 35 : 36 8 : ReweightBase::ReweightBase(const ActionOptions&ao): 37 : Action(ao), 38 : ActionWithValue(ao), 39 8 : ActionWithArguments(ao) 40 : { 41 8 : simtemp=getkBT(); 42 8 : if(simtemp==0) error("The MD engine does not pass the temperature to plumed so you have to specify it using TEMP"); 43 : // Create something to hold the weight 44 16 : addValue(); setNotPeriodic(); 45 8 : } 46 : 47 2008 : void ReweightBase::calculate() { 48 2008 : double weight = getLogWeight(); 49 2008 : setValue( weight ); 50 2008 : } 51 : 52 : } 53 : }