Harmonic Wall Potential


Implements a harmonic potential energy wall at a specified origin origin with force in the vector direction forceDir. The cut off distance is specified by the dist keyword. The spring constant associated with the wall is denoted by the k parameter. The wall potential has a potential energy function given by

\[U_{\text{wall}} = \frac{1}{2} k (r - r_{0})^2\]




Simulation state to apply the fix.
A name for the object. String type.
Group of atoms to which the fix is applied. String type.
Point of origin for the wall. Vector type.
The direction in which the force is to be applied. Vector type.
The cutoff for the potential. Float type.
The spring constant associated with the wall. Float type.

Python Member Functions

Member data of the FixWallHarmonicpotential may be modified directly via the Python interface; namely, ‘k’, ‘dist’, ‘forceDir’, and ‘origin’ keywords are directly accessible from an instance of FixWallHarmonic.

To modify any these parameters, simply assign them a new value of an appropriate type.


Example 1: Creating an instance of FixWallHarmonic

# create a simulation state to which we will add the fix
state = state()

# set the bounds of the state
state.bounds = Bounds(state, lo=Vector(0,0,0), hi=Vector(30,30,30))

# put the wall at (0,0,0)
origin = Vector(0,0,0)

# have the wall be acting in the +x direction
forceDir = Vector(1,0,0)

# cutoff distance of 15 units
dist = 15

# set a spring constant k = 2.5
k = 2.5

# create an instance of the fix
fixWall = FixWallHarmonic(state,"wall","all",origin,forceDir,dist,k)

# activate the fix

Example 2: Modifying the force constant after instantiation

# increase the spring constant to k = 3.5
fixWall.k = 3.5

Table Of Contents

Previous topic

LJ Wall Potential

Next topic

External Harmonic Potential Fix

This Page