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 "PathBase.h"
23 : #include "core/ActionRegister.h"
24 :
25 : //+PLUMEDOC COLVAR PATH
26 : /*
27 : Path collective variables with a more flexible framework for the distance metric being used.
28 :
29 : The Path Collective Variables developed by Branduardi and co-workers \cite brand07 allow one
30 : to compute the progress along a high-dimensional path and the distance from the high-dimensional
31 : path. The progress along the path (s) is computed using:
32 :
33 : \f[
34 : s = \frac{ \sum_{i=1}^N i \exp( -\lambda R[X - X_i] ) }{ \sum_{i=1}^N \exp( -\lambda R[X - X_i] ) }
35 : \f]
36 :
37 : while the distance from the path (z) is measured using:
38 :
39 : \f[
40 : z = -\frac{1}{\lambda} \ln\left[ \sum_{i=1}^N \exp( -\lambda R[X - X_i] ) \right]
41 : \f]
42 :
43 : In these expressions \f$N\f$ high-dimensional frames (\f$X_i\f$) are used to describe the path in the high-dimensional
44 : space. The two expressions above are then functions of the distances from each of the high-dimensional frames \f$R[X - X_i]\f$.
45 : Within PLUMED there are multiple ways to define the distance from a high-dimensional configuration. You could calculate
46 : the RMSD distance or you could calculate the ammount by which a set of collective variables change. As such this implementation
47 : of the path cv allows one to use all the difference distance metrics that are discussed in \ref dists. This is as opposed to
48 : the alternative implementation of path (\ref PATHMSD) which is a bit faster but which only allows one to use the RMSD distance.
49 :
50 : \par Examples
51 :
52 : The following input instructs PLUMED to calculate the values of the path collective variables. The frames that make up this
53 : path are defined in the file all.pdb and all distances are measured using the OPTIMAL metric that is discussed in the manual
54 : page on \ref RMSD.
55 :
56 : \verbatim
57 : p2: PATH REFERENCE=all.pdb LAMBDA=69087
58 : PRINT ARG=p2.spath,p2.zpath STRIDE=1 FILE=colvar
59 : \endverbatim
60 :
61 : If you wish to use collective variable values in the definition of your path you would use an input file with something like this:
62 :
63 : \verbatim
64 : d1: DISTANCE ATOMS=1,2
65 : d2: DISTANCE ATOMS=3,4a
66 : p2: PATH REFERENCE=mypath.pdb LAMBDA=2 TYPE=EUCLIDEAN
67 : PRINT ARG=p2.spath,p2.zpath STRIDE=1 FILE=colvar
68 : \endverbatim
69 :
70 : The corresponding pdb file containing the definitions of the frames in the path would then look like this:
71 :
72 : \verbatim
73 : DESCRIPTION: a defintiion of a PATH
74 : REMARK TYPE=EUCLIDEAN
75 : REMARK ARG=d1,d2
76 : REMARK d1=1.0 d2=1.0
77 : END
78 : REMARK TYPE=EUCLIDEAN
79 : REMARK ARG=d1,d2
80 : REMARK d1=2.0 d2=2.0
81 : END
82 : \endverbatim
83 :
84 : For each frame in the path you must specify the arguments that should be used to calculate the distance between the instantaneous configuration
85 : of the system and the reference configurations together with the values that these arguments take in each of the reference configurations.
86 :
87 : */
88 : //+ENDPLUMEDOC
89 :
90 : namespace PLMD {
91 : namespace mapping {
92 :
93 8 : class Path : public PathBase {
94 : public:
95 : static void registerKeywords( Keywords& keys );
96 : explicit Path(const ActionOptions&);
97 : };
98 :
99 2527 : PLUMED_REGISTER_ACTION(Path,"PATH")
100 :
101 5 : void Path::registerKeywords( Keywords& keys ) {
102 5 : PathBase::registerKeywords( keys ); keys.remove("PROPERTY");
103 5 : keys.addFlag("NOSPATH",false,"do not calculate the spath position");
104 5 : keys.remove("LOWMEM");
105 5 : }
106 :
107 4 : Path::Path(const ActionOptions& ao):
108 : Action(ao),
109 4 : PathBase(ao)
110 : {
111 4 : setLowMemOption( true );
112 4 : bool nos; parseFlag("NOSPATH",nos);
113 :
114 4 : std::string empty;
115 4 : if(!nos) {
116 4 : if( getPropertyIndex("spath")!=0 || getNumberOfProperties()>1 ) {
117 0 : error("paths only work when there is a single property called sss being calculated");
118 : }
119 4 : empty="LABEL=spath";
120 4 : addVessel("SPATH",empty,0);
121 : }
122 4 : readVesselKeywords();
123 4 : checkRead();
124 4 : }
125 :
126 : }
127 2523 : }
|