Regarding coulumbic cutoff in pair_style lj/charmm/coul/long

The system I am trying to simulate is charge neutral.
Sweta

Can’t use pair cutoff > box size when special bond setting != 1. See the Feb 2008 entry here: http://lammps.sandia.gov/unbug.html

This is a known problem. We may add a warning/error message and eventually a bug fix.

You’ll see good convergence if you keep your cutoff less than the box size. No need to go larger than that on your cutoff.

Paul

I think I just fixed this issue with the 15Jun patch. Can
you both check your test problems to see if they now work.
There is no longer any restriction in cutoff length. There is
however a restriction that no periodic dimension of the
box can be smaller than 2x where x is the max distance
between 2 atoms in the same bonded interaction (e.g. bond,
angle, dihedral). This is tested for and should now throw
an error. This limitation is b/c the periodic image of the interacting
atom will be closer than the real one and LAMMPS will get
confused about which atom to interact with.

Steve

Hi Steve
Thanks for the update.
I tested the updated version on my simulations
For the system having bonded atoms (single phospholipid, water, neutralizing ions), the one I mentioned in my first email, the results are not sensitive to ewald cut off anymore.

However I am running into a new error for another system that would run just fine with the earlier version
ERROR: KSpace accuracy too large to estimate G vector

Also when calculating the electrostatic energy for a 2d square lattice using a fixed simulation calculation in lammps,(83.66A x 83.66A) (charge is neutralized appropriately), the energy values calculated using the updated lammps version are very sensitive to the cut off!
This is a system with no bonds.
I tested them for cut off values 10,40,80,100A and the system size is 83.66A in the periodic directions.
The energy values change by 200kcal/mol for a 70 Angstrom change in cut off values. (from 10 to 80)

I plan to use the energy values for further analysis of my systems, and thus want to make sure I am using the right values of energy.
Are these errors values normal? or Am I doing something wrong? or is this still a bug?
How are accuracy and cut off related ?

Thanks
Regards
Sweta

I think these other issues are new accuracy metrics Paul has
added to all the KSpace solvers. You're just seeing
them b/c you're now running a newer version of the code.
Paul can comment on your Qs.

Steve

However I am running into a new error for another system that would
run just fine with the earlier version
ERROR: KSpace accuracy too large to estimate G vector

You can try setting the g_ewald parameter to see if this goes away. You won't get the optimal value that way though. Could also just reduce (use a larger number) your accuracy requested.

Also when calculating the electrostatic energy for a 2d square
lattice using a fixed simulation calculation in lammps,(83.66A x
83.66A) (charge is neutralized appropriately), the energy values
calculated using the updated lammps version are very sensitive to the cut off!
This is a system with no bonds.
I tested them for cut off values 10,40,80,100A and the system size is
83.66A in the periodic directions.
The energy values change by 200kcal/mol for a 70 Angstrom change in
cut off values. (from 10 to 80)

I plan to use the energy values for further analysis of my systems,
and thus want to make sure I am using the right values of energy.
Are these errors values normal? or Am I doing something wrong? or is
this still a bug?
How are accuracy and cut off related ?

If you're doing a 2d calculation, I assume you're not using kspace. I don't think you can. So, you're using a cutoff. And yes, the energies you get will be very sensitive to cutoff, even in a charge neutral system.

Paul

Hi Paul
For the system I mentioned in my earlier email, I use pair_style lj/cut/coul/long and 2D ewald summation for the long range electrostatics with the following parameters (in real units ) :

pair_style lj/cut/coul/long 3.0 40.0
kspace_style ewald 1.0e-4
kspace_modify slab 3.0

I am confused about the energy values because the earlier lammps version I had on my computer, would give consistent energy values for different cutoffs, the updated version does not when I try running both on the same system with the same set of simulation parameters.

Sweta

I’d recommend trying your calculation again with “kspace_style ewald 1e-6”. One of the changes that was recently made was the definition of “accuracy” or “precision” in the kspace calculations. As a consequence, fewer kspace vectors are now used for Ewald for a given accuracy than were used previously. For details, search on the word “accuracy” here: http://lammps.sandia.gov/doc/kspace_style.html

If that doesn’t seem to help, please send me your input so that I can take a closer look.

Paul

And see the 2 March 2012 patch notice for more details
about what changed relative to earlier versions of LAMMPS.

Steve

Hi
Thanks for the replies!
The accuracy errors are gone with the increased accuracy value, however the energy values are still not consistent for the old and new version, and for the new version, when I use different values for the long range cutoff.
Please find attached the Lammps input script and the test data file I use.
The system is a very simple one, with two oppositely charged square lattices placed at a sufficiently large distance from each other! No bonds involved. Typically I add mobile ions to the system too but there are no mobile charges in this test system!
(In the Lammps script I keyed in the values of the total electrostatic energy I get for the different cut off values that I tried)

From the results looks like there is still some restriction on the cut off value!
For my purpose, I just keep the cutoff lower than the box size, however was just curious if the difference in energies is because of something I am doing wrong or is it an error.

Thanks
Regards
Sweta

data_FixedCharges (9.57 KB)

in_LammpsScript_FixedCharges (1.05 KB)

Problem is that you are using slab mode (“kspace_modify slab 3.0”), so you need to keep your cutoff shorter than the inter-slab spacing, otherwise, the slabs that are supposed to be isolated will not be. So it is not surprising that the energies change when you change the cutoff that much in slab mode.

Energies may not match perfectly versus older versions of LAMMPS due to a variety of factors. Exact agreement with older versions is not guaranteed. I’d be surprised if there’s a large difference on a reasonable test problem, but I’d trust the latest version of the code more. If you can show us that energies computed by the latest version are wrong, we’d certainly like to hear about that.

Paul

Hi Paul
I did not have problems with my other simulations so far, but I again ran into the same problem with another system : Different cutoff values give different simulation results.
So I had to revisit this thread. This time I used a test system to calculate the Madelung constant for a 2d square lattice.
Please find attached the input script and the results for an old version (5th September 2010) and new version (27th Jan 2013) of lammps that I have.

I simulated a system having two planes with equal and opposite charge in the x-y plane separated by a distance ‘z’ in the z direction. The charges are placed in a square lattice arrangement.
For each of the results all other parameters are the same. The only thing that is changed is either the electrostatic cutoff or the accuracy.
It is a 2d ewald summation, so I use the slab geometry for these simulations. The system is charge neutral.
I took into consideration the fact that rcutoff < interslab spacing. (the box size of the simulation box is 83.66 x 83.66 x 41.83A) and I use
kspace_modify slab 3.0
So the interslab spacing would be 2*41.83 ~ 83.66A.

I calculated the Madelung Constant (which should be -1.957) from the energy values obtained by running a simulation with this simple test case using ewald and pppm.
The values of the constant vary over a wide range and so does the total electrostatic energy of the system.
Can you please take a look and help me out with this?

You mentioned that lammps now uses fewer kspace vectors in its calculation for the same accuracy values than it used to earlier. Is there a way to set this number manually?

Also for this system, I know what the value of the constant should be, so I would choose my parameters accordingly to get meaningful results. But in cases where I rely completely on the simulation results, how can I be sure that the results I get from the simulation are correct or that the accuracy and cutoff values that I used are optimal? Also using high accuracy value does yield a reasonable value of the constant, but such high accuracy values drastically slow down the simulation.

Thanks
Regards
Sweta

data_FixedSquareLattice (9.37 KB)

in_LammpsScript_FixedSquareLattice (918 Bytes)

Madelung_constant_results.pdf (21.2 KB)

Sorry I attached the wrong file in my earlier email.
Please use this updated version of the lammps input script.
Regards
Sweta

in_LammpsScript_FixedSquareLattice_updated (927 Bytes)

You can set the number of kspace vectors manually for PPPM, but not Ewald. For PPPM, use “kspace_modify mesh nx ny nz”:

http://lammps.sandia.gov/doc/kspace_modify.html

Sounds to me like this isn’t a bug, but rather that you’re finding you need pretty high accuracy in order to recover the Madelung constant. So I’d recommend using high accuracy if you really need it, even if it is slow.

Note that the relative accuracies for PPPM didn’t change between the versions. We only updated it for Ewald so that the accuracies between PPPM and Ewald would be consistent. So it isn’t surprising that you now need higher nominal accuracy for Ewald to achieve the same actual accuracy as before.

In your comparison between the older and newer versions of the Ewald solver in LAMMPS, you don’t list the relative compute times. Presumably, the newer version is much faster for a given prescribed accuracy since it is using way fewer kspace vectors.

I’ll also note that we’ve recently added non-periodic BC capability to LAMMPS’s new MSM long-range solver. MSM might be competitive for this slab geometry problem since you won’t need to use the empty space slab option.

Paul

Thanks for the suggestions.
I shall try the PPPM with a higher number of kspace vectors and also MSM with non-periodic BC.

As for these results :
The newer version is definitely faster, but after pumping up the accuracy, it does not make a huge difference.
For the madelung constant, I thought (at a low cutoff) values like -6 or -3 when compared to -1.95 is a huge error. I just used this as a test case, but I was getting different simulation results for a different system as well, which I describe here (results attached): http://lammps.sandia.gov/threads/msg34177.html
And the deviations start at z= rcutoff. So I wanted to know what was going on! and which result should I trust more, to use for further analysis.

Regards
Sweta