WorksPhysics and Astronomy
samQEq: universal charge equilibration for molecules and conductors
Abstract
Charge equilibration assigns atomic charges by equalizing an atomic chemical potential built from electronegativity, hardness and the Coulomb interaction. Under one global constraint it lets charge flow without limit between molecules, which fluctuating-charge models prevent with one neutrality constraint per molecule. A metal needs the opposite: a global constraint and a hardness near zero, and there the charge operator becomes indefinite unless it includes each charge's own self-energy. Here, we present samQEq (solids-and-molecules QEq), a unified charge-equilibration package for LAMMPS that combines the two constructions in one energy functional and one matrix-free solve. An orthogonal projector imposes one neutrality constraint per molecule, and the finite-width self-energy of a Gaussian charge on designated conductor types, narrower than the conductor's own Gaussian, keeps the conductor's part of the operator positive definite at any hardness. On a gold slab carrying a water film, the operator stays definite down to the conductor limit of the model, the metal screens a point charge by a constant amount at every height beyond 4 Å, and the film's charges stay bounded under dynamics. Reciprocal-space electrostatics is evaluated inside the matrix-vector product, and three distinct shielding kernels are run-time settings. We verify the implementation by reproducing a published fluctuating-charge water model without refitting, and the native ReaxFF charge-equilibration step to approximately . On a single four-V100 node the largest tested systems run at approximately twice the throughput of a 128-core CPU node. samQEq thus provides one charge-equilibration layer for molecules, conductors and the interfaces between them.
main.pdf
Highlights
Charge equilibration that is well posed for both molecules and conductors
A narrow Gaussian self-energy keeps the conductor block definite at any hardness
One neutrality constraint per molecule, or one global constraint, in one solver
Particle-mesh Ewald inside the matrix-vector product, with three shielding kernels
Kokkos device kernels for the charge solve on a single GPU node
ORCID(s): 0009-0007-8884-4249 (N. Solan); 0009-0009-8977-0151 (D. Sun); 0000-0003-2096-1143 (T.A. Pascal)
Program title: samQEq
CPC Library link to program files: (to be added by Technical Editor)
Developer’s repository link: https://github.com/atlas-nano/codes/tree/main/samqeq
Archived version: samQEq 1.0.2, https://doi.org/10.5281/zenodo.23629400
Code Ocean capsule: (to be added by Technical Editor)
Licensing provisions: GPL-2.0 (derived from LAMMPS)
Programming language: C++17, with optional Kokkos device kernels
Supplementary material: The per-fragment projector, the solvers and their convergence criteria, the dense diagonalization of the constrained operator, the parameter sets, the simulation protocols, the regression suite, the device benchmark and the charge-solve tolerance study.
Nature of problem: Atomic charges that respond to their environment are obtained by minimizing a second-order charge-equilibration functional [1, 2] under neutrality constraints, in periodic systems with long-range electrostatics, at every step of a molecular dynamics run. Under one global constraint the functional lets charge flow without limit between atoms, appropriate for conductors but not molecules.[3] At the near-zero hardness of a conductor [4] the operator of a kernel without the charge’s self-energy becomes indefinite.[5] The computational problem is a single linear solve in which molecules and conductors are both well posed, with forces consistent with the solved charges.
Solution method: We implement a single second-order charge-equilibration energy functional as a LAMMPS fix and make both limits well posed within one solve. An orthogonal projector imposes one neutrality constraint per molecule [6] (the insulating limit), or a single global constraint, and for designated conductor types the finite-width self-energy of a Gaussian charge is added to the on-site hardness [4], which, for a self-energy narrower than the type’s own Gaussian, keeps the conductor’s part of the operator positive definite at any hardness. The reciprocal-space contribution is evaluated inside the matrix-vector product [5, 7] [8], so that one projected Krylov solve returns fully long-range charges with no self-consistent-field outer loop. The cube-root, Gaussian-overlap [9] and exact Slater-orbital shielding kernels are run-time settings, mirrored by a companion pair style so that the forces and the charge solve use one kernel. The fix and its pair style are overlaid on any other LAMMPS potential. Charges may be minimized at each step, propagated by an extended Lagrangian, or advanced by a time-reversible predictor–corrector.
Additional comments including Restrictions and Unusual features: External routines. The package builds within a LAMMPS source tree [10], tested at version 2 Sep 2026, with the long-range electrostatics, molecule, rigid-body and extra-fix packages enabled. The optional device kernels additionally require the Kokkos package. Three edits to the host tree are needed, and all three ship with the package as patches: the registration of the package in the build system’s package list; a zeroing of the per-atom particle-mesh accumulators, without which a per-atom energy can be read from uninitialized memory; and a friend declaration in the external-field fix header, so that the base class can read the applied field. The distributed build recipe and regression suite are included. The solver itself is self-contained: the augmented saddle-point solver and the per-atom reciprocal particle-particle particle-mesh routine are both shipped in the package, so the package does not depend on the ReaxFF package. Restrictions. Conductors carry a fixed total charge; there is no constant-potential mode. The bond-softness kernel restores linear scaling of the polarizability with chain length but needs additional parameters. MINRES is unpreconditioned. The extended-Lagrangian and predictor–corrector charge propagators do not conserve energy at the documented settings. The device solve only covers the atomic-charge path on a single node. Features. Correctness is enforced by 22 self-contained regression cases compared against committed per-atom charges at relative tolerance, run from an automated pre-commit test hook. The combined molecule–conductor test is covered by two of the regression cases, each with its decks and reference output. § 8.3 documents the initialization checks that detect when the solved operator differs from the one the input specifies.
Introduction
The electrostatic energy in molecular simulations depends on the charge distribution, and that distribution is not fixed: a molecule polarizes in the field of its neighbors, an ion redistributes charge with its solvation shell, and a metal surface screens an applied field. Fixed-charge models cannot represent this environmental response, whereas charge equilibration allows the atomic charges to vary with configuration. In the electronegativity equalization method (EEM) of Mortier, Ghosh and Shankar[1] and the charge equilibration (QEq) scheme of Rappé and Goddard,[2] the atomic charges are obtained by equalizing an atomic chemical potential constructed from experimental ionization potentials, electron affinities and shielded electrostatic interactions. The charges then depend on geometry and respond to the environment, at the cost of repeated electrostatic evaluations within each step. Patel and Brooks carried the approach into a biomolecular force field,[3] while Naserifar and co-workers replaced the point charge by a Gaussian of element-specific width whose shielded interaction stays finite at every separation.[4]
The limitations of the original construction are equally well characterized. Because the chemical potential is equalized over the entire system, charge flows without limit, and every system behaves as a metal with respect to charge transfer. Chen and Martínez showed that this yields incorrect asymptotics when bonds are broken and introduced QTPIE, which is formulated in charge-transfer variables and attenuates the transfer with orbital overlap.[5] Split-charge equilibration reaches the same end through a distance-dependent bond hardness.[6] Verstraelen and co-workers derived ACKS2 from Kohn–Sham density functional theory, restoring the linear size-dependence of the polarizability and the correct dissociation limit through constrained atomic populations and a Legendre-transformed kinetic energy.[7] Rick and co-workers applied an alternative approach to liquid water: a per-molecule neutrality constraint.[8] More recently, Gergs and co-workers generalized QEq and QTPIE into a model that constrains the split-charge transfer locally without specifying a bond hardness.[9]
At the other end, global electronegativity equalization is metallic by construction,[10] and metals need a hardness near zero: under a global constraint the charge-equilibration functional is the semiclassical Thomas–Fermi model, with the electronegativity in the role of the Fermi level and the hardness in that of the screening length.[11] Yet, as the QEq hardness approaches zero, the operator loses positive definiteness, and the solve returns a saddle point or fails to converge.[12] Various remedies have been proposed: employing constant-potential electrode models, which represent each electrode atom by a Gaussian charge whose self-energy sits on the diagonal,[13, 14] adding a Thomas–Fermi hardness term,[11] or rederiving the polarizable electrode from chemical-potential equalization itself.[15] Gaussian charges with the self-term on the hardness have been employed in QEq force fields for metal oxides,[16] recent machine-learned potentials,[17, 18] and to electrochemical cells under applied potentials.[19]
Recently introduced machine-learned interatomic potentials (MLIPs) face a related limitation in treating their electrostatics. Most are short-ranged by construction and require message passing frameworks to extend their reach for condensed-phase simulations. Alternatively, fourth-generation neural-network potentials employ QEq-like schemes, predicting atomic electronegativities and solving under a global charge constraint with cutoffs[18] and more recently on a particle mesh.[20] Another approach is the Latent Ewald Summation formalism, where a hidden per-atom variable is learned from the local descriptors and summed in reciprocal space with a Gaussian smearing factor.[21, 22] The field response of such a model follows in the linear regime from the Born effective charges.[23] Fragment-resolved constraints on a learned charge equilibration model have also been introduced for electrochemical interfaces, with the fragments themselves a learned, differentiable function of the geometry, trained on DFT charges for an oxide electrode in water.[24] Notably, in each case, the electrostatics is part of what the model encodes.
For practical MD simulations, QEq options are available as standalone packages in LAMMPS with point, shielded, Slater and dynamic shielding variants, as the charge steps of COMB, ReaxFF, ACKS2 and QTPIE, and as the constant-potential ELECTRODE package.[25–27] Each prescribes the kernel, the long-range treatment and the constraint together (§ 12). The ELECTRODE package solves the electrode charges on the particle mesh under the field of a fixed-charge electrolyte;[26] MetalWalls, outside LAMMPS, solves them together with the induced dipoles of a polarizable electrolyte.[28] None solves a fluctuating-charge electrolyte, one neutrality constraint per molecule, in the same charge-equilibration solve as the conductor.
What is missing is an abstract electrostatics layer that any potential can call, with a physical energy, a choice of kernel, full long-range sums, and constraints that span molecules and metals. To that end, we developed samQEq, or solids-and-molecules QEq, a universal charge-equilibration package for LAMMPS[25] that combines the two constructions in one energy functional and one solve (Figure 1). An orthogonal projector imposes one total-charge constraint per molecule, which enforces the insulating limit: charge redistributes within each molecule but not between molecules. A finite-width self-energy of a Gaussian charge enforces the conductor limit: for a width narrower than the conductor’s own Gaussian it keeps the conductor’s part of the operator positive definite at any hardness. One projected Krylov solve satisfies both, with the reciprocal-space term inside the matrix-vector product. The shielding kernel and the long-range treatment are run-time settings; every kernel is used as defined, and the particle-mesh sum inside the matrix-vector product is the same for all of them. This allows simultaneous treatment of molecules, metals and molecules on metals. On a gold slab carrying a water film we show that, of the four combinations of constraint and self-energy, only this one is definite at every hardness without charge transfer between molecules (§ 9.1).
Figure 1. One functional, two limits. Top, the energy functional, written for , and the single projected solve that minimizes it, with the reciprocal-space term inside the matrix–vector product (§ 5). Left, the molecular limit: one neutrality constraint per molecule, imposed by the projector (§ 4.3); under the single global constraint of conventional charge equilibration, charge flows between molecules as in a metal. Right, the conductor limit: the finite-width self-energy of a Gaussian charge on the diagonal keeps the conductor’s part of the operator positive definite for any hardness (§ 4.4); without the self-energy the operator turns indefinite as the hardness approaches zero. Bottom, both limits in one cell and one solve (§ 9.1), and the remaining run-time settings.
The remainder of the paper is organized as follows: Section 2 gives the functional, the kernels, the constrained solve, and the conductor limit. Section 3 describes the evaluation of the reciprocal-space term inside the matrix-vector product, and Section 4 the composition with other potentials. Section 5 describes the code architecture and the run-time controls, while Section 6 goes beyond implementation details to discuss the conditions under which the solve is well posed and the guards that keep it so. Section 7 reports the validation: molecules and a conductor in one solve, the central result, then the reproduction of a published water model and of the ReaxFF charge step with no parameter refit. Section 8 states the current limitations, Section 9 reports performance, and Section 10 positions the method against related approaches.
Theory
The energy functional
We reference each charge to a per-type formal charge,
where is the reference charge of the type of atom and the solved deviation. Following the standard expansion of the energy in the atomic charges,[1, 2] which is first order in the electronegativity and second order in the hardness , we write
where is the charge on atom , is taken as (IP + EA), is taken as IP − EA, with IP and EA the ionization potential and electron affinity of the atom, and is a shielded Coulomb kernel between atoms and separated by . The reference places the center of the on-site parabola at the specified formal charge rather than at zero: an isolated atom takes the charge . The projector of Section 2.3 holds each fragment’s total charge at the sum of its reference charges, which we refer to throughout as the “neutrality” constraint. For , the case of every model in Section 7, (2) is the familiar unreferenced functional.
Shielding kernels
The off-diagonal kernel is the point at which published models differ most, and we therefore make it selectable at run time rather than fixed at compile time (Table 1). All three tabulated forms approach at large separation, so the Ewald complement is unchanged, and all three are dimensionally consistent in both supported unit systems without a conversion factor.
| Kernel | Parameter | |
| cbrt (default) | (inverse length) | |
| gaussian | , | (Gaussian radius) |
| slater | exact Slater-orbital integral[8] | (Slater exponent) |
Table 1. Interchangeable off-diagonal shielding kernels. The fourth column of the parameter file is reinterpreted according to the selected form. The companion pair style accepts the same selection, so that the forces and the charge solve use one kernel. The Slater form is the closed-form two-center Coulomb integral over 1s or 2s Slater densities given by Rick and co-workers[8]; we evaluate it by tabulation, verified against direct numerical quadrature in § 9.2. The Gaussian form is that of Naserifar and co-workers[4], with the pair exponent of Eq. (3).
The exact Slater form allows published models to be used without a refit. Published Slater-overlap fluctuating-charge models are parameterized against the exact Slater-orbital Coulomb integral[8], so pinning such a model to an approximate kernel requires a refit, and a refit obscures whether an implementation reproduces the original. With the exact integral available, the original exponents may be used directly (§ 9.2).
The conductor mode and the machine-learning correspondence of this paper rest on the Gaussian form. It is the Coulomb interaction of two normalized Gaussian charge densities, , with the per-type exponent ,[4] where is the Gaussian radius of the type and a dimensionless width factor. The kernel depends on the pair only through
where is an inverse length, since has units of (length). In samQEq, the combination rule may be overridden for any type pair at run time. Because the kernel is the interaction of a real charge distribution, its reciprocal-space form is exact rather than fitted,
where is a wavevector of magnitude . The shielding is therefore equivalent to a Gaussian factor on each wavevector of the Ewald sum. For a single width, the factor is with , which is the smearing factor of Latent Ewald Summation;[21] § 6.3 returns to that correspondence. In the cube-root form the pair parameter is ; in the Slater form each type carries either the 1s or the 2s Slater form factor.
For designated ion pairs the off-diagonal element may additionally be Tang–Toennies damped on top of the active kernel,[29]
where is the Tang–Toennies damping function of order (default 4) and is the damping range parameter in Å. Since at contact, the damping suppresses the contact charge-transfer coupling, which otherwise transfers too much charge across a contact ion pair. Additionally, since at large , it leaves the long-range complement unchanged. Every kernel choice is mirrored in the companion pair style.
Enforcing the molecular limit
We minimize the charges using Lagrange multipliers (i.e., subject to a constraint applied per fragment) over the atoms of a designated group . Writing H for the Hessian of Eq. (2) and P for the orthogonal projector onto the constrained subspace, the solve is
with restricted to , so that the reference charges enter as a fixed field. For atoms outside , the sum in uses their actual fixed charges in place of . For per-fragment neutrality the projector removes each fragment’s uniform-charge direction,
where is the fragment containing atom , the number of atoms in fragment , and any per-atom vector. Rather than eliminating the constraint, we project each search direction onto the constrained subspace, which keeps the operator symmetric and makes the constraint a property of the projector rather than of the linear system. Alternative constraint forms are therefore run-time settings that reuse the same solver. Here we use per-fragment neutrality or global neutrality throughout.
Per-fragment neutrality is the constraint of the fluctuating-charge model of Rick and co-workers:[8] charge redistributes within a molecule but not between molecules, which is the correct limit for an insulating molecular liquid. In the absence of fragment identifiers, the projector degenerates to global charge neutrality, recovering the standard electronegativity-equalization constraint appropriate to a conductor (§ 4.4). Both limits are reached without a change of code path.
The conductor limit
Under the global constraint, Eq. (2) is equivalent to the semiclassical Thomas–Fermi electrode model of Scalfi and coworkers, who noted that the two self-consistent problems coincide when plays the role of the Fermi level and that of , with the Thomas–Fermi screening length, the atomic density and the vacuum permittivity.[11] Whether the limit is well posed depends on how the finite size of the charge enters the solve. For a molecule, the fitted already contains the electrostatic cost of confining charge to an atom of finite size, and the operator diagonal therefore carries no self-energy; the grid self-term of § 5 is subtracted to keep it so. For a metal, by contrast, is a bulk quantity with no width, and the finite size must be supplied separately. We supply it, for designated types, as the diagonal element of the Gaussian kernel,
where is the standard deviation of the Gaussian charge and the Coulomb constant. The added term is the limit of for a Gaussian of width . For the Gaussian shielding kernel this gives a rigorous sufficient condition for the solve to be well posed. Let be the self-energy of the type’s own Gaussian. The kernel matrix completed by on its diagonal is the interaction matrix of a set of real charge densities, a Gram matrix, and is positive semidefinite, so
where is the self-energy of Eq. (8) on the conductor types and zero on the others. The bound holds for the full operator and therefore for its restriction to the constrained subspace, since the operator itself has one exact zero eigenvalue per fragment, on the null space of the projector. The argument requires every off-diagonal element to be the Coulomb interaction of the two sites’ own Gaussian densities: the Gaussian kernel with its combination rule, Eq. (3), shielding every pair. A per-pair radius override, a damped ion pair, or bare intermolecular pairs (the intramolecular-shielding mode of § 5) leave the Gram form, and the bound no longer applies.
The bound is also a minimum over all sites. A molecular site whose hardness is below its own contact value makes it negative and uninformative. Thus, for an interface Eq. (9) removes the instability that the conductor would introduce, while the definiteness of the combined operator is established by dense diagonalization (§ 9.1). Without the self-energy, a conductor’s operator can become indefinite once its hardness falls below the contact value of its own kernel. With it, the smallest eigenvalue is bounded below by , positive for every whenever is narrower than the type’s own Gaussian, . At equal widths the bound reaches zero as , where the Gram matrix of distinct Gaussians stays positive definite but becomes severely ill-conditioned. The self-energy term is therefore a hardness offset derived from the width , not the self-energy of the charge density that the off-diagonal kernel describes, which keeps the type’s own width. The offset bounds the effective screening length from below, and the conductor limit of the model is a finite Thomas–Fermi length rather than a perfect conductor. Taking equal to the type’s own width would make the functional that of one charge density, but it leaves the operator ill-conditioned and staggers the layer charges of a slab. The bound holds up to the discretization error of the particle mesh, which we measure below at 0.06 to 0.11 eV on a gold slab.
Long-range electrostatics inside the matrix-vector product
Placing the reciprocal term inside the operator avoids an outer self-consistent loop. We carry the real-space Ewald-split short range in the sparse operator and add the reciprocal-space per-atom potential inside the matrix-vector product, so that one projected solve returns fully long-range charges with no self-consistent-field outer loop. The grid-dependent reciprocal self-interaction of each charge is removed from the operator diagonal, which then carries the on-site hardness and the interaction of the charge with its own periodic images. By default the term is calibrated from sixteen deterministic probe pairs, those of the lowest global tags, and re-measured only when the mesh or the Ewald parameter changes. It may instead be pinned to a value, or computed exactly for each atom from its interpolation stencil and one transform of the Green’s function (fix_modify <id> recip_self peratom), which requires no calibration and does not drift under a barostat.
Evaluating the reciprocal term on a mesh within an iterative charge-equilibration solve is established practice.[12, 20, 26, 30, 31] What samQEq introduces is not the mesh but what the projector enforces, and how many conditions it carries at once: one constraint per fragment from the molecular connectivity. This ensures that the reciprocal evaluation sits inside a solve, carrying as many simultaneous constraints as there are molecules, each reimposed on every Krylov iterate. That is what makes the insulating limit of § 4.3 a run-time mode rather than a different code, and it is the reason a published bare-intermolecular model ports without refitting (§ 9.2).
A second difference is the kernel. Gaussian charge densities are the natural choice on a mesh, and Ref. [12] accordingly replaces Slater-orbital shielding with Gaussians whose widths are fitted, per element, to reproduce the Slater repulsion. We instead carry each kernel of Table 1 as given on the long-range path: the exact Slater integral is tabulated and used unmodified, and the Gaussian carries the widths of the model that defines it. The splitting is the same for every kernel,
with the Ewald splitting parameter and the solve cutoff. The mesh carries the point-charge term only and the kernel enters through the real-space bracket, which reduces to where has reached , and the cutoff must lie beyond that point. For the Gaussian kernel, Eq. (4) shows the equivalent reciprocal-space form. No kernel is refitted for mesh efficiency, and all three are exercised under full Ewald.
samQEq provides two non-equivalent long-range modes. Shielding only intramolecular pairs and leaving intermolecular pairs bare reproduces the structure of published bare-QEq models, and is the mode in which such a model ports faithfully. Shielding all pairs instead moves the solution away from the polarization catastrophe (the point at which the smallest eigenvalue of the constrained operator reaches zero), and supports stable energy-conserving dynamics. It does, however, move the model away from the bare-QEq reference. We therefore recommend the all-pairs mode for new parameterizations. The difference between the two modes is structural, not a fitting residual, as measured in § 9.2.
Coupling to other potentials
samQEq is a layer independent of the potential: it solves only for the charges, the companion pair style adds the shielding correction to the forces, and the long-range sum is standard particle-mesh, with an in-package routine supplying the per-atom reciprocal potential. Any other LAMMPS pair style is combined with it through hybrid/overlay. It ships its own copy of the ACKS2 augmented saddle-point solver, so it depends only on standard LAMMPS packages.
Fixed-charge force fields
A fixed-charge force field supplies the dispersion, repulsion and bonded terms, and samQEq replaces its static charges by solved ones. Species whose charge should stay fixed, such as an ion held at an assigned charge state or a phase whose charges are not to be equilibrated, are left outside the solve group. The 13,216-atom cell of § 11 composes the fix with an embedded-atom potential and a fixed-charge force field in this way.
Reactive force fields
A reactive force field carries its own charge-equilibration step, and the step can be delegated: samQEq supplies the charges to the LAMMPS ReaxFF pair style with that style’s own charge step disabled, using ReaxFF’s electronegativities, hardnesses and shielding parameters under the same taper and global neutrality. § 9.3 demonstrates this coupling.
Machine-learned potentials
The same layering applies to a machine-learned potential without long-range electrostatics, in two ways. In the first, the electronegativities, hardnesses and widths are fixed per element, the machine-learned potential is trained on the difference between the reference energies and forces and those of samQEq, and the two are summed at run time through hybrid/overlay. In the second, the potential predicts from the local environment and samQEq solves Eq. (6) for the charges, which is the structure of fourth-generation potentials.[18] Because the projector depends on neither nor the positions, the constrained minimum satisfies , and the forces require no derivative of the charges,
where is the position of atom . The second term is a single backward pass through the potential with the solved charges as its input. With the Gaussian kernel the reciprocal-space energy of the second mode is that of Latent Ewald Summation,[21] with the latent variable replaced by an equilibrated charge.[18, 23] This coupling will be developed formally in a future work and is not demonstrated here.
Code architecture
Design goals
We now formally state the three requirements that shaped the implementation. The first is that one solve be well posed in both limits, for molecules and for conductors, and in a cell that holds both (Figure 1): the constraint and the self-energy that make each limit well posed are properties of the atoms, not of the code path. The second is that the solver run beside any potential (§ 6), and the third that it impose no outer self-consistent loop (§ 5). The remaining choices on which published models differ (the shielding kernel, the long-range treatment and the charge dynamics) are run-time settings against the same solver, so that changing a model does not change the code.
Matrix-free assembly
samQEq is matrix-free: the Krylov solver receives the action of the operator on a vector, never the matrix itself (Figure 2). That choice sets the memory footprint, the cost of adding a model, and what a device port has to replace. Only the short-range block is assembled, on the default route. Once per solve, samQEq walks the neighbor list and stores the shielded Coulomb couplings inside the shielding cutoff in compressed sparse row form, as a row offset, a neighbor count, a column index list and the values. Storage is therefore linear in the number of pairs inside that cutoff rather than quadratic in the number of atoms.

Figure 2. Where the solve sits, and what the operator is made of. Top, one timestep: the fix runs before the forces and hands the pair and long-range styles a charge set. Middle, the solve is a projected Krylov iteration whose only argument is the action of the operator on the current iterate. Bottom, that action is assembled in one part and applied in two: the short-range block is stored in compressed sparse row form, while the particle-mesh reciprocal (§ 5) and the per-fragment projector (§ 4.3) are evaluated on the fly, so the constrained operator is never formed. The dashed band marks what the Kokkos device path replaces (§ 7.6). Schematic.
One advantage of this implementation is that the two terms that would dominate a dense assembly are never built. The reciprocal-space contribution is applied inside the matrix–vector product as a particle-mesh transform (§ 5), so the full long-range block, which couples every atom to every other, exists only as the action of a transform on the current iterate. The projector is likewise applied rather than formed: at each Krylov iteration the vector is swept once over fragments and its per-fragment mean removed, at a cost linear in the number of atoms, so the rank- constraint, with the number of fragments, never appears as stored entries either. The constrained operator , whose spectrum decides whether the solve is a minimization at all (§ 8.1), consequently has no representation anywhere in the code. It exists only as the composition of the operations the Krylov method calls.
The optional block incomplete-LU preconditioner of § 11 is a deliberate exception: every rank gathers the global augmented system, carries the two global constraints of the augmented formulation as bordered Schur rows, and factors it, so that the preconditioner is independent of the domain decomposition by construction. This replicated factorization makes the solve practical on near-singular metal systems but limits it to thousands of atoms rather than millions.
Three consequences naturally follow. First, a new shielding kernel or a new long-range route is a change to the matrix-vector product and to nothing else, which makes the kernel and the long-range treatment run-time settings rather than code paths. Second, the device port has one object to replace rather than a solver to rewrite (§ 7.6). Third, a spectrum cannot be read from the running code by inspection. The spectra of § 8.1 therefore come from the operator rebuilt outside the simulation, or recovered from the code’s own matrix-vector product, and checked against the charges the code solves (§ 23 of the Supplementary Material).
Run-time controls
The constraint, the self-energy of the conductor types and the settings of § 7.1 are selected through fix_modify keywords, so that changing a model is an edit to an input deck rather than to the code. The charge model of the water benchmark takes five commands beyond those of a fixed-charge deck:
pair_style hybrid/overlay lj/cut 10.0 coul/long 10.0 coul/shield/intra 10.0 all
pair_coeff * * coul/shield/intra 1.11
kspace_style pppm/samqeq 1.0e-6
# fix ID group qeq/sam Nevery cutlo cuthi tol paramfile
fix chg fq qeq/sam 1 0.0 10.0 1.0e-5 spcfq_expt.param
fix_modify chg recip_self peratom # exact per-atom grid self-term
The listing shows the recommended settings. The water-benchmark decks behind § 8 to § 11 used a 5 Å shielding cutoff and a pinned self-term, except the energy-conservation deck of Table 5. That table and § 10 measure what each choice costs. The pair style must use the same kernel, kernel parameters and pair scope as the charge solve. The initialization check of § 8.3 enforces this. Its cutoff must be close enough to the solve cutoff that the shielding correction is negligible where the shorter one stops, and energy conservation requires matching the two cutoffs more closely than that check demands (§ 11). The final all is the scope, which must match the sixth field of the parameter-file header (lr_ewald) and so differs between decks that shield all pairs and decks that shield intramolecular pairs only. Table 2 lists the principal controls; the package README gives the complete keyword and parameter-file reference.
| Control | Effect |
solver cg | minres [<cap>] | Selects the long-range solver. The optional cap enables a bounded early termination, a heuristic safeguard, when the iteration stalls (§ 22.1 of the Supplementary Material). The default is cg, with an automatic MINRES re-solve when a solved charge exceeds a threshold. |
solver cg nofallback | Disables the automatic fallback. |
solver warmstart on | Seeds the solve from the previously converged charges, which reduces the iteration count by about a quarter on the water benchmark (Table 5). |
ridge eig <floor> [<m>] [<every>] | Ridge that varies continuously with the configuration, set from an -step Lanczos estimate of , recomputed every <every> steps (piecewise constant between updates when <every> ). The ridge regularizes the solve and is not part of the reported energy, so forces are not conservative while it is active. |
shield cbrt | gaussian | slater | Off-diagonal kernel, Table 1. |
shieldpair <i> <j> <R> | Overrides the Gaussian radius of one type pair, Eq. (3). |
gself on [width <w>] [types ...] | Finite-width self-energy of Eq. (8) on the listed types (default: every type, Å; list the conductor types, since on a molecular site it double-counts the hardness). |
xl <mass> <damp> | Extended-Lagrangian charge dynamics. |
aspc <n> | Time-reversible predictor with corrector iterations. |
spikeguard <q> <k> | off | Soft projected restoring force on charges above , for the extended-Lagrangian path. On by default, with and eV . |
precond ilu [<tol>] | Block incomplete-LU preconditioner of the augmented system, drop tolerance by default. |
recip_probes <K> | Number of probe pairs in the calibration of the reciprocal self-term, 16 by default; 0 selects the single-pair estimator. |
bondsoft <kappa> <bcut> | ACKS2 bond-softness kernel with scale kappa and cutoff bcut; selects MINRES on the short-ranged Gaussian operator. |
Table 2. Run-time solver controls, issued as fix_modify <id> <keyword> .... is the smallest eigenvalue of the projected charge operator, estimated as in § 22.2 of the Supplementary Material; <cap> is a charge magnitude in units of the elementary charge.
| Charge dynamics | Matrix-vector products/step | Time per step (ms) | Microcanonical behavior over 200 ps |
| Full solve | 17.94 | 10.3 | +20 ± 21 K ns |
| Solve seeded from history | 13.52 | 9.4 | +20 ± 9 K ns |
| Predictor–corrector | 2.00 | 5.7 | −1145 ± 15 K ns; 2.76 → 2.96 D |
| Extended Lagrangian | — | 5.5 | falls from 270 to 85 K in 10 ps; → 3.52 D |
Table 5. The four charge-dynamics modes on one system, 64 molecules of the water benchmark over 200 ps of microcanonical dynamics, on the deck described in the text, at a relative residual of . The time per step is on one core, the mean of three repeats for the two solves (±1 ms). For the two modes that advance the charges a drift does not describe the trajectory, and the last column states what happens instead.
The parameter file carries a header line and one line per atom type. The header is gamma_align kappa_bond r_ov r_loc lr_alpha lr_ewald lr_ridge. The field lr_ewald selects the long-range path: 0 evaluates the operator in real space alone; 1 and 2 place the reciprocal-space contribution inside the matrix-vector product, shielding intramolecular pairs only or all pairs (§ 5). kappa_bond and r_ov are the amplitude and length of the bond-softness term within a fragment, lr_alpha is the damping parameter of the damped-shifted-force (DSF) real-space path, and lr_ridge is an optional diagonal ridge in the units of ; gamma_align (which must be positive) and r_loc are reserved and enter no solve in this release. Each type line is type , where the last two are likewise reserved, with two optional trailing columns carrying cubic and quartic on-site coefficients, which default to zero and recover the parabola of Eq. (2). The fourth column is not a single physical quantity: it is an inverse shielding length under cbrt, a Gaussian radius under gaussian, and a Slater exponent under slater (Table 1).
Charge dynamics
The charges may be obtained in three ways, and the full solve may also be seeded from the previous step (Table 5). The default solves Eq. (6) each step by a projected conjugate gradient. An extended-Lagrangian option propagates the charges as fictitious-mass dynamical variables by velocity Verlet, as in original fluctuating-charge models, avoiding the per-step solve.[8] A time-reversible always-stable predictor–corrector (ASPC) predicts the charges from history and runs a small fixed number of corrector iterations.[32] In ASPC, each corrected step is accepted only if it satisfies a residual criterion; otherwise the full solve is used. § 11 gives the cost and the energy conservation of each on one system.
Units
samQEq supports two unit systems, metal (eV) and real (kcal mol), under three rules. First, every quantity typed by the user (parameter-file columns and run-time modifier arguments alike) is in the deck’s native energy units and is never pre-converted. Second, internal hard-coded constants are anchored in electronvolts and converted once through a single scale factor, so that they mean the same physical value in either system. Third, solver tolerances are rescaled internally, so that the same numerical tolerance means the same physical convergence in both systems.
Device kernels
The object the device has to replace is the matrix-vector product of § 7.2, not the solver. Under the LAMMPS Kokkos package, selected with the standard suffix, the sparse product, the three shielding kernels and the particle-mesh reciprocal all have device implementations, and with fix_modify <id> devsolve on the projected conjugate-gradient iteration runs on the device as well, including under ASPC. The iterate, the residual and the search direction are device arrays, and with the device mesh style the reciprocal term stays on the device too. One per-iteration host transfer remains, the ghost exchange of the trial charges, which LAMMPS routes through host memory for a fix.
Two limitations apply. First, not every route is ported. Routes that run on the host solve include the quartic onsite term, the per-atom ridge, the bond-softness operator and the intramolecular-only shielding mode of § 5. Per-pair Gaussian radii, ion-damped kernels, the exact per-atom self-term, a molecule-free long-range solve and slab geometries (kspace_modify slab) are also not ported. The device styles refuse these at initialization, and such decks run with the host styles; the conductor slabs of this paper are therefore host-only. We recommend checking any deck that requests the device solve against the host result. Second, halo exchange goes through GPU-aware MPI, which is not an optimization but a requirement of practical throughput: staging the same halos through host memory costs an order of magnitude on four devices (§ 11).
We validated the device port against forces in addition to energies and charges. The potential energy and the solved charges are contractions that a defect in a field-carrying ghost exchange can leave numerically exact, so a bitwise comparison of either passes while the force on an atom near a subdomain face is wrong. We therefore require the device path to reproduce the host forces at fixed charges to eV Å on one and two GPUs, and the host charges to e after ten steps of the benchmark of § 11 (§ 27 of the Supplementary Material).
Numerical stability
Well-posedness of the solve
The constrained operator is symmetric by construction, and whether it is also positive definite decides whether the solve is a minimization at all. This question is intrinsic to QEq models: Savvidi and co-workers mapped the smallest eigenvalue against hardness and shielding width and noted that a solve on an indefinite matrix may return a saddle point or fail to converge.[12] For the Gaussian kernel, Eq. (9) gives a rigorous sufficient condition, up to mesh error; for the cube-root and Slater kernels we use a weaker sufficient condition.
For a molecular system a sufficient condition is that every site’s hardness exceed the total coupling that site carries,
which is row-wise diagonal dominance of and passes to the constrained operator. It applies only to the truncated real-space operator: the reciprocal-space sum is not absolutely convergent, so for the full operator the condition is a heuristic. Because the kernel is monotone in , each term is bounded by its contact value, so Eq. (12) follows from , with the number of neighbors of inside the cutoff. On a two-site fragment, where , that reduces to the per-pair statement in which the condition is usually quoted. On an extended system the per-pair statement is not sufficient: the sum runs over all neighbors, so a configuration whose lowest constrained mode alternates in sign between near neighbors can satisfy the per-pair bound and still carry a negative eigenvalue. For the Gaussian kernel no such collective analysis is needed: the gold slab’s smallest eigenvalue, 3.47 eV below its hardness, is the contact value of its own kernel, Eq. (9), to within the mesh residual.
(12) is a condition on the parameters and the geometry rather than on the kernel form, and it is sufficient rather than necessary; the water benchmark of § 24 is a case that violates it and is definite anyway. It violates the condition because its cube-root kernel reaches eV against eV, and it stays definite because its rigid geometry holds the intramolecular couplings low enough that the constrained operator of an isolated molecule has eigenvalues of 2.26 and 7.79 eV. Direct diagonalization of the constrained operator of the 512-molecule liquid, with the reciprocal-space term included as the solve applies it, returns eV and a condition number of 8.0, with no negative eigenvalue (§ 23 of the Supplementary Material). With the same kernel, a Slater exponent read as an inverse shielding length makes the operator of a single molecule indefinite, and the solve then returns a sign-inverted charge distribution (§ 9.2).
For a conductor the dominance bound cannot hold, since , and the sufficient condition is instead Eq. (9) with the self-energy of Eq. (8). Equation (9) is itself sufficient rather than necessary. The M site of the water model of § 9.1 has a hardness below its own contact value, 16.11 against 17.53 eV, so the bound does not necessarily validate the model. The dense spectrum of the interface operator is nonetheless positive, with eV under per-molecule constraints and 1.53 eV under the global one. The bound is a worst case over single sites, and under either constraint no admissible charge displacement is confined to one site.
Solvers
The default solver is a projected conjugate gradient. The package also provides an augmented saddle-point formulation. Because the augmented matrix is indefinite, that path uses BiCGStab with a restart that re-anchors the shadow residual when it becomes orthogonal to the residual, a breakdown that otherwise returns incorrect charges.[33] A projected MINRES solve[34] is available for indefinite operators. On a 216-molecule fluctuating-charge water box it costs the same as preconditioned conjugate gradient (18 matrix-vector products each at a tolerance of ), because the matrix-vector product dominates the solve (§ 11). The near-uniform hardness diagonal makes diagonal preconditioning worth little.
Consistency checks at initialization
A converged residual on a neutral charge set does not ensure that the intended problem was solved. The residual is formed against the operator in use, and the projector holds the charges neutral whatever operator produced them, so the two quantities a user is most likely to inspect are both blind to a substitution of the operator itself. samQEq therefore provides the following explicit checks at initialization.
When only part of the system is solved, samQEq tests group membership for both atoms of every matrix element, so that no element couples a solved atom to an atom whose entries were never assembled. It asserts that the companion pair style and the fix carry the same kernel, the same parameters and the same set of pairs, and that the pair style has a term for every pair of solved types (an unassigned pair is refused, or flagged when the shielding is intramolecular only): under LAMMPS’s hybrid/overlay, coefficients given per type are not mixed across type pairs that another sub-style already covers, so the cross pairs would enter the solve and not the forces. It compares the two cutoffs by magnitude, asking whether the shielding correction is still appreciable where one side stops applying it. It requires its calibrated constants to be reproducible across domain decompositions and checks each recalibration against the first at the same mesh; the exact per-atom self-term of § 5 removes that calibration altogether. A self-term pinned by the user belongs to one Ewald splitting, and samQEq warns when it departs by more than 2% from the converged-mesh limit of the current one: on the water benchmark, a pin carried unchanged from a 10 to a 12 Å cutoff is 19% off and drives the liquid close to the polarization catastrophe. The convergence tolerance admits no such check: whether a tolerance is tight enough depends on the property of interest, not on the solve. We bound it by measurement instead (§ 28 of the Supplementary Material).
Verification and validation
Molecules and a conductor in one solve
The central thesis of this work is that one solve can hold a molecular liquid and a metal at once, each in its own limit. We test it on the 240-atom Au(111) slab carrying a film of 81 water molecules on its upper face, with no applied field, so that the metal responds only to the water. The water is described by the TIP4P-FQ[8] force field with the Gaussian kernel, with the two radii fitted to reproduce the model’s own intramolecular Coulomb integrals at its rigid geometry (§ 25 of the Supplementary Material). Two settings distinguish the four models: (i) the constraint, either one global neutrality condition over metal and water or one per water molecule plus one for the slab; and (ii) the finite-width self-energy of Eq. (8) on the gold, on or off. The per-molecule constraint is a modeling choice: it forbids charge transfer between the water and the metal, and with it charge-transfer chemisorption and interfacial redox. We scan the gold hardness from 5.172 eV, which corresponds through to a Thomas–Fermi length of 0.70 Å at the atomic density of gold, down to 0.05 eV.
With the self-energy the effective diagonal of Eq. (9) is eV, so the scan moves the equivalent screening length only from 1.30 to 1.10 Å. The lower end is the conductor limit of the model, not a vanishing screening length. Each point is a single solve on one fixed configuration, and is from dense diagonalization of the operator the code applies, recovered column by column from its own matrix-vector product; that operator reproduces the solved charges to e. No eigenvalue is negative at any hardness. Under per-molecule constraints the smallest eigenvalue is 1.68 eV throughout, set by the water; the metal’s modes lie above 13 eV, and the solve converges in 31 to 35 iterations at every hardness. Conversely, without the self-energy the operator follows the gold’s bound, , and turns indefinite once the hardness falls below 3.5 eV, with up to 221 negative eigenvalues, under either constraint (Figure 3a). The corresponding solve takes 150 to 600 iterations and returns layer charges of up to 30 e.
Figure 3. Molecules and a conductor in one solve. (a) Smallest eigenvalue of the constrained charge operator of an Au(111) slab carrying 81 water molecules, by dense diagonalization, against the gold hardness (logarithmic, decreasing to the right), for the four combinations of constraint and self-energy; shading marks an indefinite operator. (b) At the Thomas–Fermi hardness, the net charge moved from the water into the metal (filled) and the largest net charge on a single molecule (open), against a common offset of the water electronegativities; the two per-molecule arms coincide at zero and are invariant to the offset. (c) Charge above the mid-plane of a 2160-atom slab, from the Gaussian charge densities, opposite a unit point charge at height , with and without the self-energy, at the Thomas–Fermi hardness (open) and at 0.3 eV (filled); the dotted line is the ideal conductor. (d) The self-energy width: face charge in a field of 0.5 V Å relative to the Gauss limit, and the sub-surface layer relative to the face, whose sign change marks the staggered mode; the dotted line is the width of gold’s own Gaussian.
The global constraint fails differently, and the failure does not depend on the hardness. The electronegativities of a QEq water model carry an arbitrary common offset, which a per-molecule constraint cancels and a global one does not. For the global constraint, shifting the water’s electronegativities by moves the net charge between water and metal linearly, from +3.9 e to −0.9 e over eV (Figure 3b). The magnitude of the transfer therefore carries no physical information. What does not depend on the offset is the charge on individual molecules. Under the global constraint the largest net charge on a single molecule never falls below 0.19 , even where the net transfer vanishes, because the constraint lets charge flow between molecules as in a metal. Under per-molecule constraints every molecule is neutral by construction, and the charges are invariant to the offset to ; the mean water dipole equals that of the same film without the metal to 0.1%, and the slab responds with a smooth image charge beneath the film. The demonstration is one interface in one configuration, and it establishes that both limits are well posed together; it does not test the physics of the water–metal coupling, which needs a fitted interface potential and a mobile metal.
A conductor must screen a charge at any distance. We measure the screening on a model system: a 2160-atom slab (the 240-atom slab replicated three times in each lateral direction; § 25 of the Supplementary Material), as the charge above the slab’s mid-plane opposite a unit point charge. The charge is integrated from the Gaussian charge densities of the kernel rather than taken from site charges, whose densities overlap adjacent layers. With the self-energy activated, it is −1.13 and −1.16 at the two hardnesses and does not change with the height of the charge beyond 4 Å (Figure 3c). The same definition gives 1.13 to 1.16 times the Gauss limit for the slab in the field of 0.5 V Å. Both tests measure the laterally uniform response of the slab, and both read 1.13 to 1.16 times the ideal for the same reason. The gold Gaussian, with a standard deviation of 2.38 Å, is wider than the equivalent Thomas–Fermi length of 1.1 to 1.3 Å, so the induced charge does not decay monotonically into the metal but overshoots and oscillates, with a decay length of 2.9 Å and a period of about 13 Å. The mid-plane of a five-layer slab lies two layers below the face, inside the first overshoot, and the measure records it. On slabs of 13 and 17 layers the same model screens a unit charge to −0.99 and a field to 0.99 to 1.00 times the Gauss limit, and a narrower gold Gaussian ( Å) removes the excess on five layers as well. Without the self-energy term, the definite slab at the Thomas–Fermi hardness screens to −1.07 , and the indefinite one at 0.3 eV returns −1.9 . Beyond 4 Å the interaction energy follows the exact image law of the laterally periodic cell to 23 and 27 meV with the self-energy, with the image plane 0.2 and 0.4 Å above the top atoms; closer in, the charge’s Gaussian overlaps those of the metal and the point-charge law no longer applies. Interestingly, the indefinite solve follows the law to 18 meV, meaning the energy cannot be used to discriminate between the two approaches.
The same film under dynamics separates the four combinations more sharply than any single solve. Here, we held the gold fixed, kept the water rigid and thermostatted at 298 K, and ran each combination for 5 ps at a 0.2 fs step, at either hardness. With the self-energy and per-molecule constraints, the largest charge on any site stayed at or below 1.33 , under the 1.34 of the same film without the metal, and the eigenvalue ridge never engaged. Without the self-energy, at 0.3 eV, the per-molecule run raised no warning, but the gold site charges drifted as the water moved, to a standard deviation of 0.63 , and the largest charge, 1.88 after 5 ps, did not reach a steady value. The global constraint at the same hardness went near-critical within 0.3 ps, engaged the ridge at nearly every step thereafter, and moved up to 9.5 into the water, with single molecules carrying up to 1.0 . At the Thomas–Fermi hardness the global constraint was stable, but single molecules carried up to 0.28 throughout.
The self-energy width is a parameter of the model, and the screening is sensitive to it (Figure 3d). For widths up to 0.5 Å the sub-surface layer carries the sign of the face, a screening tail, and the face charge lies within 6 to 16% of the Gauss limit. Between 0.75 and 1.0 Å the sub-surface layer changes sign, and it stays inverted at larger widths. At the width of gold’s own Gaussian, 2.38 Å, where the Coulomb block is only semidefinite, the layers alternate at about three times the Gauss limit at 0.3 eV, and the metal’s softest mode falls below the water’s. We use 0.5 Å and recommend widths no larger than it in practice.
Reproduction of a published model without refitting
The most direct test of the implementation is whether it reproduces a published model from that model’s own parameters. Using the exact Slater kernel with the original Slater exponents of the TIP4P-FQ model of Rick and co-workers, in the intramolecular-shielding mode that matches the structure of their model, we obtain a gas-phase dipole of 1.8634 D against their 1.85 D and a liquid dipole of 2.630 ± 0.004 D over seven of eight independent 100 ps trajectories against their 2.637 D.[8] The eighth settles during equilibration into a less hydrogen-bonded network, with a dipole of 2.55 D that persists for the whole run. As in the original model, the port runs at a 0.25 fs step under a thermostat; we did not test it in the microcanonical ensemble. The tabulated kernel itself agrees with direct numerical quadrature of the reference integral to a maximum relative deviation of .
To establish the sensitivity of the choice of shielding, we ran the same kernel and the same parameters in the all-pairs-shielded mode, which gives a liquid dipole of 2.340 ± 0.001 D over three independent 10 ps trajectories, an under-polarization of about 11%. Both uncertainties are the standard error of the mean over independent trajectories, each trajectory contributing its time average. The difference comes from which pairs are shielded, not from the kernel or its parameters, and samQEq therefore makes the pair scope a user setting. The pair style must be told to shield the same set of pairs as the solve; a deck that shields all pairs in the charge matrix while correcting only intramolecular pairs in the forces is an instance of the pair–solve mismatch that § 8.3 guards against, and it shifts this dipole by 0.12 D. Here, at a given configuration, the solved charges are unchanged, but the forces differ, and with them the sampled structure.
The effect of kernel choice itself can be isolated in the same way, with an even larger effect. Table 3 compares two runs of the gas-phase monomer that differ by a single substantive line of input, the kernel selection. Read as Slater exponents under the exact integral, the published parameters give the published dipole. Read as inverse shielding lengths under the cube-root kernel, the same numbers give a dipole of similar magnitude but a sign-inverted charge distribution: the M site (the off-atom charge site of the model), which carries the largest electronegativity at eV and must therefore be negative, comes out positive.
| Kernel | (D) | Deviation | (eV) | ||
| slater | 1.8634 | ||||
| cbrt | 1.9033 |
Table 3. Two runs of the gas-phase monomer differing in a single setting, the selection of the shielding kernel. The molecule, the parameter file and all other settings are identical; the fourth column is read as a Slater exponent in the first row and as an inverse shielding length in the second. The reference dipole is 1.85 D.[8] Charges are in units of the elementary charge. Each run is one molecule in a cubic periodic cell, solved with the reciprocal-space term inside the matrix-vector product and extrapolated to infinite dilution from cells of 100 and 120 Å. is the reported potential energy: the shielded pair and reciprocal-space energies and the on-site term of Eq. (2). The inverted reading has a positive total energy, which the charge signs alone do not reveal. Both kernels are exercised by a distributed two-deck example, examples/kernel_comparison, in a 40 Å cell.
The inversion originates in the operator of the isolated molecule. Interpreted as , these exponents raise the cube-root kernel to of 2.15, 2.75 and 1.60 for the H–M, M–M and H–H type pairs, and at the geometry of the model they make the constrained operator indefinite, with eigenvalues of and eV. The native model, whose contact value also exceeds its hardness, stays positive definite (§ 8.1). The resulting stationary solution has an inverted charge distribution. Neither kernel is inferior: a Slater exponent and an inverse shielding length are parameters of different kernels, and reusing one number under the other is not a small approximation but an entirely different model (here a qualitatively wrong one). Separating the two requires that the kernel be a setting rather than a property of the code.
Reproduction of the ReaxFF charge-equilibration step
The charge equilibration of ReaxFF[35, 36] is a tapered QEq whose kernel is the cube-root form of Table 1. We therefore ran the LAMMPS ReaxFF pair style with its own charge step disabled and let samQEq supply the charges from ReaxFF’s electronegativities, hardnesses and shielding parameters, under the same taper and global neutrality, with no parameter refitting. On the 3000-atom QEq water of the LAMMPS distribution[37] and on a 21-atom RDX molecule, the charges agree with the native ReaxFF step to at most and e, respectively. The ReaxFF energy agrees to and kcal mol, and the forces to and kcal mol Å, for the water and RDX, respectively. A 20-step thermostatted trajectory of the water tracks the native one to kcal mol in potential energy. One caveat applies: we convert the parameters with ReaxFF’s rounded Coulomb constant, 14.4 eV Å, rather than the exact one, and with the factor of two with which ReaxFF converts its tabulated hardness. The exact constant would move the charges by at most e, and omitting the factor of two moves them by up to 3.1 e.
The reproduction ships as examples/reaxff_port, with the reference and samQEq decks for both systems, the script that converts the parameters and the reference output. It is an example rather than a regression case because it needs the LAMMPS ReaxFF package, which the rest of the package does not. The composition needs three settings besides the parameters: the fix’s own on-site energy is excluded, because the ReaxFF pair style already carries it, and the particle-mesh and long-range pair terms that the fix requires are present but switched off. Omitting any of them leaves the charges correct and the energy and forces wrong.
Regression suite
Numerical reproducibility across code changes is enforced by 22 self-contained test cases, each run on a single processor, so that the result is bit-reproducible, and compared against committed per-atom charges at a relative tolerance of and an absolute tolerance of . The suite exits non-zero on any failure and runs from a pre-commit hook, so a change that perturbs a converged charge cannot be committed without the perturbation being seen. The cases span the gas and liquid models in both long-range paths, all three shielding kernels, the extended-Lagrangian and ASPC propagators, solver set-up across successive runs, molecule-free global-neutrality solves, slab geometries, the gold slab of § 4.4 with its finite-width self-energy, the water film on gold under both constraints, the augmented solve with its preconditioner, and the exact per-atom grid self-term, with separate scripts in the package for multi-rank runs and for the device styles (§ 26 of the Supplementary Material).
Known limitations
The present release has the following limitations; the list is not exhaustive.
Constant-potential routes, in which the electrode charges are themselves prescribed rather than solved under a neutrality constraint, are the subject of future work and are not part of this release.
The physical validation reported here is on water, an Au(111) slab with and without a water film, and two ReaxFF systems. The accuracy of the framework is not yet demonstrated on an organic electrolyte, an ionic liquid or a metal/electrolyte interface, which are the natural next tests of transferability. The conductor mode is measured at one field strength, on Au(111) slabs of 3 to 17 layers, with the width scanned in Figure 3d, and the width is a parameter that the shipped sets do not supply in general; it must be derived for each new electrode material. The two limits are shown together on one fixed configuration of one interface (§ 9.1) and over 5 ps of dynamics with the metal held fixed; mobile copper electrodes run stably for 5 ps in the cell of § 11, but a production-length metal/electrolyte interface with fitted metal–electrolyte interactions is not yet validated in this mode, and the metal/electrolyte cell of § 11 runs the conductor mode with mobile electrodes for 5 ps as a stability and throughput test, with an illustrative zinc–copper contact term; it is not a validated model of zinc deposition. No machine-learned potential is coupled here.
The default atomic-charge solve should not be used for the longitudinal response of long molecules: it makes their longitudinal polarizability grow super-linearly with chain length rather than linearly. The remedy, the bond-softness kernel, requires two additional parameters. The values that restore the correct scaling give 0.62 ų per carbon, about a third of the polarizability increment of a CH₂ group, 1.84 ų.[38] We expect condensed-phase properties, where short-range intermolecular polarization dominates the response, to be much less sensitive; the water benchmark results reported here use the atomic-charge mode.
The device path does not strong-scale across nodes for the system sizes considered here. On one node it runs about twice as fast as a CPU node, and four nodes return only 1.2 to 1.3 times one node, because roughly thirty latency-bound collectives per timestep sit inside the solve (§ 11).
The initialization check of § 8.3 compares the fix against the companion pair style only. When the Coulomb term of the forces is supplied by another pair style, as in the ReaxFF composition of § 6.2, nothing verifies that its kernel matches the solve, and that composition also requires the fix’s own energy and the standard long-range pair and mesh terms to be excluded by hand.
The extended-Lagrangian and ASPC charge propagators do not conserve energy for the water benchmark at the documented settings (§ 11); a thermostat hides the failure. Use them only in thermostatted runs whose observables are checked against the full solve.
The MINRES path is unpreconditioned. That is adequate for a near-uniform hardness diagonal. It is not adequate for a dense-metal electrode, whose severely ill-conditioned operator requires the block incomplete-LU preconditioner of the augmented path (§ 11).
The probe calibration of the reciprocal self-term has a validity window that narrows as the particle-mesh accuracy is tightened, because each probe must find a partner within 2.5 mesh spacings for the Ewald complement to
hold. At a particle-mesh accuracy of the mesh spacing is small enough that a probe on an atom with a bond shorter than 1 Å finds no partner. When the probes are requested explicitly, a probe without a partner is refused; otherwise the calibration falls back to the single-pair estimator, as it does for the gold slab of § 4.4. The exact per-atom route has no such window, but it is host-only and requires a mesh of at least nine points per direction at fifth-order interpolation. The water benchmark is defined at its pinned self-term, 1.0% below the converged-mesh limit of its Ewald splitting, and the liquid dipole depends on that choice: re-solved on the same 51 configurations at the same splitting, it is 2.5% higher with the probe calibration and 3.5% higher with the exact per-atom self-term, with a spread over configurations of 0.002 D. The benchmark parameters are fitted at the pinned value and carry that choice. The benchmark lies close enough to the polarization catastrophe that a 1% change in a diagonal term moves its dipole by 2.5 to 3.5%. We therefore recommend the exact per-atom route wherever the mesh allows it. A pinned value also has to follow the splitting, which the particle-mesh style re-tunes at every run from the current charges unless it is fixed with kspace_modify; the warning of § 8.3 catches that case.
Performance
The CPU nodes of the Perlmutter system at the National Energy Research Scientific Computing Center carry two AMD EPYC 7763 processors (128 physical cores) and 512 GB of memory behind a single HPE Slingshot 11 interface. We benchmark a thermostatted 13,216-atom metal/electrolyte interface cell of 36.15 × 36.15 × 158.3 Å, in which two copper electrodes of 1,600 atoms in total bound 3,800 water molecules, 72 Zn and 144 Cl ions. Each copper electrode is one fragment carrying the finite-width self-energy of Eq. (8) ( Å), so its charges are solved as a neutral conductor, and the copper moves: copper–copper interactions are the embedded-atom potential of Mendelev and King,[39] and the electrodes are integrated and thermostatted with the electrolyte. Each zinc ion is a single-atom fragment held at +2 by the constraint, the water charges are solved with the Gaussian kernel, and the chloride ions stay outside the solve group; the zinc–copper short-range term is an illustrative Lennard-Jones potential, not a fitted one. ASPC advances the charges without the eigenvalue ridge, and SHAKE constrains the water at a 0.25 fs timestep. Over 5 ps at 298 K the electrodes stay crystalline (a copper mean-square displacement of 0.14 Å) and neutral to , the induced charge sits in the two layers facing the electrolyte, with site charges up to 0.25 , and ASPC falls back to the full solve on 7 of 20,000 steps. On this cell the implementation sustains 8.5, 12.5 and 16.4 timesteps per second at 16, 32 and 64 processes, corresponding to 73% and 66% parallel efficiency at each of the two doublings of the process count (48% from 16 to 64), within 3% of the same cell with the copper held fixed and neutral atom by atom. All three counts fit within one node, so these are intra-node figures, and the loss in efficiency reflects contention within the node rather than the network. At 64 processes the charge solve accounts for 26% of wall time against 65% for the pair interactions, and between 20 and 26% at 16 to 128 processes, as the collectives inside the solve become latency-bound. The solve is the minority term because ASPC holds it to about two matrix-vector products per step; the iteration count sets that share, and at two products per step the choice of Krylov method has little effect on throughput.
On the GPU nodes of Expanse at the San Diego Supercomputer Center, which carry four NVLink-connected NVIDIA V100 GPUs with 32 GB each, we further benchmark the water model of § 5, replicated from 12,288 to 786,432 atoms under a Nosé–Hoover thermostat with the device solve, and the same deck on a full Expanse CPU node of two 64-core AMD EPYC 7742 processors (Table 4; protocol in § 27 of the Supplementary Material). A single V100 holds the largest box in under 24 GB and runs at 0.3–0.8 times the speed of the CPU node. Four V100s run 1.86 to 1.98 times as fast as the CPU node from 98,304 atoms upward. Both benchmarks are thermostatted, so where they use the predictor–corrector they measure its cost and not its energy conservation, which Table 5 reports. Two choices decide those numbers. Solving the charges on the device is 4.4 times faster on one GPU than solving them on the host between device kernel calls, and exchanging halos through GPU-aware MPI raises the throughput tenfold over staging them through host memory at 331,776 atoms on four GPUs.
| Atoms | CPU node | 1 V100 | 4 V100 |
| 12,288 | 21.14 | 17.27 | 23.37 |
| 98,304 | 3.172 | 1.458 | 6.269 |
| 331,776 | 0.849 | 0.275 | 1.643 |
| 786,432 | 0.305 | 0.107 | 0.568 |
Table 4. Throughput of the water benchmark with the full charge solve at every step, in timesteps per second, on one Expanse CPU node (128 cores) and on one and four V100 GPUs with the device solve and GPU-aware MPI.
These results are for one node. Whether the same solve carries across nodes is a separate question, and the answer sets the range of use of the present implementation. On Perlmutter, whose GPU nodes carry four NVIDIA A100 devices, we repeated the benchmark at 331,776 and 786,432 atoms on one, two and four nodes, with the device solve and GPU-aware MPI throughout (Figure 4a). A single A100 node is 2.1 and 2.6 times a V100 node on the same deck, at 3.41 and 1.47 timesteps per second. Beyond it the returns are small: two nodes are marginally slower than one at both sizes, 3.38 against 3.41 and 1.39 against 1.47, and four nodes reach only 4.47 and 1.82, which is 1.3 and 1.2 times the single-node rate at a parallel efficiency of about a third.
Figure 4. Multi-node behavior of the device solve on Perlmutter A100 nodes, 200 timesteps with the full solve at every step. (a) Measured throughput against device count at two system sizes; the dashed lines are ideal scaling anchored on the single-node point. Two nodes give no measurable improvement over one, and four give 1.2 to 1.3 times. (b) The share of the timestep by LAMMPS task category at 786,432 atoms. The charge solve is recorded in Modify and holds 91 to 92% throughout, so the limit is a property of the solve, not of the molecular dynamics around it. “Mesh” is the reciprocal-space force evaluation; “other” pools the pair, bond, neighbor, communication and output time, each under 1.1%.
The timing breakdown localizes the limitation. The charge solve is recorded in Modify, and it takes 91 to 92% of the timestep at every size and every node count (Figure 4b), while the communication LAMMPS reports falls from 0.58 to 0.19% as the atom count per device drops. The iteration count is also unchanged, at 15 conjugate-gradient iterations per step in all six runs, so the solve is not doing more work on more nodes. What grows is the cost inside it: each iteration carries a global reduction for its inner products and a distributed transform for the reciprocal term, roughly thirty collectives per timestep, and those are latency-bound once they cross the interconnect. The standard task breakdown cannot resolve this, because the solve’s own communication is charged to the fix rather than to Comm.
We therefore recommend the current implementation for single-node device runs, where it is about twice a CPU node, and not as a route to strong scaling across nodes. Reducing the number of collectives per step, by a communication-avoiding Krylov variant or, for thermostatted runs, by accepting the ASPC’s looser per-step criterion, is the natural next step.
Table 5 gives the cost of four charge-dynamics modes on one system in the microcanonical (NVE) ensemble. The system is the 64 molecules of the water benchmark at 1.00 g cm, rigid, at a 1 fs step, carried through 200 ps of NVE dynamics after 100 ps of thermostatted equilibration at 298 K. The shielding correction of the pair style extends to the solve cutoff of 10 Å, and the Lennard-Jones term is shifted to zero there. The cutoff exceeds half the 12.4 Å box; LAMMPS includes every periodic image within it, so the operator is exact for the periodic system, and the small box serves only to compare the modes on one system. Drifts are the slope of the total energy per rigid-body degree of freedom, expressed as a temperature (K ns), with the standard error from ten contiguous segments.
The full solve conserves energy to within the resolution of a 200 ps run, and is insensitive to tightening the tolerance: the drift is +6 ± 15, +20 ± 21 and +1 ± 13 K ns at relative residuals of , and , and −7 ± 18 K ns at and a 0.5 fs step. The total energy fluctuates by 12 to 21 meV about its trend in all four runs. What does matter is the cutoff. The same system with the shielding correction truncated at 5 Å against the solve’s 10 Å, a deck the initialization check accepts because the residual correction there is small, drifts by +54 ± 32 K ns and its total energy fluctuates by 64 meV, three to five times more. We therefore recommend the full solve, or the solve seeded from history, with the shielding correction carried to the solve cutoff.
Computational cost tracks the iteration count, as expected. Seeding the solve from the previously converged charges saves a quarter of the matrix-vector products, which on this small system is within the timing noise. The ASPC integrator needs 9 times fewer products than the full solve and runs 1.8 times faster, because the pair and mesh work it does not remove dominates at 2 products per step. Shared-memory threading of the solve adds less: on one MPI rank of a 5184-atom water box, four threads reduce the wall time by a factor of 1.23 and eight by 1.26, where two MPI ranks give 1.80, so ranks remain the first choice. Conversely, in the near-singular metallic limit, where the operator is poorly conditioned, a block incomplete-LU preconditioner holds the saddle-point solve of a 26-atom metal slab at three iterations as the hardness approaches zero, where a diagonal preconditioner needs 59 iterations at a hardness of 0.5 eV and fails to converge below 0.1 eV. At the default drop tolerance of the count grows with system size; at it stays at six or fewer from 26 to 1682 atoms.
We find a distinct failure mode for the two charge integrators that advance rather than solve the charges at every step, in NVE dynamics of this model at the documented settings (one charge mass and damping for the extended Lagrangian, the default acceptance tolerance for ASPC); we did not scan those settings. The ASPC cools the system while its mean molecular dipole rises. Its acceptance criterion, a relative residual below , admits every step: the accepted residuals sit near , far above the solve tolerance, so the fallback to the full solve never triggers. The extended Lagrangian fails sooner and more severely, although the thermostatted equilibration does not distinguish it from the other modes. In both, energy leaves the nuclear motion and appears in the polarization, which acts as a sink for it. The lesson here is that satisfying the residual criterion and conserving energy are separate properties, so a trajectory propagated by either mode must be validated against a fully solved one, not by its own residual in NVE. A thermostat masks this failure, so the fidelity of a propagated trajectory can be checked only in the microcanonical ensemble.
Comparison with related methods
Table 6 places samQEq among the charge-equilibration routes of LAMMPS, and it implements several features which are otherwise spread amongst various LAMMPS fixes and external codes. The functional of Eq. (2) is that of QEq and EEM,[1, 2] and in its globally constrained mode samQEq reproduces their behavior, including the unlimited inter-fragment transfer that follows from equalizing one chemical potential over a whole system. It also reproduces the charge step of ReaxFF to about (§ 9.3). The per-fragment-neutral mode reproduces the constrained fluctuating-charge model of Rick and co-workers,[8] which has run with per-molecule constraints under particle-mesh electrostatics in biomolecular force fields for two decades,[3] although as currently implemented the samQEq projector acts inside a Krylov solve with the reciprocal term in the matrix-vector product rather than on extended-Lagrangian charge dynamics. The conductor construction in samQEq is similar to the ELECTRODE model already in LAMMPS: the finite-width self-energy in the global mode is equivalent to the Thomas–Fermi approach of Scalfi and co-workers,[11] whose Gaussian electrode charges carry that self-energy implicitly, and the ELECTRODE package solves it on the same particle mesh at constant potential or at constant charge.[26] What samQEq adds is a fluctuating-charge electrolyte, constrained molecule by molecule from the connectivity, in the same charge-equilibration solve as a Gaussian-regularized conductor, within LAMMPS and with a selectable kernel. The ELECTRODE package keeps the electrolyte at fixed charges; MetalWalls polarizes it through induced dipoles rather than fluctuating charges;[28] and the fragment-constrained model of Peuketi et al. learns its fragments and electronegativities inside a machine-learned potential for an oxide electrode, without a conductor self-energy.[24] A constant-potential/constant-current extension to samQEq is another natural next step.
| Route | Kernel | Long range | Constraint | Conductor |
| qeq/point, qeq/shielded, qeq/dynamic, qeq/fire | point or shielded | cutoff | global | no |
| qeq/slater | Slater | Wolf or DSF | global | no |
| qeq/reaxff, acks2/reaxff, qtpie/reaxff | shielded, tapered | cutoff | global (ACKS2, QTPIE attenuate transfer) | no |
| electrode/conp, electrode/conq | Gaussian | particle mesh | per electrode; electrolyte fixed | yes |
| qeq/sam (this work) | cube-root, Gaussian, Slater | particle mesh, inside the solve | per molecule and per conductor, or global | yes |
Table 6. Charge-equilibration routes in LAMMPS. “Long range” is how interactions beyond the cutoff enter the charge solve; “conductor” is whether the self-energy of a Gaussian charge can stabilize a hardness near zero.
samQEq builds on the QTPIE[5] and split-charge[6] QEq formulations, and differs in the variables retained. Those methods transform to charge-transfer or bond variables, which delivers the correct dissociation asymptotics directly; samQEq remains in atomic charges and applies the restriction through the constraint. The atomic-charge formulation keeps the solve in the same variables the pair styles and the reciprocal-space solver already use, which is what makes the evaluation of the reciprocal term inside the matrix-vector product and the composition of § 6 possible. The cost is that polarization is represented on atoms rather than along bonds, a limitation shared by all atom-centered charge models.[9]
Compared to ACKS2[7], which derives its response kernel from Kohn–Sham theory and thereby obtains the correct macroscopic polarizability scaling, samQEq is empirical: the separation between intramolecular and intermolecular response is imposed rather than derived. The two are nonetheless complementary: the ACKS2 bond-softness kernel is a run-time setting in samQEq and restores linear scaling (§ 10), so a system whose longitudinal response matters should use it. Obtaining both the correct scaling and the correct magnitude requires a reparameterization outside the scope of this paper. Finally, samQEq provides the same ingredients as recent machine-learned QEq approaches,[18, 21, 24] but does so as an abstraction layer independent of the short-range potential itself. § 6.3 provides a perspective on how its Gaussian kernel maps onto the Latent Ewald Summation approach.[21, 22]
Conclusions
In summary, we have developed samQEq, a charge-equilibration framework that holds molecules and conductors in one energy functional and one projected solve. One neutrality constraint per molecule gives the insulating limit of fluctuating-charge models, while a finite-width self-energy of a Gaussian charge, narrower than the conductor’s own, keeps the conductor’s part of the operator positive definite down to the conductor limit of the model. On a gold slab carrying a water film, of the four combinations of constraint and self-energy only the two together keep the operator definite down to the conductor limit without charge transfer between molecules, and the metal screens a point charge by a constant amount beyond 4 Å. The shielding kernel and the long-range treatment are run-time settings under full particle-mesh electrostatics inside the matrix-vector product. We validated the implementation by reproducing the published Slater-overlap TIP4P-FQ water model and the ReaxFF charge step with no refit. The Kokkos device implementation shows that a four-GPU node runs at about twice the throughput of a CPU node, and the package composes with fixed-charge and reactive force fields. We show that a converged, neutral charge set does not ensure the intended solve, and we document the initialization checks that catch the operator substitutions a converged residual cannot solve.
More generally, the molecular and conductor limits of charge equilibration are two conditions on one operator, and both can be imposed in the same solve. For the Gaussian kernel, Eq. (9) bounds the conductor’s contribution to that operator from below at any hardness, up to the mesh residual, so the conductor limit is well posed by construction rather than by tuning. An interface between an electrolyte and an electrode contains both limits, and a model that is well posed in only one of them cannot describe it.
This framework defines the next set of problems. The first is the physics of the framework itself: native fluctuating-charge water, the constraint axis between the molecular and metallic limits, conductors as a function of field strength and slab thickness, and the longitudinal polarizability of chain molecules. The frontier levels that every parameter file already carries are the basis for charge transfer between fragments gated by those levels, so that transfer switches on only where it is chemically allowed. Constant-potential electrodes, redox and grand-canonical charge exchange at electrochemical interfaces build on the same solve. The initialization checks are the starting point for a systematic treatment of silent operator substitutions in charge solvers. Coupling to machine-learned potentials that predict the electronegativities requires no derivative on the charges (§ 6.3), and Drude-like shells enter the solve as fixed charges through their field in b (§ 4.3). samQEq thus makes molecules, conductors and the interfaces between them one electrostatics problem, available to any LAMMPS potential through a single constrained solve.
CRediT authorship contribution statement
Nicholas Solan: Data curation, Formal analysis, Investigation, Methodology, Validation, Writing – review & editing. David Sun: Data curation, Formal analysis, Investigation, Methodology, Validation, Writing – review & editing. Tod A. Pascal: Conceptualization, Formal analysis, Funding acquisition, Methodology, Project administration, Software, Supervision, Writing – original draft, Writing – review & editing.
Declaration of Competing Interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.
Data Availability
The samQEq source, the regression suite, the patches and the example decks, including the runnable example kernel_comparison, which exercises both kernels of Table 3 in a 40 Å cell, are available at https://github.com/atlas-nano/codes/tree/main/samqeq; the version described here, 1.0.2, is archived at Zenodo.[40] The data and scripts that reproduce the figures are available at https://github.com/atlas-nano/manuscript-data/tree/main/samqeq-molecules-conductors.
Acknowledgments
This work was supported by the U.S. National Science Foundation through grant CBET-2145144. This research used resources of the National Energy Research Scientific Computing Center, a DOE Office of Science User Facility supported by the Office of Science of the U.S. Department of Energy under Contract No. DE-AC02-05CH11231 using NERSC award DDR-ERCAP0039121. This work used Expanse at the San Diego Supercomputer Center through allocation TG-DMR190106 from the Advanced Cyberinfrastructure Coordination Ecosystem: Services & Support (ACCESS) program, which is supported by U.S. National Science Foundation grants #2138259, #2138286, #2138307, #2137603 and #2138296. T.A.P. acknowledges support from the Alfred P. Sloan Foundation.
Supplementary Material
The Supplementary Material provides the per-fragment projector; the long-range reciprocal-in-matrix-vector construction; the solvers and their convergence criteria; the dense diagonalization of the constrained operator and its check against the solved charges; the water model parameters and protocols; the construction and protocol of the molecule–conductor interface; the regression suite; the device benchmark; and the sensitivity to the charge-solve tolerance.
Supplementary Material for samQEq: universal charge equilibration for molecules and conductors
Nicholas Solana; David Sun; Tod A. Pascal
si.pdf
Computational approach
The per-fragment projector
Fragments were identified by molecule ID and the projector of Eq. (7) was applied to the matrix-vector product output, to the search directions and to the right-hand side, so that the Krylov method sees the symmetric operator of Eq. (6). In the absence of molecule IDs, the code treats every atom in the group as a single fragment. We formed the per-fragment sums over the occupied fragments rather than over the largest molecule ID, which keeps the cost independent of how molecule IDs are numbered; the sums, and hence the charges, are the same either way.
Long-range electrostatics inside the matrix-vector product
Both long-range modes of § 5 of the main text were run under a thermostat (Table S2). The intramolecular-only mode sits closer to the polarization catastrophe (§ 5 of the main text), at which the charges polarize without bound.[1] We measured the grid-dependent reciprocal self-term once per set of mesh dimensions and Ewald parameter, rather than at every run start, which avoids recalibrating on a grid that has not yet been finalized. Each of the sixteen default probes pairs one of the lowest global tags with its nearest partner between 0.1 Å and 2.5 mesh spacings. Every recalibration is checked against the first at the same mesh, and the run aborts at a 2% departure. The exact per-atom route subtracts the analytic periodic-image term from each atom’s own grid self-potential and is re-evaluated at every solve.
| Model | , (Å) | (fs) | Ensemble, damping | Run |
| Ported, shipped deck | 256, 19.713 | 0.25 | NVT 298 K, 0.02 or 0.1 | eight seeds (20 ps equil. + 100 ps) |
| Ported, all-pairs-shielded | 256, 19.713 | 0.25 | NVT 298 K, 0.02 | three seeds 10 ps |
| Native | 512, 24.800 | 1.0 | NPT 298 K, 1 bar; 0.1, 1.0 | 15 ps equil. + 15 ps |
Table S2. Production protocols. is the number of water molecules, the cubic box edge. Thermostat and barostat damping times follow the LAMMPS convention, in picoseconds. The ported model is reported against Ref. [1] rather than against experiment. The shipped-deck dipole of § 9.2 of the main text is the mean over the eight runs of the first row, with the standard error over runs; the all-pairs-shielded dipole is the mean over the three runs of the second row, with the standard error over runs.
The solvers
Projected MINRES and the stall gate
MINRES[2] is provided for indefinite operators. It does not replace the group-membership check of § 8.3 of the main text, which refuses such a solve at initialization. We solved by the MINRES algorithm unpreconditioned, where is the vector of charge deviations and the projected right-hand side. The approach builds a Lanczos[3] tridiagonalization of and applies a Givens QR factorization to it, and minimizes over the Krylov subspace. The only requirement is symmetry; positive definiteness is not assumed. The operator is singular by construction, since the projector annihilates one direction per fragment, and MINRES carries no general guarantee on a singular system. Indeed, iterations of an inconsistent solve can grow without bound while the residual norm settles at its least-squares floor, and a minimum-norm solution needs MINRES-QLP[4] rather than MINRES. Neither applies here. The right-hand side is projected, the operator maps the constrained subspace into itself, and the iteration starts inside it, so the system MINRES actually sees is consistent, and the null space is never excited.
We initialized , the unnormalized Lanczos vectors , the direction vectors , , and . Each iteration forms the Lanczos vector , applies the operator, orthogonalizes against the two previous Lanczos vectors to give the tridiagonal entries and , and then updates the QR factors as
where and are the cosine and sine of the current Givens rotation, and are the running diagonal and subdiagonal of the factorized tridiagonal, and are the two off-diagonal carries, is the rotation norm, is the current solution coefficient, and is the residual norm. We then applied the three-term recurrence for the direction vectors and accumulated .
Because is the residual norm, the stopping test is a true relative residual and is dimensionally invariant, unlike a preconditioned conjugate-gradient criterion built from (with the diagonal preconditioner), which carries the units of the preconditioner. Because the matrix-vector product projects its output, every Lanczos vector remains in the constrained subspace, so the method solves the projected problem with no further machinery.
The stall gate. From Eq. (S4), , so measures the per-iteration residual reduction directly. A value of close to unity means only that the residual has stopped falling (consistent with growth along a near-null direction) but does not strictly establish it. Stagnation can follow from clustered eigenvalues, from loss of Lanczos orthogonality in finite precision, and, were the projected right-hand side ever inconsistent, from the residual settling at its least-squares floor. The criterion is therefore an empirical detector for growth along a near-null direction of a near-singular operator in finite precision, rather than a diagnosis of its cause. The gate is a heuristic safeguard, a bounded early termination rather than a regularized solve. We applied it on (i.e., on less than half a percent reduction per iteration), and on a charge magnitude above a cap. When both held, we terminated the iteration and returned the bounded, regularized iterate. Gating on the charge magnitude alone proved to be incorrect: MINRES here is non-monotonic, so a healthy converging solve may transiently exceed the cap, and truncating it would return a non-finite result for a system that otherwise solves correctly.
Deployment. We left projected conjugate gradient as the default path. When a solve returns a maximum charge magnitude above a threshold, we re-solve that same step with MINRES with the truncation cap engaged. The user may also select MINRES directly (§ 7.3 of the main text) if desired.
The eigenvalue estimate and the configuration-smooth ridge
We estimated the smallest eigenvalue of the projected operator from an -step Lanczos tridiagonalization and obtained the smallest eigenvalue of the resulting tridiagonal by Sturm-sequence bisection. The Sturm count is
where is the trial shift, the identity, the triangular factorization with unit-diagonal and pivots on the diagonal of , and the eigenvalues of . In short, is the smallest for which , which we located by bisection from Gershgorin spectral bounds.[5]
The bisection returns the smallest eigenvalue of to the requested tolerance, but that is a Ritz value, a Rayleigh quotient on the Krylov space, and therefore an upper bound on of the full operator. The error is one-sided in the direction that matters: an unconverged can only miss a negative mode, never invent one. On one interface cell, returns eV where gives eV. The implementation therefore also reports the -step Ritz value from the same tridiagonal, which costs nothing, and warns once if the two estimates still differ.
We then set a Tikhonov ridge such that meets a specified floor.[6, 7] Because is a continuous function of the configuration when it is recomputed at every step, the charges and hence the forces then vary continuously through a near-critical configuration. Recomputed every steps, is piecewise constant and the forces jump at each update. Because the Ritz value is an upper bound, an unconverged estimate can also set too small to reach the floor. A discrete escalation, raising the ridge in steps when a solve misbehaves, instead makes the forces discontinuous. The ridge is not part of the reported energy, so forces are not conservative while it is active.
The Lanczos estimate costs matrix-vector products. Recomputing it every steps rather than every step reduced the wall time of a 512-molecule water run under the full solve in the microcanonical ensemble by a factor of 1.5 at , with the same energy drift.
Dense diagonalization of the benchmark operator
We took the final configuration of a 30 ps isothermal–isobaric run of the shipped deck of the benchmark water model (512 molecules, 298 K, 1 bar, pinned self-term), solved its charges once to a relative residual of with the conjugate-gradient path and the fallback disabled, and rebuilt the constrained operator from the geometry and the parameter file. Here, , with the cube-root kernel at Å for every pair inside the 10 Å solve cutoff, and the reciprocal-space term as an Ewald sum at the splitting parameter and self-term the solve applies, 0.33957 Å and 0.37933 Å (in units of ). The rebuilt operator reproduces the solved charges to 3.3 × e at a particle-mesh accuracy of and to 2.7 × e at . On the 1024-dimensional constrained subspace it has eV and eV, a condition number of 8.03 and no negative eigenvalue. The 512 exact zero modes of the projector, one per molecule, are removed by the change of basis: 1536 atomic degrees of freedom carry 512 neutrality constraints, leaving the 1024 reported here. The real-space kernel alone, truncated at 10 Å, has 273 negative eigenvalues, so the measurement keeps the reciprocal term. A fresh single point on the same configuration retunes the splitting parameter to 0.34576 Å; used with the pinned self-term, the retuned splitting shifts every eigenvalue by +0.10 eV and lowers the solved dipole to 2.62 D.
Water models: parameters and protocols
Zero-refit port of a published model
We used the exact Slater kernel of Table 1 with the published exponents (Table S1) and no parameter adjustment, in the intramolecular-shielding-only mode that matches that model’s structure,[1] and repeated the liquid simulation in the all-pairs-shielded mode over three independent trajectories (Table S2). § 9.2 of the main text reports the dipoles.
| Model | Type | 4th col. | |||
Ported TIP4P-FQ (bare intermolecular), Ref. [1], kernel slater, (Å) | |||||
| O | 0.00 | 100.00 | 3.0803 | 0.0 | |
| H | 4.50 | 15.31 | 1.7007 | 0.0 | |
| M | 7.47 | 16.11 | 3.0803 | 0.0 | |
Benchmark water (native fluctuating-charge model, fitted to the gas dipole and liquid density), kernel cbrt, (Å) | |||||
| O | 6.7721 | 15.1145 | 1.11 | 0.0 | |
| H | 4.5000 | 16.1595 | 1.11 | 0.0 |
Table S1. samQEq per-type parameters for every model reported in this work. is in eV and in eV; the fourth column is read according to the active kernel, as named per model. is the reference charge about which the on-site expansion is taken. The frontier levels eV and eV are carried by every type and enter no calculation reported here.
Parameter sets
The parameter-file format is given in § 7.3 of the main text. The fourth column is read according to the active kernel, so Table S1 labels it per model. The Slater exponents of the ported model are the published values converted from atomic units, Å for the oxygen and M-site 2s form factor and Å for the hydrogen 1s. Both O and M carry the oxygen form factor, following the convention of the original model, in which the M site borrows the oxygen exponent although it sits 0.15 Å off the oxygen nucleus. Nothing else was adjusted.
Simulation protocols
Table S2 collects the box, ensemble and run length of each production simulation reported in the main text. Both models use a rigid-molecule integrator for the nuclear degrees of freedom, and all production charge solves use a convergence tolerance of on the relative residual, which § 28 shows lies well inside the property plateau. Reciprocal-space sums use the particle-mesh solver at a relative accuracy of for the ported model and for the native model.
The ported liquid was run from the shipped deck with eight velocity seeds, each equilibrated for 20 ps at ps (the shipped value) and then continued for 100 ps of production at and 0.1 ps, with the grid self-term pinned at its calibrated value. Seven of the eight starts give a mean molecular dipole of 2.6299 D at 0.02 ps and 2.6298 D at 0.1 ps, so the strong coupling does not bias it, and 2.630 ± 0.004 D over the seven (standard deviation over starts; standard error 0.0014 D). The eighth settles during its equilibration into a network with fewer hydrogen bonds, 3.53 per molecule against 3.59 to 3.65 in the others (intermolecular O⋯H within 2.4 Å), and holds a dipole of 2.55 D through 100 ps at both couplings. A Born–Oppenheimer re-solve of its configurations reproduces the propagated dipole to D, so the lower value belongs to the structure, not to the charge propagation.
Molecules and a conductor in one solve: building and simulation protocol
We built the interface of § 9.1 of the main text from two systems distributed with the package, with no parameters fitted to explicitly describe the interfacial interactions. The metal is the 240-atom Au(111) slab of § 4.4: five layers of 48 atoms in a 17.651 × 20.381 × 60 Å cell, layers at to 19.608 Å, periodic in the plane and free normal to it, with a nearest-neighbor distance of 2.942 Å (a lattice constant of 4.16 Å, 2% above the experimental 4.078 Å; the Thomas–Fermi conversion of the main text uses the experimental atomic density), eV, a Gaussian radius of 1.618 Å and a self-energy width of 0.5 Å when the self-energy is on. The water is the Gaussian-kernel port of 4-site TIP4P-FQ distributed with the package (examples/tip4pfq_liquid), whose oxygen is uncharged and whose hydrogen and massless M sites carry the fluctuating charges. Its Gaussian radii, 0.404355 Å for H and 0.315328 Å for M, were fitted so that the kernel reproduces the model’s own intramolecular Coulomb integrals at the rigid geometry, at 1.5139 Å and at 0.8735 Å. The hardnesses and electronegativities are those of Rick et al.[1] Every site uses the Gaussian kernel with the default ; the pair cutoff is 12 Å, the solve cutoff 10 Å, and the particle mesh is that of the bare slab (pppm/samqeq, accuracy , kspace_modify slab 3.0 mesh 24 28 80 gewald 0.35).
We performed a single solve at a fixed configuration, on one rank, to a relative residual tolerance of , with no applied field. Under the global constraint all atoms share one fragment; under per-molecule constraints each water molecule is its own fragment and the slab another. We scanned the gold hardness over 5.172, 2.5, 1.0, 0.3 and 0.05 eV; the parameter file requires , and 0.05 eV stands as the conductor limit. For the spectrum we recovered the operator, column by column, by applying its own matrix-vector product (diagonal, real-space kernel and reciprocal term with the grid self-term removed) to each unit vector of the 483 solved sites. We projected it onto an orthonormal basis of the constrained subspace (482 dimensions under the global constraint, 401 under per-molecule constraints), and diagonalized it densely. The recovered operator is symmetric to relative accuracy and, solved directly, reproduces the charges of the code to within e at every point. Its smallest eigenvalue agrees with the code’s 200-step Lanczos estimate (§ 22.2) to eV. The molecular reference is the same film with the slab deleted. Molecular dipoles are taken about the oxygen. Under the global constraint the molecules carry net charge and their dipoles are origin-dependent.
For the screening test we replicated the slab three times in each lateral (xy) direction (2160 atoms, 52.95 × 61.14 Å) and placed a fixed +1 e point charge a height above the top plane and a fixed −1 e the same height below the bottom plane. Both test charge locations are at the lateral center, and both are outside the solve group, so that they enter only through their field in . The cell therefore stays neutral. The mesh was 72 × 84 × 80. Since site charges are a poor measure of the screening (the Gaussian densities of adjacent layers overlap), we integrated the Gaussian density of every gold site, at the width of the pair kernel between gold sites, over the half-space above the slab’s mid-plane. The exact image energy of a point charge at height above a conducting plane at , with the lateral periodicity of the cell of area , is with , the sum running over the in-plane reciprocal vectors. We then fitted to the interaction energies for Å. The water-electronegativity offset shifted of H and M together by −2 to +2 eV on the fixed film. The self-energy width was scanned from 0.3 to 2.378 Å on the five-layer slab of § 4.4 in the uniform field of 0.5 V Å. To decompose the excess screening, the same field test was repeated on slabs of 3, 5, 7, 9, 13 and 17 layers and at gold Gaussian radii from 0.5 to 2.4 Å, and the point-charge test on 13 layers; separately uniform response was also reproduced, to , by a one-dimensional model of the layer charges with Gaussian-sheet interactions and the net on-site hardness .
For MD, we kept the water rigid (fix rigid/nvt/small, 298 K, damping 0.1 ps, bodies keyed on a per-atom label so that the global-constraint arm can place all atoms in one fragment without merging the bodies), held the gold fixed, and added a generic Au–O Lennard-Jones term ( Å, eV) to keep the film on the slab. This term is not a fitted gold–water potential; it is sufficient to keep the charge solve. Each arm ran 25,000 steps of 0.2 fs, the timestep of the distributed Gaussian TIP4P-FQ example (examples/tip4pfq_liquid), solving to a relative residual of at every step. The metal-free control is the same film with the slab deleted. Under pair_style hybrid/overlay the
coul/shield/intra coefficients must be given for every pair of solved types, as pair_coeff * * or one line per pair (§ 8.3 of the main text); the fix refuses a deck that omits one and names the missing pairs.
The two single-solve arms at the ends of the hardness scan ship with the package as the regression cases conductor_water_samqeq and conductor_water_qeq. The data and scripts that reproduce the figures are at https://github.com/atlas-nano/manuscript-data/tree/main/samqeq-molecules-conductors.
Regression suite
Table S3 lists the 22 regression cases of § 9.4 of the main text, grouped by what they pin. All 22 pass at the source commit from which the package is distributed.
| Group | Cases |
| Water models and long-range paths | spcfq_gas_dsf, spcfq_gas_ewald, spcfq_liq_ewald, tip4pfq_gas |
| Shielding kernels and fixed charges | slater_gas_kernel, shield_special00, ionfield_cl_water |
| Charge dynamics | spcfq_xl, spcfq_xl_staircase, aspc_corrector |
| Constraint and set-up | charge_solid_global, second_run_molinv, recalib_on_grid_change |
| Grid self-term | recip_self_peratom |
| Slabs and the conductor limit | slab_ewald3dc, slab_ewald_sawtooth, metal_slab_gself, gself_cluster_energy |
| Molecules and a conductor in one solve | conductor_water_samqeq, conductor_water_qeq |
| Augmented solve | bondsoft_gas, metal_ilu_group |
Table S3. The regression cases, grouped by what they pin. Each is a LAMMPS input deck with its committed reference charges; the names are those of the distributed test directory.
Device benchmark
We built the benchmark from the water model of § 5 of the main text, replicated to 12,288, 98,304, 331,776 and 786,432 atoms, with two changes that keep the whole step on the device: we constrained bonds and angles with SHAKE rather than integrating rigid bodies, for which no device integrator exists, and ran at fixed volume at the lattice density of 1.004 g cm with a Nosé–Hoover thermostat at a 1 fs timestep. All intramolecular pairs stay in the pair styles at full weight, as in the native model. We solved the charges to the shipped tolerance of at every step, or advanced them with ASPC with two corrector iterations, and ran 1000, 200, 100 and 50 steps at the four sizes. We ran the CPU benchmarks on one Expanse CPU node with 128 MPI ranks bound to cores, and the GPU benchmarks with one MPI rank per V100, the device solve enabled (fix_modify <id> devsolve on), the Kokkos package with Newton’s third law on and half neighbor lists, and GPU-aware MPI. The MPI library is CUDA-aware at run time. Before timing, host and device forces at fixed charges agreed to eV Å on one and two GPUs, and host and device charges agreed to e after ten steps.
Sensitivity to the charge-solve tolerance
We scanned the charge-solve tolerance over ten orders of magnitude on the water benchmark of § 5 of the main text, on a configuration of 512 molecules taken from the end of a 30 ps NPT run of the shipped deck, and recorded the mean molecular dipole and the number of Krylov iterations at each setting. The solve was run with the automatic fallback disabled, so that a struggling solve reports its own failure rather than being rescued, and with the self-term, Ewald splitting parameter and mesh of the production run, so that the only quantity varying across the scan is the tolerance. The splitting parameter must be held with the self-term (§ 23). Charges were solved once at each setting on the fixed configuration, which isolates the accuracy of the solve from any propagation of error through dynamics. The converged dipole is 2.7987 D.
The dipole was found to be insensitive to the tolerance across nine of the ten orders of magnitude (Figure S1), and the settings at and tighter are identical to ten significant figures, while the cost keeps rising. The property plateau is therefore reached well before the residual stops falling, and the shipped tolerance sits inside it.
Figure S1. Sensitivity of the solved dipole to the charge-solve tolerance , on the 512-molecule native fluctuating-charge water at fixed geometry, the final configuration of a 30 ps isothermal–isobaric run solved with the self-term, Ewald splitting parameter and mesh of the production run. is the mean molecular dipole of that configuration. Tolerance loosens to the left. (a) The dipole is flat to D from to and within D at (blue), and breaks at (orange), where the solver reports convergence after two iterations and returns a value 3.0% low. The dotted line marks the converged dipole, 2.798710 D. (b) Krylov iterations against the same axis, growing by about three per decade. The dashed line in both panels marks the of the shipped decks; the arrow spans the range over which a further eighteen iterations change no reported digit of . Solved with the automatic fallback disabled.
The plateau does break, however, at the loosest setting tried, and the failure carries no diagnostic of its own: the residual is below tolerance, the charges sum correctly and nothing in the output distinguishes the answer from a converged one. A converged label is therefore necessary but not sufficient evidence of a correct solve.
Code and data availability
The samQEq package, including the source, the regression suite, the patches and the example decks, is available at https://github.com/atlas-nano/codes/tree/main/samqeq; version 1.0.2 is archived at https://doi.org/10.5281/zenodo.23629400. The data and scripts that reproduce the figures are available at https://github.com/atlas-nano/manuscript-data/tree/main/samqeq-molecules-conductors.
References
- [1]S. W. Rick, S. J. Stuart, B. J. Berne, Dynamical fluctuating charge force fields: Application to liquid water, The Journal of Chemical Physics 101 (1994) 6141–6156. doi:10.1063/1.468398.DOI
- [2]C. C. Paige, M. A. Saunders, Solution of sparse indefinite systems of linear equations, SIAM Journal on Numerical Analysis 12 (1975) 617–629. doi:10.1137/0712047.DOI
- [3]C. Lanczos, An iteration method for the solution of the eigenvalue problem of linear differential and integral operators, Journal of Research of the National Bureau of Standards 45 (1950) 255–282.DOI
- [4]S.-C. T. Choi, C. C. Paige, M. A. Saunders, MINRES-QLP: A Krylov subspace method for indefinite or singular symmetric systems, SIAM Journal on Scientific Computing 33 (2011) 1810–1836. doi:10.1137/100787921.DOI
- [5]B. N. Parlett, The Symmetric Eigenvalue Problem, SIAM, 1998.
- [6]A. N. Tikhonov, V. Y. Arsenin, Solutions of Ill-Posed Problems, Winston, 1977.DOI
- [7]P. C. Hansen, Rank-Deficient and Discrete Ill-Posed Problems: Numerical Aspects of Linear Inversion, SIAM, 1998.



