plumed2 icon indicating copy to clipboard operation
plumed2 copied to clipboard

Simple algebra in input values

Open GiovanniBussi opened this issue 8 years ago • 1 comments

Currently, whenever we read a double, we check it first against a few special strings, namely those in the form Xpi (with X a double). Exploiting either libmatheval or lepton it would be easy to also parse the string to solve simple expressions, such as:

RESTRAINT ARG=a AT=1+0.3

Instead of implementing it with libmatheval, I would rather wait for #244 so as to implement it directly using lepton. In this manner it would be always available.

An advantage of lepton (wrt libmatheval) is that it allows constants to be added to the pool. This would even allow defining some global parameters, e.g.

SET_GLOBAL VAR=lambda VALUE=replicas@{0.0,0.2,0.4,0.6,0.8,1.0}
RESTRAINT ARG=a AT=1+lambda*0.5

In this example lambda would be a constant similar to pi, but defined specifically on different replicas.

GiovanniBussi avatar Jun 20 '17 12:06 GiovanniBussi

Simple algebra is possible as of 7c5b10470bf5806c7b431e71125b91310101fa64

I leave this issue open for the implementation of SET_GLOBAL action, which is non trivial and will require some time.

GiovanniBussi avatar Jul 23 '17 23:07 GiovanniBussi