Skip to content
Snippets Groups Projects
Commit 03a25046 authored by Giovanni Bussi's avatar Giovanni Bussi
Browse files

Merge branch 'v2.4'

[makedoc]
parents 08669b2e ef1415f0
No related branches found
No related tags found
No related merge requests found
...@@ -93,3 +93,4 @@ Fixes after alpha release: ...@@ -93,3 +93,4 @@ Fixes after alpha release:
Notice that this is an experimental feature and is not fully validated yet. See \issue{244}. Notice that this is an experimental feature and is not fully validated yet. See \issue{244}.
- When parsing constants, PLUMED uses lepton library. This allows to pass - When parsing constants, PLUMED uses lepton library. This allows to pass
arguments such as `HEIGHT=exp(0.5)`. arguments such as `HEIGHT=exp(0.5)`.
- \ref CUSTOM function has been added as an alias to \ref MAXENT.
...@@ -9,7 +9,7 @@ cc1: MATHEVAL ARG=t1,t2,t3 FUNC=x^2+y+0*z+1 PERIODIC=NO ...@@ -9,7 +9,7 @@ cc1: MATHEVAL ARG=t1,t2,t3 FUNC=x^2+y+0*z+1 PERIODIC=NO
cc2: MATHEVAL ARG=t1,t2,t3 FUNC=0*x^3+0*y^3+0*z^3 PERIODIC=NO cc2: MATHEVAL ARG=t1,t2,t3 FUNC=0*x^3+0*y^3+0*z^3 PERIODIC=NO
cc3: MATHEVAL ARG=t1,t2 FUNC=x^2+y^2 PERIODIC=NO cc3: MATHEVAL ARG=t1,t2 FUNC=x^2+y^2 PERIODIC=NO
all: MATHEVAL ARG=t1,t2,t3,cc1,cc2,cc3 VAR=a1,a2,a3,a4,a5,a6 FUNC={ (a1+a2+a3+a4+a5+a6) / 6.0 } PERIODIC=NO all: CUSTOM ARG=t1,t2,t3,cc1,cc2,cc3 VAR=a1,a2,a3,a4,a5,a6 FUNC={ (a1+a2+a3+a4+a5+a6) / 6.0 } PERIODIC=NO
RESTRAINT ARG=all AT=0 SLOPE=1.0 RESTRAINT ARG=all AT=0 SLOPE=1.0
......
c: COORDINATION GROUPA=1 GROUPB=2 SWITCH={MATHEVAL R_0=1.3 D_MAX=2.6 FUNC=1/(1+x^6) NOSTRETCH} c: COORDINATION GROUPA=1 GROUPB=2 SWITCH={MATHEVAL R_0=1.3 D_MAX=2.6 FUNC=1/(1+x^6) NOSTRETCH}
cs: COORDINATION GROUPA=1 GROUPB=2 SWITCH={MATHEVAL R_0=1.3 D_MAX=2.6 FUNC=1/(1+x^6)} cs: COORDINATION GROUPA=1 GROUPB=2 SWITCH={CUSTOM R_0=1.3 D_MAX=2.6 FUNC=1/(1+x^6)}
PRINT ... PRINT ...
ARG=c,cs ARG=c,cs
......
...@@ -78,6 +78,8 @@ The value of \f$ \xi(\lambda,t)\f$ is written in output as a component named: ar ...@@ -78,6 +78,8 @@ The value of \f$ \xi(\lambda,t)\f$ is written in output as a component named: ar
Setting \f$ \sigma =0\f$ is equivalent to enforce a pure Maximum Entropy restraint without any noise modelling. Setting \f$ \sigma =0\f$ is equivalent to enforce a pure Maximum Entropy restraint without any noise modelling.
This method can be also used to enforce inequality restraint as shown in following examples. This method can be also used to enforce inequality restraint as shown in following examples.
Notice that a similar method is available as \ref EDS, although with different features and using a different optimization algorithm.
\par Examples \par Examples
The following input tells plumed to restrain the distance between atoms 7 and 15 The following input tells plumed to restrain the distance between atoms 7 and 15
......
...@@ -65,6 +65,8 @@ to zero with the default value of \f$s_i\f$ as this will cause a ...@@ -65,6 +65,8 @@ to zero with the default value of \f$s_i\f$ as this will cause a
divide-by-zero error. Instead, set \f$s_i=1\f$ or modify the CV so the divide-by-zero error. Instead, set \f$s_i=1\f$ or modify the CV so the
desired target value is no longer zero. desired target value is no longer zero.
Notice that a similar method is available as \ref MAXENT, although with different features and using a different optimization algorithm.
\par Examples \par Examples
The following input for a harmonic oscillator of two beads will The following input for a harmonic oscillator of two beads will
......
...@@ -206,6 +206,32 @@ public: ...@@ -206,6 +206,32 @@ public:
PLUMED_REGISTER_ACTION(Matheval,"MATHEVAL") PLUMED_REGISTER_ACTION(Matheval,"MATHEVAL")
//+PLUMEDOC FUNCTION CUSTOM
/*
An alias to the \ref MATHEVAL function.
\par Examples
Just replace \ref MATHEVAL with \ref CUSTOM.
\plumedfile
d: DISTANCE ATOMS=10,15
m: CUSTOM ARG=d FUNC=0.5*step(0.5-x)+x*step(x-0.5) PERIODIC=NO
# check the function you are applying:
PRINT ARG=d,n FILE=checkme
RESTRAINT ARG=d AT=0.5 KAPPA=10.0
\endplumedfile
(see also \ref DISTANCE, \ref PRINT, and \ref RESTRAINT)
*/
//+ENDPLUMEDOC
class Custom :
public Matheval {
};
PLUMED_REGISTER_ACTION(Matheval,"CUSTOM")
void Matheval::registerKeywords(Keywords& keys) { void Matheval::registerKeywords(Keywords& keys) {
Function::registerKeywords(keys); Function::registerKeywords(keys);
keys.use("ARG"); keys.use("PERIODIC"); keys.use("ARG"); keys.use("PERIODIC");
......
...@@ -266,7 +266,7 @@ void SwitchingFunction::set(const std::string & definition,std::string& errormsg ...@@ -266,7 +266,7 @@ void SwitchingFunction::set(const std::string & definition,std::string& errormsg
for(auto & e : expression_deriv) e=ped.createCompiledExpression(); for(auto & e : expression_deriv) e=ped.createCompiledExpression();
} }
#ifdef __PLUMED_HAS_MATHEVAL #ifdef __PLUMED_HAS_MATHEVAL
else if(name=="MATHEVAL") { else if(name=="MATHEVAL" || name=="CUSTOM") {
type=matheval; type=matheval;
std::string func; std::string func;
Tools::parse(data,"FUNC",func); Tools::parse(data,"FUNC",func);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment