[lammps-users] lj/cut/coul/long with ewald

I am trying to get a feel for how to use the lj/cut/coul/long and kspace_style commands. My basic set up is 4000 LJ particles, 10 of which are charged (system is neutral). I define the potential using

pair_style lj/cut/coul/long 2.5 8.0
      # LJ cutoff = 2.5
      # coulombic cutoff = 8.0
pair_modify shift yes
kspace_style ewald 1.0e-4
pair_coeff * * 1.0 1.0 2.5

The thermo command prints out the following when I try to run:

Step Temp PotEng KinEng TotEng E_vdwl E_coul
        0 1 nan 1.499625 nan -4.8869093 nan

I'm not sure how to fix this. Any advice would be great. Thanks in advance.


NANs on your intial config probably means your atoms are overlapping (charge
term or LJ term) too much.


I forgot to mention that my initial configuration is from an equilibrated LJ run, so I don't think I would have any overlapping atoms. The charges on the ions are +/- 5.0. Would that be considered too much? I can try it with a lower charge.

Thanks for the reply.


Steve Plimpton wrote:


My initial configuration for the particles is taken from an equilibrated LJ run, so I do not believe atom overlap to be the problem. I tried reducing the charge from +/- 5.0 to 1.0, but get the same results as below, namely NAN on the first time step for the PE, E_vdwl, and E_Coul. What's strange is that when I use

pair_style lj/cut/coul/cut 2.5 8.0

everything runs fine. The problem arise only with the long version of this pair_style. Any thoughts?


Steve Plimpton wrote:


My guess is that the charges on your particles are producing huge forces. The LAMMPS manual says that for LJ units (which I assume you’re using) you should have “charge = reduced LJ charge” (see: http://lammps.sandia.gov/doc/units.html ). So your charges of 5 or 1 would be fine in real units, but probably too large in LJ units. How about trying your simulation using real units throughout?

If my hunch is wrong, I’d recommend that you send us your data file and input script so that we can try it out here.


Dear Paul,

Attached are the input and data files. I tried using real units throughout, but I got the same results, namely NaNs when using lj/cut/coul/long and numbers when using lj/cut/coul/cut. I then went back to lj units and tried smaller values for the charge (instead of +/- 1.0 I used +/- 0.1), which also produced the same outcomes.

Thanks for taking a look at this!


Paul Crozier wrote:

data.LJwIons (199 KB)

in.LJwIons (1.14 KB)

It looks like the data file you sent was truncated:

2016 1 0.000000 3.665880 5.612010 8.540880
2017 1 0.000000 3.948240 16.574100 8.057220

LAMMPS code: LJ system with ions

temp = 1.0

density of LJ particles = 0.85

13 November 2006