qrunch.chemistry.ground_state_problem.calculators.pair_configuration_interaction_calculators

Ground state energy calculator using Pair Full CI.

The Pair Full Configuration Interaction (pFCI) is a version of the full configuration interaction (FCI) where only pair excitations are included in the calculation. The Orbital Optimized Pair Full Configuration Interaction (oo-pFCI) is the orbital optimized version.

Module Attributes

DEFAULT_OPTIONS

The default options for the Orbital Optimizer minimizer.

Functions

build_pair_bit_string_integers(...)

Generate all pair excitation bitstrings from the electronic configuration.

generate_pair_excitations(reference, ...)

Generate all pair excitation bitstrings.

log_scipy_result(result)

Log details from scipy OptimizeResult in a readable format.

Classes

BasinHoppingOptions

Options for SciPy basinhopping global optimization.

OrbitalOptimizedPairConfigurationInteractionGroundStateProblemCalculator

Class for performing orbital-optimized pair full configuration interaction calculations.

OrbitalOptimizerOptions

The default options for SciPy minimizer.

PairConfigurationInteractionGroundStateProblemCalculator

Class for performing pair full configuration interaction calculations.

SecondOrderCorrectedPairConfigurationInteractionGroundStateProblemCalculator

Class for second-order corrected pair full configuration interaction calculations.

class BasinHoppingOptions

Bases: DataclassPublicAPI

Options for SciPy basinhopping global optimization.

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

Parameters:
  • number_of_macro_iterations – How many basin hopping steps to perform. (default=3)

  • temperature – Controls accept probability for worse solutions. (default=0.01)

  • stepsize – Size of random displacement. (default=0.05)

  • number_of_successive_failures – Stop if no improvement after this many steps. (default=4)

  • seed – RNG seed for reproducibility. (default=None)

  • display – Verbosity. (default=True)

  • active – Activate Basin Hopping. (default=True)

__init__(*, number_of_macro_iterations: int = 3, temperature: float = 0.01, stepsize: float = 0.05, number_of_successive_failures: int = 4, seed: int | None = None, display: bool = True, active: bool = True) None
Parameters:
  • number_of_macro_iterations (int)

  • temperature (float)

  • stepsize (float)

  • number_of_successive_failures (int)

  • seed (int | None)

  • display (bool)

  • active (bool)

Return type:

None

active: bool = True
display: bool = True
number_of_macro_iterations: int = 3
number_of_successive_failures: int = 4
seed: int | None = None
stepsize: float = 0.05
temperature: float = 0.01
DEFAULT_OPTIONS = OrbitalOptimizerOptions(relative_error_tolerance=1e-06, max_iterations_per_parameter=20000, jacobian_step_size=1e-08, display=True)

The default options for the Orbital Optimizer minimizer.

class OrbitalOptimizedPairConfigurationInteractionGroundStateProblemCalculator

Bases: object

Class for performing orbital-optimized pair full configuration interaction calculations.

__init__(options: OrbitalOptimizerOptions | None = None, basin_hopping_options: BasinHoppingOptions | None = None) None

Initialize an instance of OrbitalOptimizedPairConfigurationInteractionGroundStateProblemCalculator.

Parameters:
Return type:

None

calculate(ground_state_problem: RestrictedGroundStateProblem | UnrestrictedGroundStateProblem) GroundStateProblemCalculatorResult

Solve the orbital-optimized pair full configuration interaction (pFCI) calculation.

Note that the ground_state_problem may restrict the orbital space - in which case this is not a oo-pFCI calculation but a oo-pCASCI calculation. However, we consider this a FCI calculation in the provided orbital space, and in case of a restricted orbital space the inactive energy contribution associated with the CAS is included in the energy_correction of the ground_state_problem.

The Hamiltonian for the ground state problem is assumed to be real.

Parameters:

ground_state_problem (RestrictedGroundStateProblem | UnrestrictedGroundStateProblem) – The Ground state problem to calculate energy for.

Return type:

GroundStateProblemCalculatorResult

class OrbitalOptimizerOptions

Bases: DataclassPublicAPI

The default options for SciPy minimizer.

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

Parameters:
  • relative_error_tolerance – Convergence tolerance (default=1.0e-6)

  • max_iterations_per_parameter – Maximum number of iterations per parameter. (default=20000)

  • jacobian_step_size – Jacobian step size (default=1e-8)

  • display – (default=True)

__init__(*, relative_error_tolerance: float = 1e-06, max_iterations_per_parameter: int = 20000, jacobian_step_size: float = 1e-08, display: bool = True) None
Parameters:
  • relative_error_tolerance (float)

  • max_iterations_per_parameter (int)

  • jacobian_step_size (float)

  • display (bool)

Return type:

None

display: bool = True
jacobian_step_size: float = 1e-08
max_iterations_per_parameter: int = 20000
relative_error_tolerance: float = 1e-06
class PairConfigurationInteractionGroundStateProblemCalculator

Bases: object

Class for performing pair full configuration interaction calculations.

__init__() None

Initialize an instance of PairConfigurationInteractionGroundStateProblemCalculator.

Return type:

None

calculate(ground_state_problem: RestrictedGroundStateProblem | UnrestrictedGroundStateProblem) GroundStateProblemCalculatorResult

Solve the pair full configuration interaction (pFCI) calculation.

Note that the ground_state_problem may restrict the orbital space - in which case this is not a pFCI calculation but a pCASCI calculation. However, we consider this a FCI calculation in the provided orbital space, and in case of a restricted orbital space the inactive energy contribution associated with the CAS is included in the energy_correction of the ground_state_problem.

The Hamiltonian for the ground state problem is assumed to be real.

Parameters:

ground_state_problem (RestrictedGroundStateProblem | UnrestrictedGroundStateProblem) – The Ground state problem to calculate energy for.

Return type:

GroundStateProblemCalculatorResult

class SecondOrderCorrectedPairConfigurationInteractionGroundStateProblemCalculator

Bases: object

Class for second-order corrected pair full configuration interaction calculations.

__init__(calculator: OrbitalOptimizedPairConfigurationInteractionGroundStateProblemCalculator | PairConfigurationInteractionGroundStateProblemCalculator) None

Initialize an instance of OrbitalOptimizedPairConfigurationInteractionGroundStateProblemCalculator.

Parameters:

calculator (OrbitalOptimizedPairConfigurationInteractionGroundStateProblemCalculator | PairConfigurationInteractionGroundStateProblemCalculator) – The pair full configuration interaction calculator.

Return type:

None

calculate(ground_state_problem: RestrictedGroundStateProblem | UnrestrictedGroundStateProblem) GroundStateProblemCalculatorResult

Solve the orbital-optimized pair full configuration interaction (pFCI) calculation.

Note that the ground_state_problem may restrict the orbital space - in which case this is not a oo-pFCI calculation but a oo-pCASCI calculation. However, we consider this a FCI calculation in the provided orbital space, and in case of a restricted orbital space the inactive energy contribution associated with the CAS is included in the energy_correction of the ground_state_problem.

The Hamiltonian for the ground state problem is assumed to be real.

Parameters:

ground_state_problem (RestrictedGroundStateProblem | UnrestrictedGroundStateProblem) – The Ground state problem to calculate energy for.

Return type:

GroundStateProblemCalculatorResult

build_pair_bit_string_integers(electronic_configuration: MolecularElectronConfiguration) list[int]

Generate all pair excitation bitstrings from the electronic configuration.

Parameters:

electronic_configuration (MolecularElectronConfiguration) – The electronic configuration.

Return type:

list[int]

generate_pair_excitations(reference: int, total_length: int) list[int]

Generate all pair excitation bitstrings.

The pair excitation bitstrings are generated as integers from the reference integer provided. It should represent a binary string composed of two identical halves.

Parameters:
  • reference (int) – Reference bitstring as integer.

  • total_length (int) – Total bit length of the binary string; must be even.

Return type:

list[int]

log_scipy_result(result: OptimizeResult) None

Log details from scipy OptimizeResult in a readable format.

Parameters:

result (OptimizeResult) – The scipy OptimizeResult.

Return type:

None