CAPSChain Assembly and Packing Suite

Theory · 11 methods

Force fields

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.

DL_POLY export (FIELD, CONFIG, CONTROL)

The typed system as DL_POLY 4 input in units of kcal/mol, in DL_POLY's own conventions: harmonic bonds and angles with DL_POLY's ½k (twice the force field's k), class II bonds and angles as quartic terms (2K2, 3K3, 4K4), torsions as cos terms (OPLS triples as cos3) with the 1-4 electrostatic and van der Waals scale factors on exactly one term per 1-4 pair (a zero-amplitude term where the force field has no torsion), impropers in the rule's own atom order (explicit rules before wildcards; the outer atoms read by index, backwards, then otherwise), class II out-of-plane terms as harmonic inversions with the centre first, and every van der Waals type pair written out (lj, nm 9-6 for class II, buck). Consecutive identical molecules share one molecular type (nummols N); CONFIG holds the atoms about the cell centre; CONTROL is a generic NVT run with the same cut-off.

$$\begin{gathered}\text{harm:}\ \ \tfrac{1}{2}k(r - r_0)^2 \qquad \text{quar:}\ \ \tfrac{1}{2}k(r - r_0)^2 + \tfrac{1}{3}k'(r - r_0)^3 + \tfrac{1}{4}k''(r - r_0)^4 \\ \text{cos:}\ \ A\left[1 + \cos(m\phi - \delta)\right] \qquad \text{cos3:}\ \ \tfrac{1}{2}\left[A_1(1 + \cos\phi) + A_2(1 - \cos 2\phi) + A_3(1 + \cos 3\phi)\right]\end{gathered}$$

DL_POLY 4 user manual forms

SymbolMeaningIn CAPS
unitskcal/mol, Å, degreeskcal
1-4 scaleelectrostatic, van der Waalsthe force field's

When to use it

To run the same model in DL_POLY.

Source
core/src/dlpoly.cpp (write_dlpoly); impropers_dlpoly in core/src/ffdef.cpp
Tested by
Dlpoly.FieldConfigControl
Departure from the reference
DL_POLY has no class II cross terms, separate 1-4 Lennard-Jones parameters or combined bending–torsion: those are left out and named in the notes

Universal force field (UFF)

Every element from H to Lr, typed from its bonds, hybridisation and oxidation state. Used for clean-up and for any structure the other force fields cannot type (metals, silicon, phosphorus, halogens).

$$\begin{gathered}E = \sum k(r - r_0)^2 + \sum K\left[C_0 + C_1\cos\theta + C_2\cos 2\theta\right] + \sum \tfrac{1}{2}V\left[1 - \cos(n\phi_0)\cos(n\phi)\right] \\ \quad + \sum D\left[\left(\frac{x}{r}\right)^{12} - 2\left(\frac{x}{r}\right)^{6}\right] + E_\text{inversion}\end{gathered}$$

Rappé et al. 1992

SymbolMeaningIn CAPS
r₀natural bond length r_i + r_j + r_BO − r_ENfrom the atom types
kbond constant 332.06 Z_i Z_j / r₀³from the atom types
D, xvan der Waals well and distancegeometric means

When to use it

Geometry clean-up of any molecule; runs on structures outside GAFF's scope. UFF has no charges of its own: use QEq when electrostatics matter.

Source
core/src/uff.cpp · core/src/uff_params.inc
Tested by
Uff.TableCoversEveryElementToLawrencium · Uff.ForcesMatchFiniteDifferences · Uff.CleanUpGivesTextbookGeometry
Departure from the reference
parameter table typed in from the paper's Tables I and III and the QEq paper (Rh6+3 Z1 = 3.508 as printed); a wall below 30° on the periodic angle terms, not in the paper; LAMMPS export checked term by term

References

  1. Rappé, A. K., Casewit, C. J., Colwell, K. S., Goddard, W. A., Skiff, W. M., "UFF, a full periodic table force field for molecular mechanics and molecular dynamics simulations", J. Am. Chem. Soc. 114, 10024–10035 (1992). doi:10.1021/ja00051a040
  2. Rappé, A. K., Goddard, W. A., "Charge equilibration for molecular dynamics simulations", J. Phys. Chem. 95, 3358–3363 (1991). doi:10.1021/j100161a070

Charge equilibration (QEq)

Charges that equalise the electronegativity of every atom at fixed total charge, for any element. The energy below is minimised; the linear system is solved by conjugate gradients.

$$\begin{gathered}E(q) = \sum_i \chi_i q_i + \frac{1}{2}\sum_i J_i q_i^2 + \sum_{i<j} q_i q_j K(r_{ij}) \\ K = J_{ij}^{\text{Slater}}(r)\ \text{(default)} \quad \text{or} \quad K = \frac{14.40}{\sqrt{r^2 + a_{ij}^2}}\ \text{eV}, \qquad a_{ij} = 7.20\left(\frac{1}{J_i} + \frac{1}{J_j}\right)\ \text{Å}\end{gathered}$$

Rappé & Goddard 1991; the Slater integral J_ij(r) is given under QEq for periodic fillers. The Ohno–Klopman kernel is an option, its difference from 1/r switched off over a fixed 5 to 7 Å

SymbolMeaningIn CAPS
χ, Jelectronegativity and idempotentialUFF / QEq table
Kshielded Coulomb kernelns Slater densities (default) or Ohno–Klopman; tapered to zero at the cut-off unless Ewald is used
r_ccut-off10 Å, summed over every periodic image within it

When to use it

Charges for structures with metals, silicon or other elements without force-field charges, such as fillers and coupling agents. Ionic crystals get large charges (quartz Si +1.26 e, O −0.63 e with the default Slater kernel).

Source
core/src/qeq.cpp
Tested by
QEq.MoleculesAreNeutralWithSensibleSigns · QEq.PeriodicCrystals · QEq.ChargesIndependentOfTheCutoff
Departure from the reference
the default kernel is the paper's Slater-orbital Coulomb integral; the Ohno–Klopman kernel is an option, and the hydrogen correction is opt-in. Without Ewald a 7th-order taper brings the kernel to zero at the cut-off; a cell periodic along a, b and c takes the Ewald sum unless it is turned off or the cell is too large for it to be quick: see QEq for periodic fillers

References

  1. Rappé, A. K., Goddard, W. A., "Charge equilibration for molecular dynamics simulations", J. Phys. Chem. 95, 3358–3363 (1991). doi:10.1021/j100161a070

QEq for periodic fillers

Options of the charge equilibration for crystals and fillers such as silica, ZnO, clays and CaCO3 when the force field gives no charges. Kernel: the Coulomb integral between the atoms' normalised ns Slater densities, as in the original QEq. Here n is the element's period, ζ = λ(2n+1)/(2R) with R the QEq radius and λ = 0.4913, and the integral is evaluated exactly through incomplete gamma functions and a radial quadrature, then tabulated per element pair. Ewald, the default for a cell periodic along a, b and c: the long-range 1/r is summed over every periodic image. By default a large cell, where the reciprocal sum would cost more than 2·10⁷ atom × k-vector terms per step (a few thousand atoms), takes the tapered kernel over the images within the cut-off instead and says so; Ewald asked for explicitly is always used. The real space erfc(αr)/r runs over explicit images out to the cut-off, so the cell may be narrower than twice the cut-off. The reciprocal space is applied as structure factors and never stored. The kernel's short-range difference from 1/r is added for every image pair within the cut-off. Hydrogen: its hardness follows its charge, solved self-consistently with damped steps. Bounds: per element a lowest and highest charge; atoms that would pass one are held there, the rest are re-equalised, and held atoms are released when the Karush–Kuhn–Tucker conditions no longer keep them.

$$\begin{gathered}J_{ij}(R) = \iint \frac{|\phi_i(\mathbf r_1)|^2\,|\phi_j(\mathbf r_2)|^2}{r_{12}}\,d\mathbf r_1\,d\mathbf r_2,\qquad \phi \propto r^{n-1}e^{-\zeta r},\quad \zeta = \frac{\lambda(2n+1)}{2R_i} \\ K^{\mathrm{Ewald}}_{ij} = \sum_{\mathbf n}{}' \frac{\operatorname{erfc}(\alpha|\mathbf r_{ij}+\mathbf n|)}{|\mathbf r_{ij}+\mathbf n|} + \frac{4\pi}{V}\sum_{\mathbf k\neq 0}\frac{e^{-k^2/4\alpha^2}}{k^2}\cos(\mathbf k\cdot\mathbf r_{ij}) - \frac{2\alpha}{\sqrt\pi}\,\delta_{ij},\qquad J_H(q) = J_H^0\left(1 + \frac{q}{\zeta_H}\right)\end{gathered}$$

the Slater integral tends to 1/R once the densities part; the Ewald split α = √(−ln ε)/r_c and k_max = 2α√(−ln ε) for the accuracy ε

SymbolMeaningIn CAPS
n, ζprincipal quantum number and Slater exponent—, bohr⁻¹
R_iQEq radiusÅ
λSlater exponent scale0.4913
αEwald splitting parameterÅ⁻¹
εEwald accuracy1e-7
ζ_Hhydrogen Slater exponentbohr⁻¹

When to use it

Charges for oxide, carbonate and clay fillers and for silica surfaces in rubber composites when no force field supplies them; bounds keep strongly ionic crystals at the charges a force field expects.

Source
core/src/qeq.cpp
Tested by
tests/test_qeq_periodic.cpp (1s–1s integrals against Roothaan's closed form to 1e-11; rock salt's Madelung energy 1.747564594633 to 1e-8 eV; water against the equalisation written out by hand, with and without the hydrogen term; quartz charges the same at two cut-offs, neutral, every Si alike and Si = −2 O; a molecule in a 40 Å box as without the box; oxygen held at −0.5 e leaves silicon at +1.0 e); tests/python/test_bindings.py charges
Departure from the reference
the paper text was not open to us: the exponent rule, λ and the hydrogen hardness follow open implementations and reviews of the method (Chen's 2009 thesis, arXiv:1004.0186). The hydrogen Slater exponent stays fixed while its hardness changes. Silicon's diffuse 3s density still differs from a point charge by 3·10⁻⁶ of 1/r at 10 Å, so charges move by about 3·10⁻⁵ e between 10 and 12 Å cut-offs.

References

  1. Rappé, A. K., Goddard, W. A., "Charge equilibration for molecular dynamics simulations", J. Phys. Chem. 95, 3358–3363 (1991). doi:10.1021/j100161a070
  2. Wilmer, C. E., Kim, K. C., Snurr, R. Q., "An extended charge equilibration method", J. Phys. Chem. Lett. 3, 2506–2511 (2012). doi:10.1021/jz3008485
  3. Ewald, P. P., "Die Berechnung optischer und elektrostatischer Gitterpotentiale", Ann. Phys. 369, 253–287 (1921). doi:10.1002/andp.19213690304

General AMBER force field (GAFF)

Atom types for organic molecules assigned by rules in antechamber's order (rings, aromaticity, conjugation), with AMBER functional forms: harmonic bonds and angles, cosine torsions, 12–6 Lennard-Jones, 1–4 interactions scaled by ½ (LJ) and 1/1.2 (Coulomb).

$$\begin{gathered}E = \sum k_b(r - r_0)^2 + \sum k_\theta(\theta - \theta_0)^2 + \sum \frac{V_n}{2}\left[1 + \cos(n\phi - \gamma)\right] \\ \quad + \sum 4\epsilon\left[\left(\frac{\sigma}{r}\right)^{12} - \left(\frac{\sigma}{r}\right)^{6}\right] + \sum \frac{q_i q_j}{4\pi\epsilon_0 r}\end{gathered}$$

Wang et al. 2004

SymbolMeaningIn CAPS
typesc3, ca, hc, ha … assigned by rulesdata/typing/gaff*
1–4 scalingLJ and Coulomb½ and 1/1.2

When to use it

Organic polymers and additives. CAPS's built-in default for pure hydrocarbons; the library also holds GAFF2 and the other published force fields, with CAPS typing rules.

Source
core/src/typing.cpp · core/src/ffdef.cpp · data/forcefields
Tested by
Field.TypesPolystyrene · tests/test_typing.cpp · bench/ff/check_data_lammps.py
Departure from the reference
none

References

  1. Wang, J., Wolf, R. M., Caldwell, J. W., Kollman, P. A., Case, D. A., "Development and testing of a general amber force field", J. Comput. Chem. 25, 1157–1174 (2004). doi:10.1002/jcc.20035

Gasteiger–Marsili charges (PEOE)

Partial equalisation of orbital electronegativity: charge flows along each bond from the less to the more electronegative atom, in six iterations damped by half each time, so it stays local.

$$\chi_i = a_i + b_i q_i + c_i q_i^2, \qquad \Delta q_i^{(k)} = \left(\frac{1}{2}\right)^{k}\sum_j \frac{\chi_j - \chi_i}{\chi^+}$$

Gasteiger & Marsili 1980

SymbolMeaningIn CAPS
a, b, cper element and hybridisationH, C, N, O (sp³, sp², sp), F, Cl, Br, I, sp³ S
χ⁺χ of the cation (H: 20.02)—
kiteration1 … 6
q⁽⁰⁾starting chargesthe perceived formal charges, so the total is the net formal charge (acetate −1, methylammonium +1)

When to use it

Quick charges for organic molecules. Other elements are refused; use QEq for them.

Source
core/src/grow.cpp (gasteiger_ch)
Tested by
Gasteiger.HeteroatomsGetTheirOwnParameters · Gasteiger.IonsKeepTheirFormalCharge
Departure from the reference
parameters of Table 1 plus the sp³ sulfur extension

References

  1. Gasteiger, J., Marsili, M., "Iterative partial equalization of orbital electronegativity–-a rapid access to atomic charges", Tetrahedron 36, 3219–3228 (1980). doi:10.1016/0040-4020(80)80168-2

Water models and their massless sites

Three-site models (SPC, SPC/E, SPC/Fw, TIP3P and its variants, OPC3) carry their charges on O and H. Four-site models (TIP4P, TIP4P-Ew, TIP4P/2005, TIP4P/Ice, OPC) move the negative charge to a massless site M on the H–O–H bisector. TIP5P puts it on two massless lone pairs L out of the molecular plane, on the side away from the hydrogens. The sites are placed from O and H at every evaluation and their forces handed back to them by the chain rule; for the out-of-plane lone pairs the cross product adds one more term to the virial.

$$\begin{gathered}M = (1-\alpha)\,O + \tfrac{\alpha}{2}(H_1 + H_2), \qquad \alpha = \frac{d_{OM}}{r_{OH}\cos(\theta/2)} \\ L_\pm = O + a\,(\mathbf{r}_1 + \mathbf{r}_2) \pm c\,(\mathbf{r}_1 \times \mathbf{r}_2), \qquad a = -\frac{d_{OL}\cos(\phi/2)}{2 r_{OH}\cos(\theta/2)}, \qquad c = \frac{d_{OL}\sin(\phi/2)}{r_{OH}^2 \sin\theta}\end{gathered}$$

r₁, r₂ the O–H vectors, θ the H–O–H angle, φ the L–O–L angle; for TIP5P (r_OH 0.9572 Å, θ 104.52°, d_OL 0.70 Å, φ 109.47°) a = −0.344908 and c = 0.64438 Å⁻¹, GROMACS's virtual_sites3 function 4 (c in nm⁻¹ = 6.4438); the cross part scales as λ² when the atoms are scaled by λ, hence the extra virial term

SymbolMeaningIn CAPS
d_OMO–M distanceÅ
d_OLO–lone pair distanceÅ
φL–O–L angle°
a, cout-of-plane site constants—, 1/Å

When to use it

Solvating rubbers, fillers or other solutes, water uptake and sorption, hydrated interfaces. TIP5P reproduces water's density maximum near 4 °C; it exports to GROMACS only (LAMMPS has no five-site water). Four-site models export to LAMMPS with the tip4p pair styles (M left out, its charge on O) and to GROMACS with M as a virtual site.

Source
core/src/water.cpp (water_models, apply_water_model, water_forcefield), core/src/field.cpp (virtual sites)
Tested by
tests/test_solvate.cpp Water.ModelsGeometryAndSites (TIP4P/2005's M 0.1546 Å from O, LAMMPS tip4p styles); Water.Tip5pLonePairsForcesAndVirial (lone pairs at 0.70 Å and 109.47° away from the hydrogens, GROMACS's a and c, forces against finite differences, the virial against −dE/dλ: 0.98082 with the λ² term, 0.634 without); TIP5P in GROMACS on 512 waters: Coulomb 34.371 against CAPS's 34.382 kcal/mol (PME), Lennard-Jones with its tail 6162.68 against 6162.69
Departure from the reference
rigid models are run with SHAKE/RATTLE on CAPS's side (GROMACS uses SETTLE); bond and angle constants are given only for flexible runs

References

  1. Berendsen, H. J. C., Grigera, J. R., Straatsma, T. P., "The missing term in effective pair potentials", J. Phys. Chem. 91, 6269–6271 (1987). doi:10.1021/j100308a038
  2. Jorgensen, W. L., Chandrasekhar, J., Madura, J. D., Impey, R. W., Klein, M. L., "Comparison of simple potential functions for simulating liquid water", J. Chem. Phys. 79, 926–935 (1983). doi:10.1063/1.445869
  3. Abascal, J. L. F., Vega, C., "A general purpose model for the condensed phases of water: TIP4P/2005", J. Chem. Phys. 123, 234505 (2005). doi:10.1063/1.2121687
  4. Mahoney, M. W., Jorgensen, W. L., "A five-site model for liquid water and the reproduction of the density anomaly by rigid, nonpolarizable potential functions", J. Chem. Phys. 112, 8910–8922 (2000). doi:10.1063/1.481505

Charges from bond increments

Class II and CVFF force fields (PCFF, COMPASS, CVFF and IFF from their .frc files) give each bonded pair of atom types an increment that moves charge from one atom to the other. Summing over the bonds gives charges that balance bond by bond, so every neutral molecule stays neutral and a charged group keeps its formal charge. CAPS assigns them whenever the force field carries a bond-increment table and the charges are the force field's own.

$$q_i = \sum_{j \text{ bonded to } i}\delta_{ij}, \qquad \delta_{ji} = -\delta_{ij}$$

the .frc #bond_increments convention

SymbolMeaningIn CAPS
δ_ijbond charge incrementthe force field's #bond_increments table
typethe atom's force-field typeits increment equivalence where the file gives one

When to use it

Automatic for a force field with a bond-increment table when the charges are its own (charges "types" or auto).

Source
core/src/ffdef.cpp (parameterize)
Tested by
FFDef.IffSilicaAndMetalsByRule
Departure from the reference
none: the increments are applied as the .frc file lists them

Force fields by group and crystal potentials

Each group of molecules (a filler and its matrix, each component of a blend) is typed and parameterised by its own force field with its own charges and mixing rule; the Lennard-Jones pairs between groups follow a cross rule chosen for them, or pairs given explicitly, and every cross pair is written out in the engine files. A crystal group can instead take a literature many-body potential (Tersoff, Stillinger–Weber, Vashishta, EAM) that LAMMPS reads from its file. Units of the LAMMPS files: automatic (metal, that is eV, ps and bar, when a potential is read by LAMMPS in metal units only: AIREBO, AIREBO-M, REBO, MEAM; the published file then unchanged and every force-field energy parameter divided by 23.060549, LAMMPS's own factor; real, that is kcal/mol, fs and atm, otherwise, where LAMMPS converts Tersoff, SW, Vashishta, GW and EAM files itself), or real with AIREBO / REBO (a copy of the file CAPS converts: A, B and the LJ, torsion and Morse ε; the splines are dimensionless), or metal for any system. Both are exact: the physics does not depend on the unit system, only LAMMPS's electric-conversion constants differ in their last digits. MEAM maps each element to a library entry (by default the first of its atomic number) and keeps the parameter file's index order. A group's force field may change its molecules: TraPPE O2 and N2 add a massless centre site, a united-atom force field folds hydrogens into their carbons. That is done on the real structure before the groups are typed, in every frame and as one undo step, only on that group's molecules; molecule ids are the ones the structure had before, other groups keep their order, and assigning again changes nothing. The report gives each group its massless sites, the sites added, the atoms folded and its net charge. In LAMMPS a massless site has a form in two cases: four-site water (the tip4p styles), and a site on a rigid molecule, every bond and angle constant 0 as in TraPPE's O2 and N2. The second is written as an atom of a body that fix rigid carries, with mass 0.001 g/mol taken from the atoms that define it, so the molecule's mass and centre of mass are exact; zero-force bonds exclude the pairs inside the body, from PPPM too. Bodies are held during minimisation, have their own thermostat (fix rigid/nvt/small) and stay out of the fix that integrates group mobile; a box of nothing but such molecules takes fix rigid/npt/small under pressure. `velocity create` gives a linear body too much kinetic energy at the start, which the thermostat removes within its damping time. A site on a flexible molecule or out of the plane (TIP5P) has no LAMMPS form and is refused by name: export those to GROMACS.

$$\begin{gathered}\epsilon_{ab} = \sqrt{\epsilon_a\epsilon_b}\ \text{ or }\ \frac{\epsilon_a + \epsilon_b}{2}, \qquad \sigma_{ab} = \frac{\sigma_a + \sigma_b}{2}\ \text{ or }\ \sqrt{\sigma_a\sigma_b} \\ \text{sixth power:}\ \ \sigma_{ab} = \left(\frac{\sigma_a^6 + \sigma_b^6}{2}\right)^{1/6}, \qquad \epsilon_{ab} = \frac{2\sqrt{\epsilon_a\epsilon_b}\,\sigma_a^3\sigma_b^3}{\sigma_a^6 + \sigma_b^6}\end{gathered}$$

between groups; inside a group its force field's own rule

SymbolMeaningIn CAPS
a, batom types of two different groupseach group's own parameters
crystal siteone type per element, standard atomic mass, no chargeUFF's well depth D and minimum x across; 12-6 σ = x/2^(1/6), or 9-6 σ = x beside PCFF / COMPASS
potential fileLAMMPS's own file, converted from metal to real units by LAMMPSthe library (data/potentials) or the user's

When to use it

Composites and blends where one force field cannot describe every part: silica, SiC, graphene / CNT or a metal in a PCFF, COMPASS, OPLS or GAFF polymer; blend components parameterised by different force fields. What one simulation cannot hold is refused with the reason: different 1-4 scalings (unless the first group's is taken for all), 9-6 with 12-6 (unless 9-6 sites enter cross pairs as 12-6 with the same ε and minimum); MEAM in real units (LAMMPS reads it in metal units only). A crystal under a literature potential runs in LAMMPS; CAPS's own runs hold it still.

Source
core/src/ffmerge.cpp · core/src/manybody.cpp · capi caps_field_assign_groups · data/potentials
Tested by
FFMerge.SameForceFieldInTwoPartsIsExact · FFMerge.DifferentFamiliesAreRefusedOrMergedAsAsked · FFMerge.ManyBodyGroup · FFMerge.PotentialLibrary · FFMerge.AireboWritesMetalUnits · FFMerge.MeamMapsLibraryEntries
Departure from the reference
Si Tersoff slab under hexane: LAMMPS van der Waals beside Tersoff equals CAPS's for GAFF2 (366.6761), PCFF (133.1490 / 133.149) and COMPASS (84.3140 / 84.3139 kcal/mol); GAFF2 + OPLS polystyrene in GROMACS 573.546, LAMMPS 573.549 kcal/mol; (6,6) nanotube under AIREBO in hexane, metal units: van der Waals beside AIREBO GAFF2 3.49464, PCFF 16.67939, COMPASS 1.26178 kcal/mol in LAMMPS and CAPS; PS melt real vs metal export identical to 1e-9 in bonded and van der Waals terms; AIREBO, AIREBO-M, REBO in real units with CAPS's converted file: energy equal to the metal run ×23.060549 to 1e-13, forces to 2e-12 kcal/mol/Å, pressure to every digit; MEAM (SiC set) in the composite equals the slab alone (atom_style atomic) to 1e-10 eV, van der Waals beside it equals CAPS's (GAFF2 366.67611, PCFF 133.14904 kcal/mol)

References

  1. Rappé, A. K., Casewit, C. J., Colwell, K. S., Goddard, W. A., Skiff, W. M., "UFF, a full periodic table force field for molecular mechanics and molecular dynamics simulations", J. Am. Chem. Soc. 114, 10024–10035 (1992). doi:10.1021/ja00051a040

Cells too small for their bonds

A force field reads each separation at the nearest image and excludes or scales bonded partners there, and a bond list has one entry per pair of atoms. A small crystal cell breaks both: a polyethylene cell repeats its chain every 2.5 Å, so a carbon bonds to two images of one neighbour and partners three bonds apart lie closer through the next cell. CAPS follows every path of two and three bonds and compares where it ends with the image the engines would read.

$$\mathbf{f} = \mathsf{h}^{-1}\sum_{\mathrm{path}} \mathbf{r}_{\mathrm{bond}}, \qquad |f_k| < \tfrac{1}{2}\ \text{ for every periodic axis } k$$

The test follows from the minimum-image convention; f is the path's end in fractional coordinates. A tie at ½ fails, because two images are then equally near.

SymbolMeaningIn CAPS
hthe cell matrix, its columns the edge vectors a, b, cÅ
r_bonda bond's vector at its nearest imageÅ
f_kthe path's end along cell axis k, in fractional coordinates—

When to use it

Opening a crystal cell as published, before any supercell. Energy and relaxation evaluate enough copies on their own, with the force field assigned on the copies, and report the energy per cell given; a box relaxation there moves the three lengths independently and holds the angles. Dynamics stops and names the supercell it needs. caps ff apply writes its file with a warning.

Source
core/src/cell_fit.cpp (cell_fit, copies_to_fit)
Tested by
CellFit.PolyethyleneCells: OPLS-AA polyethylene, cut-off 10 Å. The cells that fail are those whose energy per cell differs from 4×4×10 (1×1×1 gave 191.37, 1×1×2 40.30, 1×1×3 −5.77, 2×2×3 −5.56, 1×1×8 −6.43 kcal/mol against −6.218) and the cells that pass agree with it. Evaluated as copies, 1×1×1 gives −6.217951. Python: the bond, angle, dihedral, van der Waals and Coulomb terms each match 3×3×8 to 1e-8, and the relaxed energy with the cell held to 1e-3.
Departure from the reference
A partner counts only if the assigned force field excludes or scales it; coarse-grained beads are left out. Copies move together, so a relaxation keeps the cell's translational symmetry. Held atoms, restraints and a target density need the supercell.

Fitting a force field to crystal data

Pair, bond and charge parameters of the assigned force field are refined so that a crystal (a filler, a mineral, a polymer crystal) keeps its observed structure and reproduces its lattice energy and elastic constants. Each crystal is evaluated in its periodic copies: a supercell at least twice the cut-off wide whose copies move together, so a small cell still sees every neighbour within the cut-off. Shells, whose positions are not observed, are relaxed in every evaluation. In conventional fitting the observed structure should be a stationary point, and its residual forces and stresses are fitted to zero. In relaxed fitting the cell and atoms are relaxed for each trial set (L-BFGS over the atoms and the six symmetric strains, the strain gradient −W F⁻ᵀ from the virial tensor) and the relaxed cell lengths, angles and coordinates are fitted to the observed ones; this weighs a soft direction by how far it moves the structure, not by its small gradient. Elastic constants are central differences of the stress over ± strain with the ions relaxed; bulk and shear moduli are their Hill averages. The weighted sum of squares is minimised by Levenberg–Marquardt with a forward-difference Jacobian, and standard errors come from s²(JᵀJ)⁻¹ when there are more observations than parameters. The fitted values can go into the assignment or into a force-field file (an explicit rule of the same types is updated, otherwise a rule for exactly those types is appended).

$$\begin{gathered}S(\mathbf{p}) = \sum_i w_i\left[y_i^{\mathrm{calc}}(\mathbf{p}) - y_i^{\mathrm{obs}}\right]^2, \qquad \left(J^{\mathsf T}J + \lambda\,\mathrm{diag}\,J^{\mathsf T}J\right)\delta\mathbf{p} = -J^{\mathsf T}\mathbf{r} \\ \boldsymbol{\sigma} = -\frac{W}{V}, \qquad \frac{\partial E}{\partial F} = -W F^{-\mathsf T}, \qquad C_{IJ} = \frac{\sigma_I(+\varepsilon_J) - \sigma_I(-\varepsilon_J)}{2\varepsilon}, \qquad s_k = \sqrt{\frac{S}{m-n}\left[(J^{\mathsf T}J)^{-1}\right]_{kk}}\end{gathered}$$

Gale 1996 (conventional and relaxed fitting); Marquardt 1963

SymbolMeaningIn CAPS
w_iweight of observable i (1/σ² for meaningful errors)1/unit²
JJacobian ∂r_i/∂p_k of the weighted residuals r_i = √w_i (y_i^calc − y_i^obs)—
λLevenberg–Marquardt damping—
Wvirial tensor Σ r_a f_bkcal/mol
Fdeformation gradient I + ε of the cell—
C_IJelastic constant (Voigt, engineering shear)GPa
m, nnumber of residuals and of parameters—

When to use it

Filler potentials (CaCO3, silica, ZnO, clays, a Buckingham or shell-model set from a paper) that must hold the measured lattice and stiffness before they meet a polymer; refitting one pair after a cross-term or charge change; checking what a published set gives for a crystal it was not fitted to (no parameters ticked: the crystal is only evaluated).

Source
core/src/crystalfit.cpp (fit_to_crystals, apply_fitted_terms)
Tested by
CrystalFit.StressIsTheStrainDerivative (a sheared rock salt with an ion off its site, Ewald sums: σ_xx −3.855336 and σ_xy 0.518951 GPa from the virial equal the energy's strain derivatives to all printed digits); CrystalFit.LennardJonesFccIsExact (relaxed fcc argon: a = 5.276400 Å and C11 4.10134, C12 = C44 2.33486 GPa equal the analytic lattice sums); CrystalFit.RelaxedFitRecoversLennardJones (ε and σ back to 4 × 10⁻⁷ from 15 % and 4 % off); CrystalFit.ConventionalFitRecoversBuckingham (Buckingham A back to 4 × 10⁻⁶ from 20 % off, the stress to 10⁻¹⁰ GPa); CrystalFit.BalancedChargeAndWriteBack; Catlow MgO shell model on periclase: the Mg–O A refitted to the observed cell is the same by relaxed and conventional fitting (26267.918 kcal/mol), and C12 = C44 as pair potentials with shells must give
Departure from the reference
static (0 K, no zero-point or thermal expansion: fit to low-temperature data); no vibrational frequencies, dielectric or piezoelectric constants as targets; no breathing shells or many-body terms among the fitted parameters; the Ewald grid is refined to 0.5 Å for a fit so nearby cells are compared consistently

References

  1. Gale, J. D., "Empirical potential derivation for ionic materials", Philos. Mag. B 73, 3–19 (1996). doi:10.1080/13642819608239107
  2. Marquardt, D. W., "An algorithm for least-squares estimation of nonlinear parameters", J. Soc. Ind. Appl. Math. 11, 431–441 (1963). doi:10.1137/0111030