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