LCOV - code coverage report
Current view: top level - vesselbase - LessThan.cpp (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 23 23 100.0 %
Date: 2018-12-19 07:49:13 Functions: 11 11 100.0 %

          Line data    Source code
       1             : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
       2             :    Copyright (c) 2013-2018 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 "LessThan.h"
      23             : #include "VesselRegister.h"
      24             : 
      25             : namespace PLMD {
      26             : namespace vesselbase {
      27             : 
      28        2580 : PLUMED_REGISTER_VESSEL(LessThan,"LESS_THAN")
      29             : 
      30          57 : void LessThan::registerKeywords( Keywords& keys ) {
      31          57 :   FunctionVessel::registerKeywords( keys );
      32          57 :   SwitchingFunction::registerKeywords( keys );
      33          57 : }
      34             : 
      35         841 : void LessThan::reserveKeyword( Keywords& keys ) {
      36             :   keys.reserve("vessel","LESS_THAN","calculate the number of variables less than a certain target value. "
      37             :                "This quantity is calculated using \\f$\\sum_i \\sigma(s_i)\\f$, where \\f$\\sigma(s)\\f$ "
      38         841 :                "is a \\ref switchingfunction.");
      39             :   keys.addOutputComponent("lessthan","LESS_THAN","the number of values less than a target value. This is calculated using one of the "
      40             :                           "formula described in the description of the keyword so as to make it continuous. "
      41         841 :                           "You can calculate this quantity multiple times using different parameters.");
      42         841 : }
      43             : 
      44          57 : LessThan::LessThan( const VesselOptions& da ) :
      45          57 :   FunctionVessel(da)
      46             : {
      47          57 :   usetol=true;
      48          57 :   if( getAction()->isPeriodic() ) error("LESS_THAN is not a meaningful option for periodic variables");
      49          57 :   std::string errormsg; sf.set( getAllInput(), errormsg );
      50          57 :   if( errormsg.size()!=0 ) error( errormsg );
      51          57 : }
      52             : 
      53          57 : std::string LessThan::value_descriptor() {
      54          57 :   return "the number of values less than " + sf.description();
      55             : }
      56             : 
      57       57300 : double LessThan::calcTransform( const double& val, double& dv ) const {
      58       57300 :   double f = sf.calculate(val, dv); dv*=val; return f;
      59             : }
      60             : 
      61          16 : double LessThan::getCutoff() {
      62          16 :   return sf.get_dmax();
      63             : }
      64             : 
      65             : }
      66        2523 : }

Generated by: LCOV version 1.13