qrunch.chemistry.ground_state_problem.builders.problems

Protocols for ground state problem builders.

Module Attributes

GeneralRestrictedGroundStateProblem

A restricted ground state problem, possibly in lazy on-disk form.

GeneralUnrestrictedGroundStateProblem

An unrestricted ground state problem, possibly in lazy on-disk form.

GeneralGroundStateProblem

A ground state problem of either spin treatment, possibly in lazy on-disk form.

Functions

manifest_problem(...)

Manifest a lazy problem into an in-memory GroundStateProblem, or return it directly if already materialized.

Classes

LazyRestrictedGroundStateProblem

Lazy reference to a RestrictedGroundStateProblem stored via a DataPersisterManager.

LazyUnrestrictedGroundStateProblem

Lazy reference to an UnrestrictedGroundStateProblem stored via a DataPersisterManager.

RestrictedGroundStateProblem

Restricted ground state problem.

UnrestrictedGroundStateProblem

Unrestricted ground state problem.

GeneralGroundStateProblem = qrunch.chemistry.ground_state_problem.builders.problems.RestrictedGroundStateProblem | qrunch.chemistry.ground_state_problem.builders.problems.LazyRestrictedGroundStateProblem | qrunch.chemistry.ground_state_problem.builders.problems.UnrestrictedGroundStateProblem | qrunch.chemistry.ground_state_problem.builders.problems.LazyUnrestrictedGroundStateProblem

A ground state problem of either spin treatment, possibly in lazy on-disk form.

GeneralRestrictedGroundStateProblem = qrunch.chemistry.ground_state_problem.builders.problems.RestrictedGroundStateProblem | qrunch.chemistry.ground_state_problem.builders.problems.LazyRestrictedGroundStateProblem

A restricted ground state problem, possibly in lazy on-disk form.

GeneralUnrestrictedGroundStateProblem = qrunch.chemistry.ground_state_problem.builders.problems.UnrestrictedGroundStateProblem | qrunch.chemistry.ground_state_problem.builders.problems.LazyUnrestrictedGroundStateProblem

An unrestricted ground state problem, possibly in lazy on-disk form.

class LazyRestrictedGroundStateProblem

Bases: object

Lazy reference to a RestrictedGroundStateProblem stored via a DataPersisterManager.

Holding a lazy reference avoids keeping the (potentially very large) problem instance in memory. The full problem can be reconstructed on demand via manifest(), used, and then released so that only one problem is materialised at a time.

Parameters:
  • data_persister_manager – Manager that handles loading the persisted problem.

  • key – Persistence key used when the problem was saved.

  • metadata – Metadata that uniquely identifies the persisted problem within key. Must match the metadata used during saving.

__init__(data_persister_manager: DataPersisterManager, key: str, metadata: Mapping[str, str | Mapping[str, str | NestedStrDict]]) None
Parameters:
  • data_persister_manager (DataPersisterManager)

  • key (str)

  • metadata (Mapping[str, str | Mapping[str, str | NestedStrDict]])

Return type:

None

data_persister_manager: DataPersisterManager
property is_lazy: Literal[True]

Return True, if it is lazy.

property is_restricted: Literal[True]

Return True, if it is restricted.

key: str
manifest() RestrictedGroundStateProblem

Load the persisted problem via the data persister manager into memory.

Return type:

RestrictedGroundStateProblem

metadata: Mapping[str, str | Mapping[str, str | NestedStrDict]]
class LazyUnrestrictedGroundStateProblem

Bases: object

Lazy reference to an UnrestrictedGroundStateProblem stored via a DataPersisterManager.

Holding a lazy reference avoids keeping the (potentially very large) problem instance in memory. The full problem can be reconstructed on demand via manifest(), used, and then released so that only one problem is materialised at a time.

Parameters:
  • data_persister_manager – Manager that handles loading the persisted problem.

  • key – Persistence key used when the problem was saved.

  • metadata – Metadata that uniquely identifies the persisted problem within key. Must match the metadata used during saving.

__init__(data_persister_manager: DataPersisterManager, key: str, metadata: Mapping[str, str | Mapping[str, str | NestedStrDict]]) None
Parameters:
  • data_persister_manager (DataPersisterManager)

  • key (str)

  • metadata (Mapping[str, str | Mapping[str, str | NestedStrDict]])

Return type:

None

data_persister_manager: DataPersisterManager
property is_lazy: Literal[True]

Return True, if it is lazy.

property is_restricted: Literal[False]

Return False, since this is an unrestricted problem.

key: str
manifest() UnrestrictedGroundStateProblem

Load the persisted problem via the data persister manager into memory.

Return type:

UnrestrictedGroundStateProblem

metadata: Mapping[str, str | Mapping[str, str | NestedStrDict]]
class RestrictedGroundStateProblem

Bases: HasMetadataHashMethod

Restricted ground state problem.

All fields are immutable (frozen=True) so an instance can be safely reused.

Parameters:
  • electronic_structure_integrals – Integrals for the problem.

  • electron_configuration – Electronic configuration for the problem.

  • energy_contributions – Energy contributions needed for the final energy.

  • molecular_orbital_energies – Molecular orbital energies for the problem, if available.

  • molecular_orbital_occupations – Molecular orbital occupations for the problem, if available.

__init__(electronic_structure_integrals: RestrictedElectronicStructureIntegrals, electron_configuration: MolecularElectronConfiguration, energy_contributions: MolecularEnergyContributions, molecular_orbital_energies: RestrictedMolecularOrbitalEnergies | None, molecular_orbital_occupations: RestrictedMolecularOrbitalOccupations | None) None
Parameters:
Return type:

None

electron_configuration: MolecularElectronConfiguration
electronic_structure_integrals: RestrictedElectronicStructureIntegrals
energy_contributions: MolecularEnergyContributions
property is_lazy: Literal[False]

Return False, since this is an in-memory (non-lazy) problem.

property is_restricted: Literal[True]

Return True, if it is restricted.

molecular_orbital_energies: RestrictedMolecularOrbitalEnergies | None
molecular_orbital_occupations: RestrictedMolecularOrbitalOccupations | None
class UnrestrictedGroundStateProblem

Bases: HasMetadataHashMethod

Unrestricted ground state problem.

All fields are immutable (frozen=True) so an instance can be safely reused.

Parameters:
  • electronic_structure_integrals – Integrals for the problem.

  • electron_configuration – Electronic configuration for the problem.

  • energy_contributions – Energy contributions needed for the final energy.

  • molecular_orbital_energies – Molecular orbital energies for the problem, if available.

  • molecular_orbital_occupations – Molecular orbital occupations for the problem, if available.

__init__(electronic_structure_integrals: UnrestrictedElectronicStructureIntegrals, electron_configuration: MolecularElectronConfiguration, energy_contributions: MolecularEnergyContributions, molecular_orbital_energies: UnrestrictedMolecularOrbitalEnergies | None, molecular_orbital_occupations: UnrestrictedMolecularOrbitalOccupations | None) None
Parameters:
Return type:

None

electron_configuration: MolecularElectronConfiguration
electronic_structure_integrals: UnrestrictedElectronicStructureIntegrals
energy_contributions: MolecularEnergyContributions
property is_lazy: Literal[False]

Return False, since this is an in-memory (non-lazy) problem.

property is_restricted: Literal[False]

Return False, since this is an unrestricted problem.

molecular_orbital_energies: UnrestrictedMolecularOrbitalEnergies | None
molecular_orbital_occupations: UnrestrictedMolecularOrbitalOccupations | None
manifest_problem(problem: RestrictedGroundStateProblem | LazyRestrictedGroundStateProblem) RestrictedGroundStateProblem
manifest_problem(problem: UnrestrictedGroundStateProblem | LazyUnrestrictedGroundStateProblem) UnrestrictedGroundStateProblem

Manifest a lazy problem into an in-memory GroundStateProblem, or return it directly if already materialized.

Parameters:

problem (RestrictedGroundStateProblem | LazyRestrictedGroundStateProblem | UnrestrictedGroundStateProblem | LazyUnrestrictedGroundStateProblem) – A ground state problem that may be lazy (on-disk) or already in memory.

Return type:

RestrictedGroundStateProblem | UnrestrictedGroundStateProblem