Skip to content

Commit

Permalink
Fixed some mistakes in manual for functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Gareth Aneurin Tribello authored and Gareth Aneurin Tribello committed Nov 22, 2024
1 parent 6ca0ab6 commit 2d850bb
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 18 deletions.
5 changes: 4 additions & 1 deletion src/function/Between.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
#include "Between.h"
#include "FunctionShortcut.h"
#include "FunctionOfScalar.h"
#include "FunctionOfVector.h"
#include "FunctionOfMatrix.h"
#include "core/ActionRegister.h"
Expand Down Expand Up @@ -66,7 +67,7 @@ The $\sigma$ values in the expressions above is calculated from the parameters $
Also note that the Kernel function $K$ that is used in the first example is a Gaussian. The actual integral that is evaluated is thus:
$$
w(s) = \frac{1}{\sqrt{2\pi}\sigma} \int_a^b \exp\left( -\frac{(x-s)^2}{2\sigma^2} \textrm{d}x
w(s) = \frac{1}{\sqrt{2\pi}\sigma} \int_a^b \exp\left( -\frac{(x-s)^2}{2\sigma^2}\right) \textrm{d}x
$$
The Gaussian kernel in this expression can be replaced by a triangular Kernel by changing the input to:
Expand Down Expand Up @@ -158,6 +159,8 @@ Transform all the elements of a matrix using a switching function that is oen wh

typedef FunctionShortcut<Between> BetweenShortcut;
PLUMED_REGISTER_ACTION(BetweenShortcut,"BETWEEN")
typedef FunctionOfScalar<Between> ScalarBetween;
PLUMED_REGISTER_ACTION(ScalarBetween,"BETWEEN_SCALAR")
typedef FunctionOfVector<Between> VectorBetween;
PLUMED_REGISTER_ACTION(VectorBetween,"BETWEEN_VECTOR")
typedef FunctionOfMatrix<Between> MatrixBetween;
Expand Down
4 changes: 2 additions & 2 deletions src/function/Combine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ COMBINE action that takes vectors and scalars in input.
```plumed
p: CONSTANT VALUE=2
d: DISTANCE ATOMS1=1,2 ATOMS2=3,4 ATOMS3=5,6 ATOMS4=7,8
c: COMBINE ARG=d,p COEFFICIENTS=4,-1 POWERS=2.5,1
c: COMBINE ARG=d,p COEFFICIENTS=4,-1 POWERS=2.5,1 PERIODIC=NO
PRINT ARG=c FILE=colvar
```
Expand All @@ -117,7 +117,7 @@ Lastly, notice that if you pass a single vector in input to COMBINE as in the fo
```plumed
d: DISTANCE ATOMS1=1,2 ATOMS2=3,4 ATOMS3=5,6 ATOMS4=7,8
c: COMBINE ARG=d COEFFICIENTS=4 POWERS=2.5 PARAMETERS=0.5
c: COMBINE ARG=d COEFFICIENTS=4 POWERS=2.5 PARAMETERS=0.5 PERIODIC=NO
PRINT ARG=c FILE=colvar
```
Expand Down
18 changes: 9 additions & 9 deletions src/function/Custom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ that you can use in in the input to the `FUNC` keyword for CUSTOM.
| cos(x) | The cosine of x |
| sec(x) | The reciprocal of the cosine of $x$. $\frac{1}{\cos(x)}$ |
| csc(x) | The reciprocal of the sine of $x$. $\frac{1}{\sin(x)}$ |
| tan(x) | The tangent of x i.e. $\frac{\sin(x)}(\cos(x)}$ |
| tan(x) | The tangent of x i.e. $\frac{\sin(x)}{\cos(x)}$ |
| cot(x) | The reciprocal of the tangent of $x$. $\frac{1}{\tan(x)}$ |
| asin(x) | The principal arc sine of x. Returns $-\frac{\pi}{2} \le y \le \frac{\pi}{2}$ which gives $x = \sin(y)$ |
| acos(x) | The principal arc cosine of x. Returns $0 \le y \le \pi$ which gives $x=\cos(y)$ |
Expand All @@ -110,8 +110,8 @@ that you can use in in the input to the `FUNC` keyword for CUSTOM.
| sinh(x) | The hyperbolic sine of $x$ |
| cosh(x) | the hyperbolic cosine of $x$ |
| tanh(x) | The hyperbolic tangent of $x$ |
| erf(x) | The [error function](https://en.wikipedia.org/wiki/Error_function) $\frac{2}{\sqrt{\pi}}\int_0^x e^{-t^2} \txtrm{d}t$ |
| erfc(x) | The complementary error function $1-\frac{2}{\sqrt{\pi}}\int_0^x e^{-t^2} \txtrm{d}t$ |
| erf(x) | The [error function](https://en.wikipedia.org/wiki/Error_function) $\frac{2}{\sqrt{\pi}}\int_0^x e^{-t^2} \textrm{d}t$ |
| erfc(x) | The complementary error function $1-\frac{2}{\sqrt{\pi}}\int_0^x e^{-t^2} \textrm{d}t$ |
| step(x) | 1 if $x \ge 0$ and 0 otherwise |
| delta(x) | inf if $x=0$ and 0 otherwise |
| nandelta(x) | nan if $x=0$ and 0 otherwise |
Expand All @@ -120,7 +120,7 @@ that you can use in in the input to the `FUNC` keyword for CUSTOM.
| recip(x) | The reciprocal of x i.e. $\frac{1}{x}$ |
| min(x,y) | If $x<y$ this function returns $x$. If $y\le x$ this function returns $y$ |
| max(x,y) | If $x>y$ this function returns $x$. If $y\ge x$ this function returns $y$ |
| abs(x) | The absolute value of x i.e. $|x|$ |
| abs(x) | The absolute value of x |
| floor(x) | The largest integer that is less than $x$ |
| ceil(x) | The smallest integer that is greater than $x$ |
| select(x,y,z) | If $x==0$ this returns $z$ otherwise this returns $y$ |
Expand Down Expand Up @@ -208,7 +208,7 @@ Notice that you can use CUSTOM to implement a [MOVINGRESTRAINT](MOVINGRESTRAINT.
```plumed
t: TIME
d: DISTANCE ATOMS=1,2
f: CUSTOM ARG=d,t FUNC=100*(d-((0.2-0.1)*t/100))^2 PERIODIC=NO
f: CUSTOM ARG=d,t FUNC=100*(x-((0.2-0.1)*y/100))^2 PERIODIC=NO
BIASVALUE ARG=f
```
Expand Down Expand Up @@ -310,9 +310,9 @@ d: DISTANCE COMPONENTS ATOMS1=1,2 ATOMS2=3,4 ATOMS3=5,6 ATOMS4=7,8
# Calculate the norm of these four vectors
norm: CUSTOM ARG=d.x,d.y,d.z FUNC=sqrt(x*x+y*y+z*z) PERIODIC=NO
# Now calculate the directors of the vectors
norm_x: CUSTOM ARG=d.x,norm FUNC=x/y PEROIDIC=NO
norm_y: CUSTOM ARG=d.y,norm FUNC=x/y PEROIDIC=NO
norm_z: CUSTOM ARG=d.z,norm FUNC=x/y PEROIDIC=NO
norm_x: CUSTOM ARG=d.x,norm FUNC=x/y PERIODIC=NO
norm_y: CUSTOM ARG=d.y,norm FUNC=x/y PERIODIC=NO
norm_z: CUSTOM ARG=d.z,norm FUNC=x/y PERIODIC=NO
# And combine all these directors in a matrix
stack: VSTACK ARG=norm_x,norm_y,norm_z
# Now calculate the matrix of dot products between directors (these are the cosines of the angles)
Expand All @@ -328,7 +328,7 @@ Notice that you can pass multiple $N\times M$ matrices in the input to a CUSTOM
```plumed
c1: CUSTOM VALUES=2,3,4,5 NROWS=2 NCOLS=2
c2: CUSTOM VALUES=1,0,0,1 NROWS=2 NCOLS=2
f: CUSTOM ARG=c1,c2 FUNC=x*y PEIRODIC=NO
f: CUSTOM ARG=c1,c2 FUNC=x*y PERIODIC=NO
PRINT ARG=f FILE=colvar
```
Expand Down
6 changes: 3 additions & 3 deletions src/function/FuncPathMSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ calculate the progress along the path and the distance from it in p1
```plumed
#SETTINGS INPUTFILES=regtest/trajectories/path_msd/frame_1.dat,regtest/trajectories/path_msd/frame_21.dat,regtest/trajectories/path_msd/frame_42.dat
t1: RMSD REFERENCE=regtest/trajectories/path_msd/frame_1.pdb TYPE=OPTIMAL SQUARED
t2: RMSD REFERENCE=regtest/trajectories/path_msd/frame_21.pdb TYPE=OPTIMAL SQUARED
t3: RMSD REFERENCE=regtest/trajectories/path_msd/frame_42.pdb TYPE=OPTIMAL SQUARED
t1: RMSD REFERENCE=regtest/trajectories/path_msd/frame_1.dat TYPE=OPTIMAL SQUARED
t2: RMSD REFERENCE=regtest/trajectories/path_msd/frame_21.dat TYPE=OPTIMAL SQUARED
t3: RMSD REFERENCE=regtest/trajectories/path_msd/frame_42.dat TYPE=OPTIMAL SQUARED
p1: FUNCPATHMSD ARG=t1,t2,t3 LAMBDA=500.0
PRINT ARG=t1,t2,t3,p1.s,p1.z STRIDE=1 FILE=colvar FMT=%8.4f
```
Expand Down
2 changes: 1 addition & 1 deletion src/function/Moments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Notice that you can also achieve the same result using the following input:
```plumed
d: DISTANCE ATOMS1=1,2 ATOMS2=1,3 ATOMS3=1,4 ATOMS4=1,5
sort: SORT ARG=d
sort: MOMENTS ARG=d POWERS=2,3
PRINT ARG=mv.moment-2,mv.moment-3 FILE=colvar
```
Expand Down
2 changes: 1 addition & 1 deletion src/function/Sum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ This example calculates and outputs the number of distances that are less than 0
You can do something similar by summing the elements of a matrix as shown below:
```plumed
c: CONTACT_MAP SPECIES=1-100 SWITCH={RATIONAL R_0=0.1}
c: CONTACT_MATRIX SPECIES=1-100 SWITCH={RATIONAL R_0=0.1}
s: SUM ARG=c PERIODIC=NO
PRINT ARG=s FILE=colvar
```
Expand Down
2 changes: 1 addition & 1 deletion src/generic/Constant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ in the following input the values `d` and `f` are evaluated on every step. `c`
p: CONSTANT VALUE=1.0
c: CUSTOM ARG=p FUNC=2*x+1 PERIODIC=NO
d: DISTANCE ATOMS=1,2
f: CUSTOM ARG=p,d FUNX=x*y PERIODIC=NO
f: CUSTOM ARG=p,d FUNC=x*y PERIODIC=NO
PRINT ARG=f FILE=colvar STRIDE=1
```
Expand Down

1 comment on commit 2d850bb

@PlumedBot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found broken examples in automatic/ANN.tmp
Found broken examples in automatic/CLASSICAL_MDS.tmp
Found broken examples in automatic/CONVERT_TO_FES.tmp
Found broken examples in automatic/COORDINATIONNUMBER.tmp
Found broken examples in automatic/DISTANCE_FROM_CONTOUR.tmp
Found broken examples in automatic/DUMPCUBE.tmp
Found broken examples in automatic/DUMPGRID.tmp
Found broken examples in automatic/EDS.tmp
Found broken examples in automatic/EMMI.tmp
Found broken examples in automatic/FIND_CONTOUR.tmp
Found broken examples in automatic/FIND_CONTOUR_SURFACE.tmp
Found broken examples in automatic/FIND_SPHERICAL_CONTOUR.tmp
Found broken examples in automatic/FOURIER_TRANSFORM.tmp
Found broken examples in automatic/FUNNEL.tmp
Found broken examples in automatic/FUNNEL_PS.tmp
Found broken examples in automatic/GPROPERTYMAP.tmp
Found broken examples in automatic/HISTOGRAM.tmp
Found broken examples in automatic/INTERPOLATE_GRID.tmp
Found broken examples in automatic/LOCAL_AVERAGE.tmp
Found broken examples in automatic/MAZE_OPTIMIZER_BIAS.tmp
Found broken examples in automatic/MAZE_RANDOM_ACCELERATION_MD.tmp
Found broken examples in automatic/MAZE_SIMULATED_ANNEALING.tmp
Found broken examples in automatic/MAZE_STEERED_MD.tmp
Found broken examples in automatic/METATENSOR.tmp
Found broken examples in automatic/MULTICOLVARDENS.tmp
Found broken examples in automatic/PCA.tmp
Found broken examples in automatic/PCAVARS.tmp
Found broken examples in automatic/PIV.tmp
Found broken examples in automatic/PYCVINTERFACE.tmp
Found broken examples in automatic/PYTHONFUNCTION.tmp
Found broken examples in automatic/Q3.tmp
Found broken examples in automatic/Q4.tmp
Found broken examples in automatic/Q6.tmp
Found broken examples in automatic/QUATERNION.tmp
Found broken examples in automatic/REWEIGHT_BIAS.tmp
Found broken examples in automatic/REWEIGHT_METAD.tmp
Found broken examples in automatic/SIZESHAPE_POSITION_LINEAR_PROJ.tmp
Found broken examples in automatic/SIZESHAPE_POSITION_MAHA_DIST.tmp
Found broken examples in AnalysisPP.md
Found broken examples in CollectiveVariablesPP.md
Found broken examples in MiscelaneousPP.md

Please sign in to comment.