23 #include "tools/Angle.h"
24 #include "tools/SwitchingFunction.h"
25 #include "core/ActionRegister.h"
33 namespace multicolvar{
93 static void registerKeywords(
Keywords& keys );
96 virtual double compute(
const unsigned& j );
98 void calculateWeight();
103 PLUMED_REGISTER_ACTION(Angles,
"ANGLES")
106 MultiColvar::registerKeywords( keys );
107 keys.use(
"ATOMS"); keys.use(
"MEAN"); keys.use(
"LESS_THAN");
108 keys.use(
"BETWEEN"); keys.use(
"HISTOGRAM"); keys.use(
"MORE_THAN");
110 keys.add(
"atoms-1",
"GROUP",
"Calculate angles for each distinct set of three atoms in the group");
111 keys.add(
"atoms-2",
"GROUPA",
"A group of central atoms about which angles should be calculated");
112 keys.add(
"atoms-2",
"GROUPB",
"When used in conjuction with GROUPA this keyword instructs plumed "
113 "to calculate all distinct angles involving one atom from GROUPA "
114 "and two atoms from GROUPB. The atom from GROUPA is the central atom.");
115 keys.add(
"atoms-3",
"GROUPC",
"This must be used in conjuction with GROUPA and GROUPB. All angles "
116 "involving one atom from GROUPA, one atom from GROUPB and one atom from "
117 "GROUPC are calculated. The GROUPA atoms are assumed to be the central "
119 keys.add(
"optional",
"SWITCH",
"A switching function that ensures that only angles between atoms that "
120 "are within a certain fixed cutoff are calculated. The following provides "
121 "information on the \\ref switchingfunction that are available.");
122 keys.add(
"optional",
"SWITCHA",
"A switching function on the distance between the atoms in group A and the atoms in "
124 keys.add(
"optional",
"SWITCHB",
"A switching function on the distance between the atoms in group A and the atoms in "
134 std::string sfinput,errors;
parse(
"SWITCH",sfinput);
135 if( sfinput.length()>0 ){
139 if( errors.length()!=0 )
error(
"problem reading SWITCH keyword : " + errors );
141 if( errors.length()!=0 )
error(
"problem reading SWITCH keyword : " + errors );
144 parse(
"SWITCHA",sfinput);
145 if(sfinput.length()>0){
149 if( errors.length()!=0 )
error(
"problem reading SWITCHA keyword : " + errors );
150 sfinput.clear();
parse(
"SWITCHB",sfinput);
151 if(sfinput.length()==0)
error(
"found SWITCHA keyword without SWITCHB");
153 if( errors.length()!=0 )
error(
"problem reading SWITCHB keyword : " + errors );
154 log.
printf(
" only calculating angles when the distance between GROUPA and GROUPB atoms is less than %s\n",
sf1.
description().c_str() );
155 log.
printf(
" only calculating angles when the distance between GROUPA and GROUPC atoms is less than %s\n",
sf2.
description().c_str() );
170 double w1, w2, dw1, dw2, wtot;
173 wtot=w1*w2; dw1*=w2; dw2*=w1;
void addAtomsDerivativeOfWeight(const unsigned &i, const Vector &wder)
Set the derivative of the weight (used in MEAN and HISTOGRAM)
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.
double compute(const Vector &v1, const Vector &v2) const
Compute the angle between vectors v1 and v2.
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)...
virtual double compute(const unsigned &j)
Actually compute the colvar.
void addCentralAtomDerivatives(const unsigned &iatom, const Tensor &der)
Add derivatives to the central atom position.
bool weightHasDerivatives
Does the weight have derivatives.
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.
int printf(const char *fmt,...)
Formatted output with explicit format - a la printf.
void setWeight(const double &weight)
Set a weight for this colvar (used in MEAN and HISTOGRAM)
void addAtomsDerivatives(const int &, const Vector &)
Add some derivatives for an atom.
const Vector & getPosition(unsigned) const
Get the position of atom iatom.
Provides the keyword ANGLES
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
void addBoxDerivativesOfWeight(const Tensor &vir)
void calculateWeight()
Returns the number of coordinates of the field.
bool isPeriodic()
Are the base quantities periodic.