> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/cuda/cupotential/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/cuda/cupotential/_mcp/server.

# Error Analysis

> Distinguish intrinsic splitting error from extrinsic mesh error, then interpret the convergence and NVE energy-drift studies.

The accuracy of a particle-mesh calculation depends on how well the splitting
represents the physical interaction and how accurately the mesh evaluates it.
**Intrinsic error** belongs to the decomposition itself. **Extrinsic error**
arises from discretization onto a mesh, including its finite Fourier range,
spreading, aliasing, and interpolation.

The convergence plots compare energies and forces at fixed particle positions.
The [NVE study](#nve-energy-drift) tests a different property: how well the
resulting dynamics conserve energy over time.

## Intrinsic and extrinsic error

We follow the definition in Section IV A of Predescu et al.,
[*The u-series: A separable decomposition for electrostatics computation with improved accuracy*](https://pubs.aip.org/aip/jcp/article/152/8/084113/199370/The-u-series-A-separable-decomposition-for),
*The Journal of Chemical Physics* **152**, 084113 (2020):

> We start by focusing on errors that are intrinsic to the decomposition
> scheme: those that remain even if the direct and *k*-space sums are performed
> exactly.

Fix the decomposition parameters, including its prescribed short-range cutoff,
and evaluate its direct and complete Fourier sums exactly, with matching self
and boundary corrections. Any remaining difference from the physical interaction
is intrinsic. Here, **extrinsic** names the additional error from evaluating
that decomposition on a mesh.

### Intrinsic error: the decomposition itself

A decomposition can define an approximate pair interaction even before a mesh
is introduced. For example, cutting off or shifting the Ewald short-range
kernel changes the interaction it represents. The u-series is exact within its
prescribed cutoff but approximates $1/r$ beyond it. These discrepancies remain
when the sums for the chosen decomposition are evaluated exactly.

An exact decomposition has no intrinsic error under this definition. In the
[C2 Prolate construction](/cuda/cupotential/theory/splitting), $u_{\mathrm{lr}}=1/r$ beyond
$r_c$, and $u_{\mathrm{sr}}$ is its exact complement inside the cutoff. Those
mathematical functions therefore reconstruct $1/r$ everywhere. This statement
concerns the decomposition; its evaluation on a finite mesh still has error.

In particular, its Fourier kernel has a nonzero tail. Omitting modes to fit a
finite mesh introduces extrinsic error. Evaluating every retained coefficient
exactly does not recover the omitted modes.

### Extrinsic error: discretization onto a mesh

The ideal reciprocal sum uses the point-charge structure factor

$$
S(\mathbf k)=\sum_i q_i e^{-i\mathbf k\cdot\mathbf r_i}.
$$

The mesh method approximates this calculation through spreading, an FFT,
Fourier scaling, and gathering over a finite set of modes. Its error depends
on the grid spacing, assignment window and support, deconvolution rule, and
how forces are recovered at particle positions. Sampling introduces aliases;
interpolation introduces further approximation. Deconvolution compensates the
assignment window, but cannot recover omitted modes or remove all aliasing.
The [spreading guide](/cuda/cupotential/theory/spreading) derives those steps.

The same window can give different errors with different splittings because
each physical Fourier kernel weights the affected modes differently.

### How to separate the contributions

Let $\mathbf F_{\mathrm{exact}}$ be the force from the physical interaction,
$\mathbf F_{\mathrm{split}}$ the force from exact evaluation of the chosen
decomposition, and $\mathbf F_{\mathrm{mesh}}$ the force after mesh discretization.
Use exact kernels and arithmetic at the same particle positions and box, with
consistent boundary and correction conventions:

$$
\begin{aligned}
\Delta\mathbf F_{\mathrm{intrinsic}}
&=\mathbf F_{\mathrm{split}}-\mathbf F_{\mathrm{exact}},\\
\Delta\mathbf F_{\mathrm{extrinsic}}
&=\mathbf F_{\mathrm{mesh}}-\mathbf F_{\mathrm{split}}.
\end{aligned}
$$

Their vector sum is $\mathbf F_{\mathrm{mesh}}-\mathbf F_{\mathrm{exact}}$,
the force error of the mesh approximation under these assumptions. The same
subtraction separates signed energy errors. **Error magnitudes generally do
not add:** the contributions can reinforce or cancel one another.

To measure them separately, first converge the evaluation of the chosen
decomposition and compare it with a converged physical reference. Then compare
the practical mesh result with that decomposition result. In practical
calculations, polynomial kernel fits, tabulated Fourier coefficients, and
floating-point roundoff can affect both evaluations. Control these effects
when measuring either contribution.

The plots below use finite precision and a reference with finite resolution.
They include intrinsic and extrinsic errors together with the effects of kernel
evaluation, roundoff, and the reference itself.

## Mesh convergence

The plots below vary the number of grid points while keeping the splitting
parameters and real-space cutoff fixed. They show energy and force errors at
**6 Å and 9 Å cutoffs**. Increasing the grid size expands the retained Fourier
range and changes the assignment error. The decomposition stays fixed, so its
intrinsic error is unchanged while these extrinsic contributions vary.

All curves use the same C2-order-3 (C2O3) spreading and interpolation window
with discrete deconvolution. C2O3 names the assignment window; C2 Prolate names
the splitting. Holding the window fixed allows the splittings to be compared
with the same assignment rule, though mesh error remains. The Ewald curves
therefore use this common mesh calculation rather than stock OpenMM PME.
The cuPotential curves are shown in green.

### What the axes measure

The horizontal axis is $G$, the **number of mesh points per axis**. Each
calculation uses a $G\times G\times G$ mesh; for a cubic box of side $L$, its
spacing is $h=L/G$. The study samples
$G=32,48,64,80,96,128,160,192,224$.

Each saved frame is compared with an OpenMM double-precision reference. The
upper panels show the relative energy error of the interaction channel:

$$
\epsilon_E=
\frac{|E-E_{\mathrm{ref}}|}{|E_{\mathrm{ref}}|}.
$$

The lower panels show the relative force error across all particles:

$$
\epsilon_F=
\frac{\left(\sum_i\|\mathbf F_i-\mathbf F_{i,\mathrm{ref}}\|^2\right)^{1/2}}
     {\left(\sum_i\|\mathbf F_{i,\mathrm{ref}}\|^2\right)^{1/2}}.
$$

Here, “total” includes the direct and reciprocal contributions and their self
and exclusion corrections **within one interaction channel**. Coulomb and
attractive dispersion are evaluated separately. The force metric measures the
norm of the error over all particles; it is not the largest per-particle error
or the error in the complete molecular force field.

#### Frame averages and error bars

Each point combines $M=25$ saved NPT frames. For either error metric, the mean
and standard deviation of the logarithmic errors are

$$
\mu=\frac{1}{M}\sum_{f=1}^{M}\log\epsilon_f,
\qquad
\sigma=\left[\frac{1}{M}\sum_{f=1}^{M}
               (\log\epsilon_f-\mu)^2\right]^{1/2}.
$$

The plotted value is the geometric mean $e^\mu$, and the error-bar endpoints
are $e^{\mu-\sigma}$ and $e^{\mu+\sigma}$. These bars describe variation between
the saved frames; they are not confidence intervals. The dashed
$5\times10^{-4}$ line in the force panels is a comparison guide, not a bound
that every frame must satisfy.

### Coulomb convergence

The Coulomb channel uses the physical $1/r$ interaction. The comparison includes
Ewald splitting, u-series 2, and cuPotential's C2 Prolate splitting. Within each
cutoff panel, their splitting parameters stay fixed while the mesh changes.

![Coulomb energy and force errors versus mesh points per axis at 6 and 9 angstrom cutoffs, comparing fixed Ewald, u-series 2, and cuPotential splitting over 25 water frames.](/cuda/cupotential/_fern-files/_img/adbf981a1cfce969194a4be524ae294eb700c3135e33c77ccbc71b45b169e75e.webp)

*Coulomb convergence for the saved water system. Columns show the 6 Å and 9 Å
cutoffs; rows show energy and force errors. All curves use C2O3 spread/gather
and discrete deconvolution. The reference uses OpenMM PME in double precision
with a $192^3$ mesh.*

The cuPotential force error falls across most of the sweep. The fixed Ewald
and u-series curves level off sooner. These are total-error curves: they show
where refinement stops helping for these settings, but do not isolate the
intrinsic or extrinsic contribution. Energy errors need not decrease
monotonically: contributions can cancel without a corresponding reduction in
force error.

### Attractive dispersion convergence

The dispersion channel is the attractive $-C_{6,ij}/r^6$ interaction. Its
reference uses OpenMM LJPME with the repulsive $r^{-12}$ contribution subtracted.
Consequently, these plots describe attractive dispersion rather than the full
Lennard-Jones potential.

![Attractive dispersion energy and force errors versus mesh points per axis at 6 and 9 angstrom cutoffs, comparing fixed Ewald and cuPotential splitting over 25 water frames.](/cuda/cupotential/_fern-files/_img/2955b135095b3da17f38b184a90c197c98916492053d3c2f0bc91f8aac39a7c4.webp)

*Attractive dispersion convergence for the same saved frames. The splitting
parameters, C2O3 spread/gather, and discrete deconvolution are fixed within each
panel. The reference uses OpenMM LJPME in double precision with a $192^3$ mesh,
after removing the repulsive contribution.*

At 6 Å, the cuPotential force error decreases throughout the tested range. At
9 Å, it begins to level off on the finer meshes. The fixed Ewald curves plateau
earlier. As in the Coulomb comparison, the plateau is an observation about the
complete calculation, not a measurement of the splitting error alone.

### Why a curve can level off

A plateau means that increasing $G$ alone is no longer reducing the dominant
observed error. Several mechanisms can produce it:

| Contribution                                     | What mesh refinement can change                                                                                                                       |
| ------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| Intrinsic decomposition error                    | The discrepancy in the prescribed near and far kernels remains fixed when the decomposition parameters and $r_c$ stay fixed.                          |
| Extrinsic Fourier truncation                     | More retained modes recover more of the long-range Fourier tail. Refinement cannot help if an independent spectral cutoff still excludes those modes. |
| Extrinsic assignment error                       | Finer spacing can improve spreading and interpolation, but the chosen window, support, and deconvolution rule also control aliasing and accuracy.     |
| Kernel evaluation, roundoff, and reference error | These can dominate once the other contributions are small; they require separate checks.                                                              |

The C2 Prolate curves retain every mode available on each mesh. A plateau
does not establish an intrinsic error floor. To identify its cause, converge
the Fourier sum for the chosen decomposition, vary the assignment window or
its support, and check kernel evaluation and reference accuracy.

The splitting parameters were not retuned during these sweeps. The results
describe these parameter choices and this water system; they are not separate
measurements of intrinsic splitting accuracy or comparisons at equal cost.

### Study conditions and reference resolution

| Setting                     | Saved study                                                                                                                 |
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| System                      | `water_100k`: 100,002 atoms with TIP3P-FB water parameters; first 25 saved NPT frames.                                      |
| Numerical path              | Host C++ real space in FP32, FP32 mesh/FFT storage, and FP64 reference stencil evaluation.                                  |
| Spreading and interpolation | C2O3 window with discrete deconvolution for every comparison curve.                                                         |
| Fourier support             | All modes retained by each mesh, including the C2 Fourier tail.                                                             |
| Cutoffs shown               | 0.6 nm and 0.9 nm (6 Å and 9 Å).                                                                                            |
| Coulomb comparison          | Ewald $\alpha=4.590$ and $2.989\;\mathrm{nm}^{-1}$ respectively; u-series 2 with $b\approx1.63$; C2 Prolate with $c=10.75$. |
| Dispersion comparison       | Ewald $\alpha=4.484$ and $1.968\;\mathrm{nm}^{-1}$ respectively; C2 Prolate with $c\approx12.764$.                          |
| OpenMM reference            | OpenMM 8.4.0, CUDA double precision, $192^3$ mesh, 2.0 nm real-space cutoff, $\alpha=4.0\;\mathrm{nm}^{-1}$.                |

The reference was also checked on the first frame using a $256^3$ mesh. The
relative differences between the $192^3$ and $256^3$ reference calculations were:

| Channel               | Energy difference   | Force difference    |
| --------------------- | ------------------- | ------------------- |
| Coulomb               | $4.25\times10^{-7}$ | $5.40\times10^{-6}$ |
| Attractive dispersion | $1.32\times10^{-7}$ | $2.36\times10^{-6}$ |

These checks show the change in the reference on the first frame. They do not
bound its error over all 25 frames. Near this scale, a difference from the
reference cannot be attributed entirely to either intrinsic or extrinsic
error in the method being tested.

## NVE energy drift

We run these trajectories in the microcanonical (NVE) ensemble. Many factors
can affect energy drift; here we focus on the contribution from any residual
jump at the cutoff of the short-range splitting term. Tight constraint
tolerances and Lennard-Jones switching help reduce other sources of drift.

This saved study compares cuPotential, standard OpenMM PME, and a converged
PME reference over **10 ns** for **10,000 rigid TIP3P-FB water molecules
(30,000 atoms)**. All three trajectories start from the same positions and
velocities and use a **2 fs timestep**.

![Mean-centered NVE total-energy traces over 10 ns. cuPotential on a 45 cubed grid has normalized signed drift plus 1.399 times 10 to the minus 6 per ns; standard OpenMM PME on a 60 cubed grid has plus 6.685 times 10 to the minus 4; the 128 cubed PME reference has minus 4.536 times 10 to the minus 7.](/cuda/cupotential/_fern-files/_img/ef08fc471925b04e6e67ead8d932e1d56e17129e6dbc8f668b835d9d180c03c9.webp)

*The cuPotential and standard PME runs use a 9 Å electrostatic cutoff. The
reference uses a 20 Å cutoff. Each trace is centered on its own mean energy
over 20 ps–10 ns.*

### Normalization and fitted drift

The vertical axis is

$$
\delta E(t)=
\frac{E(t)-\langle E\rangle}{N_{\mathrm{DOF}}k_{\mathrm B}T}.
$$

The study uses $N_{\mathrm{DOF}}=3\times30{,}000-30{,}000=60{,}000$: three
coordinates per atom, minus the rigid-water constraints. The normalization uses
a fixed reference temperature $T=300\;\mathrm K$. Centering
removes each trajectory's energy offset; it does not change its drift.

The legend reports the signed slope of a linear least-squares fit,
normalized by the same energy scale:

$$
d=\frac{1}{N_{\mathrm{DOF}}k_{\mathrm B}T}
\frac{dE_{\mathrm{fit}}}{dt}.
$$

The fit uses all **49,901 energy samples**, recorded every **0.2 ps** from
**20 ps to 10 ns**. The plotted curves show every 10 ps. A positive slope
means energy increases; a negative slope means it decreases.

| Method                  | Electrostatic cutoff | Grid    | Normalized signed drift ($\mathrm{ns}^{-1}$) |
| ----------------------- | -------------------- | ------- | -------------------------------------------- |
| cuPotential, C2 Prolate | 9 Å                  | $45^3$  | $+1.399\times10^{-6}$                        |
| Standard OpenMM PME     | 9 Å                  | $60^3$  | $+6.685\times10^{-4}$                        |
| Converged PME reference | 20 Å                 | $128^3$ | $-4.536\times10^{-7}$                        |

At these settings, standard PME has a clear positive drift, while cuPotential
and the reference show much smaller drift on the same scale. This difference
cannot be assigned to the splitting alone: the methods also use different
meshes and reciprocal-space evaluation rules.

### Simulation conditions

* **Initial state:** the same water configuration and velocities, with seed
  730201, in a fixed cubic box of side 6.698671 nm.
* **Integration:** synchronized velocity-Verlet with RATTLE constraints,
  a 2 fs timestep, and constraint tolerance $10^{-8}$. Production uses no
  thermostat, barostat, or center-of-mass velocity removal.
* **Precision:** OpenMM 8.4 on CUDA, with mixed precision for all three methods.
* **Electrostatics:** standard PME uses automatic parameter selection at
  error tolerance $5\times10^{-4}$; the reference fixes
  $\alpha=3\;\mathrm{nm}^{-1}$ and a $128^3$ grid.
* **Lennard-Jones interactions:** all three methods use the same 9 Å cutoff,
  a switching function starting at 8 Å, and no dispersion tail correction.

## Future directions

Future work will likely re-optimize the numerical parameters to minimize
**ensemble error**, rather than focusing primarily on force errors at fixed
configurations.