Skip to content

Constant Potential Method ​

Module: sci_form::cpm (core since 2026-10-13; beta::cpm re-export) Feature flag: none (core); beta-cpm/experimental-cpm kept as no-op aliases


Validation and limits ​

QuestionAnswer
Compared withLAMMPS fix electrode/conp
Measured separationplate charge scale 1.76×; per-atom cosine similarity 0.44
Confidence regiongraphene bilayer, 3×3 cells, V = ±0.5/1/2 V, η = 1.979
Main limitationpoint-charge hardness 5 eV vs ~22 eV Gaussian self-energy; over-polarizes dense conductors

The raw rows and the exact tolerances are in the full validation matrix.


Overview ​

Extends charge and electronic property calculations by coupling the molecule to a "virtual electrode" at electrochemical potential μ. Charges fluctuate to equilibrate with the electrode, enabling simulation of quantum capacitance, charge response to potential, and electrochemical energy surfaces.


Theory ​

Grand Potential ​

The grand potential functional couples electronic energy with the electrode potential:

Ω({qi},μ)=Eelec({qi})−μ∑iqi

Minimizing with respect to charges {qi} yields the equilibrium charge distribution at potential μ.

Charge Equilibration at Fixed μ ​

The CPM equations are linear:

qi=μi−χi−∑j≠iJijqjηi⟺∑jMijqj=μi−χi,Mii=ηi,Mij=Jij

with Coulomb interaction:

Jij=14.3996ε⋅rij(kcal/mol per e²)

The solver inverts M directly (LU). The damped fixed-point iteration (q←(q+qnew)/2) was removed in 2026-10-13: it diverges for electrode-sized conducting systems (charges blow up to 1e157 on a graphene bilayer — spectral radius of J/η exceeds 1). LAMMPS electrode/conp likewise inverts the elastance matrix (mat_inv).

Multi-Electrode Setups ​

CpmConfig::mu_per_atom (optional, None = uniform mu_ev) assigns one applied potential per atom — e.g. plate A at +V/2, plate B at −V/2, as in LAMMPS fix electrode/conp ... couple. The grand potential generalizes to Ω=Eelec−∑iμiqi.

Electrochemical Energy Surface ​

Scanning μ produces the charge response curve Q(μ) and capacitance:

C(μ)=∂Q∂μ

computed via finite differences over the μ scan.


API ​

rust
use sci_form::cpm::*;

// CPM charges at a given potential
let config = CpmConfig {
    mu_ev: -4.44,           // SHE reference (eV)
    dielectric: 78.5,       // water
    max_iter: 100,
    charge_tol: 1e-6,
    mu_per_atom: None,      // Some(vec) for multi-electrode setups
};
let result = compute_cpm_charges(&elements, &positions, &config);
// result.charges: Vec<f64>
// result.total_charge: f64
// result.grand_potential: f64
// result.converged: bool
// result.iterations: usize

// Electrochemical surface scan
let surface = compute_cpm_surface(&elements, &positions, mu_min, mu_max, n_points, dielectric);
// surface.mu_values: Vec<f64>
// surface.total_charge: Vec<f64>
// surface.free_energy: Vec<f64>
// surface.capacitance: Vec<f64>

Potential Scale ​

Referenceμ (eV)
SHE (Standard Hydrogen Electrode)−4.44
+1 V vs SHE−3.44
-1 V vs SHE−5.44
Typical scan range[−5.5,−3.5]

Applications ​

  • Quantum capacitance of molecular electrodes
  • Redox potential estimation: E0=−ΔΩ/nF
  • Conformer ranking under electrochemical bias
  • Charge response analysis for molecular electronics

Tests ​

bash
cargo test --features beta-cpm --test experimental_gates -- test_cpm

9 integration tests (tests/experimental/test_cpm.rs) covering: charge equilibration convergence, total charge response to potential, monotonic charge-potential relationship, grand potential computation, capacitance positivity, electrochemical surface scanning, solvent dielectric effects, multi-element systems, and the LAMMPS bilayer comparison.

These tests live in the experimental_gates target — see Overview for the full command matrix.

Validation vs LAMMPS (F95, 2026-10-13) ​

Oracle scripts/validation/oracle_cpm_lammps.py + fixture tests/fixtures/validation/cpm_lammps.json + gate test_cpm_bilayer_matches_lammps: graphene bilayer capacitor (two 3×3-cell flakes, AB @ 3.35 Å) at V = ±0.5/1/2 V vs LAMMPS fix electrode/conp (η=1.979). Compared on voltage-induced charges (ΔQ=Q(V)−Q(0), where χ cancels exactly): both exactly linear and antisymmetric; plate-Q scale 1.76x, per-atom pattern cosine similarity 0.44 (tolerances 2.5x / 0.3).

Model gap (documented): our point-charge hardness (ηC=5.0 eV) vs the Gaussian self-energy (~22 eV) — ours over-polarizes dense conductors (onsite too soft, edge oscillations). Path forward: Gaussian smearing in J (ELECTRODE-style) and/or retuned onsite hardness.

LAMMPS recipe notes: atom_modify map yes, kspace_modify gewald for uncharged starts, pair_coeff after read_data, two plates with couple (a lone electrode group stays neutral), charges solve while stepping (run 1), dump per-atom q.

Released under the MIT License.