pydft_qmmm.interfaces package

Subpackages

Submodules

pydft_qmmm.interfaces.interface module

Base classes for software interfaces and settings.

class pydft_qmmm.interfaces.interface.MMInterface[source]

Bases: SoftwareInterface

The abstract MM interface base class.

theory_level

The level of theory that the software applies in energy and force calculations.

Type:

pydft_qmmm.common.constants.TheoryLevel

abstract add_non_elst(atoms, inclusion=None)[source]

Add a non-electrostatic interaction for the specified atoms.

Parameters:
  • atoms (frozenset[int]) – The indices of atoms to add a non-electrostatic, non-bonded interaction for.

  • inclusion (NDArray[np.float64] | None) – An Nx3 array with values that will be applied to the forces of the non-electrostatic interaction through element-wise multiplication.

Return type:

None

abstract add_real_elst(atoms, const=1, inclusion=None)[source]

Add Coulomb interaction for the specified atoms.

Parameters:
  • atoms (frozenset[int]) – The indices of atoms to add a Coulomb interaction for.

  • const (float | int) – A constant to multiply at the beginning of the coulomb expression.

  • inclusion (NDArray[np.float64] | None) – An Nx3 array with values that will be applied to the forces of the Coulomb interaction through element-wise multiplication.

Return type:

None

theory_level: TheoryLevel = 'The molecular mechanical (forcefield) level of theory.'
abstract zero_charges(atoms)[source]

Remove charges from the specified atoms.

Parameters:

atoms (frozenset[int]) – The indices of atoms to remove charges from.

Return type:

None

abstract zero_forces(atoms)[source]

Zero forces on the specified atoms.

Parameters:

atoms (frozenset[int]) – The indices of atoms to zero forces for.

Return type:

None

abstract zero_intermolecular(atoms)[source]

Remove inter-molecular interactions for the specified atoms.

Parameters:

atoms (frozenset[int]) – The indices of atoms to remove inter-molecular interactions from.

Return type:

None

abstract zero_intramolecular(atoms)[source]

Remove intra-molecular interactions for the specified atoms.

Parameters:

atoms (frozenset[int]) – The indices of atoms to remove intra-molecular interactions from.

Return type:

None

class pydft_qmmm.interfaces.interface.MMSettings(system, forcefield, nonbonded_method='PME', nonbonded_cutoff=14.0, pme_gridnumber=None, pme_alpha=None)[source]

Bases: SoftwareSettings

Immutable container which holds settings for an MM interface.

Parameters:
  • system (System) – The system which will be tied to the MM interface.

  • forcefield (list[str]) – The files containing forcefield and topology data for the system.

  • nonbonded_method (str) – The method for treating non-bonded interactions, as in OpenMM.

  • nonbonded_cutoff (float | int) – The distance at which to truncate close-range non-bonded interactions.

  • pme_gridnumber (tuple[int, int, int] | None) – The number of grid points to include along each lattice edge in PME summation.

  • pme_alpha (float | int | None) – The Gaussian width parameter in Ewald summation (\(\mathrm{nm^{-1}}\)).

forcefield: list[str]
nonbonded_cutoff: float | int = 14.0
nonbonded_method: str = 'PME'
pme_alpha: float | int | None = None
pme_gridnumber: tuple[int, int, int] | None = None
system: System
class pydft_qmmm.interfaces.interface.QMInterface[source]

Bases: SoftwareInterface

The abstract QM interface base class.

theory_level

The level of theory that the software applies in energy and force calculations.

Type:

pydft_qmmm.common.constants.TheoryLevel

abstract disable_embedding()[source]

Disable electrostatic embedding.

Return type:

None

theory_level: TheoryLevel = 'The quantum mechanical (DFT) level of theory.'
class pydft_qmmm.interfaces.interface.QMSettings(system, basis_set, functional, charge, spin, quadrature_spherical=302, quadrature_radial=75, scf_type='df', read_guess=True)[source]

Bases: SoftwareSettings

Immutable container which holds settings for an QM interface.

Parameters:
  • system (System) – The system which will be tied to the QM interface.

  • basis_set (str) – The name of the basis set to be used in QM calculations.

  • functional (str) – The name of the functional set to be used in QM calculations.

  • charge (int) – The net charge (\(e\)) of the system represented by the QM Hamiltonian.

  • spin (int) – The net spin of the system represented by the QM Hamiltonian

  • quadrature_spherical (int) – The number of spherical Lebedev points to use in the DFT quadrature.

  • quadrature_radial (int) – The number of radial points to use in the DFT quadrature.

  • scf_type (str) – The name of the type of SCF to perform, relating to the JK build algorithms as in Psi4.

  • read_guess (bool) – Whether or not to reuse previous wavefunctions as initial guesses in subsequent QM calculations.

basis_set: str
charge: int
functional: str
quadrature_radial: int = 75
quadrature_spherical: int = 302
read_guess: bool = True
scf_type: str = 'df'
spin: int
system: System
class pydft_qmmm.interfaces.interface.SoftwareInterface[source]

Bases: ABC

The abstract software interface base class.

theory_level

The level of theory that the software applies in energy and force calculations.

Type:

pydft_qmmm.common.constants.TheoryLevel

abstract compute_components()[source]

Compute the components of energy using the external software.

Returns:

The components of the energy (\(\mathrm{kJ\;mol^{-1}}\)) of the system.

Return type:

dict[str, float]

abstract compute_energy()[source]

Compute the energy of the system using the external software.

Returns:

The energy (\(\mathrm{kJ\;mol^{-1}}\)) of the system.

Return type:

float

abstract compute_forces()[source]

Compute the forces on the system using the external software.

Returns:

The forces (\(\mathrm{kJ\;mol^{-1}\;\mathring{A}^{-1}}\)) acting on atoms in the system.

Return type:

NDArray[np.float64]

theory_level: TheoryLevel
abstract update_memory(memory)[source]

Set the amount of memory used by the external software.

Parameters:

memory (str) – The amount of memory to utilize.

Return type:

None

abstract update_threads(threads)[source]

Set the number of threads used by the external software.

Parameters:

threads (int) – The number of threads to utilize.

Return type:

None

class pydft_qmmm.interfaces.interface.SoftwareSettings[source]

Bases: ABC

The abstract software settings base class.

Note

This currently doesn’t do anything.

pydft_qmmm.interfaces.interface_manager module

Functionality for importing package and external interfaces.

pydft_qmmm.interfaces.interface_manager.MODULE_PATH

The directory where the PyDFT-QMMM interfaces sub-package is installed.

pydft_qmmm.interfaces.interface_manager.DISCOVERED_INTERFACES

A list of entry points into the interface architecture of PyDFT-QMMM within installed package metadata.

pydft_qmmm.interfaces.interface_manager.get_software_factory(field)[source]

Get a factory method according to the interfaces in interfaces.conf.

Fields include ‘MMSoftware’ or ‘QMSoftware’.

Parameters:

field (str) – The field of the interfaces configuration file to extract a factory method for.

Returns:

A factory method which builds a software interface for the specified field.

Return type:

Factory

pydft_qmmm.interfaces.interface_manager.set_default_interfaces(qm_interface='Psi4', mm_interface='OpenMM')[source]

Set the default QM and MM interfaces in interfaces.conf.

Parameters:
  • qm_interface (str | None) – The name of the new default QM interface.

  • mm_interface (str | None) – The name of the new default MM interface.

Return type:

None

pydft_qmmm.interfaces.interface_manager.set_interfaces(qm_interface='Psi4', mm_interface='OpenMM')[source]

Set the active QM and MM interfaces in interfaces.conf.

Parameters:
  • qm_interface (str | None) – The name of the QM interface to use.

  • mm_interface (str | None) – The name of the MM interface to use.

Return type:

None

Module contents

A sub-package containing interfaces to external software.