emle._backends

The backends module containts classes for computing in-vacuo energies and gradients. This is an internal module. Backends are used by the emle.calculator and emle._analyzer modules.

class emle._backends._backend.Backend[source]

Base class for in-vacuo backends.

This class should not be instantiated directly, but should be subclassed by specific backends.

Constructor.

calculate(atomic_numbers, xyz, forces=True)[source]

Compute the energy and forces.

Parameters:
  • atomic_numbers (numpy.ndarray, (N_BATCH, N_QM_ATOMS,)) – The atomic numbers of the atoms in the QM region.

  • xyz (numpy.ndarray, (N_BATCH, N_QM_ATOMS, 3)) – The coordinates of the atoms in the QM region in Angstrom.

  • forces (bool) – Whether to calculate and return forces.

Returns:

  • energy (float) – The in-vacuo energy in Eh.

  • forces (numpy.ndarray) – The in-vacuo forces in Eh/Bohr.

class emle._backends.DeePMD(model, deviation=None, deviation_threshold=None)[source]

DeepMD in-vacuo backend implementation.

Constructor.

calculate(atomic_numbers, xyz, forces=True)[source]

Compute the energy and forces.

Parameters:
  • atomic_numbers (numpy.ndarray, (N_BATCH, N_QM_ATOMS,)) – The atomic numbers of the atoms in the QM region.

  • xyz (numpy.ndarray, (N_BATCH, N_QM_ATOMS, 3)) – The coordinates of the atoms in the QM region in Angstrom.

  • forces (bool) – Whether to calculate and return forces.

Returns:

  • energy (float) – The in-vacuo energy in Eh.

  • forces (numpy.ndarray) – The in-vacuo forces in Eh/Bohr.

class emle._backends.ORCA(exe, template=None)[source]

ORCA in-vacuo backend implementation.

Constructor.

Parameters:
  • exe (str) – The path to the ORCA executable.

  • template (str) – The path to the ORCA template file.

calculate(atomic_numbers, xyz, forces=True)[source]

Compute the energy and forces.

Parameters:
  • atomic_numbers (numpy.ndarray, (N_BATCH, N_QM_ATOMS,)) – The atomic numbers of the atoms in the QM region.

  • xyz (numpy.ndarray, (N_BATCH, N_QM_ATOMS, 3)) – The coordinates of the atoms in the QM region in Angstrom.

  • forces (bool) – Whether to calculate and return forces.

Returns:

  • energy (float) – The in-vacuo energy in Eh.

  • forces (numpy.ndarray) – The in-vacuo forces in Eh/Bohr.

calculate_sander(xyz_file, orca_input, forces=True)[source]

Internal function to compute in vacuo energies and forces using ORCA via input written by sander.

Parameters:
  • xyz_file (str) – The path to the xyz coordinate file for the QM region.

  • orca_input (str) – The path to the ORCA input file.

  • forces (bool) – Whether to compute and return the forces.

Returns:

  • energy (float) – The in vacuo QM energy in Eh.

  • forces (numpy.array) – The in vacuo QM forces in Eh/Bohr.

class emle._backends.Rascal(model)[source]

Rascal in-vacuo backend implementation.

Constructor.

Parameters:

model (str) – The path to the Rascal model file.

calculate(atomic_numbers, xyz, forces=True)[source]

Compute the energy and forces.

Parameters:
  • atomic_numbers (numpy.ndarray, (N_BATCH, N_QM_ATOMS,)) – The atomic numbers of the atoms in the QM region.

  • xyz (numpy.ndarray, (N_BATCH, N_QM_ATOMS, 3)) – The coordinates of the atoms in the QM region in Angstrom.

  • forces (bool) – Whether to calculate and return forces.

Returns:

  • energy (float) – The in-vacuo energy in Eh.

  • forces (numpy.ndarray) – The in-vacuo forces in Eh/Bohr.

class emle._backends.Sander(parm7, is_gas=True)[source]

Class for in-vacuo calculations using the AMBER Sander molecular dynamics engine.

Constructor.

calculate(atomic_numbers, xyz, forces=True)[source]

Compute the energy and forces.

Parameters:
  • atomic_numbers (numpy.ndarray, (N_BATCH, N_QM_ATOMS,)) – The atomic numbers of the atoms in the QM region.

  • xyz (numpy.ndarray, (N_BATCH, N_QM_ATOMS, 3)) – The coordinates of the atoms in the QM region in Angstrom.

  • forces (bool) – Whether to calculate and return forces.

Returns:

  • energy (float) – The in-vacuo energy in Eh.

  • forces (numpy.ndarray) – The in-vacuo forces in Eh/Bohr.

class emle._backends.SQM(parm7, theory='DFTB3', qm_charge=0)[source]

SQM in-vacuo backend implementation.

Constructor.

Parameters:
  • parm7 (str) – The path to the AMBER topology file for the QM region.

  • theory (str) – The SQM theory to use.

  • qm_charge (int) – The charge on the QM region.

calculate(atomic_numbers, xyz, forces=True, qm_charge=None)[source]

Compute the energy and forces.

Parameters:
  • atomic_numbers (numpy.ndarray) – The atomic numbers of the atoms in the QM region.

  • xyz (numpy.ndarray) – The coordinates of the atoms in the QM region in Angstrom.

  • forces (bool) – Whether to calculate and return forces.

  • qm_charge (int) – The charge on the QM region.

Returns:

  • energy (float) – The in-vacuo energy in Eh.

  • forces (numpy.ndarray) – The in-vacuo gradient in Eh/Bohr.

class emle._backends.XTB[source]

XTB in-vacuo backend implementation.

Constructor.

static calculate(atomic_numbers, xyz, forces=True)[source]

Compute the energy and forces.

Parameters:
  • atomic_numbers (numpy.ndarray, (N_BATCH, N_QM_ATOMS,)) – The atomic numbers of the atoms in the QM region.

  • xyz (numpy.ndarray, (N_BATCH, N_QM_ATOMS, 3)) – The coordinates of the atoms in the QM region in Angstrom.

  • forces (bool) – Whether to calculate and return forces.

Returns:

  • energy (float) – The in-vacuo energy in Eh.

  • forces (numpy.ndarray) – The in-vacuo forces in Eh/Bohr.