qrunch.chemistry.problem_builders.ground_state_problem.builders_protocols

Protocols for ground state problem builders.

Functions

ground_state_problem_list_is_all_restricted(problem)

Tell static type checkers that in the True-branch this is a list of restricted ground state problems.

Classes

GroundStateProblemBuilder

Ground state problem builder.

GroundStateProblemModifier

Protocol for classes that modify a GroundStateProblem.

class GroundStateProblemBuilder

Bases: Protocol

Ground state problem builder.

__init__(*args, **kwargs)
apply_restricted_post_active_space_modifiers(problem: RestrictedGroundStateProblem) RestrictedGroundStateProblem

Apply modifiers that follow the active space modifier to a restricted problem.

Parameters:

problem (RestrictedGroundStateProblem)

Return type:

RestrictedGroundStateProblem

apply_restricted_post_active_space_modifiers_lazy(problem: RestrictedGroundStateProblem, molecular_configuration: MolecularConfiguration) LazyRestrictedGroundStateProblem

Apply post-active-space modifiers, persist the final restricted problem and return a lazy reference.

Parameters:
Return type:

LazyRestrictedGroundStateProblem

apply_unrestricted_post_active_space_modifiers(problem: UnrestrictedGroundStateProblem) UnrestrictedGroundStateProblem

Apply modifiers that follow the active space modifier to an unrestricted problem.

Parameters:

problem (UnrestrictedGroundStateProblem)

Return type:

UnrestrictedGroundStateProblem

apply_unrestricted_post_active_space_modifiers_lazy(problem: UnrestrictedGroundStateProblem, molecular_configuration: MolecularConfiguration) LazyUnrestrictedGroundStateProblem

Apply post-active-space modifiers, persist the final unrestricted problem and return a lazy reference.

Parameters:
Return type:

LazyUnrestrictedGroundStateProblem

build_restricted(molecular_configuration: MolecularConfiguration) RestrictedGroundStateProblem

Build the restricted ground state problem.

Parameters:

molecular_configuration (MolecularConfiguration)

Return type:

RestrictedGroundStateProblem

build_restricted_lazy(molecular_configuration: MolecularConfiguration) LazyRestrictedGroundStateProblem

Build the restricted ground state problem and return a lazy on-disk reference.

Parameters:

molecular_configuration (MolecularConfiguration)

Return type:

LazyRestrictedGroundStateProblem

build_restricted_pre_active_space_problem(molecular_configuration: MolecularConfiguration) RestrictedGroundStateProblem

Build the restricted problem up to (but not including) the active space modifier.

Parameters:

molecular_configuration (MolecularConfiguration)

Return type:

RestrictedGroundStateProblem

build_unrestricted(molecular_configuration: MolecularConfiguration) UnrestrictedGroundStateProblem

Build the unrestricted ground state problem.

Parameters:

molecular_configuration (MolecularConfiguration)

Return type:

UnrestrictedGroundStateProblem

build_unrestricted_lazy(molecular_configuration: MolecularConfiguration) LazyUnrestrictedGroundStateProblem

Build the unrestricted ground state problem and return a lazy on-disk reference.

Parameters:

molecular_configuration (MolecularConfiguration)

Return type:

LazyUnrestrictedGroundStateProblem

build_unrestricted_pre_active_space_problem(molecular_configuration: MolecularConfiguration) UnrestrictedGroundStateProblem

Build the unrestricted problem up to (but not including) the active space modifier.

Parameters:

molecular_configuration (MolecularConfiguration)

Return type:

UnrestrictedGroundStateProblem

data_persister_manager() DataPersisterManager | None

Return the data persister manager, if any, used by this builder.

Return type:

DataPersisterManager | None

is_mean_field() bool

Return whether the molecular orbital calculator is a mean-field method.

Return type:

bool

class GroundStateProblemModifier

Bases: Protocol

Protocol for classes that modify a GroundStateProblem.

__init__(*args, **kwargs)
modify(problem: RestrictedGroundStateProblem) RestrictedGroundStateProblem
modify(problem: UnrestrictedGroundStateProblem) UnrestrictedGroundStateProblem

Modify the GroundStateProblem and return the modified instance.

Parameters:

problem (RestrictedGroundStateProblem | UnrestrictedGroundStateProblem) – The ground state problem to be modified.

Return type:

RestrictedGroundStateProblem | UnrestrictedGroundStateProblem

classmethod persistence_key() str

Provide a unique persistence key for checkpointing after this modifier is applied.

Return type:

str

classmethod short_name() str

Provide a short name for logging purposes.

Return type:

str

ground_state_problem_list_is_all_restricted(problem: list[RestrictedGroundStateProblem] | list[UnrestrictedGroundStateProblem]) TypeGuard[list[RestrictedGroundStateProblem]]

Tell static type checkers that in the True-branch this is a list of restricted ground state problems.

Parameters:

problem (list[RestrictedGroundStateProblem] | list[UnrestrictedGroundStateProblem])

Return type:

TypeGuard[list[RestrictedGroundStateProblem]]