Theory · 5 methods
Electrostatics
What CAPS computes, as it computes it: the equation, its symbols with CAPS's defaults, when to use the method, the source file, the tests that check it, and any departure from the cited method.
Damped shifted force (DSF)
A pairwise alternative to Ewald sums: the Coulomb interaction is damped by erfc and shifted so that both the energy and the force go to zero at the cut-off. It converges to Ewald results for condensed phases at modest cost.
Fennell & Gezelter 2006
| Symbol | Meaning | In CAPS |
|---|---|---|
| α | damping parameter | 0.2 Å⁻¹ |
| r_c | cut-off, shared with van der Waals | 10 Å (set per run) |
| erfc | complementary error function | inside the cut-off erfc(αr)/r = 1/r − erf(αr)/r, the second from a cubic Hermite table in r² (error below 10⁻¹² of it); Abramowitz–Stegun 7.1.26 (|error| < 1.5 × 10⁻⁷, as LAMMPS) only for the shift constants at r_c and for frozen and excluded pairs beyond the cut-off |
When to use it
The default electrostatics in CAPS: cheap, no grid, fine for neutral bulk polymers. Use smooth PME for ionic systems, interfaces with net dipoles, or when comparing with Ewald-based codes.
- Source
core/src/field.cpp- Tested by
- Field.ForcesMatchFiniteDifferences · bench/ff/check_data_lammps.py (LAMMPS lj/cut/coul/dsf)
- Departure from the reference
- bonded partners are treated as LAMMPS coul/dsf does (the damped sum includes them, the excluded part is removed); erfc is more accurate than LAMMPS's polynomial inside the cut-off, so energies differ from LAMMPS's by up to ~10⁻⁶ relative unless its erfc is corrected (bench/ff/check_data_lammps.py does)
References
- Fennell, C. J., Gezelter, J. D., "Is the Ewald summation still necessary? Pairwise alternatives to the accepted standard for long-range electrostatics", J. Chem. Phys. 124, 234104 (2006). doi:10.1063/1.2206581
Smooth particle-mesh Ewald (SPME)
The Ewald sum split into a short-ranged real-space part and a smooth reciprocal part evaluated on a grid: charges are spread with B-splines, transformed by FFT, multiplied by the influence function and gathered back as forces. The threaded version keeps the transform of the real charge grid for half the frequencies; at an even grid's Nyquist index the influence function is the mean over both signs, so it is even in m in any cell.
Essmann et al. 1995
| Symbol | Meaning | In CAPS |
|---|---|---|
| β | Ewald coefficient | from erfc(β r_c) = 10⁻⁵, as GROMACS |
| p | B-spline order | 5 |
| h | largest grid spacing | 1.0 Å |
| Q | charge grid | — |
When to use it
Charged or strongly polar systems, ionic crystals, interfaces, and whenever results must match Ewald-based codes. Periodic cells only; about 1.5 × the cost of DSF in MD.
- Source
core/fortran/caps_kspace.f90 · core/src/kspace.cpp- Tested by
- Kspace.PmeMatchesEwaldForForcesEnergyAndVirial · Kspace.MadelungConstantOfRockSalt · Kspace.FftMatchesTheDirectTransform · bench/ff/check_data_lammps.py --pme · Kspace.ThreadedHalfSpectrumPmeMatchesTheSerialOne
- Departure from the reference
- none
References
- Essmann, U., Perera, L., Berkowitz, M. L., Darden, T., Lee, H., Pedersen, L. G., "A smooth particle mesh Ewald method", J. Chem. Phys. 103, 8577–8593 (1995). doi:10.1063/1.470117
Pair forces in mixed precision (cluster kernel)
Atoms are sorted into columns and cut into clusters of four. The pair list holds pairs of clusters, each with its periodic image and a 16-bit mask of the atom pairs that interact, and is pruned every few steps to r_c + 0.8 Å. The kernel takes the four atoms of a j cluster in one SIMD register against each i atom, in single precision with positions relative to each cluster's origin; energies, virial and forces leave it in double. The Ewald (or DSF) real-space term comes from rational fits of erf(√u)/√u and its derivative, so no exponential is evaluated per pair.
the cluster scheme of Páll & Hess 2013; fits made for CAPS
| Symbol | Meaning | In CAPS |
|---|---|---|
| κ | Ewald coefficient β (SPME) or damping α (DSF) | from erfc(β r_c) = 10⁻⁵, or Electrostatics · α |
| g_V, g_F | erf(√u)/√u and 2 d/du of it, as rational functions of t = u/16 | maximum error 3·10⁻⁸ and 5·10⁻⁸ for u ≤ 16 |
| r_c | cut-off | Dynamics · cut-off |
| r_c + 0.8 Å | pruned list radius | pruned again when an atom has moved 0.4 Å |
When to use it
Molecular dynamics and equilibration with plain 12-6 or class II 9-6 Lennard-Jones and SPME, DSF or no charges (OPLS-AA, PCFF, COMPASS, CVFF, GAFF): on by default for MD (caps md --precision double turns it off). Other pair forms, single-point energies and minimisation keep the double-precision loop. NEON on Arm, SSE2 or AVX2 with FMA on x86-64, chosen at run time.
- Source
core/src/nbnxm.cpp · core/src/nbnxm_avx2.cpp · core/src/nbnxm_fit.hpp · core/src/simd4.hpp- Tested by
- Nbnxm.MixedPrecisionMatchesDoubleForEveryPairForm · Nbnxm.MixedPrecisionDynamicsConservesEnergy · tests/nbnxm_check.cpp (NEON, SSE2, AVX2 and plain builds against a direct double sum)
- Departure from the reference
- energies agree with double precision to about 1e-6 relative and forces to about 5e-6 rms; same-seed runs are bit-identical for a given thread count
References
- Páll, S., Hess, B., "A flexible algorithm for calculating pair interactions on SIMD architectures", Comput. Phys. Commun. 184, 2641–2650 (2013). doi:10.1016/j.cpc.2013.06.003
Ewald summation (reference)
The plain Ewald sum over reciprocal-lattice vectors. CAPS keeps it as the reference the PME kernel is tested against; runs use PME.
Ewald 1921
| Symbol | Meaning | In CAPS |
|---|---|---|
| β | Ewald coefficient | as PME |
| k_max | reciprocal vectors | enough for 10⁻⁸ relative accuracy in tests |
When to use it
Not offered for runs: its cost grows as N^{3/2}–N². It checks PME forces, energy and virial.
- Source
core/fortran/caps_kspace.f90- Tested by
- Kspace.PmeMatchesEwaldForForcesEnergyAndVirial
- Departure from the reference
- reference only
References
- Ewald, P. P., "Die Berechnung optischer und elektrostatischer Gitterpotentiale", Ann. Phys. 369, 253–287 (1921). doi:10.1002/andp.19213690304
PME for slab cells: the vacuum correction
A film or surface with vacuum above it, in a periodic cell with c along z, still feels its own images along z through a plain Ewald or PME sum, and the energy then depends on how much vacuum the cell has. With the slab correction on, the reciprocal sum runs on the cell lengthened along z by a factor (3 is usual) and the dipole term of Yeh and Berkowitz is added with its forces. For a slab with a net charge, the terms of Ballenegger, Arnold and Cerdà keep the energy unchanged when the slab moves along z. V′ and L′_z are the volume and height of the lengthened box, the box the Ewald sum runs on, as in LAMMPS's kspace_modify slab. The LAMMPS input gets boundary p p f and kspace_modify slab, the GROMACS parameters ewald-geometry = 3dc (GROMACS lengthens nothing itself, so its cell should hold the vacuum). The correction gives no virial: the pressure along z means nothing for a slab, and x and y keep theirs.
k Coulomb's constant (332.06 kcal Å/(mol e²)); Q the net charge; z inside the cell; V′ = factor × V, L′_z = factor × L_z
| Symbol | Meaning | In CAPS |
|---|---|---|
| M_z | dipole moment along z | e Å |
| Q | net charge | e |
| V′ | volume of the lengthened box | ų |
| L′_z | height of the lengthened box | Å |
When to use it
Every film-on-surface or slab cell with vacuum and charges: a polymer film on silica or cellulose, a fibre surface with water, a charged layer, adhesion and wetting cells.
- Source
core/src/field.cpp- Tested by
- tests/test_slab_ewald.cpp (a dipolar ion slab: with the correction the energy at 40 and 80 Å cell height differs by under 2 % of what it differs without it, and by under 10⁻³ relative; factor 3 against 5 within 10⁻³; a slab with a net charge moved 3 Å along z keeps its energy to 10⁻⁶; forces equal −∂E/∂z by central differences to 10⁻⁴; against LAMMPS (ewald 1e-10, coul/long, kspace_modify slab 3.0, boundary p p f) 2452.6201 kcal/mol and plain 1914.1118, CAPS within 2·10⁻³ of both); tests/python/test_bindings.py (the LAMMPS and GROMACS exports carry the settings)
- Departure from the reference
- c must lie along z and a, b in the xy plane. No virial from the correction. Atoms must stay inside the cell along z (the vacuum keeps them there); one that crosses is wrapped, which a slab should never need.
References
- Yeh, I.-C., Berkowitz, M. L., "Ewald summation for systems with slab geometry", J. Chem. Phys. 111, 3155–3162 (1999). doi:10.1063/1.479595
- Ballenegger, V., Arnold, A., Cerdà, J. J., "Simulations of non-neutral slab systems with long-range electrostatic interactions in two-dimensional periodic boundary conditions", J. Chem. Phys. 131, 094107 (2009). doi:10.1063/1.3216473
- Essmann, U., Perera, L., Berkowitz, M. L., Darden, T., Lee, H., Pedersen, L. G., "A smooth particle mesh Ewald method", J. Chem. Phys. 103, 8577–8593 (1995). doi:10.1063/1.470117