pydft_qmmm.hamiltonians package

Submodules

pydft_qmmm.hamiltonians.hamiltonian module

Hamiltonian base and derived classes.

class pydft_qmmm.hamiltonians.hamiltonian.CalculatorHamiltonian[source]

Bases: Hamiltonian

An abstract Hamiltonian base class for creating calculators.

atoms

Indices corresponding to the atoms for which the Hamiltonian is applicable.

Type:

list[int | slice]

theory_level

The level of theory of the Hamiltonian.

Type:

pydft_qmmm.common.constants.TheoryLevel

atoms: list[int | slice] = []
abstract build_calculator(system)[source]

Build the calculator corresponding to the Hamiltonian.

Parameters:

system (System) – The system that will be used to calculate the calculator.

Returns:

The calculator which is defined by the system and the Hamiltonian.

Return type:

Calculator

theory_level: TheoryLevel = 'No level of theory (a default).'
class pydft_qmmm.hamiltonians.hamiltonian.CompositeHamiltonian(*hamiltonians)[source]

Bases: Hamiltonian

An abstract Hamiltonian base class for combining Hamiltonians.

Parameters:

hamiltonians (Hamiltonian) – A set of Hamiltonians belonging to the composite Hamiltonian.

build_calculator(system)[source]

Build the calculator corresponding to the Hamiltonian.

Parameters:

system (System) – The system that will be used to calculate the calculator.

Returns:

The calculator which is defined by the system and the Hamiltonian.

Return type:

Calculator

class pydft_qmmm.hamiltonians.hamiltonian.CouplingHamiltonian[source]

Bases: Hamiltonian

An abstract Hamiltonian base class for coupling Hamiltonians.

force_matrix

A matrix representing the gradient of potential expressions representing interactions between differing subsystems.

Type:

dict[pydft_qmmm.common.constants.Subsystem, dict[pydft_qmmm.common.constants.Subsystem, pydft_qmmm.common.constants.TheoryLevel]]

force_matrix: dict[Subsystem, dict[Subsystem, TheoryLevel]]
abstract modify_calculator(calculator, system)[source]

Modify a calculator to represent the coupling.

Parameters:
  • calculator (Calculator) – A calculator which is defined in part by the system.

  • system (System) – The system that will be used to modify the calculator.

Return type:

None

abstract modify_composite(calculator, system)[source]

Modify a composite calculator to represent the coupling.

Parameters:
  • calculator (CompositeCalculator) – A composite calculator which is defined in part by the system.

  • system (System) – The system that will be used to modify the calculator.

Return type:

None

class pydft_qmmm.hamiltonians.hamiltonian.Hamiltonian[source]

Bases: ABC

The abstract Hamiltonian base class.

pydft_qmmm.hamiltonians.mm_hamiltonian module

A Hamiltonian representing the MM level of theory.

class pydft_qmmm.hamiltonians.mm_hamiltonian.MMHamiltonian(forcefield, nonbonded_method='PME', nonbonded_cutoff=14.0, pme_gridnumber=None, pme_alpha=None)[source]

Bases: CalculatorHamiltonian

A Hamiltonian representing the MM level of theory.

Parameters:
  • forcefield (str | 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 (int | 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}}\)).

build_calculator(system)[source]

Build the calculator corresponding to the Hamiltonian.

Parameters:

system (System) – The system that will be used to calculate the calculator.

Returns:

The calculator which is defined by the system and the Hamiltonian.

Return type:

InterfaceCalculator

forcefield: str | list[str]
nonbonded_cutoff: float | int = 14.0
nonbonded_method: str = 'PME'
pme_alpha: float | int | None = None
pme_gridnumber: int | tuple[int, int, int] | None = None

pydft_qmmm.hamiltonians.qm_hamiltonian module

A Hamiltonian representing the QM level of theory.

class pydft_qmmm.hamiltonians.qm_hamiltonian.QMHamiltonian(basis_set, functional, charge, spin, quadrature_spherical=302, quadrature_radial=75, scf_type='df', read_guess=True)[source]

Bases: CalculatorHamiltonian

A Hamiltonian representing the QM level of theory.

Parameters:
  • 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
build_calculator(system)[source]

Build the calculator corresponding to the Hamiltonian.

Parameters:

system (System) – The system that will be used to calculate the calculator.

Returns:

The calculator which is defined by the system and the Hamiltonian.

Return type:

InterfaceCalculator

charge: int
functional: str
quadrature_radial: int = 75
quadrature_spherical: int = 302
read_guess: bool = True
scf_type: str = 'df'
spin: int

pydft_qmmm.hamiltonians.qmmm_hamiltonian module

A Hamiltonian defining the inter-subsystem coupling in QM/MM.

pydft_qmmm.hamiltonians.qmmm_hamiltonian._DEFAULT_FORCE_MATRIX

The default force matrix, which has no level of theory coupling subsystem I to subsystems II and III.

pydft_qmmm.hamiltonians.qmmm_hamiltonian._CLOSE_EMBEDDING

The levels of theory for I-II and II-I forces for different close-range embedding schemes.

pydft_qmmm.hamiltonians.qmmm_hamiltonian._LONG_EMBEDDING

The levels of theory for I-III and III-I forces for different long-range embedding schemes.

pydft_qmmm.hamiltonians.qmmm_hamiltonian._SUPPORTED_EMBEDDING

Allowed pairs of close-range and long-range embedding schemes.

class pydft_qmmm.hamiltonians.qmmm_hamiltonian.QMMMHamiltonian(close_range='electrostatic', long_range='cutoff', cutoff=14.0)[source]

Bases: CouplingHamiltonian

A Hamiltonian defining inter-subsystem coupling in QM/MM.

Parameters:
  • close_range (str) – The name of the embedding procedure for close-range (I-II) interactions.

  • long_range (str) – The name of the embedding procedure for long-range (I-III) interactions.

  • cutoff (float | int) – The cutoff distance (\(\mathrm{\mathring{A}}\)) at which to partition a system into subsystems II and III.

close_range: str = 'electrostatic'
cutoff: float | int = 14.0
long_range: str = 'cutoff'
modify_calculator(calculator, system)[source]

Modify a calculator to represent the coupling.

Parameters:
  • calculator (Calculator) – A calculator which is defined in part by the system.

  • system (System) – The system that will be used to modify the calculator.

Return type:

None

modify_composite(calculator, system)[source]

Modify a composite calculator to represent the coupling.

Parameters:
  • calculator (CompositeCalculator) – A composite calculator which is defined in part by the system.

  • system (System) – The system that will be used to modify the calculator.

Return type:

None

modify_mm_interface(interface, system)[source]

Modify an MM interface to reflect the selected embedding.

Parameters:
  • interface (MMInterface) – The MM interface representing part of the system.

  • system (System) – The system that will be used to modify the interface.

Return type:

None

modify_qm_interface(interface, system)[source]

Modify a QM interface to reflect the selected embedding.

Parameters:
  • interface (QMInterface) – The QM interface representing part of the system.

  • system (System) – The system that will be used to modify the interface.

Return type:

None

Module contents

A sub-package containing the Hamiltonian API.