22 #include "core/ActionAtomistic.h"
23 #include "core/ActionPilot.h"
24 #include "core/ActionRegister.h"
25 #include "tools/Vector.h"
26 #include "tools/AtomNumber.h"
27 #include "tools/Tools.h"
28 #include "core/Atoms.h"
29 #include "core/PlumedMain.h"
30 #include "core/ActionSet.h"
31 #include "core/SetupMolInfo.h"
103 static void registerKeywords(
Keywords& keys );
108 PLUMED_REGISTER_ACTION(WholeMolecules,
"WHOLEMOLECULES")
111 ActionAtomistic::registerKeywords( keys );
112 keys.add(
"compulsory",
"STRIDE",
"1",
"the frequency with which molecules are reassembled. Unless you are completely certain about what you are doing leave this set equal to 1!");
113 keys.add(
"numbered",
"ENTITY",
"the atoms that make up a molecule that you wish to align. To specify multiple molecules use a list of ENTITY keywords: ENTITY1, ENTITY2,...");
114 keys.reset_style(
"ENTITY",
"atoms");
115 keys.add(
"residues",
"RESIDUES",
"this command specifies a set of residues which all must be aligned. It must be used in tandem with the \\ref MOLINFO "
116 "action and the RES_ATOMS keyword. If you wish to use all the residues from all the chains in your system you can do so by "
117 "specifying all. Alternatively, if you wish to use a subset of the residues you can specify the particular residues "
118 "you are interested in as a list of numbers");
119 keys.add(
"optional",
"RES_ATOMS",
"this command tells plumed what atoms should be aligned in each of the residues that are being aligned");
127 vector<AtomNumber> merge;
129 vector<AtomNumber> group;
131 if( group.empty() )
break;
133 for(
unsigned j=0;j<group.size();++j)
log.
printf(
"%d ",group[j].serial() );
136 merge.insert(merge.end(),group.begin(),group.end());
140 vector<string> resstrings;
parseVector(
"RESIDUES",resstrings);
141 if( resstrings.size()>0 ){
142 vector<string> backnames;
parseVector(
"RES_ATOMS",backnames);
143 if(backnames.size()==0)
error(
"Found RESIDUES keyword without any specification of the atoms that should be in a residue - use RES_ATOMS");
145 if( moldat.size()==0 )
error(
"Unable to find MOLINFO in input");
146 std::vector< std::vector<AtomNumber> > backatoms;
147 moldat[0]->getBackbone( resstrings, backnames, backatoms );
148 for(
unsigned i=0;i<backatoms.size();++i){
150 for(
unsigned j=0;j<backatoms[i].size();++j)
log.
printf(
"%d ",backatoms[i][j].serial() );
152 groups.push_back( backatoms[i] );
153 merge.insert(merge.end(),backatoms[i].begin(),backatoms[i].end());
157 if(
groups.size()==0)
error(
"no atom found for WHOLEMOLECULES!");
165 for(
unsigned i=0;i<
groups.size();++i){
166 for(
unsigned j=0;j<
groups[i].size()-1;++j){
Log & log
Reference to the log stream.
This is used to create PLMD::Action objects that are run with some set frequency. ...
Class implementing fixed size vectors of doubles.
void error(const std::string &msg) const
Crash calculation and print documentation.
void checkRead()
Check if Action was properly read.
void parseAtomList(const std::string &key, std::vector< AtomNumber > &t)
Parse a list of atoms without a numbered keyword.
void calculate()
Calculate an Action.
This class holds the keywords and their documentation.
vector< vector< AtomNumber > > groups
Provides the keyword WHOLEMOLECULES
This class is used to bring the relevant information to the Action constructor.
Action used to create objects that access the positions of the atoms from the MD code.
int printf(const char *fmt,...)
Formatted output with explicit format - a la printf.
void apply()
Apply an Action.
Base class for all the input Actions.
void parseVector(const std::string &key, std::vector< T > &t)
Parse one keyword as std::vector.
Vector & modifyPosition(AtomNumber i)
Vector pbcDistance(const Vector &, const Vector &) const
Compute the pbc distance between two positions.
void requestAtoms(const std::vector< AtomNumber > &a)
Request an array of atoms.