111 static void registerKeywords(
Keywords& keys );
114 virtual void calculate();
117 PLUMED_REGISTER_ACTION(
Distance,
"DISTANCE")
120 Colvar::registerKeywords( keys );
121 keys.add(
"atoms",
"ATOMS",
"the pair of atom that we are calculating the distance between");
122 keys.addFlag(
"COMPONENTS",
false,
"calculate the x, y and z components of the distance separately and store them as label.x, label.y and label.z");
123 keys.addOutputComponent(
"x",
"COMPONENTS",
"the x-component of the vector connecting the two atoms");
124 keys.addOutputComponent(
"y",
"COMPONENTS",
"the y-component of the vector connecting the two atoms");
125 keys.addOutputComponent(
"z",
"COMPONENTS",
"the z-component of the vector connecting the two atoms");
133 vector<AtomNumber>
atoms;
136 error(
"Number of specified atoms should be 2");
143 log.
printf(
" between atoms %d %d\n",atoms[0].serial(),atoms[1].serial());
144 if(
pbc)
log.
printf(
" using periodic boundary conditions\n");
145 else log.
printf(
" without periodic boundary conditions\n");
156 log<<
" WARNING: components will not have the proper periodicity - see manual\n";
172 const double value=distance.
modulo();
173 const double invvalue=1.0/value;
191 valuex->
set(distance[0]);
196 valuey->
set(distance[1]);
201 valuez->
set(distance[2]);
const Vector & getPosition(int) const
Get position of i-th atom.
void parseFlag(const std::string &key, bool &t)
Parse one keyword as boolean flag.
void setNotPeriodic()
Set your default value to have no periodicity.
Log & log
Reference to the log stream.
double modulo() const
Compute the modulo.
void componentIsNotPeriodic(const std::string &name)
Set your value component to have no periodicity.
Class implementing fixed size vectors of doubles.
A class for holding the value of a function together with its derivatives.
void setAtomsDerivatives(int, const Vector &)
Provides the keyword DISTANCE
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 addValueWithDerivatives()
Add a value with the name label that has derivatives.
virtual void calculate()
Calculate an Action.
void requestAtoms(const std::vector< AtomNumber > &a)
#define PLUMED_COLVAR_INIT(ao)
void setBoxDerivatives(const Tensor &)
void set(double)
Set the value of the function.
This class holds the keywords and their documentation.
This class is used to bring the relevant information to the Action constructor.
int printf(const char *fmt,...)
Formatted output with explicit format - a la printf.
This is the abstract base class to use for implementing new collective variables, within it there is ...
VectorGeneric< n > delta(const VectorGeneric< n > &v1, const VectorGeneric< n > &v2)
void setValue(const double &d)
Set the default value (the one without name)
Vector pbcDistance(const Vector &, const Vector &) const
Compute the pbc distance between two positions.
void addComponentWithDerivatives(const std::string &name)
Add a value with a name like label.name that has derivatives.
Value * getPntrToComponent(int i)
Return a pointer to the component by index.
Vector3d Vector
Alias for three dimensional vectors.