LCOV - code coverage report
Current view: top level - multicolvar - Dihcor.cpp (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 12 12 100.0 %
Date: 2024-10-18 13:59:31 Functions: 2 3 66.7 %

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

Generated by: LCOV version 1.16