LCOV - code coverage report
Current view: top level - multicolvar - Torsions.cpp (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 15 15 100.0 %
Date: 2025-04-08 21:11:17 Functions: 2 3 66.7 %

          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             : The following provides an example of the input for the TORSIONS command
      31             : 
      32             : ```plumed
      33             : ab: TORSIONS ...
      34             :   ATOMS1=168,170,172,188
      35             :   ATOMS2=170,172,188,190
      36             :   ATOMS3=188,190,192,230
      37             :   BETWEEN={GAUSSIAN LOWER=0 UPPER=pi SMEAR=0.1}
      38             : ...
      39             : PRINT ARG=ab.* FILE=colvar STRIDE=10
      40             : ```
      41             : 
      42             : The input above calculates how many of torsion angles for the three groups of atoms that have been specified are between 0 and $\pi$.
      43             : 
      44             : 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
      45             : can avoid this by using the [MOLINFO](MOLINFO.md) command.  PLUMED uses the pdb file that you provide to this command to learn
      46             : about the topology of the protein molecule.  This means that you can specify torsion angles using the following syntax:
      47             : 
      48             : ```plumed
      49             : #SETTINGS MOLFILE=regtest/basic/rt32/helix.pdb
      50             : MOLINFO MOLTYPE=protein STRUCTURE=regtest/basic/rt32/helix.pdb
      51             : TORSIONS ...
      52             : ATOMS1=@phi-3
      53             : ATOMS2=@psi-3
      54             : ATOMS3=@phi-4
      55             : BETWEEN={GAUSSIAN LOWER=0 UPPER=pi SMEAR=0.1}
      56             : LABEL=ab
      57             : ... TORSIONS
      58             : PRINT ARG=ab.* FILE=colvar STRIDE=10
      59             : ```
      60             : 
      61             : Here, `@phi-3` tells plumed that you would like to calculate the $\phi$ angle in the third residue of the protein.
      62             : Similarly `@psi-4` tells plumed that you want to calculate the $\psi$ angle of the fourth residue of the protein.
      63             : 
      64             : 
      65             : */
      66             : //+ENDPLUMEDOC
      67             : 
      68             : namespace PLMD {
      69             : namespace multicolvar {
      70             : 
      71             : class Torsions : public ActionShortcut {
      72             : public:
      73             :   static void registerKeywords(Keywords& keys);
      74             :   explicit Torsions(const ActionOptions&);
      75             : };
      76             : 
      77             : PLUMED_REGISTER_ACTION(Torsions,"TORSIONS")
      78             : 
      79           8 : void Torsions::registerKeywords(Keywords& keys) {
      80           8 :   ActionShortcut::registerKeywords( keys );
      81           8 :   MultiColvarShortcuts::shortcutKeywords( keys );
      82          16 :   keys.needsAction("TORSION");
      83           8 :   keys.add("atoms","ATOMS","the four atoms involved in the torsional angle");
      84          16 :   keys.setValueDescription("vector","the TORSION for each set of three atoms that were specified");
      85           8 : }
      86             : 
      87           6 : Torsions::Torsions(const ActionOptions& ao):
      88             :   Action(ao),
      89           6 :   ActionShortcut(ao) {
      90           6 :   log.printf("Action TORSION\n");
      91           6 :   log.printf("  with label %s \n", getShortcutLabel().c_str() );
      92             :   std::map<std::string,std::string> keymap;
      93           6 :   MultiColvarShortcuts::readShortcutKeywords( keymap, this );
      94          12 :   readInputLine( getShortcutLabel() + ": TORSION " + convertInputLineToString() );
      95             :   // Add shortcuts to label
      96          12 :   MultiColvarShortcuts::expandFunctions( getShortcutLabel(), getShortcutLabel(), "", keymap, this );
      97           6 : }
      98             : 
      99             : }
     100             : }

Generated by: LCOV version 1.16