Define a pair potential energy function corresponding to the modified Lennard-Jones potential
where \(r_{ij}\) is the distance between particles \(i,j\) \(\varepsilon, \sigma\) are Lennard-Jones potential parameters, and that must be set to define the interaction between atoms, \(r_{\rm cut}\) is cutoff distance, and \(F_{\rm LJ}(r_{ij})\) is the original Lennard-Jones force:
This modified Lennard-Jones potential has force equal to 0 at cutoff distance.
parameters of potential can be defined directly within the python input script, read from a LAMMPS data file (using the LAMMPS reader utility), read from a NAMD input file (using the NAMD reader utility) or read from a restart file.
Adding Fix
FixLJCutFS(state=..., handle=...)
Arguments
Setting parameters from within the Python environment is done with setParameter.
setParameter(param=...,handleA=...,handleB=...,val=...,)
Arguments
name of parameter to set. Can be eps, sig, rCut.
rCut parameter has a default value equal to state.rCut. All other parameters have to be set manually.
It is also possible to get value of the parameters within the Python environment with getParameter.
val = getParameter(param=...,handleA=...,handleB=...)
Arguments
Adding the fix
#adding force-shifted Lennard-Jones potential
ljcut = FixLJCutFS(state, handle='ljcut')
Setting parameters in python
ljcut.setParameter(param='eps', handleA='A', handleB='B', val=1.0)
ljcut.setParameter(param='sig', handleA='B', handleB='B', val=1.0)
Setting same parameters for all types in python
ljsig=1.0
ljeps=1.0
#list of all types
types=['A','B','C','S','P','N']
for A in types:
for B in types:
ljcut.setParameter(param='eps', handleA=A, handleB=B, val=ljeps)
ljcut.setParameter(param='sig', handleA=A, handleB=B, val=ljsig)
Activating the fix
#Activate fix
state.activateFix(ljcut)
rCut, eps, sig