23 #include "tools/Random.h"
85 std::vector<double>
to;
86 std::vector<double>
min;
94 static void registerKeywords(
Keywords& keys);
97 PLUMED_REGISTER_ACTION(
ABMD,
"ABMD")
100 Bias::registerKeywords(keys);
102 keys.add(
"compulsory",
"TO",
"The array of target values");
103 keys.add(
"compulsory",
"KAPPA",
"The array of force constants.");
104 keys.add(
"optional",
"MIN",
"Array of starting values for the bias (set rho_m(t), otherwise it is set using the current value of ARG)");
105 keys.add(
"optional",
"NOISE",
"Array of white noise intensities (add a temperature to the ABMD)");
106 keys.add(
"optional",
"SEED",
"Array of seeds for the white noise (add a temperature to the ABMD)");
107 componentsAreNotOptional(keys);
108 keys.addOutputComponent(
"bias",
"default",
"the instantaneous value of the bias potential");
109 keys.addOutputComponent(
"force2",
"default",
"the instantaneous value of the squared force due to this bias potential");
111 keys.addOutputComponent(
"min_",
"default",
"one or multiple instances of this quantity will be refereceable elsewhere in the input file. "
112 "These quantities will be named as min_# and the number of the argument to which they refer."
113 "These quantities tell the user the minimum value assumed by rho_m(t).");
118 to(getNumberOfArguments(),0.0),
119 min(getNumberOfArguments(),-1.0),
120 kappa(getNumberOfArguments(),0.0),
121 temp(getNumberOfArguments(),0.0),
122 seed(getNumberOfArguments(),time(0)),
123 random(getNumberOfArguments())
147 sprintf(str_min,
"min_%u",i+1);
163 const double cv2=cv*cv;
164 const double k=
kappa[i];
166 if(cv2<=diff) { diff=0.;
temp[i]=0.; }
167 double noise = 2.*
random[i].Gaussian()*diff;
176 const double f = -2.*k*(cv2-
min[i])*cv;
178 ene += 0.5*k*(cv2-
min[i])*(cv2-
min[i]);
182 sprintf(str_min,
"min_%u",i+1);
Log & log
Reference to the log stream.
void componentIsNotPeriodic(const std::string &name)
Set your value component to have no periodicity.
double difference(int, double, double) const
Takes the difference taking into account pbc for arg i.
void error(const std::string &msg) const
Crash calculation and print documentation.
void checkRead()
Check if Action was properly read.
void addComponent(const std::string &name)
Add a value with a name like label.name.
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.
void parseVector(const std::string &key, std::vector< T > &t)
Parse one keyword as std::vector.
std::vector< double > min
void setOutputForce(int i, double g)
std::vector< double > temp
void calculate()
Calculate an Action.
double getArgument(const unsigned n) const
Returns the value of an argument.
std::vector< double > kappa
Provides the keyword ABMD
This is the abstract base class to use for implementing new simulation biases, within it there is inf...
#define PLUMED_BIAS_INIT(ao)
Value * getPntrToComponent(int i)
Return a pointer to the component by index.
unsigned getNumberOfArguments() const
Returns the number of arguments.