Line data Source code
1 : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 : Copyright (c) 2012-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_core_GenericMolInfo_h 23 : #define __PLUMED_core_GenericMolInfo_h 24 : 25 : #include "ActionSetup.h" 26 : #include "ActionPilot.h" 27 : #include "ActionAtomistic.h" 28 : #include "ActionAnyorder.h" 29 : #include "tools/Exception.h" 30 : #include "tools/ForwardDecl.h" 31 : #include "tools/Subprocess.h" 32 : #include <memory> 33 : 34 : namespace PLMD { 35 : 36 : class PDB; 37 : 38 : class GenericMolInfo : 39 : public ActionAnyorder, 40 : public ActionPilot, 41 : public ActionAtomistic { 42 : private: 43 : ForwardDecl<PDB> pdb_fwd; 44 : /// A pdb file containing the topology 45 : PDB& pdb=*pdb_fwd; 46 : /// The type of molecule in the pdb 47 : std::string mytype; 48 : /// The name of the reference pdb file 49 : std::string reference; 50 : /// The backbone that was read in from the pdb file 51 : std::vector< std::vector<AtomNumber> > read_backbone; 52 : /// Python interpreter is enabled 53 : bool enablePythonInterpreter=false; 54 : /// Python command 55 : std::string pythonCmd; 56 : /// Selector subprocess 57 : std::unique_ptr<Subprocess> selector; 58 : /// Track is selector is running 59 : /// Needed on Get_rank()>0 60 : bool selector_running=false; 61 : /// Structure in pdb file is whole 62 : bool iswhole_; 63 : public: 64 : ~GenericMolInfo(); 65 5121 : void calculate() override {} 66 5121 : void apply() override {} 67 : static void registerKeywords( Keywords& keys ); 68 : explicit GenericMolInfo(const ActionOptions&ao); 69 : void getBackbone( std::vector<std::string>& resstrings, const std::string& fortype, std::vector< std::vector<AtomNumber> >& backbone ); 70 : std::string getAtomName(AtomNumber a)const; 71 : bool checkForAtom(AtomNumber a)const; 72 : unsigned getResidueNumber(AtomNumber a)const; 73 : std::string getChainID(AtomNumber a)const; 74 : Vector getPosition(AtomNumber a)const; 75 : bool isWhole() const; 76 : unsigned getPDBsize()const ; 77 : std::string getResidueName(AtomNumber a)const; 78 : void interpretSymbol( const std::string& symbol, std::vector<AtomNumber>& atoms ); 79 : /// Calculate is used to kill the python interpreter. 80 : /// We do this in order to avoid possible interference or slowing down of the simulation 81 : /// due to the extra subprocess. 82 : void prepare() override; 83 : }; 84 : 85 : } 86 : 87 : #endif