LCOV - code coverage report
Current view: top level - analysis - WhamWeights.cpp (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 25 25 100.0 %
Date: 2019-08-13 10:15:31 Functions: 9 10 90.0 %

          Line data    Source code
       1             : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
       2             :    Copyright (c) 2018,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 "core/ActionShortcut.h"
      23             : #include "core/ActionRegister.h"
      24             : 
      25             : namespace PLMD {
      26             : namespace analysis {
      27             : 
      28             : //+PLUMEDOC REWEIGHTING WHAM_WEIGHTS
      29             : /*
      30             : This can be used to output the data that has been stored in an Analysis object.
      31             : 
      32             : \par Examples
      33             : 
      34             : */
      35             : //+ENDPLUMEDOC
      36             : 
      37          18 : class WhamWeights : public ActionShortcut {
      38             : public:
      39             :   static void registerKeywords( Keywords& keys );
      40             :   explicit WhamWeights( const ActionOptions& );
      41             : };
      42             : 
      43        7844 : PLUMED_REGISTER_ACTION(WhamWeights,"WHAM_WEIGHTS")
      44             : 
      45           7 : void WhamWeights::registerKeywords( Keywords& keys ) {
      46          14 :   ActionShortcut::registerKeywords( keys ); keys.remove("LABEL");
      47          35 :   keys.add("compulsory","BIAS","*.bias","the value of the biases to use when performing WHAM");
      48          28 :   keys.add("compulsory","TEMP","the temperature at which the simulation was run");
      49          35 :   keys.add("compulsory","STRIDE","1","the frequency with which the bias should be stored to perform WHAM");
      50          28 :   keys.add("compulsory","FILE","the file on which to output the WHAM weights");
      51          28 :   keys.add("optional","FMT","the format to use for the real numbers in the output file");
      52           7 : }
      53             : 
      54           6 : WhamWeights::WhamWeights( const ActionOptions& ao ) :
      55             :   Action(ao),
      56           6 :   ActionShortcut(ao)
      57             : {
      58             :   // Input for REWEIGHT_WHAM
      59           6 :   std::string rew_line = getShortcutLabel() + "_weights: REWEIGHT_WHAM";
      60          18 :   std::string bias; parse("BIAS",bias); rew_line += " ARG=" + bias;
      61          18 :   std::string temp; parse("TEMP",temp); rew_line += " TEMP=" + temp;
      62           6 :   readInputLine( rew_line );
      63             :   // Input for COLLECT_FRAMES
      64          18 :   std::string col_line = getShortcutLabel() + "_collect: COLLECT_FRAMES LOGWEIGHTS=" + getShortcutLabel() + "_weights";
      65          18 :   std::string stride; parse("STRIDE",stride); col_line += " STRIDE=" + stride;
      66           6 :   readInputLine( col_line );
      67             :   // Input for line to output data
      68          12 :   std::string out_line="OUTPUT_ANALYSIS_DATA_TO_COLVAR USE_OUTPUT_DATA_FROM=" + getShortcutLabel() + "_collect";
      69          18 :   std::string file; parse("FILE",file); out_line += " FILE=" + file;
      70          18 :   std::string fmt="%f"; parse("FMT",fmt); out_line += " FMT=" + fmt;
      71           6 :   readInputLine( out_line );
      72           6 : }
      73             : 
      74             : }
      75        5874 : }

Generated by: LCOV version 1.14