Code: Select all
CustomExternalForce
This is simple with a flat-bottom harmonic potential, however the issue that I find is with PBC. This excerpt from the
Code: Select all
CustomExternalForce
and equally horrific from the FAQ,Special care is needed in systems that use periodic boundary conditions. In that case, each particle really represents an infinite set of particles repeating through space. The variables x, y, and z contain the coordinates of one of those periodic copies, but there is no guarantee about which.
For the case of the harmonic potential the particles position affects the force. For example, for a linear force solely on z with a general expression ofPeriodic boundary conditions are applied while computing forces that depend on the displacements between particles.
Code: Select all
" f * z "
Code: Select all
" select(a, a, b) * (k/2) * ( z - select(a, zUpper, zLower) )^2; a=step(z - zUpper); b=step(zLower - z) "
Code: Select all
zUpper
Code: Select all
zLower
Code: Select all
periodicdistance(0, 0, z, 0, 0, zUpper)
Code: Select all
periodicdistance(0, 0, z, 0, 0, zLower)
Code: Select all
periodicdistance(x1, y1, z1, x2, y2, z2)
Code: Select all
z = zUpper
Does anyone have suggestions to implement this restraint? It is also a possible that I have misunderstood the
Code: Select all
CustomExternalForce