qdk_chemistry.algorithms.multi_configuration_calculator module
Public entry point for the multi-configuration calculator algorithms.
This module re-exports the core MultiConfigurationCalculator and concrete
implementations so that consumers can import them directly from
qdk_chemistry.algorithms without depending on internal package paths.
- class qdk_chemistry.algorithms.multi_configuration_calculator.MultiConfigurationCalculator
Bases:
pybind11_objectAbstract base class for multi-configuration calculators.
This class defines the interface for multi configuration-based quantum chemistry calculations. Concrete implementations should inherit from this class and implement the
calculatemethod.Examples
>>> # To create a custom multi-configuration calculator, inherit from this class. >>> import qdk_chemistry.algorithms as alg >>> import qdk_chemistry.data as data >>> class MyMultiConfigurationCalculator(alg.MultiConfigurationCalculator): ... def __init__(self): ... super().__init__() # Call the base class constructor ... # Implement the _run_impl method (called by run()) ... def _run_impl(self, hamiltonian: data.Hamiltonian, n_active_alpha_electrons: int, n_active_beta_electrons: int) -> tuple[float, data.Wavefunction]: ... # Custom MC implementation ... return energy, wavefunction
- __init__(self: qdk_chemistry.algorithms.MultiConfigurationCalculator) None
Create a MultiConfigurationCalculator instance.
Default constructor for the abstract base class. This should typically be called from derived class constructors.
Examples
>>> # In a derived class: >>> class MyCalculator(alg.MultiConfigurationCalculator): ... def __init__(self): ... super().__init__() # Calls this constructor
- name(self: qdk_chemistry.algorithms.MultiConfigurationCalculator) str
The algorithm’s name.
- Returns:
The name of the algorithm
- Return type:
- run(self: qdk_chemistry.algorithms.MultiConfigurationCalculator, hamiltonian: qdk_chemistry.data.Hamiltonian, n_active_alpha_electrons: SupportsInt, n_active_beta_electrons: SupportsInt) tuple[float, qdk_chemistry.data.Wavefunction]
Perform multi-configuration calculation on the given Hamiltonian.
- Parameters:
hamiltonian (qdk_chemistry.data.Hamiltonian) – The Hamiltonian to perform the calculation on
n_active_alpha_electrons (int) – The number of alpha electrons in the active space
n_active_beta_electrons (int) – The number of beta electrons in the active space
- Returns:
A tuple containing the computed total energy (active + core) and wavefunction
- Return type:
- Raises:
SettingsAreLocked – If attempting to modify settings after run() is called
- settings(self: qdk_chemistry.algorithms.MultiConfigurationCalculator) qdk_chemistry.data.Settings
Access the calculator’s configuration settings.
- Returns:
Reference to the settings object for configuring the calculator
- Return type:
- type_name(self: qdk_chemistry.algorithms.MultiConfigurationCalculator) str
The algorithm’s type name.
- Returns:
The type name of the algorithm
- Return type:
- class qdk_chemistry.algorithms.multi_configuration_calculator.QdkMacisAsci
Bases:
MultiConfigurationCalculatorQDK MACIS-based Adaptive Sampling Configuration Interaction (ASCI) calculator.
This class provides a concrete implementation of the multi-configuration calculator using the MACIS library for Adaptive Sampling Configuration Interaction (ASCI) calculations, which adaptively selects the most important configurations.
Typical usage:
import qdk_chemistry.algorithms as alg # Create an ASCI calculator asci = alg.QdkMacisAsci() # Configure ASCI-specific settings asci.settings().set("ntdets_max", 1000) asci.settings().set("h_el_tol", 1e-6) # Run calculation energy, wavefunction = asci.run(hamiltonian, n_alpha, n_beta)
See also
MultiConfigurationCalculatorqdk_chemistry.data.Hamiltonianqdk_chemistry.data.Wavefunction- __init__(self: qdk_chemistry.algorithms.QdkMacisAsci) None
Default constructor.
Initializes a MACIS ASCI calculator with default settings.
- class qdk_chemistry.algorithms.multi_configuration_calculator.QdkMacisCas
Bases:
MultiConfigurationCalculatorQDK MACIS-based Complete Active Space (CAS) calculator.
This class provides a concrete implementation of the multi-configuration calculator using the MACIS library for Complete Active Space Configuration Interaction (CASCI) calculations.
Typical usage:
import qdk_chemistry.algorithms as alg # Create a CASCI calculator casci = alg.QdkMacisCas() # Configure settings if needed casci.settings().set("max_iterations", 100) # Run calculation energy, wavefunction = casci.run(hamiltonian, n_alpha, n_beta)
See also
MultiConfigurationCalculatorqdk_chemistry.data.Hamiltonianqdk_chemistry.data.Wavefunction- __init__(self: qdk_chemistry.algorithms.QdkMacisCas) None
Default constructor.
Initializes a MACIS CAS calculator with default settings.