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 : #ifndef __PLUMED_secondarystructure_SecondaryStructureRMSD_h 23 : #define __PLUMED_secondarystructure_SecondaryStructureRMSD_h 24 : 25 : #include "core/ActionWithVector.h" 26 : #include "tools/RMSD.h" 27 : #include <vector> 28 : 29 : namespace PLMD { 30 : 31 : class ActionShortcut; 32 : 33 : namespace secondarystructure { 34 : 35 : /// Base action for calculating things like AlphRMSD, AntibetaRMSD, etc 36 : 37 : class SecondaryStructureRMSD : public ActionWithVector { 38 : private: 39 : /// Are we operating without periodic boundary conditions 40 : bool nopbc; 41 : /// The type of rmsd we are calculating 42 : std::string alignType; 43 : /// List of all the atoms we require 44 : std::vector<AtomNumber> all_atoms; 45 : /// The list of tasks that we need to do on the round 46 : std::vector<unsigned> ss_tasks; 47 : /// The atoms involved in each of the secondary structure segments 48 : std::vector< std::vector<unsigned> > colvar_atoms; 49 : /// The list of reference configurations 50 : std::vector<RMSD> myrmsd; 51 : std::vector<std::map<std::pair<unsigned,unsigned>, double> > drmsd_targets; 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 : /// Get the index of an atom 58 : unsigned getAtomIndex( const unsigned& current, const unsigned& iatom ) const ; 59 : public: 60 : static void registerKeywords( Keywords& keys ); 61 : static void readBackboneAtoms( ActionShortcut* action, PlumedMain& plumed, const std::string& backnames, std::vector<unsigned>& chain_lengths, std::string& all_atoms ); 62 : static bool readShortcutWords( std::string& ltmap, ActionShortcut* action ); 63 : static void expandShortcut( const bool& uselessthan, const std::string& labout, const std::string& labin, const std::string& ltmap, ActionShortcut* action ); 64 : explicit SecondaryStructureRMSD(const ActionOptions&); 65 : unsigned getNumberOfDerivatives() override ; 66 : void areAllTasksRequired( std::vector<ActionWithVector*>& task_reducing_actions ) override; 67 : int checkTaskStatus( const unsigned& taskno, int& flag ) const override; 68 : void calculate() override; 69 : void performTask( const unsigned&, MultiValue& ) const override; 70 : }; 71 : 72 : inline 73 110 : unsigned SecondaryStructureRMSD::getNumberOfDerivatives() { 74 110 : return 3*getNumberOfAtoms()+9; 75 : } 76 : 77 : inline 78 : unsigned SecondaryStructureRMSD::getAtomIndex( const unsigned& current, const unsigned& iatom ) const { 79 4721646 : return colvar_atoms[current][iatom]; 80 : } 81 : 82 : } 83 : } 84 : 85 : #endif