mlipops.ZBL#
- class mlipops.ZBL(neighbor_list: NeighborList, prefactor: float, bohr_radius: float)#
Compute the repulsive Ziegler-Biersack-Littmark (ZBL) potential between atoms.
This is an empirical potential to describe screened nuclear repulsion between atoms. It depends only on the atomic numbers of the interacting atoms, and gives a good fit for a wide range of elements.
Because it was parameterized based on scattering data, it does not give an accurate description of the interaction between covalently bonded atoms. It therefore should usually be restricted to only very short distances. You can optionally provide a covalent radius for each atom. The ZBL interaction is then multiplied by a cosine cutoff function to make it go to zero when the distance between two atoms equals the sum of their covalent radii. You can obtain covalent radii by calling get_covalent_radii(), or you can use other values that you choose.
When you create an instance of this class, you must specify the values of Coulomb’s constant 1/(4*pi*eps0) and the Bohr radius. The values you specify set the unit system. See the User Guide for the values in common unit systems.
- __init__(neighbor_list: NeighborList, prefactor: float, bohr_radius: float)#
Create on object for computing ZBL interactions.
- Parameters:
neighbor_list (NeighborList) – the NeighborList used to identify interactions. It determines the cutoff distance, the device to run on, and whether padding is used to enable caching of neighbors.
prefactor (float) – Coulomb’s constant 1/(4*pi*eps0)
bohr_radius (float) – the Bohr radius
- forward(positions: Tensor, atomic_numbers: Tensor, radii: Tensor | None, box_vectors: Tensor | None = None, batch: Tensor | None = None) Tensor#
Compute the interaction.
- Parameters:
positions (torch.Tensor) – a Tensor of shape (n_particles, 3) containing the Cartesian coordinates of each particle
atomic_numbers (torch.Tensor) – a Tensor of shape (n_particles,) containing the atomic number of each particle
radii (torch.Tensor | None) – a Tensor of shape (n_particles,) containing the covalent radius of each particle. If None, the cutoff function is omitted.
box_vectors (torch.Tensor | None) – if batch is None, a Tensor of shape (3, 3) containing box vectors defining the periodic box. If batch is not None, a Tensor of shape (n_systems, 3, 3) containing the box vectors for each system. If None, periodic boundary conditions are not used.
batch (torch.Tensor | None) – a Tensor of shape (n_particles,) containing the index of the system each particle belongs to. This must be sorted in ascending order, and every system must contain at least one particle. If None, the interaction is computed for a single system instead of a batch of systems.
- Returns:
a torch.Tensor containing the energy of the interaction. If batch is None, this is a scalar containing the total energy. Otherwise, it has shape (n_systems,) containing the energy of each system in the batch.
- Return type:
torch.Tensor