qmmm_pme.interfaces package

Submodules

qmmm_pme.interfaces.interface module

A module to define the SoftwareInterface base class and the various SoftwareSettings classes.

class qmmm_pme.interfaces.interface.MMSettings(system, nonbonded_method='PME', nonbonded_cutoff=14.0, pme_gridnumber=30, pme_alpha=5.0, temperature=300.0, friction=0.001, timestep=1.0)[source]

Bases: SoftwareSettings

An immutable wrapper class which holds settings for an MM software interface.

Parameters:
  • system (System) – The System object to perform MM calculations on.

  • nonbonded_method (str) – The MM nonbonded method.

  • nonbonded_cutoff (float | int) – The MM nonbonded cutoff.

  • pme_gridnumber (int) – The number of PME gridpoints to use along each box vector.

  • pme_alpha (float | int) – The PME alpha parameter for Gaussian widths, in inverse nanometers.

  • temperature (float | int) – The temperature, in Kelvin.

  • friction (float | int) – The friction felt by particles as a result of a thermostat, in inverse femtoseconds.

  • timestep (float | int) – The timestep that the Simulation propagates with, in femtoseconds.

friction: float | int = 0.001
nonbonded_cutoff: float | int = 14.0
nonbonded_method: str = 'PME'
pme_alpha: float | int = 5.0
pme_gridnumber: int = 30
system: System
temperature: float | int = 300.0
timestep: float | int = 1.0
class qmmm_pme.interfaces.interface.QMSettings(system, basis_set, functional, charge, spin, quadrature_spherical=302, quadrature_radial=75, scf_type='df', read_guess=True, reference_energy=None)[source]

Bases: SoftwareSettings

An immutable wrapper class which holds settings for a QM software interface.

Parameters:
  • system (System) – The System object to perform QM calculations on.

  • basis_set (str) – The basis set to use for QM calculations.

  • functional (str) – The DFT functional to use for the QM calculations.

  • charge (int) – The net charge of the QM atoms.

  • spin (int) – The net spin of the QM atoms.

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

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

  • scf_type (str) – The type of SCF procedure to perform for QM calculations.

  • read_guess (bool) – Whether or not read in wavefunction from previous a calculation. This speeds up calculations.

  • reference_energy (float | int | None) – The base potential energy for QM energies, in Hartree. This is subtracted from all QM energies.

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

Bases: ABC

The abstract SoftwareInterface base class.

abstract compute_components()[source]

Compute the components of the potential energy for the System with the SoftwareInterface.

Returns:

The individual contributions to the energy, in kJ/mol.

Return type:

dict[str, float]

abstract compute_energy()[source]

Compute the energy for the System with the SoftwareInterface.

Returns:

The calculated energy, in kJ/mol.

Return type:

float

abstract compute_forces()[source]

Compute the forces for the System with the SoftwareInterface.

Returns:

The calculated forces, in kJ/mol/Angstrom.

Return type:

NDArray[np.float64]

abstract get_state_notifiers()[source]

Get the methods which should be called when a given StateVariable is updated.

Returns:

A dictionary of StateVariable names and their respective notifier methods.

Return type:

dict[str, Callable[[NDArray[np.float64]], None]]

abstract get_topology_notifiers()[source]

Get the methods which should be called when a given TopologyVariable is updated.

Returns:

A dictionary of TopologyVariable names and their respective notifier methods.

Return type:

dict[str, Callable[(Ellipsis, None)]]

class qmmm_pme.interfaces.interface.SoftwareSettings[source]

Bases: ABC

An abstract SoftwareSettings base class.

Note

This currently doesn’t do anything.

class qmmm_pme.interfaces.interface.SoftwareTypes(value)[source]

Bases: Enum

Enumerations of the different types of software to interface with.

MM = 'A software for performing MM calculations.'
QM = 'A software for performing QM calculations.'
class qmmm_pme.interfaces.interface.SystemTypes(value)[source]

Bases: Enum

Enumerations of the types of subsystems for a QM/MM calculation.

EMBEDDING = 'A Subsystem for Mechanical Embedding.'
SUBSYSTEM = 'A Subsystem of a QM/MM System.'
SYSTEM = 'A System.'

qmmm_pme.interfaces.interface_manager module

A module for handling software interface imports.

Warning

MyPy is not currently happy with this module.

qmmm_pme.interfaces.interface_manager.get_software_factories(field)[source]

Get the FACTORIES dictionary for the specified field of the interfaces configuration file. Fields include ‘MMSoftware’ or ‘QMSoftware’.

Parameters:

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

Returns:

The FACTORIES dictionary for the specified field of the interfaces configuration file.

Return type:

Factory

qmmm_pme.interfaces.openmm_interface module

A module to define the OpenMMInterface class.

class qmmm_pme.interfaces.openmm_interface.OpenMMInterface(pdb, modeller, forcefield, system, context)[source]

Bases: SoftwareInterface

A SoftwareInterface class which wraps the functional components of OpenMM.

Parameters:
  • pdb (PDBFile) – The OpenMM PDBFile object for the interface.

  • modeller (Modeller) – The OpenMM Modeller object for the interface.

  • forcefield (ForceField) – The OpenMM ForceField object for the interface.

  • system (System) – The OpenMM System object for the interface.

  • context (Context) – The OpenMM Context object for the interface.

compute_components(**kwargs)[source]

Compute the components of the potential energy for the System with the SoftwareInterface.

Returns:

The individual contributions to the energy, in kJ/mol.

Parameters:

kwargs (bool) –

Return type:

dict[str, float]

compute_energy(**kwargs)[source]

Compute the energy for the System with the SoftwareInterface.

Returns:

The calculated energy, in kJ/mol.

Parameters:

kwargs (bool) –

Return type:

float

compute_forces(**kwargs)[source]

Compute the forces for the System with the SoftwareInterface.

Returns:

The calculated forces, in kJ/mol/Angstrom.

Parameters:

kwargs (bool) –

Return type:

NDArray[np.float64]

compute_pme_potential(**kwargs)[source]
Parameters:

kwargs (bool) –

Return type:

Any

context: Context
forcefield: ForceField
get_state_notifiers()[source]

Get the methods which should be called when a given StateVariable is updated.

Returns:

A dictionary of StateVariable names and their respective notifier methods.

Return type:

dict[str, Callable[[NDArray[np.float64]], None]]

get_topology_notifiers()[source]

Get the methods which should be called when a given TopologyVariable is updated.

Returns:

A dictionary of TopologyVariable names and their respective notifier methods.

Return type:

dict[str, Callable[(Ellipsis, None)]]

modeller: Modeller
pdb: PDBFile
system: System
update_box(box)[source]

Update the box vectors for OpenMM.

Parameters:

box (NDArray[np.float64]) – The current box vectors of the System, in Angstroms.

Return type:

None

Warning

This method is not currently implemented.

update_charges(charges)[source]

Update the atom charges for OpenMM.

Parameters:

charges (NDArray[np.float64]) – The current charges of all atoms in the System, in elementary charge units.

Return type:

None

update_positions(positions)[source]

Update the atom positions for OpenMM.

Parameters:

positions (NDArray[np.float64]) – The current positions of all atoms in the System, in Angstroms.

Return type:

None

qmmm_pme.interfaces.openmm_interface.openmm_embedding_factory(settings)[source]

A function which constructs the OpenMMInterface for a mechanical embedding subsystem of a QM/MM supersystem.

Parameters:

settings (MMSettings) – The MMSettings object to build the mechanical embedding subsystem interface from.

Returns:

The OpenMMInterface for the mechanical embedding subsystem.

Return type:

OpenMMInterface

qmmm_pme.interfaces.openmm_interface.openmm_subsystem_factory(settings)[source]

A function which constructs the OpenMMInterface for an MM subsystem of a QM/MM supersystem.

Parameters:

settings (MMSettings) – The MMSettings object to build the MM subsystem interface from.

Returns:

The OpenMMInterface for the MM subsystem.

Return type:

OpenMMInterface

qmmm_pme.interfaces.openmm_interface.openmm_system_factory(settings)[source]

A function which constructs the OpenMMInterface for a standalone MM system.

Parameters:

settings (MMSettings) – The MMSettings object to build the standalone MM system interface from.

Returns:

The OpenMMInterface for the standalone MM system.

Return type:

OpenMMInterface

qmmm_pme.interfaces.pme_openmm_interface module

A module to define the OpenMMInterface class.

class qmmm_pme.interfaces.pme_openmm_interface.PMEOpenMMInterface(pdb, modeller, forcefield, system, context)[source]

Bases: OpenMMInterface

A class which wraps the functional components of OpenMM.

Parameters:
  • pdb (PDBFile) –

  • modeller (Modeller) –

  • forcefield (ForceField) –

  • system (System) –

  • context (Context) –

context: Context
forcefield: ForceField
modeller: Modeller
pdb: PDBFile
system: System
qmmm_pme.interfaces.pme_openmm_interface.pme_openmm_embedding_factory(settings)[source]

A function which constructs the OpenMMInterface.

Parameters:

settings (MMSettings) –

Return type:

OpenMMInterface

qmmm_pme.interfaces.pme_openmm_interface.pme_openmm_subsystem_factory(settings)[source]

A function which constructs the OpenMMInterface.

Parameters:

settings (MMSettings) –

Return type:

PMEOpenMMInterface

qmmm_pme.interfaces.pme_openmm_interface.pme_openmm_system_factory(settings)[source]

A function which constructs the OpenMMInterface.

Parameters:

settings (MMSettings) –

Return type:

PMEOpenMMInterface

qmmm_pme.interfaces.psi4_interface module

A module to define the Psi4Interface class.

class qmmm_pme.interfaces.psi4_interface.Psi4Context(atoms, embedding, elements, positions, charge, spin)[source]

Bases: object

A wrapper class for managing Psi4 Geometry object generation.

Parameters:
  • atoms (list[list[int]]) – …

  • embedding (list[list[int]]) – …

  • elements (list[str]) – The element symbols of all atoms in the Topology of the System object.

  • positions (NDArray[np.float64]) – The current positions of all atoms in the System, in Angstroms.

  • charge (int) – The net charge of the QM atoms.

  • spin (int) – The net spin of the QM atoms.

generate_molecule()[source]

Create the Geometry object for Psi4 calculations.

Returns:

The Psi4 Geometry object.

Return type:

Molecule

update_embedding(embedding)[source]

Update the analytic embedding atoms for Psi4.

Parameters:

embedding (list[list[int]]) – …

Return type:

None

update_positions(positions)[source]

Update the atom positions for Psi4.

Parameters:

positions (ndarray[Any, dtype[float64]]) – The current positions of all atoms in the System, in Angstroms.

Return type:

None

class qmmm_pme.interfaces.psi4_interface.Psi4Interface(options, functional, context, reference)[source]

Bases: SoftwareInterface

A SoftwareInterface class which wraps the functional components of Psi4.

Parameters:
compute_components(**kwargs)[source]

Compute the components of the potential energy for the System with the SoftwareInterface.

Returns:

The individual contributions to the energy, in kJ/mol.

Parameters:

kwargs (ComputationOptions) –

Return type:

dict[str, float]

compute_energy(**kwargs)[source]

Compute the energy for the System with the SoftwareInterface.

Returns:

The calculated energy, in kJ/mol.

Parameters:

kwargs (ComputationOptions) –

Return type:

float

compute_forces(**kwargs)[source]

Compute the forces for the System with the SoftwareInterface.

Returns:

The calculated forces, in kJ/mol/Angstrom.

Parameters:

kwargs (ComputationOptions) –

Return type:

NDArray[np.float64]

compute_quadrature()[source]

Build a reference quadrature.

Returns:

A reference quadrature constructed from the Psi4 Geometry object.

Return type:

ndarray[Any, dtype[float64]]

context: Psi4Context
functional: str
get_state_notifiers()[source]

Get the methods which should be called when a given StateVariable is updated.

Returns:

A dictionary of StateVariable names and their respective notifier methods.

Return type:

dict[str, Callable[(Ellipsis, None)]]

get_topology_notifiers()[source]

Get the methods which should be called when a given TopologyVariable is updated.

Returns:

A dictionary of TopologyVariable names and their respective notifier methods.

Return type:

dict[str, Callable[(Ellipsis, None)]]

options: Psi4Options
reference: Psi4Reference
update_embedding(embedding)[source]

Update the analytic embedding atoms for Psi4.

Parameters:

embedding (list[list[int]]) – …

Return type:

None

update_memory(memory)[source]

Update the amount of memory for Psi4 to use.

Parameters:

memory (str) – The amount of memory for Psi4 to use.

Return type:

None

update_num_threads(num_threads)[source]

Update the number of threads for Psi4 to use.

Parameters:

num_threads (int) – The number of threads for Psi4 to use.

Return type:

None

update_positions(positions)[source]

Update the atom positions for Psi4.

Parameters:

positions (ndarray[Any, dtype[float64]]) – The current positions of all atoms in the System, in Angstroms.

Return type:

None

class qmmm_pme.interfaces.psi4_interface.Psi4Options(basis, dft_spherical_points, dft_radial_points, scf_type, scf__reference, scf__guess)[source]

Bases: object

An immutable wrapper class for storing Psi4 global options.

Parameters:
  • basis (str) – The basis set to use for QM calculations.

  • dft_spherical_points (int) – The number of spherical (angular and azimuthal) points to use in the Lebedev quadrature.

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

  • scf_type (str) – The type of SCF procedure to perform for QM calculations.

  • scf__reference (str) – The base potential energy for QM energies, in Hartree. This is subtracted from all QM energies.

  • scf__guess (str) – The type of guess to use for the Psi4 calculation.

basis: str
dft_radial_points: int
dft_spherical_points: int
scf__guess: str
scf__reference: str
scf_type: str
class qmmm_pme.interfaces.psi4_interface.Psi4Reference(total, nuclear_repulsion, one_electron, kinetic, potential, two_electron, exchange_correlation)[source]

Bases: object

An immutable wrapper class for storing Psi4 reference energies.

Parameters:
  • total (float | int) – The total reference energy, in Hartree.

  • nuclear_repulsion (float | int) – The reference nuclear repulsion energy, in Hartree.

  • one_electron (float | int) – The reference one-electron energy, in Hartree.

  • kinetic (float | int) – The reference one-electron kinetic energy, in Hartree.

  • potential (float | int) – The reference one-electron potential energy, in Hartree.

  • two_electron (float | int) – The reference two-electron energy, in Hartree.

  • exchange_correlation (float | int) – The reference exchange-correlation energy, in Hartree.

exchange_correlation: float | int
kinetic: float | int
nuclear_repulsion: float | int
one_electron: float | int
potential: float | int
total: float | int
two_electron: float | int
qmmm_pme.interfaces.psi4_interface.psi4_system_factory(settings)[source]

A function which constructs the Psi4Interface for a QM system.

Parameters:

settings (QMSettings) – The QMSettings object to build the QM system interface from.

Returns:

The Psi4Interface for the QM system.

Return type:

Psi4Interface

Module contents

A sub-package containing interfaces to external software.