torchani.electro#

Utilities for working with charged systems

Useful for systems that have charges and coulomb-like electrostatic interactions.

Functions

compute_dipole

Compute dipoles in eA

Classes

DipoleComputer

Compute dipoles in eA

ChargeNormalizer

Usage:

class torchani.electro.DipoleComputer(masses=(), reference='center_of_mass', device=None, dtype=None)[source]#

Compute dipoles in eA

Parameters:
  • masses (Iterable[float]) – Sequence of atomic masses

  • reference ('center_of_mass' | 'center_of_geometry' | 'origin') – Reference frame to use when calculating dipole.

forward(atomic_nums, coordinates, charges)[source]#

Calculate the dipoles

Parameters:
  • atomic_nums (Tensor) – An int tensor that stores the atomic numbers of a batch of molecules. Shape is (molecules, 3).

  • coordinates (Tensor) – A float tensor with the coordinates of a batch of molecules. Shape is (molecules, atoms, 3). All ANI models use Angstrom.

  • charges (Tensor) – Float tensor of atomic charges (M, N). Unit should be e.

Returns:

Dipoles with shape (molecules, 3)

Return type:

Tensor

torchani.electro.compute_dipole(species, coordinates, charges, reference='center_of_mass')[source]#

Compute dipoles in eA

Convenience wrapper over DipoleComputer. Non-jittable.

class torchani.electro.ChargeNormalizer(symbols, weights=(), scale_weights_by_charges_squared=False)[source]#

Usage:

forward(elem_idxs, raw_charges, charge=0)[source]#

Normalize charges so that they add up to a total charge