LCOV - code coverage report
Current view: top level - secondarystructure - SecondaryStructureRMSD.h (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 7 7 100.0 %
Date: 2018-12-19 07:49:13 Functions: 4 4 100.0 %

          Line data    Source code
       1             : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
       2             :    Copyright (c) 2013-2018 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             : #ifndef __PLUMED_secondarystructure_SecondaryStructureRMSD_h
      23             : #define __PLUMED_secondarystructure_SecondaryStructureRMSD_h
      24             : 
      25             : #include "core/ActionAtomistic.h"
      26             : #include "core/ActionWithValue.h"
      27             : #include "vesselbase/ActionWithVessel.h"
      28             : #include <vector>
      29             : 
      30             : namespace PLMD {
      31             : 
      32             : class SingleDomainRMSD;
      33             : 
      34             : namespace secondarystructure {
      35             : 
      36             : /// Base action for calculating things like AlphRMSD, AntibetaRMSD, etc
      37             : 
      38             : class SecondaryStructureRMSD :
      39             :   public ActionAtomistic,
      40             :   public ActionWithValue,
      41             :   public vesselbase::ActionWithVessel
      42             : {
      43             : private:
      44             : /// The type of rmsd we are calculating
      45             :   std::string alignType;
      46             : /// List of all the atoms we require
      47             :   std::vector<AtomNumber> all_atoms;
      48             : /// The atoms involved in each of the secondary structure segments
      49             :   std::vector< std::vector<unsigned> > colvar_atoms;
      50             : /// The list of reference configurations
      51             :   std::vector<SingleDomainRMSD*> references;
      52             : /// Variables for strands cutoff
      53             :   bool align_strands;
      54             :   double s_cutoff2;
      55             :   unsigned align_atom_1, align_atom_2;
      56             :   bool verbose_output;
      57             : /// Tempory variables for getting positions of atoms and applying forces
      58             :   std::vector<double> forcesToApply;
      59             : /// Get the index of an atom
      60             :   unsigned getAtomIndex( const unsigned& current, const unsigned& iatom ) const ;
      61             : protected:
      62             : /// Get the atoms in the backbone
      63             :   void readBackboneAtoms( const std::string& backnames, std::vector<unsigned>& chain_lengths );
      64             : /// Add a set of atoms to calculat ethe rmsd from
      65             :   void addColvar( const std::vector<unsigned>& newatoms );
      66             : /// Set a reference configuration
      67             :   void setSecondaryStructure( std::vector<Vector>& structure, double bondlength, double units );
      68             : /// Setup a pair of atoms to use for strands cutoff
      69             :   void setAtomsFromStrands( const unsigned& atom1, const unsigned& atom2 );
      70             : public:
      71             :   static void registerKeywords( Keywords& keys );
      72             :   explicit SecondaryStructureRMSD(const ActionOptions&);
      73             :   virtual ~SecondaryStructureRMSD();
      74             :   unsigned getNumberOfFunctionsInAction();
      75             :   unsigned getNumberOfDerivatives();
      76             :   unsigned getNumberOfQuantities() const ;
      77             :   void turnOnDerivatives();
      78             :   void calculate();
      79             :   void performTask( const unsigned&, const unsigned&, MultiValue& ) const ;
      80             :   void apply();
      81          25 :   bool isPeriodic() { return false; }
      82             : };
      83             : 
      84             : inline
      85        5403 : unsigned SecondaryStructureRMSD::getNumberOfQuantities() const {
      86        5403 :   return 1 + references.size();
      87             : }
      88             : 
      89             : 
      90             : inline
      91             : unsigned SecondaryStructureRMSD::getNumberOfFunctionsInAction() {
      92             :   return colvar_atoms.size();
      93             : }
      94             : 
      95             : inline
      96        5559 : unsigned SecondaryStructureRMSD::getNumberOfDerivatives() {
      97        5559 :   return 3*getNumberOfAtoms()+9;
      98             : }
      99             : 
     100             : inline
     101    13148488 : unsigned SecondaryStructureRMSD::getAtomIndex( const unsigned& current, const unsigned& iatom ) const {
     102    13148488 :   return colvar_atoms[current][iatom];
     103             : }
     104             : 
     105             : }
     106             : }
     107             : 
     108             : #endif

Generated by: LCOV version 1.13