Skip to content

Potentials

Built-in interatomic potential calculators.

SoftSphere

SoftSphere(**kwargs: Any)

Bases: Calculator

Soft sphere potential calculator for purely repulsive interactions.

Implements a soft repulsive potential used for structure generation and packing optimization. The potential is zero when r >= sigma and purely repulsive for r < sigma.

Attributes:

Name Type Description
implemented_properties list of str

Calculable properties: energy, energies, forces, free_energy, stress, stresses

default_parameters dict

Default values: sigma=1.0, epsilon=1.0, alpha=2, skin=0.2

Notes

The pairwise energy is \(u_{ij} = \frac{\epsilon}{\alpha}\) times \(\left(1 - \frac{r_{ij}}{\sigma}\right)^{\alpha}\) for \(r_{ij} < \sigma\). Energy partitioning uses symmetric approach with bothways=True neighbor list. Implementation based on JAX-MD (https://github.com/google/jax-md).

Initialize the SoftSphere calculator with the given parameters.

Parameters:

Name Type Description Default
**kwargs dict

Calculator parameters. Supported parameters:

  • sigma (float): Particle diameter, default: 1.0
  • epsilon (float): Interaction energy scale, default: 1.0
  • alpha (float): Exponent specifying interaction stiffness, default: 2
  • skin (float): Skin parameter for neighbor list, default: 0.2
{}

Functions

calculate

calculate(atoms: Optional[Atoms] = None, properties: Optional[list[str]] = None, system_changes: list[str] = all_changes) -> None

Calculate energy, forces and stress using soft sphere potential.

Parameters:

Name Type Description Default
atoms Atoms

ASE Atoms object containing atomic positions and cell

None
properties list of str

Properties to calculate. If None, calculates all implemented properties

None
system_changes list of str

List of changes since last calculation

all_changes

MultiLennardJones

MultiLennardJones(**kwargs)

Bases: Calculator

Multi-species Lennard-Jones potential calculator.

Implements the classic 12-6 Lennard-Jones potential with support for multiple chemical species, mixing rules, and custom cross-interactions.

Attributes:

Name Type Description
implemented_properties list of str

Calculable properties: energy, energies, forces, free_energy, stress, stresses

default_parameters dict

Default values: epsilon=1.0, sigma=1.0, rc=None, ro=None, smooth=False, mixing_rule='lorentz_berthelot', cross_interactions=None

Notes

The 12-6 Lennard-Jones potential between atoms i and j. Energy: \(u_{ij}(r) = 4\epsilon_{ij}[(\sigma_{ij}/r)^{12} - (\sigma_{ij}/r)^6]\). See https://en.wikipedia.org/wiki/Lennard-Jones_potential for details.

Initialize Multi-Lennard-Jones calculator.

Parameters:

Name Type Description Default
**kwargs dict

Calculator parameters. Supported parameters:

  • sigma (float, dict, or array-like): Zero-crossing distance. Default 1.0. Can be uniform float, dict mapping symbols to values, or array indexed by atomic number.
  • epsilon (float, dict, or array-like): Well depth. Default 1.0. Can be uniform float, dict mapping symbols to values, or array indexed by atomic number.
  • rc (float, optional): Cutoff distance. Default None (auto: 3 * max(sigma)).
  • ro (float, optional): Smooth cutoff onset distance. Default None (auto: 0.66 * rc).
  • smooth (bool): Use smooth cutoff function. Default False.
  • mixing_rule (str): Mixing rule for cross-species. Default 'lorentz_berthelot'. Options: 'lorentz_berthelot' or 'geometric'.
  • cross_interactions (dict, optional): Explicit cross-interaction parameters. Format: {('A', 'B'): {'sigma': value, 'epsilon': value}}.
{}

Functions

calculate

calculate(atoms=None, properties=None, system_changes=all_changes)

Calculate energy, forces and stress using Lennard-Jones potential.

Parameters:

Name Type Description Default
atoms Atoms

ASE Atoms object containing atomic positions and cell

None
properties list of str

Properties to calculate. If None, calculates all implemented properties

None
system_changes list of str

List of changes since last calculation

all_changes

cutoff_function

cutoff_function(r: ndarray, rc: float, ro: float) -> np.ndarray

Smooth cutoff function for Lennard-Jones potential.

Goes from 1 to 0 between ro and rc, ensuring that u(r) = lj(r) * cutoff_function(r) is continuously differentiable (C^1). Defined as 1 below ro, 0 above rc.

Parameters:

Name Type Description Default
r float or ndarray

Squared distance r_ij^2

required
rc float

Squared cutoff distance

required
ro float

Squared onset distance for cutoff

required

Returns:

Type Description
float or ndarray

Cutoff function value(s)

Notes

All distances (r, rc, ro) are expected to be squared. Taken from https://github.com/google/jax-md.

d_cutoff_function

d_cutoff_function(r: ndarray, rc: float, ro: float) -> np.ndarray

Derivative of smooth cutoff function with respect to r.

Parameters:

Name Type Description Default
r float or ndarray

Squared distance r_ij^2

required
rc float

Squared cutoff distance

required
ro float

Squared onset distance for cutoff

required

Returns:

Type Description
float or ndarray

Derivative of cutoff function

Notes

Since r = r_ij^2, for the derivative with respect to r_ij, multiply by 2*r_ij. The factor of 2 appears naturally, and r_ij cancels when converting from scalar distance to distance vector (d r_ij / d d_ij).