25 #include "tools/SwitchingFunction.h"
33 std::vector<double>
df;
52 keys.
reserve(
"numbered",
"MORE_THAN",
"calculate the number of variables more than a certain target value. "
53 "This quantity is calculated using \\f$\\sum_i 1.0 - \\sigma(s_i)\\f$, where \\f$\\sigma(s)\\f$ "
54 "is a \\ref switchingfunction.",
true);
55 keys.
addOutputComponent(
"more_than",
"MORE_THAN",
"the number of values more than a target value. This is calculated using one of the "
56 "formula described in the description of the keyword so as to make it continuous. "
57 "You can calculate this quantity multiple times using different parameters.");
64 if(
getAction()->isPeriodic() )
error(
"more than is not a meaningful option for periodic variables");
66 if( errormsg.size()!=0 )
error( errormsg );
78 double dval, f = 1.0 -
sf.
calculate(val, dval); dval*=-val;
79 double contr=weight*f;
double calculate(double x, double &df) const
double getTolerance() const
Return the value of the tolerance.
double getFinalValue(const unsigned &j)
Get the nth value in the distribution.
bool diffweight
Are the derivatives differentiable.
void chainRuleForElementDerivatives(const unsigned &, const unsigned &, const double &, Vessel *)
Merge the derivatives.
static void reserveKeyword(Keywords &keys)
void set(int nn, int mm, double r_0, double d_0)
bool calculate()
Calculate the part of the vessel that is done in the loop.
void setOutputValue(const double &val)
Set the final value.
Objects that inherit from FunctionVessel can be used (in tandem with PLMD::ActionWithVessel) to calcu...
std::string function_description()
The rest of the description of what we are calculating.
static void registerKeywords(Keywords &keys)
void mergeFinalDerivatives(const std::vector< double > &df)
This does a combination of the product and chain rules.
Small class to compure switching functions in the form In the future we might extend it so as to be s...
static void registerKeywords(Keywords &keys)
void addOutputComponent(const std::string &name, const std::string &key, const std::string &descr)
Add a potential component which can be output by this particular action.
This class holds the keywords and their documentation.
#define PLUMED_REGISTER_VESSEL(classname, keyword)
MoreThan(const VesselOptions &da)
void reserve(const std::string &t, const std::string &k, const std::string &d, const bool isvessel=false)
Reserve a keyword.
void error(const std::string &errmsg)
Report an error.
This class is used to pass the input to Vessels.
void finish()
Complete the calculation once the loop is finished.
std::string description() const
bool addValueUsingTolerance(const unsigned &jval, const double &val)
Add some value to the accumulator if it is greater than tolerance.
static void registerKeywords(Keywords &keys)
double getNLTolerance() const
Return the value of the neighbor list tolerance.
std::string getAllInput()
This returns the whole input line (it is used for less_than/more_than/between)
double getElementValue(const unsigned &ival) const
Get the value of this element.
ActionWithVessel * getAction()
Return a pointer to the action we are working in.