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: 2026-03-30 13:16:06 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
       2             :    Copyright (c) 2013-2023 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             : private:
      43             : /// Are we operating without periodic boundary conditions
      44             :   bool nopbc;
      45             : /// The type of rmsd we are calculating
      46             :   std::string alignType;
      47             : /// List of all the atoms we require
      48             :   std::vector<AtomNumber> all_atoms;
      49             : /// The atoms involved in each of the secondary structure segments
      50             :   std::vector< std::vector<unsigned> > colvar_atoms;
      51             : /// The list of reference configurations
      52             :   std::vector<std::unique_ptr<SingleDomainRMSD>> references;
      53             : /// Variables for strands cutoff
      54             :   bool align_strands;
      55             :   double s_cutoff2;
      56             :   unsigned align_atom_1, align_atom_2;
      57             :   bool verbose_output;
      58             : /// Tempory variables for getting positions of atoms and applying forces
      59             :   std::vector<double> forcesToApply;
      60             : /// Get the index of an atom
      61             :   unsigned getAtomIndex( const unsigned& current, const unsigned& iatom ) const ;
      62             : protected:
      63             : /// Get the atoms in the backbone
      64             :   void readBackboneAtoms( const std::string& backnames, std::vector<unsigned>& chain_lengths );
      65             : /// Add a set of atoms to calculat ethe rmsd from
      66             :   void addColvar( const std::vector<unsigned>& newatoms );
      67             : /// Set a reference configuration
      68             :   void setSecondaryStructure( std::vector<Vector>& structure, double bondlength, double units );
      69             : /// Setup a pair of atoms to use for strands cutoff
      70             :   void setAtomsFromStrands( const unsigned& atom1, const unsigned& atom2 );
      71             : public:
      72             :   static void registerKeywords( Keywords& keys );
      73             :   explicit SecondaryStructureRMSD(const ActionOptions&);
      74             :   virtual ~SecondaryStructureRMSD();
      75             :   unsigned getNumberOfFunctionsInAction();
      76             :   unsigned getNumberOfDerivatives() override;
      77             :   unsigned getNumberOfQuantities() const override;
      78             :   void turnOnDerivatives() override;
      79             :   void calculate() override;
      80             :   void performTask( const unsigned&, const unsigned&, MultiValue& ) const override;
      81             :   void apply() override;
      82          43 :   bool isPeriodic() override {
      83          43 :     return false;
      84             :   }
      85             : };
      86             : 
      87             : inline
      88        5844 : unsigned SecondaryStructureRMSD::getNumberOfQuantities() const {
      89        5844 :   return 1 + references.size();
      90             : }
      91             : 
      92             : 
      93             : inline
      94             : unsigned SecondaryStructureRMSD::getNumberOfFunctionsInAction() {
      95             :   return colvar_atoms.size();
      96             : }
      97             : 
      98             : inline
      99        6159 : unsigned SecondaryStructureRMSD::getNumberOfDerivatives() {
     100        6159 :   return 3*getNumberOfAtoms()+9;
     101             : }
     102             : 
     103             : inline
     104             : unsigned SecondaryStructureRMSD::getAtomIndex( const unsigned& current, const unsigned& iatom ) const {
     105    30523260 :   return colvar_atoms[current][iatom];
     106             : }
     107             : 
     108             : }
     109             : }
     110             : 
     111             : #endif

Generated by: LCOV version 1.16