Features
Coulomb is a library for working with electrolyte solutions and calculating electrostatic interactions in and between molecules and particles. The main purpose is to offer support for molecular simulation software.
- Temperature dependent dielectric permittivity models for common solvents.
- Handling of ionic strength and the Debye screening length.
- Automatic stoichiometry deduction for arbitrary salts.
- Extensive library of truncated electrostatic interaction schemes such as
Wolf, Reaction field, Real-space Ewald, generalized through a short-range function
trait. - Reciprocal-space Ewald summation for Coulomb and Yukawa potentials (PBC and IPBC), with automatic parameter optimization, mixed f32/f64 precision, and SIMD acceleration on x86_64.
- Ewald summation with and without implicit salt.
- Multipole expansion for energies, forces, fields between ions, dipoles, and quadrupoles.
- Extensively unit tested and may serve as reference for other implementations or approximations.
- Partial support for static unit of measure analysis via
uom. To enable, use theuomfeature flag. - Vector types use
mintfor interoperability with glam, cgmath, nalgebra, and other math libraries.
This is largely a Rust rewrite and extension of the CoulombGalore C++ library.
Examples
Dielectric Media and Electrolytes
Simple polynomial models are provided to obtain the relative permittivity or a Medium as a function
of temperature.
For working with the ionic strength, Salt of arbitrary valency can be given and the
required stoichiometry is automatically worked out.
use ;
let molarity = 0.1;
let medium = salt_water;
assert_eq!;
assert_eq!; // mol/l
assert_eq!; // angstrom
Multipolar Interactions
All pairwise schemes support calculation of potential, energy, field, force from or between multipolar particles, up to second order (ion-ion, ion-dipole, dipole-dipole; ion-quadrupole). Most scheme can be evaluated with or without a Debye-Hรผckel screening length.
Vector arguments accept any type implementing Into<mint::Vector3<f64>>, including simple arrays
and vectors from nalgebra, glam, cgmath, and other libraries with mint support.
use *;
let scheme = default; // Vanilla Coulomb scheme, ๐ฎ(๐)=1
let z = 1.0; // point charge, ๐ง
let r = ; // distance vector, ๐
let r_len = .sqrt;
let ion_pot = scheme.ion_potential; // potential |๐| away from charge
assert_eq!;
let mu = ; // point dipole, ๐
let dipole_pot = scheme.dipole_potential; // potential ๐ away from dipole
let energy = scheme.ion_dipole_energy; // interaction energy assuming ๐ = ๐(๐) - ๐(๐ง)
The image below is generated by examples/potential.rs and shows the calculated
electric potential on a plane containing a monopole and a dipole.

Reciprocal-Space Ewald Summation
The reciprocal module provides k-space Ewald summation for Coulomb (ฮบ=0) and Yukawa (ฮบ>0)
potentials with automatic parameter selection, O(N_k) Monte Carlo trial moves, and mixed-precision
SIMD acceleration.
use *;
// Automatic parameter selection for cutoff 5 ร
and target accuracy 1e-5
let mut ewald = new;
let = ;
let charges = vec!;
// Build structure factors from all particle positions
ewald.update_all;
// Reciprocal-space energy + self-energy correction
let energy = ewald.energy + ewald.self_energy;
// MC trial move: compute ฮE without mutating state
let de = ewald.energy_change;
// Forces for MD
let = ;
ewald.add_forces;
Both f32 and f64 input slices are accepted (generic over Into<f64> + Copy).
On x86_64 with the simd feature, a polynomial sin/cos with SIMD vectorization accelerates
the inner loops.
Unit analysis
Experimental support for static unit analysis can be activated with the uom feature.
use ;
let z1 = ;
let z2 = ;
let r = ;
let energy = without_cutoff.ion_ion_energy;
assert_eq!;