1 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2    Copyright (c) 2012-2021 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 public:
59   ~GenericMolInfo();
calculate()60   void calculate() override {}
apply()61   void apply() override {}
62   static void registerKeywords( Keywords& keys );
63   explicit GenericMolInfo(const ActionOptions&ao);
64   void getBackbone( std::vector<std::string>& resstrings, const std::string& fortype, std::vector< std::vector<AtomNumber> >& backbone );
65   std::string getAtomName(AtomNumber a)const;
66   bool checkForAtom(AtomNumber a)const;
67   unsigned getResidueNumber(AtomNumber a)const;
68   unsigned getPDBsize()const ;
69   std::string getResidueName(AtomNumber a)const;
70   void interpretSymbol( const std::string& symbol, std::vector<AtomNumber>& atoms );
71 /// Calculate is used to kill the python interpreter.
72 /// We do this in order to avoid possible interference or slowing down of the simulation
73 /// due to the extra subprocess.
74   void prepare() override;
75 };
76 
77 }
78 
79 #endif
80