Skip to main content

Crate coulomb

Crate coulomb 

Source
Expand description

§Electrostatic Interactions and Electrolyte Solutions

This library provides support for working with electrostatic interactions in e.g. molecular systems. This includes:

  • Background dielectric medium with or without implicit salt.
  • Handling of electrolyte solutions with salt of arbitrary valency and ionic strength.
  • Calculation of pairwise interactions between ions and point multipoles using (truncated) potentials.
  • Ewald summation

§Interactions between Multipoles

Please see the pairwise module.

§Electrolyte Solutions

This provides support for calculating properties of electrolyte solutions such as the Debye length, ionic strength, and Bjerrum length. It also has a module for empirical models of relative permittivity as a function of temperature.

§Examples

The is a Medium of neat water at 298.15 K where the temperature-dependent dielectric constant is found by the permittivity::WATER model:

use coulomb::*;
let medium = Medium::neat_water(298.15);
assert_relative_eq!(medium.permittivity(), 78.35565171480539);
assert!(medium.ionic_strength().is_none());
assert!(medium.debye_length().is_none());

We can also add Salt of arbitrary valency and concentration which leads to a non-zero ionic strength and Debye length,

let medium = Medium::salt_water(298.15, Salt::CalciumChloride, 0.1);
assert_relative_eq!(medium.ionic_strength().unwrap(), 0.3);
assert_relative_eq!(medium.debye_length().unwrap(), 5.548902662386284);

The pairwise module can be used to calculate the interaction energy (and forces, field) between point multipoles in the medium. Here’s a simple example for the energy between two point charges:

use coulomb::{Medium, TO_CHEMISTRY_UNIT};
use coulomb::pairwise::{Plain, MultipoleEnergy};

let (z1, z2, r) = (1.0, -1.0, 7.0);      // unit-less charge numbers, separation in angstrom
let medium = Medium::neat_water(298.15); // pure water
let plain = Plain::without_cutoff();     // generic coulomb interaction scheme
let energy = plain.ion_ion_energy(z1, z2, r) * TO_CHEMISTRY_UNIT / medium.permittivity();

assert_relative_eq!(energy, -2.533055636224861); // in kJ/mol

Re-exports§

pub use reciprocal::EwaldPolicy;
pub use reciprocal::EwaldReciprocal;

Modules§

pairwise
Pairwise Electrostatic Interactions.
permittivity
Relative permittivity models
reciprocal
Reciprocal-space Ewald summation for Coulomb and Yukawa potentials.
units
Re-exported units from the uom crate.

Structs§

Medium
Implicit solvent medium such as water or a salt solution

Enums§

Error
Errors returned by this crate.
Salt
Common salts and valencies

Constants§

AVOGADRO_CONSTANT
Avogadro constant, Nₐ (mol⁻¹). CODATA 2018.
BJERRUM_LEN_VACUUM_298K
Bjerrum length in vacuum at 298.15 K, e²/4πε₀kT (Å).
BOLTZMANN_CONSTANT
Boltzmann constant, k (J/K). CODATA 2018.
ELEMENTARY_CHARGE
Elementary charge, e (C). CODATA 2018.
MOLAR_GAS_CONSTANT
Molar gas constant, R (J/(mol·K)). CODATA 2018.
TO_CHEMISTRY_UNIT
Electrostatic prefactor, e²/4πε₀ × 10⁷ × NA [Å × kJ / mol].
VACUUM_ELECTRIC_PERMITTIVITY
Vacuum electric permittivity, ε₀ (F/m). CODATA 2018.

Traits§

Cutoff
Defines a spherical cut-off distance
DebyeLength
Trait for objects where a Debye length can be calculated
IonicStrength
Trait for objects that has an ionic strength
Temperature
Trait for objects with a temperature

Functions§

bjerrum_length
Calculates the Bjerrum length, λ𝐵 = e²/4πε𝑘𝑇 commonly used in electrostatics (ångström).
debye_length
Calculates the Debye length in angstrom, λ𝐷 = 1/√(8π·λ𝐵·𝐼·𝑁𝐴·𝑉), where 𝐼 is the ionic strength in molar units (mol/l).

Type Aliases§

Matrix3
A 3x3 matrix (interoperable with other math libraries via mint)
Result
A type alias for Result<T, Error>.
Vector3
A point in 3D space (interoperable with other math libraries via mint)