Shifted-force potential for pair_dipole

Dear all,

I’d like to use shifted-force potentials for the following pair interactions: Lennard-Jones, dipole-dipole, dipole-charge, charge-charge. By “shifted-force potential”, I mean a potential which is modified so that both energy and derivative are zero at the cutoff [p. 146, Allen & Tildesley, Computer simulation of liquids, 1987; p. 48, Rapaport, The art of MD simulation, 2nd ed, 2004].

I believe the shifted-force potentials I need are not available in Lammps? If so, I want to try adding them.

After reading the relevant manual section (, I’m planning to start from the two existing “pair_dipole_cut[.h and .cpp]” files, and turn them into something like “pair_dipole_sf[.h and .cpp]”. All the potentials I need will be included in such two additional files.

Does anyone have any suggestion/warning/comment about this?
Any feedback would be much appreciated. I’ve never touched the Lammps source before, but I’m used to writing molecular dynamics code in plain C (in fact, I already have some relevant routines which hopefully can be adapted).


Dear Mario,

If you search the mailing list archives, you'll find that I posted a
shifted force Lennard-Jones pair potential (Mar 15 2011). The
procedure you describe seems perfectly fine, that's what I did anyway.


Dear Laurent,

thanks for your reply.
It would be useful to have your code in the official Lammps distribution, as mentioned in the thread (
As for the other shifted-force potentials I need (charge-charge, charge-dipole, dipole-dipole), I’ve started to work…


That's my plan - I'm just behind (as usual) ...


Dear Steve/all,

for anyone interested, find attached the “.cpp” and “.h” files for a new pair style “dipole/sf” containing the shifted-force version of the potentials, forces and torques in “dipole/cut” (charge-charge, charge-dipole, dipole-charge, dipole-dipole and LJ). Corresponding “.tex” and “.txt” documentation files also attached. Everything was derived from the existing “dipole/cut” material. If you think this might be of general interest, it would be great to have it in the official distribution.


pair_dipole.txt (6.78 KB)

pair_dipole_sf.cpp (15.9 KB)

pair_dipole_sf.h (1.34 KB)

pair_dipole_sf.tex (3.48 KB) (438 Bytes)

Mario - I just posted these as an Aug 11 patch.

The LaTeX file for the eqs has some bug in it,
that wouldn't process correctly, but I didn't see it
quickly. If you correct this file (pull it from the distribution),
then I will re-post that fie.

Thanks - it looks like a nice potential, esp since we
don't yet have a long-range dipole potential (with no cutoff).


Laurent - just posted a patch with your shifted-force
pair style as well ...