LCOV - code coverage report
Current view: top level - bias - ReweightBase.cpp (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 20 21 95.2 %
Date: 2020-11-18 11:20:57 Functions: 5 6 83.3 %

          Line data    Source code
       1             : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
       2             :    Copyright (c) 2016-2019 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             : #include "core/PlumedMain.h"
      24             : #include "core/Atoms.h"
      25             : 
      26             : namespace PLMD {
      27             : namespace bias {
      28             : 
      29           6 : void ReweightBase::registerKeywords(Keywords& keys) {
      30           6 :   Action::registerKeywords( keys );
      31           6 :   ActionWithValue::registerKeywords( keys );
      32           6 :   ActionWithArguments::registerKeywords( keys );
      33          12 :   keys.setComponentsIntroduction("This action calculates the logarithm of a weight for reweighting");
      34          24 :   keys.add("optional","TEMP","the system temperature.  This is not required if your MD code passes this quantity to PLUMED");
      35          12 :   keys.remove("NUMERICAL_DERIVATIVES");
      36           6 : }
      37             : 
      38           3 : ReweightBase::ReweightBase(const ActionOptions&ao):
      39             :   Action(ao),
      40             :   ActionWithValue(ao),
      41           3 :   ActionWithArguments(ao)
      42             : {
      43           6 :   simtemp=0.; parse("TEMP",simtemp);
      44           6 :   if(simtemp>0) simtemp*=plumed.getAtoms().getKBoltzmann();
      45           0 :   else simtemp=plumed.getAtoms().getKbT();
      46           3 :   if(simtemp==0) error("The MD engine does not pass the temperature to plumed so you have to specify it using TEMP");
      47             :   // Create something to hold the weight
      48           3 :   addValue(); setNotPeriodic();
      49           3 : }
      50             : 
      51         206 : void ReweightBase::calculate() {
      52         206 :   double weight = getLogWeight();
      53         206 :   setValue( weight );
      54         206 : }
      55             : 
      56             : }
      57        4839 : }

Generated by: LCOV version 1.13