Line data Source code
1 : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 : Copyright (c) 2013-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 "MultiColvarShortcuts.h"
23 : #include "core/ActionRegister.h"
24 :
25 : #include <string>
26 : #include <cmath>
27 :
28 : namespace PLMD {
29 : namespace multicolvar {
30 :
31 : //+PLUMEDOC COLVAR DIHCOR
32 : /*
33 : Measures the degree of similarity between dihedral angles.
34 :
35 : This colvar calculates the following quantity.
36 :
37 : $$
38 : s = \frac{1}{2} \sum_i \left[ 1 + \cos( \phi_i - \psi_i ) \right]
39 : $$
40 :
41 : where the $\phi_i$ and $\psi_i$ values are the instantaneous values for the TORSION angles of interest.
42 :
43 : You can see an example input for the DIHCOR action below
44 :
45 : ```plumed
46 : dih: DIHCOR ...
47 : ATOMS1=1,2,3,4,5,6,7,8
48 : ATOMS2=5,6,7,8,9,10,11,12
49 : ...
50 : PRINT ARG=dih FILE=colvar STRIDE=10
51 : ```
52 :
53 : In the above input we are calculating the correlation between the torsion angle involving atoms 1, 2, 3 and 4 and the torsion angle
54 : involving atoms 5, 6, 7 and 8. This is then added to the correlation between the torsion angle involving atoms 5, 6, 7 and 8 and the
55 : correlation angle involving atoms 9, 10, 11 and 12.
56 :
57 : Writing out the atoms involved in all the torsion angles in this way can be rather tedious. Thankfully if you are working with protein you
58 : can avoid this by using the [MOLINFO](MOLINFO.md) command. PLUMED uses the pdb file that you provide to this command to learn
59 : about the topology of the protein molecule. This means that you can specify torsion angles using the following syntax:
60 :
61 : ```plumed
62 : #SETTINGS MOLFILE=regtest/basic/rt32/helix.pdb
63 : MOLINFO MOLTYPE=protein STRUCTURE=regtest/basic/rt32/helix.pdb
64 : dih: DIHCOR ...
65 : ATOMS1=@phi-3,@psi-3
66 : ATOMS2=@psi-3,@phi-4
67 : ATOMS3=@phi-4,@psi-4
68 : ...
69 : PRINT ARG=dih FILE=colvar STRIDE=10
70 : ```
71 :
72 : Here, `@phi-3` tells plumed that you would like to calculate the $\phi$ angle in the third residue of the protein.
73 : Similarly `@psi-4` tells plumed that you want to calculate the $\psi$ angle of the fourth residue of the protein.
74 :
75 : Notice, last of all, that if you want not to reassemble the atoms that have been broken by the periodic boundary conditions using a procedure
76 : like that outlined in [WHOLEMOLECULES](WHOLEMOLECULES.md) you can add a NOPBC as shown below:
77 :
78 : ```plumed
79 : dih: DIHCOR ...
80 : ATOMS1=1,2,3,4,5,6,7,8
81 : ATOMS2=5,6,7,8,9,10,11,12
82 : NOPBC
83 : ...
84 : PRINT ARG=dih FILE=colvar STRIDE=10
85 : ```
86 :
87 : */
88 : //+ENDPLUMEDOC
89 :
90 : // We have a little helper class here to ensure that we actually do what is required by this action
91 : class Dihcor : public ActionShortcut {
92 : public:
93 : static void registerKeywords( Keywords& keys );
94 : Dihcor(const ActionOptions&);
95 : };
96 :
97 : PLUMED_REGISTER_ACTION(Dihcor,"DIHCOR")
98 :
99 4 : void Dihcor::registerKeywords( Keywords& keys ) {
100 4 : ActionShortcut::registerKeywords( keys );
101 4 : keys.needsAction("DIHEDRAL_CORRELATION");
102 8 : keys.needsAction("SUM");
103 4 : keys.add("atoms","ATOMS","the set of 8 atoms that are being used each of the dihedral correlation values");
104 4 : keys.addFlag("NOPBC",false,"ignore the periodic boundary conditions when calculating distances");
105 8 : keys.setValueDescription("scalar","the sum of all the dihedral correlations");
106 4 : }
107 :
108 1 : Dihcor::Dihcor(const ActionOptions&ao):
109 : Action(ao),
110 1 : ActionShortcut(ao) {
111 2 : readInputLine( getShortcutLabel() +"_data: DIHEDRAL_CORRELATION " + convertInputLineToString() );
112 2 : readInputLine( getShortcutLabel() + ": SUM ARG=" + getShortcutLabel() + "_data PERIODIC=NO");
113 1 : }
114 :
115 : }
116 : }
|