coul/long

Hi everyone! I want to model a Coulomb system using the pure Ewald potential, without any modifications such pppm/wolf etc. Could you please tell me where to find the maths that is implemented in pair_coul_long.cpp, especially information about the tabular data for the long-range part?

Pretty much any text book on MD that is worth its money will explain Ewald summation. A shortened version is here: Ewald sum page on SklogWiki - a wiki for statistical mechanics and thermodynamics

The important LAMMPS specific part is, that it uses the same short range (i.e. damped pairwise Coulomb) formulation for both plain Ewald summation (kspace style ewald) and PPPM (kspace style pppm) with the latter being similar to then more commonly implemented PME.

The tabulation is for the short range part. Since the evaluation of the complementary error function is quite expensive, even if an approximation is used, LAMMPS uses the same “trick” as it uses for the “BITMAP” indexed tables. This is based on the fact that in a single precision floating point number the first 23 bits are the mantissa which represents floating point values between 1.0 and 2.0, so if you recast the damped Coulomb function from 0 to the cutoff to the same range you can look up the array values by using the first N bits of the floating point number as integer and then multiplying it with Qi * Qj.

1 Like

And one more question, what do the parameters tolerance and rcut mean? (pair_style coul/long rcut, kspace_style ewald tolerance), why do thermodynamic properties depend on them very much, and what parameters should be chosen then?

Hi @KT_Boltsman,

These are the parameters r_c and the accuracy for the forces you set for electrostatic forces using Ewald sum. Please have a look at the corresponding doc pages for pair coul/long and kspace_style commands for more details.

The reason the thermodynamic properties depend on them was heavily discussed in the literature for a long time now. Good starting points for a better understanding are standard MD textbook (and maybe the Lennard-Jones potential wiki page). It is nearly impossible to give you out-of-the-box parameters without knowing more on your simulation and goals, so please you shall probably have some trial and error to look for what suits your needs best.

1 Like

Technically, you need to provide a cutoff for both real space and reciprocal space, but those are connected through the alpha parameter in the Ewald formula (there is a corresponding output and you can set it manually via kspace_modify). With the “tolerance” LAMMPS applies some heuristics to determine the reciprocal space cutoff from the tolerance and the real space cutoff to ensure the error is below the tolerance. Mind you, this applies to forces and not necessary other properties. Pressure, for example, doesn’t have the same degree of error cancellations that forces have and thus need a smaller tolerance for good convergence.

For the same convergence the Coulomb interaction should be the same regardless of how the real space cutoff (rcut) is chosen, only the computational effort is distributed differently between real space and reciprocal space. However, in most common models, you have also an lj/cut force component and thus the choice of cutoff is primarily determined by the errors from lj/cut rather than the error from coul/long.

1 Like

thank you very much!

thanks a lot!