23 #include "tools/NeighborList.h"
24 #include "core/ActionRegister.h"
25 #include "tools/SwitchingFunction.h"
33 namespace multicolvar{
70 static void registerKeywords(
Keywords& keys );
73 virtual double compute(
const unsigned& j );
79 PLUMED_REGISTER_ACTION(CoordinationNumbers,
"COORDINATIONNUMBER")
82 MultiColvar::registerKeywords( keys );
83 keys.use(
"SPECIES"); keys.use(
"SPECIESA"); keys.use(
"SPECIESB");
84 keys.add(
"compulsory",
"NN",
"6",
"The n parameter of the switching function ");
85 keys.add(
"compulsory",
"MM",
"12",
"The m parameter of the switching function ");
86 keys.add(
"compulsory",
"D_0",
"0.0",
"The d_0 parameter of the switching function");
87 keys.add(
"compulsory",
"R_0",
"The r_0 parameter of the switching function");
88 keys.add(
"optional",
"SWITCH",
"This keyword is used if you want to employ an alternative to the continuous swiching function defined above. "
89 "The following provides information on the \\ref switchingfunction that are available. "
90 "When this keyword is present you no longer need the NN, MM, D_0 and R_0 keywords.");
92 keys.use(
"MEAN"); keys.use(
"MORE_THAN"); keys.use(
"LESS_THAN");
93 keys.use(
"MIN"); keys.use(
"BETWEEN"); keys.use(
"HISTOGRAM"); keys.use(
"MOMENTS");
100 std::string sw, errors;
parse(
"SWITCH",sw);
103 if( errors.length()!=0 )
error(
"problem reading SWITCH keyword : " + errors );
105 double r_0=-1.0, d_0;
int nn, mm;
108 if( r_0<0.0 )
error(
"you must set a value for R_0");
119 std::vector<AtomNumber> ga_lista, gb_lista;
AtomNumber aa;
120 aa.
setIndex(0); ga_lista.push_back(aa);
121 for(
unsigned i=1;i<natoms;++i){ aa.
setIndex(i); gb_lista.push_back(aa); }
127 double value=0, dfunc;
Vector distance;
Simple class to store the index of an atom.
double calculate(double x, double &df) const
Log & log
Reference to the log stream.
void readAtoms(int &natoms)
Read in all the keywords that can be used to define atoms.
Vector getSeparation(const Vector &vec1, const Vector &vec2) const
Get the separation between a pair of vectors.
double modulo() const
Compute the modulo.
void removeAtomRequest(const unsigned &aa, const double &weight)
Update the list of atoms after the neighbor list step.
unsigned getNAtoms() const
Get the number of atoms in this particular colvar.
Class implementing fixed size vectors of doubles.
Vector getCentralAtom()
Get the position of the central atom.
void set(int nn, int mm, double r_0, double d_0)
void error(const std::string &msg) const
Crash calculation and print documentation.
void checkRead()
Check if Action was properly read.
Small class to compure switching functions in the form In the future we might extend it so as to be s...
void readVesselKeywords()
Complete the setup of this object (this routine must be called after construction of ActionWithValue)...
void addCentralAtomDerivatives(const unsigned &iatom, const Tensor &der)
Add derivatives to the central atom position.
static TensorGeneric< n, n > identity()
return an identity tensor
void parse(const std::string &key, T &t)
Parse one keyword as generic type.
This class holds the keywords and their documentation.
#define PLUMED_MULTICOLVAR_INIT(ao)
void addBoxDerivatives(const Tensor &)
Add some derivatives to the virial.
This class is used to bring the relevant information to the Action constructor.
SwitchingFunction switchingFunction
int printf(const char *fmt,...)
Formatted output with explicit format - a la printf.
virtual double compute(const unsigned &j)
Actually compute the colvar.
bool isPeriodic()
Returns the number of coordinates of the field.
void addAtomsDerivatives(const int &, const Vector &)
Add some derivatives for an atom.
const Vector & getPosition(unsigned) const
Get the position of atom iatom.
AtomNumber & setIndex(unsigned)
Sets the atom number by index, returning a reference to the AtomNumber itself.
double getTolerance() const
Return the value of the tolerance.
This is the abstract base class to use for creating distributions of colvars and functions thereof...
std::string description() const
Provides the keyword COORDINATIONNUMBER