pympfit.gdma

pympfit.gdma

class pympfit.gdma._gdma.GDMAGenerator[source]

Bases: ABC

Base class for generating electrostatic potential of a molecule on a grid.

classmethod generate(molecule: Molecule, conformer: Quantity, settings: GDMASettings, directory: str = None, minimize: bool = False, compute_mp: bool = True, n_threads: int = 1, memory: Quantity = <Quantity(500, 'mebibyte')>) tuple[Quantity, Quantity][source]

Generate the GDMA multipole moments for a molecule.

Parameters:
  • molecule – The molecule to generate the GDMA data for.

  • conformer – The molecule conformer to analyze.

  • settings – The settings to use when generating the GDMA data.

  • directory – The directory to run the calculation in. If none is specified, a temporary directory will be created and used.

  • minimize – Whether to energy minimize the conformer prior to computation using the same level of theory that will be used for GDMA.

  • compute_mp – Whether to compute the multipole moments.

  • n_threads – Number of threads to use for the calculation.

  • memory – The memory to make available for computation. Default is 500 MiB, as is the default in Psi4 (see psicode.org/psi4manual/master/psithoninput.html#memory-specification).

Returns:

  • The final conformer [A] which will be identical to conformer if

  • minimize=False, and the computed multipole moments.

class pympfit.gdma._gdma.GDMASettings(*, basis: str = 'def2-SVP', method: str = 'pbe0', limit: int = 4, multipole_units: Literal['AU'] = 'AU', radius: list = ['C', 0.53, 'N', 0.53, 'H', 0.53], switch: float = 4.0, mpfit_inner_radius: float = 6.78, mpfit_outer_radius: float = 12.45, mpfit_atom_radius: float = 3.0)[source]

Bases: BaseModel

Settings for GDMA calculation and related MPFIT operations.

basis: str
limit: int
method: str
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

mpfit_atom_radius: float
mpfit_inner_radius: float
mpfit_outer_radius: float
multipole_units: Literal['AU']
radius: list
switch: float

pympfit.gdma.psi4

Compute GDMA and multipole data using Psi4.

class pympfit.gdma.psi4.Psi4GDMAGenerator[source]

Bases: GDMAGenerator

Compute the multipole moments of a molecule using Psi4.

pympfit.gdma.storage

Store GDMA data in SQLite databases.

class pympfit.gdma.storage.MoleculeGDMARecord(*, tagged_smiles: str, conformer: ~typing.Annotated[~numpy.ndarray[float], ~pydantic.functional_validators.BeforeValidator(func=functools.partial(<function _array_validator at 0x76065cfbc4a0>, unit='angstrom'), json_schema_input_type=PydanticUndefined)], multipoles: ~typing.Annotated[~numpy.ndarray[float], ~pydantic.functional_validators.BeforeValidator(func=functools.partial(<function _array_validator at 0x76065cfbc4a0>, unit='AU'), json_schema_input_type=PydanticUndefined)], gdma_settings: ~pympfit.gdma._gdma.GDMASettings)[source]

Bases: BaseModel

Record containing GDMA results for a molecule conformer.

Includes molecule information, conformer coordinates, GDMA settings provenance, and multipole values for each atom.

conformer: partial(<function _array_validator at 0x76065cfbc4a0>, unit='angstrom'), json_schema_input_type=PydanticUndefined)]
property conformer_quantity: Quantity
classmethod from_molecule(molecule: Molecule, conformer: Quantity, multipoles: Quantity, gdma_settings: GDMASettings) MoleculeGDMARecord[source]

Create a new MoleculeGDMARecord from an existing molecule.

Takes care of creating the InChI and SMARTS representations.

Parameters:
  • molecule – The molecule to store in the record.

  • conformer – The coordinates [Angstrom] of this conformer with shape=(n_atoms, 3).

  • multipoles – The multipole moments [AU] for each atom in the molecule.

  • gdma_settings – The settings used to generate the GDMA stored in this record.

Return type:

The created record.

gdma_settings: GDMASettings
model_config = {'arbitrary_types_allowed': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

multipoles: partial(<function _array_validator at 0x76065cfbc4a0>, unit='AU'), json_schema_input_type=PydanticUndefined)]
property multipoles_quantity: Quantity
tagged_smiles: str
class pympfit.gdma.storage.MoleculeGDMAStore(database_path: str = 'gdma-store.sqlite', cache_size: None | int = None)[source]

Bases: object

Store and retrieve GDMA results for molecules in multiple conformers.

This class currently can only store the data in a SQLite database.

property db_version: int
property general_provenance: dict[str, str]
list() list[str][source]

List the molecules which exist in and may be retrieved from the store.

retrieve(smiles: str | None = None, basis: str | None = None, method: str | None = None) list[MoleculeGDMARecord][source]

Retrieve records stored in this data store.

Optionally filters according to a set of criteria.

set_provenance(general_provenance: dict[str, str], software_provenance: dict[str, str]) None[source]

Set the stores provenance information.

Parameters:
  • general_provenance – A dictionary storing provenance about the store such as the author, which QCArchive data set it was generated from, when it was generated etc.

  • software_provenance – A dictionary storing the provenance of the software and packages used to generate the data in the store.

property software_provenance: dict[str, str]
store(*records: MoleculeGDMARecord) None[source]

Store the GDMA calculated for a given molecule in the data store.

Parameters:

records – The records to store.

Return type:

The records as they appear in the store.

Utilities for storing GDMA data in a SQLite database.

class pympfit.gdma.storage.db.DBConformerRecord(**kwargs)[source]

Bases: Base

Database representation of a conformer record.

coordinates
gdma_settings
gdma_settings_id
id
multipoles
parent_id
tagged_smiles
class pympfit.gdma.storage.db.DBGDMASettings(**kwargs)[source]

Bases: _UniqueMixin, Base

Database representation of GDMASettings.

basis
classmethod db_to_instance(db_instance: DBGDMASettings) GDMASettings[source]

Convert a database record to a GDMASettings instance.

id
limit
method
multipole_units
radius
switch
class pympfit.gdma.storage.db.DBGeneralProvenance(**kwargs)[source]

Bases: Base

Database representation of general provenance information.

key
parent_id
value
class pympfit.gdma.storage.db.DBInformation(**kwargs)[source]

Bases: Base

Track current database settings and version.

general_provenance
software_provenance
version
class pympfit.gdma.storage.db.DBMoleculeRecord(**kwargs)[source]

Bases: Base

Database representation of a molecule record.

conformers
smiles
class pympfit.gdma.storage.db.DBSoftwareProvenance(**kwargs)[source]

Bases: Base

Database representation of software provenance information.

key
parent_id
value