LCOV - code coverage report
Current view: top level - colvar - PathMSD.cpp (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 23 23 100.0 %
Date: 2021-11-18 15:22:58 Functions: 9 10 90.0 %

          Line data    Source code
       1             : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
       2             :    Copyright (c) 2012-2020 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 "PathMSDBase.h"
      23             : #include "core/PlumedMain.h"
      24             : 
      25             : using namespace std;
      26             : 
      27             : namespace PLMD {
      28             : namespace colvar {
      29             : 
      30             : //+PLUMEDOC COLVAR PATHMSD
      31             : /*
      32             : This Colvar calculates path collective variables.
      33             : 
      34             : This is the Path Collective Variables implementation
      35             : ( see \cite brand07 ).
      36             : This variable computes the progress along a given set of frames that is provided
      37             : in input ("sss" component) and the distance from them ("zzz" component).
      38             : (see below).
      39             : 
      40             : When running with periodic boundary conditions, the atoms should be
      41             : in the proper periodic image. This is done automatically since PLUMED 2.5,
      42             : by considering the ordered list of atoms and rebuilding molecules with a procedure
      43             : that is equivalent to that done in \ref WHOLEMOLECULES . Notice that
      44             : rebuilding is local to this action. This is different from \ref WHOLEMOLECULES
      45             : which actually modifies the coordinates stored in PLUMED.
      46             : 
      47             : In case you want to recover the old behavior you should use the NOPBC flag.
      48             : In that case you need to take care that atoms are in the correct
      49             : periodic image.
      50             : 
      51             : \par Examples
      52             : 
      53             : Here below is a case where you have defined three frames and you want to
      54             : calculate the progress along the path and the distance from it in p1
      55             : 
      56             : \plumedfile
      57             : p1: PATHMSD REFERENCE=file.pdb  LAMBDA=500.0 NEIGH_STRIDE=4 NEIGH_SIZE=8
      58             : PRINT ARG=p1.sss,p1.zzz STRIDE=1 FILE=colvar FMT=%8.4f
      59             : \endplumedfile
      60             : 
      61             : note that NEIGH_STRIDE=4 NEIGH_SIZE=8 control the neighbor list parameter (optional but
      62             : recommended for performance) and states that the neighbor list will be calculated every 4
      63             : steps and consider only the closest 8 member to the actual md snapshots.
      64             : 
      65             : This input must be accompanied by a REFERENCE PDB file in which the positions of each of the frames are specified
      66             : separated using either END or ENDMDL as shown below:
      67             : 
      68             : \auxfile{file.pdb}
      69             : ATOM      1  CL  ALA     1      -3.171   0.295   2.045  1.00  1.00
      70             : ATOM      5  CLP ALA     1      -1.819  -0.143   1.679  1.00  1.00
      71             : ATOM      6  OL  ALA     1      -1.177  -0.889   2.401  1.00  1.00
      72             : ATOM      7  NL  ALA     1      -1.313   0.341   0.529  1.00  1.00
      73             : END
      74             : ATOM      1  CL  ALA     1      -3.175   0.365   2.024  1.00  1.00
      75             : ATOM      5  CLP ALA     1      -1.814  -0.106   1.685  1.00  1.00
      76             : ATOM      6  OL  ALA     1      -1.201  -0.849   2.425  1.00  1.00
      77             : ATOM      7  NL  ALA     1      -1.296   0.337   0.534  1.00  1.00
      78             : END
      79             : ATOM      1  CL  ALA     1      -2.990   0.383   2.277  1.00  1.00
      80             : ATOM      5  CLP ALA     1      -1.664  -0.085   1.831  1.00  1.00
      81             : ATOM      6  OL  ALA     1      -0.987  -0.835   2.533  1.00  1.00
      82             : ATOM      7  NL  ALA     1      -1.227   0.364   0.646  1.00  1.00
      83             : END
      84             : \endauxfile
      85             : 
      86             : \note
      87             : The implementation of this collective variable and of \ref PROPERTYMAP
      88             : is shared, as well as most input options.
      89             : 
      90             : 
      91             : */
      92             : //+ENDPLUMEDOC
      93             : 
      94          28 : class PathMSD : public PathMSDBase {
      95             : public:
      96             :   explicit PathMSD(const ActionOptions&);
      97             :   static void registerKeywords(Keywords& keys);
      98             : };
      99             : 
     100        7384 : PLUMED_REGISTER_ACTION(PathMSD,"PATHMSD")
     101             : 
     102          15 : void PathMSD::registerKeywords(Keywords& keys) {
     103          15 :   PathMSDBase::registerKeywords(keys);
     104          15 :   componentsAreNotOptional(keys);
     105          60 :   keys.addOutputComponent("sss","default","the position on the path");
     106          60 :   keys.addOutputComponent("zzz","default","the distance from the path");
     107          15 : }
     108             : 
     109          14 : PathMSD::PathMSD(const ActionOptions&ao):
     110          14 :   Action(ao),PathMSDBase(ao)
     111             : {
     112          14 :   checkRead();
     113             : 
     114          14 :   log<<"  Bibliography "
     115          42 :      <<plumed.cite("Branduardi, Gervasio, Parrinello J. Chem. Phys. 126, 054103 (2007)")
     116          28 :      <<"\n";
     117             :   // no need to read anything
     118          42 :   addComponentWithDerivatives("sss"); componentIsNotPeriodic("sss");
     119          42 :   addComponentWithDerivatives("zzz"); componentIsNotPeriodic("zzz");
     120          28 :   requestAtoms(pdbv[0].getAtomNumbers());
     121             : 
     122          14 :   double i=1.;
     123        1254 :   for(unsigned it=0 ; it<nframes ; ++it) {
     124         620 :     vector<double> v; v.push_back(i);
     125         620 :     indexvec.push_back(v); i+=1.;
     126             :   }
     127          14 : }
     128             : 
     129             : }
     130             : 
     131        5517 : }

Generated by: LCOV version 1.14