Skip to content

Commit 15fbe87

Browse files
Gareth Aneurin TribelloGareth Aneurin Tribello
authored andcommitted
Added some documentation for PERIODIC keyword in CUSTOM
1 parent c6e517e commit 15fbe87

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/function/Custom.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,24 @@ c: CUSTOM ARG=d FUNC=pi*x*x PERIODIC=NO
162162
PRINT ARG=c FILE=colvar
163163
```
164164
165+
## The PERIODIC keyword
166+
167+
If the function you have evaluated has a periodic codomain then you have to use the PERIODIC keyword to specify the codomain of the function.
168+
To see how to use this keyword consider the following input:
169+
170+
```plumed
171+
d: DISTANCE ATOMS=1,2 COMPONENTS
172+
theta: CUSTOM ARG=d.x,d.y FUNC=atan2(y,x) PERIODIC=-pi,+pi
173+
PRINT ARG=theta FILE=colvar
174+
```
175+
176+
The above input calculates the torsional angle between the vector connecting atoms 1 and 2 and positive $x$ direction around the $z$ axis.
177+
This quantity must lie between $-\pi$ and $\pi$ so we use the PERIODIC keyword to tell PLUMED this fact about the output quantity.
178+
179+
Notice that PLUMED cannot automatically detect if the codomain of the function is periodic. You thus always have to specifiy the
180+
periodicity of the codomain whenever you use the CUSTOM command. However, the codomain of most functions that people use are not periodic
181+
so you can normally just write `PERIODIC=NO`
182+
165183
## The step function
166184
167185
The `step` operation (that is the Heaviside function) from the table above allow you to use if clauses in CUSTOM actions.

0 commit comments

Comments
 (0)