102 std::vector<std::vector<double> >
at;
103 std::vector<std::vector<double> >
kappa;
112 static void registerKeywords(
Keywords& keys );
118 Bias::registerKeywords(keys);
120 keys.add(
"compulsory",
"VERSE",
"B",
"Tells plumed whether the restraint is only acting for CV larger (U) or smaller (L) than the restraint or whether it is acting on both sides (B)");
121 keys.add(
"numbered",
"STEP",
"This keyword appears multiple times as STEPx with x=0,1,2,...,n. Each value given represents the MD step at which the restraint parameters take the values KAPPAx and ATx.");
122 keys.reset_style(
"STEP",
"compulsory");
123 keys.add(
"numbered",
"AT",
"ATx is equal to the position of the restraint at time STEPx. For intermediate times this parameter is linearly interpolated. If no ATx is specified for STEPx then the values of AT are kept constant during the interval of time between STEPx-1 and STEPx.");
124 keys.reset_style(
"AT",
"compulsory");
125 keys.add(
"numbered",
"KAPPA",
"KAPPAx is equal to the value of the force constants at time STEPx. For intermediate times this parameter is linearly interpolated. If no KAPPAx is specified for STEPx then the values of KAPPAx are kept constant during the interval of time between STEPx-1 and STEPx.");
126 keys.reset_style(
"KAPPA",
"compulsory");
127 componentsAreNotOptional(keys);
128 keys.addOutputComponent(
"bias",
"default",
"the instantaneous value of the bias potential");
129 keys.addOutputComponent(
"force2",
"default",
"the instantaneous value of the squared force due to this bias potential");
130 keys.addOutputComponent(
"_cntr",
"default",
"one or multiple instances of this quantity will be refereceable elsewhere in the input file. "
131 "these quantities will named with the arguments of the bias followed by "
132 "the character string _cntr. These quantities give the instantaneous position "
133 "of the center of the harmonic potential.");
134 keys.addOutputComponent(
"_work",
"default",
"one or multiple instances of this quantity will be refereceable elsewhere in the input file. "
135 "These quantities will named with the arguments of the bias followed by "
136 "the character string _work. These quantities tell the user how much work has "
137 "been done by the potential in dragging the system along the various colvar axis.");
142 verse(getNumberOfArguments())
145 vector<long int> ss(1); ss[0]=-1;
150 for(
unsigned j=0;j<
step.size();j++){
151 if(ss[0]<
step[j])
error(
"in moving restraint step number must always increase");
153 step.push_back(ss[0]);
165 for(
unsigned i=0;i<
step.size();i++){
168 for(
unsigned j=0;j<
at[i].size();j++)
log.
printf(
" %f",
at[i][j]);
189 log<<
" Bibliography ";
190 log<<
cite(
"Grubmuller, Heymann, and Tavan, Science 271, 997 (1996)")<<
"\n";
200 std::vector<double> kk(narg),aa(narg),f(narg);
206 }
else if(now>=
step[
step.size()-1]){
211 for(i=1;i<
step.size();i++)
if(now<
step[i])
break;
214 for(
unsigned j=0;j<narg;j++) kk[j]=(c1*
kappa[i-1][j]+c2*
kappa[i][j]);
215 for(
unsigned j=0;j<narg;j++) aa[j]=(c1*
at[i-1][j]+c2*
at[i][j]);
217 for(
unsigned i=0;i<narg;++i){
220 const double k=kk[i];
222 if(
verse[i]==
"U" && cv<0)
continue;
223 if(
verse[i]==
"L" && cv>0)
continue;
const std::string & getName() const
Get the name of the quantity.
Log & log
Reference to the log stream.
void componentIsNotPeriodic(const std::string &name)
Set your value component to have no periodicity.
std::vector< std::vector< double > > kappa
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.
Value * getPntrToArgument(const unsigned n)
Return a pointer to specific argument.
void addComponent(const std::string &name)
Add a value with a name like label.name.
std::vector< long int > step
std::vector< string > verse
std::vector< double > work
void set(double)
Set the value of the function.
std::vector< std::vector< double > > at
This class holds the keywords and their documentation.
This class is used to bring the relevant information to the Action constructor.
Provides the keyword MOVINGRESTRAINT
int printf(const char *fmt,...)
Formatted output with explicit format - a la printf.
const std::string & getName() const
Returns the name.
std::vector< double > oldf
void parseVector(const std::string &key, std::vector< T > &t)
Parse one keyword as std::vector.
void calculate()
Calculate an Action.
void setOutputForce(int i, double g)
std::vector< double > oldaa
double getArgument(const unsigned n) const
Returns the value of an argument.
long int getStep() const
Return the present timestep.
bool parseNumberedVector(const std::string &key, const int no, std::vector< T > &t)
Parse a vector with a number.
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.
std::string cite(const std::string &s)
Cite a paper see PlumedMain::cite.