qrunch.chemistry.ground_state_problem.builders.tools.localization.localization_protocols

Module containing protocols for localization and orbital assignment.

Functions

occupied_molecular_orbitals_are_restricted(...)

Tell static type checkers that in the True-branch this is the restricted version.

occupied_molecular_orbitals_are_unrestricted(...)

Tell static type checkers that in the True-branch this is the unrestricted version.

Classes

OrbitalAssigner

Assigns molecular orbitals.

OrbitalLocalizer

Protocol for orbital localizers.

RestrictedOccupiedMolecularOrbitals

The restricted occupied molecular orbitals.

RestrictedOrbitalAssignmentResult

Results of a restricted orbital assignment.

UnrestrictedOccupiedMolecularOrbitals

The unrestricted occupied molecular orbitals.

UnrestrictedOrbitalAssignmentResult

Results of an unrestricted orbital assignment.

class OrbitalAssigner

Bases: Protocol

Assigns molecular orbitals.

__init__(*args, **kwargs)
assign(molecular_configuration: MolecularConfiguration, local_occupied_molecular_orbitals: RestrictedOccupiedMolecularOrbitals) RestrictedOrbitalAssignmentResult
assign(molecular_configuration: MolecularConfiguration, local_occupied_molecular_orbitals: UnrestrictedOccupiedMolecularOrbitals) UnrestrictedOrbitalAssignmentResult

Assign occupied molecular orbitals to embedded or environment regions.

Parameters:
Return type:

RestrictedOrbitalAssignmentResult | UnrestrictedOrbitalAssignmentResult

class OrbitalLocalizer

Bases: HasMetadataHashMethod, Protocol

Protocol for orbital localizers.

__init__(*args, **kwargs)
run(molecular_configuration: MolecularConfiguration, occupied_molecular_orbitals: RestrictedOccupiedMolecularOrbitals) RestrictedOccupiedMolecularOrbitals
run(molecular_configuration: MolecularConfiguration, occupied_molecular_orbitals: UnrestrictedOccupiedMolecularOrbitals) UnrestrictedOccupiedMolecularOrbitals

Run the localization algorithm.

Parameters:
Return type:

RestrictedOccupiedMolecularOrbitals | UnrestrictedOccupiedMolecularOrbitals

class RestrictedOccupiedMolecularOrbitals

Bases: object

The restricted occupied molecular orbitals.

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

Parameters:

alpha – The alpha electron molecular orbitals.

__init__(alpha: MolecularOrbitals) None
Parameters:

alpha (MolecularOrbitals)

Return type:

None

alpha: MolecularOrbitals
property beta: MolecularOrbitals

The beta electron molecular orbitals.

property is_restricted: Literal[True]

Return True, if it is restricted.

class RestrictedOrbitalAssignmentResult

Bases: HasMetadataHashMethod

Results of a restricted orbital assignment.

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

Parameters:
  • embedded_indices – List of indices of embedded orbitals.

  • environment_indices – List of indices of environment orbitals.

__init__(embedded_indices: list[int], environment_indices: list[int]) None
Parameters:
  • embedded_indices (list[int])

  • environment_indices (list[int])

Return type:

None

embedded_indices: list[int]
property embedded_spin: int

Spin spin_difference of the embedded region.

environment_indices: list[int]
property environment_spin: int

Spin spin_difference of the environment region.

property number_of_embedded_occupied_alpha_orbitals: int

Number of embedded occupied alpha orbitals.

property number_of_embedded_occupied_beta_orbitals: int

Number of embedded occupied beta orbitals.

property number_of_environment_occupied_alpha_orbitals: int

Number of environment occupied alpha orbitals.

property number_of_environment_occupied_beta_orbitals: int

Number of environment occupied beta orbitals.

class UnrestrictedOccupiedMolecularOrbitals

Bases: object

The unrestricted occupied molecular orbitals.

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

Parameters:
  • alpha – The alpha electron molecular orbitals.

  • beta – The beta electron molecular orbitals.

__init__(alpha: MolecularOrbitals, beta: MolecularOrbitals) None
Parameters:
Return type:

None

alpha: MolecularOrbitals
beta: MolecularOrbitals
property is_restricted: Literal[False]

Return True, if it is restricted.

class UnrestrictedOrbitalAssignmentResult

Bases: HasMetadataHashMethod

Results of an unrestricted orbital assignment.

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

Parameters:
  • embedded_alpha_indices – List of indices of embedded alpha orbitals.

  • embedded_beta_indices – List of indices of embedded beta orbitals.

  • environment_alpha_indices – List of indices of environment alpha orbitals.

  • environment_beta_indices – List of indices of environment beta orbitals.

__init__(embedded_alpha_indices: list[int], embedded_beta_indices: list[int], environment_alpha_indices: list[int], environment_beta_indices: list[int]) None
Parameters:
  • embedded_alpha_indices (list[int])

  • embedded_beta_indices (list[int])

  • environment_alpha_indices (list[int])

  • environment_beta_indices (list[int])

Return type:

None

embedded_alpha_indices: list[int]
embedded_beta_indices: list[int]
property embedded_spin: int

Spin spin_difference of the embedded region.

environment_alpha_indices: list[int]
environment_beta_indices: list[int]
property environment_spin: int

Spin spin_difference of the environment region.

property number_of_embedded_occupied_alpha_orbitals: int

Number of alpha electrons in the embedded region.

property number_of_embedded_occupied_beta_orbitals: int

Number of beta electrons in the embedded region.

property number_of_environment_occupied_alpha_orbitals: int

Number of electrons in the embedded region.

property number_of_environment_occupied_beta_orbitals: int

Number of electrons in the embedded region.

occupied_molecular_orbitals_are_restricted(orbitals: UnrestrictedOccupiedMolecularOrbitals | RestrictedOccupiedMolecularOrbitals) TypeGuard[RestrictedOccupiedMolecularOrbitals]

Tell static type checkers that in the True-branch this is the restricted version.

Parameters:

orbitals (UnrestrictedOccupiedMolecularOrbitals | RestrictedOccupiedMolecularOrbitals)

Return type:

TypeGuard[RestrictedOccupiedMolecularOrbitals]

occupied_molecular_orbitals_are_unrestricted(orbitals: UnrestrictedOccupiedMolecularOrbitals | RestrictedOccupiedMolecularOrbitals) TypeGuard[UnrestrictedOccupiedMolecularOrbitals]

Tell static type checkers that in the True-branch this is the unrestricted version.

Parameters:

orbitals (UnrestrictedOccupiedMolecularOrbitals | RestrictedOccupiedMolecularOrbitals)

Return type:

TypeGuard[UnrestrictedOccupiedMolecularOrbitals]