pydft_qmmm.common package

Subpackages

Submodules

pydft_qmmm.common.atom module

The atom data container.

class pydft_qmmm.common.atom.Atom(position=<factory>, velocity=<factory>, force=<factory>, mass=0.0, charge=0.0, residue=0, element='', name='', residue_name='', subsystem=Subsystem.NULL)[source]

Bases: object

The atom data container.

Parameters:
  • position (NDArray[np.float64]) – The position (\(\mathrm{\mathring{A}}\)) of the atom within the system.

  • velocity (NDArray[np.float64]) – The velocity (\(\mathrm{\mathring{A}\;fs^{-1}}\)) of the atom.

  • force (NDArray[np.float64]) – The force (\(\mathrm{kJ\;mol^{-1}\;\mathring{A}^{-1}}\)) acting on the atom.

  • mass (float) – The mass (\(\mathrm{AMU}\)) of the atom.

  • charge (float) – The partial charge (\(e\)) of the atom.

  • residue (int) – The index of the residue to which the atom belongs.

  • element (str) – The element symbol of the atom.

  • name (str) – The name (type) of the atom, as in a PDB file.

  • residue_name (str) – The name of the residue to which the atom belongs.

  • subsystem (Subsystem) – The subsystem of which the atom is a part.

charge: float = 0.0
element: str = ''
force: NDArray[np.float64]
mass: float = 0.0
name: str = ''
position: NDArray[np.float64]
residue: int = 0
residue_name: str = ''
subsystem: Subsystem = 'NULL'
velocity: NDArray[np.float64]

pydft_qmmm.common.constants module

A module containing unit conversions and constants.

pydft_qmmm.common.constants.BOHR_PER_ANGSTROM

The number of atomic length units per Angstrom.

pydft_qmmm.common.constants.KJMOL_PER_EH

The amount of energy in kilojoules per mole per Hartree.

pydft_qmmm.common.constants.KB

The Boltzmann constant in kilojoules per mole per Kelvin.

pydft_qmmm.common.constants.ELEMENT_TO_MASS

A dictionary of atomic weights (\(\mathrm{AMU}\)) keyed by the element symbol.

class pydft_qmmm.common.constants.Subsystem(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Enumeration of the regions of the system.

I = 'I'
II = 'II'
III = 'III'
NULL = 'NULL'
class pydft_qmmm.common.constants.TheoryLevel(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Enumeration of the different levels of theory.

MM = 'The molecular mechanical (forcefield) level of theory.'
NO = 'No level of theory (a default).'
QM = 'The quantum mechanical (DFT) level of theory.'

pydft_qmmm.common.file_manager module

A utility for reading and writing files.

pydft_qmmm.common.file_manager.end_log(name)[source]

Terminate an existing log file.

Parameters:

name (str) – The directory and filename to write the log file to.

Return type:

None

pydft_qmmm.common.file_manager.load_system(*args)[source]

Load files necessary to generate a system.

Parameters:

*args (str) – The directory or list of directories containing PDB files with position, element, name, residue, residue name, and lattice vector data.

Returns:

Data required to create a System object.

Return type:

tuple[list[Atom], NDArray[np.float64]]

pydft_qmmm.common.file_manager.start_csv(name, header)[source]

Start writing to a CSV file.

Parameters:
  • name (str) – The directory and filename to write the CSV file to.

  • header (str) – The header for the CSV file.

Return type:

None

pydft_qmmm.common.file_manager.start_dcd(name, write_interval, num_particles, timestep)[source]

Start writing to a DCD file.

Parameters:
  • name (str) – The directory and filename to write the DCD file to.

  • write_interval (int) – The interval between successive DCD writes, in simulation steps.

  • num_particles (int) – The number of atoms in the system.

  • timestep (int | float) – The timestep (\(\mathrm{fs}\)) used to perform simulation.

Return type:

None

Note

Based on DCD writer from OpenMM.

pydft_qmmm.common.file_manager.start_log(name)[source]

Start writing to a log file.

Parameters:

name (str) – The directory and filename to write the log file to.

Return type:

None

pydft_qmmm.common.file_manager.write_to_csv(name, line, header=None)[source]

Write data to an existing CSV file.

Parameters:
  • name (str) – The directory and filename to write the CSV file to.

  • line (str) – A string which will be written to the CSV file.

  • header (str | None) – The header for the CSV file.

Return type:

None

pydft_qmmm.common.file_manager.write_to_dcd(name, write_interval, system, frame, offset=None)[source]

Write data to an existing DCD file.

Parameters:
  • name (str) – The directory and filename to write the DCD file to.

  • write_interval (int) – The interval between successive DCD writes, in simulation steps.

  • system (System) – The system whose data will be written to a DCD file.

  • frame (int) – The current frame of the simulation.

  • offset (NDArray[np.float64] | None) – A translation applied to positions before they are recorded.

Return type:

None

Note

Based on DCD writer from OpenMM.

pydft_qmmm.common.file_manager.write_to_log(name, lines, frame)[source]

Write data to an existing log file.

Parameters:
  • name (str) – The directory and filename to write the log file to.

  • lines (str) – A multi-line string which will be written to the log file.

  • frame (int) – The current frame of the simulation.

Return type:

None

pydft_qmmm.common.file_manager.write_to_pdb(name, system)[source]

Write system to PDB file.

Parameters:
  • name (str) – The directory and filename to write the PDB file to.

  • system (System) – The system whose data will be written to a PDB file.

Return type:

None

Note

Based on PDB writer from OpenMM.

pydft_qmmm.common.resource_manager module

A utility to manage thread and memory utilization.

class pydft_qmmm.common.resource_manager.ResourceManager(calculators)[source]

Bases: object

A utility to manage thread and memory utilization.

Parameters:

calculators (list[InterfaceCalculator]) – A list of calculators which interface to external software.

update_memory(memory)[source]

Set the amount of memory that calculators can use.

Parameters:

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

Return type:

None

update_threads(threads)[source]

Set the number of threads that calculators can use.

Parameters:

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

Return type:

None

Module contents

A sub-package containing common classes, utilities, and constants.