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_$ 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 : DIHCOR ... 47 : ATOMS1=1,2,3,4,5,6,7,8 48 : ATOMS2=5,6,7,8,9,10,11,12 49 : LABEL=dih 50 : ... DIHCOR 51 : PRINT ARG=dih FILE=colvar STRIDE=10 52 : ``` 53 : 54 : In the above input we are calculating the correlation between the torsion angle involving atoms 1, 2, 3 and 4 and the torsion angle 55 : 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 56 : correlation angle involving atoms 9, 10, 11 and 12. 57 : 58 : 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 59 : can avoid this by using the [MOLINFO](MOLINFO.md) command. PLUMED uses the pdb file that you provide to this command to learn 60 : about the topology of the protein molecule. This means that you can specify torsion angles using the following syntax: 61 : 62 : ```plumed 63 : #SETTINGS MOLFILE=regtest/basic/rt32/helix.pdb 64 : MOLINFO MOLTYPE=protein STRUCTURE=regtest/basic/rt32/helix.pdb 65 : dih: DIHCOR ... 66 : ATOMS1=@phi-3,@psi-3 67 : ATOMS2=@psi-3,@phi-4 68 : ATOMS3=@phi-4,@psi-4 69 : ... 70 : PRINT ARG=dih FILE=colvar STRIDE=10 71 : ``` 72 : 73 : Here, `@phi-3` tells plumed that you would like to calculate the $\phi$ angle in the third residue of the protein. 74 : Similarly `@psi-4` tells plumed that you want to calculate the $\psi$ angle of the fourth residue of the protein. 75 : 76 : */ 77 : //+ENDPLUMEDOC 78 : 79 : // We have a little helper class here to ensure that we actually do what is required by this action 80 : class Dihcor : public ActionShortcut { 81 : public: 82 : static void registerKeywords( Keywords& keys ); 83 : Dihcor(const ActionOptions&); 84 : }; 85 : 86 : PLUMED_REGISTER_ACTION(Dihcor,"DIHCOR") 87 : 88 5 : void Dihcor::registerKeywords( Keywords& keys ) { 89 5 : ActionShortcut::registerKeywords( keys ); 90 5 : keys.needsAction("DIHEDRAL_CORRELATION"); 91 10 : keys.needsAction("SUM"); 92 5 : keys.add("atoms","ATOMS","the set of 8 atoms that are being used each of the dihedral correlation values"); 93 5 : keys.addFlag("NOPBC",false,"ignore the periodic boundary conditions when calculating distances"); 94 10 : keys.setValueDescription("scalar","the sum of all the dihedral correlations"); 95 5 : } 96 : 97 1 : Dihcor::Dihcor(const ActionOptions&ao): 98 : Action(ao), 99 1 : ActionShortcut(ao) { 100 2 : readInputLine( getShortcutLabel() +"_data: DIHEDRAL_CORRELATION " + convertInputLineToString() ); 101 2 : readInputLine( getShortcutLabel() + ": SUM ARG=" + getShortcutLabel() + "_data PERIODIC=NO"); 102 1 : } 103 : 104 : } 105 : }