LCOV - code coverage report
Current view: top level - mapping - ZpathVessel.cpp (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 23 23 100.0 %
Date: 2018-12-19 07:49:13 Functions: 13 13 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 "vesselbase/VesselRegister.h"
      23             : #include "vesselbase/FunctionVessel.h"
      24             : #include "Mapping.h"
      25             : 
      26             : namespace PLMD {
      27             : namespace mapping {
      28             : 
      29          14 : class ZpathVessel : public vesselbase::FunctionVessel {
      30             : private:
      31             :   double invlambda;
      32             : public:
      33             :   static void registerKeywords( Keywords& keys );
      34             :   static void reserveKeyword( Keywords& keys );
      35             :   explicit ZpathVessel( const vesselbase::VesselOptions& da );
      36             :   std::string value_descriptor();
      37             :   double calcTransform( const double& val, double& dv ) const ;
      38             :   double finalTransform( const double& val, double& dv );
      39             : };
      40             : 
      41        2530 : PLUMED_REGISTER_VESSEL(ZpathVessel,"ZPATH")
      42             : 
      43           7 : void ZpathVessel::registerKeywords( Keywords& keys ) {
      44           7 :   FunctionVessel::registerKeywords(keys);
      45           7 : }
      46             : 
      47         841 : void ZpathVessel::reserveKeyword( Keywords& keys ) {
      48         841 :   keys.reserve("vessel","ZPATH","calculate the distance from the low dimensionality manifold");
      49         841 :   keys.addOutputComponent("zpath","ZPATH","the distance from the path");
      50         841 : }
      51             : 
      52           7 : ZpathVessel::ZpathVessel( const vesselbase::VesselOptions& da ):
      53           7 :   FunctionVessel(da)
      54             : {
      55           7 :   Mapping* mymap=dynamic_cast<Mapping*>( getAction() );
      56           7 :   plumed_massert( mymap, "ZpathVessel should only be used with mappings");
      57           7 :   invlambda = 1.0 / mymap->getLambda(); usetol=true;
      58           7 : }
      59             : 
      60           7 : std::string ZpathVessel::value_descriptor() {
      61           7 :   return "the distance from the low-dimensional manifold";
      62             : }
      63             : 
      64       19334 : double ZpathVessel::calcTransform( const double& val, double& dv ) const {
      65       19334 :   dv=0.0; return 1.0;
      66             : }
      67             : 
      68        3822 : double ZpathVessel::finalTransform( const double& val, double& dv ) {
      69        3822 :   dv = -invlambda / val;
      70        3822 :   return -invlambda*std::log( val );
      71             : }
      72             : 
      73             : }
      74        2523 : }

Generated by: LCOV version 1.13