Line data Source code
1 : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 : Copyright (c) 2014-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 "core/ActionShortcut.h" 23 : #include "core/ActionRegister.h" 24 : #include "MultiColvarShortcuts.h" 25 : 26 : //+PLUMEDOC MCOLVAR TORSIONS 27 : /* 28 : Calculate whether or not a set of torsional angles are within a particular range. 29 : 30 : \par Examples 31 : 32 : The following provides an example of the input for the TORSIONS command 33 : 34 : \plumedfile 35 : TORSIONS ... 36 : ATOMS1=168,170,172,188 37 : ATOMS2=170,172,188,190 38 : ATOMS3=188,190,192,230 39 : BETWEEN={GAUSSIAN LOWER=0 UPPER=pi SMEAR=0.1} 40 : LABEL=ab 41 : ... TORSIONS 42 : PRINT ARG=ab.* FILE=colvar STRIDE=10 43 : \endplumedfile 44 : 45 : 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 46 : can avoid this by using the \ref MOLINFO command. PLUMED uses the pdb file that you provide to this command to learn 47 : about the topology of the protein molecule. This means that you can specify torsion angles using the following syntax: 48 : 49 : \plumedfile 50 : #SETTINGS MOLFILE=regtest/basic/rt32/helix.pdb 51 : MOLINFO MOLTYPE=protein STRUCTURE=myprotein.pdb 52 : TORSIONS ... 53 : ATOMS1=@phi-3 54 : ATOMS2=@psi-3 55 : ATOMS3=@phi-4 56 : BETWEEN={GAUSSIAN LOWER=0 UPPER=pi SMEAR=0.1} 57 : LABEL=ab 58 : ... TORSIONS 59 : PRINT ARG=ab.* FILE=colvar STRIDE=10 60 : \endplumedfile 61 : 62 : Here, \@phi-3 tells plumed that you would like to calculate the \f$\phi\f$ angle in the third residue of the protein. 63 : Similarly \@psi-4 tells plumed that you want to calculate the \f$\psi\f$ angle of the fourth residue of the protein. 64 : 65 : 66 : */ 67 : //+ENDPLUMEDOC 68 : 69 : namespace PLMD { 70 : namespace multicolvar { 71 : 72 : class Torsions : public ActionShortcut { 73 : public: 74 : static void registerKeywords(Keywords& keys); 75 : explicit Torsions(const ActionOptions&); 76 : }; 77 : 78 : PLUMED_REGISTER_ACTION(Torsions,"TORSIONS") 79 : 80 8 : void Torsions::registerKeywords(Keywords& keys) { 81 8 : ActionShortcut::registerKeywords( keys ); MultiColvarShortcuts::shortcutKeywords( keys ); 82 8 : keys.needsAction("TORSION"); 83 16 : keys.setValueDescription("vector","the TORSION for each set of three atoms that were specified"); 84 8 : } 85 : 86 6 : Torsions::Torsions(const ActionOptions& ao): 87 : Action(ao), 88 6 : ActionShortcut(ao) 89 : { 90 6 : log.printf("Action TORSION\n"); 91 6 : log.printf(" with label %s \n", getShortcutLabel().c_str() ); 92 12 : readInputLine( getShortcutLabel() + ": TORSION " + convertInputLineToString() ); 93 : // Add shortcuts to label 94 6 : MultiColvarShortcuts::expandFunctions( getShortcutLabel(), getShortcutLabel(), "", this ); 95 6 : } 96 : 97 : } 98 : }