qrunch.chemistry.qrackle.integrals.pyscf_exchange_correlation_calculator

PySCF-backed exchange-correlation functional evaluation.

Functions

get_available_exchange_correlation_functionals()

Return LibXC functionals available in the linked PySCF installation.

validate_libxc_functional(functional)

Validate that PySCF LibXC accepts an exchange-correlation functional.

Classes

ExchangeCorrelationGridOptions

Options controlling PySCF numerical exchange-correlation integration grids.

PySCFExchangeCorrelationCalculator

Evaluate LibXC XC energies, potentials, and response kernels with PySCF.

class ExchangeCorrelationGridOptions

Bases: DataclassPublicAPI

Options controlling PySCF numerical exchange-correlation integration grids.

Parameters:
  • grid_level – PySCF radial and angular grid level. Higher values improve integration accuracy.

  • pruning – Grid-pruning strategy. "default" uses PySCF’s NWChem pruning, "aggressive" uses SG-1 pruning, and "off" disables pruning.

  • nonlocal_grid_level – PySCF grid level for VV10-style nonlocal correlation, which is usually far more expensive per point than the semilocal XC. None uses grid_level. A coarser level, e.g. 1, often costs little accuracy but changes energies.

__init__(*, grid_level: int = 3, pruning: Literal['default', 'aggressive', 'off'] = 'default', nonlocal_grid_level: int | None = None) → None
Parameters:
  • grid_level (int)

  • pruning (Literal['default', 'aggressive', 'off'])

  • nonlocal_grid_level (int | None)

Return type:

None

classmethod accurate() → ExchangeCorrelationGridOptions

Return the accurate grid options.

Return type:

ExchangeCorrelationGridOptions

classmethod balanced() → ExchangeCorrelationGridOptions

Return the balanced grid options.

Return type:

ExchangeCorrelationGridOptions

grid_level: int = 3
nonlocal_grid_level: int | None = None
pruning: Literal['default', 'aggressive', 'off'] = 'default'
classmethod quick() → ExchangeCorrelationGridOptions

Return the quick grid options.

Return type:

ExchangeCorrelationGridOptions

classmethod very_accurate() → ExchangeCorrelationGridOptions

Return the very accurate grid options.

Return type:

ExchangeCorrelationGridOptions

classmethod very_quick() → ExchangeCorrelationGridOptions

Return the very quick grid options.

Return type:

ExchangeCorrelationGridOptions

class PySCFExchangeCorrelationCalculator

Bases: MetadataFromFields, ExchangeCorrelationCalculatorProtocol[TMatrix, TVector]

Evaluate LibXC XC energies, potentials, and response kernels with PySCF.

__init__(matrix_module: MatrixModuleProtocol[TMatrix, TVector], functional: str, grid_options: ExchangeCorrelationGridOptions | None = None, *, include_nonlocal_correlation: bool = True) → None

Initialise the calculator.

Parameters:
  • matrix_module (MatrixModuleProtocol[TMatrix, TVector]) – Matrix module used to allocate result matrices.

  • functional (str) – PySCF LibXC functional expression.

  • grid_options (ExchangeCorrelationGridOptions | None) – Options controlling the PySCF numerical integration grid.

  • include_nonlocal_correlation (bool) – Whether to evaluate the functional’s VV10-style nonlocal correlation. Disabling it is only meant for approximate Fock builders.

Return type:

None

compute_restricted_result(density_matrix: RestrictedMatrix[TMatrix], molecular_configuration: MolecularConfiguration) → ExchangeCorrelationResult

Evaluate the restricted XC energy and potential.

Parameters:
Return type:

ExchangeCorrelationResult

compute_restricted_results_many(density_matrices: list[RestrictedMatrix[TMatrix]], molecular_configuration: MolecularConfiguration) → list[ExchangeCorrelationResult]

Evaluate restricted XC energies and potentials in one PySCF call.

Parameters:
Return type:

list[ExchangeCorrelationResult]

compute_unrestricted_result(density_matrix: UnrestrictedMatrix[TMatrix], molecular_configuration: MolecularConfiguration) → ExchangeCorrelationResult

Evaluate the unrestricted XC energy and potential.

Parameters:
Return type:

ExchangeCorrelationResult

compute_unrestricted_results_many(density_matrices: list[UnrestrictedMatrix[TMatrix]], molecular_configuration: MolecularConfiguration) → list[ExchangeCorrelationResult]

Evaluate unrestricted XC energies and potentials in one PySCF call.

Parameters:
Return type:

list[ExchangeCorrelationResult]

property exact_exchange: ExactExchange

Exact-exchange parameters implied by the configured functional.

property functional: str

The configured functional expression.

property prune: Callable[[...], Any] | None

PySCF pruning function for the configured strategy, or None when pruning is off.

xc_response_on_density_restricted(reference_density_matrix: RestrictedMatrix[TMatrix], density_matrix_direction: RestrictedMatrix[TMatrix], molecular_configuration: MolecularConfiguration) → RestrictedMatrix[TMatrix]

Apply the restricted first-order XC response at a reference density.

Parameters:
Return type:

RestrictedMatrix[TMatrix]

xc_response_on_density_restricted_many(reference_density_matrix: RestrictedMatrix[TMatrix], density_matrix_directions: list[RestrictedMatrix[TMatrix]], molecular_configuration: MolecularConfiguration) → list[RestrictedMatrix[TMatrix]]

Apply the restricted XC response to several density directions.

Parameters:
Return type:

list[RestrictedMatrix[TMatrix]]

xc_response_on_density_unrestricted(reference_density_matrix: UnrestrictedMatrix[TMatrix], density_matrix_direction: UnrestrictedMatrix[TMatrix], molecular_configuration: MolecularConfiguration) → UnrestrictedMatrix[TMatrix]

Apply the unrestricted first-order XC response at a reference density.

Parameters:
Return type:

UnrestrictedMatrix[TMatrix]

xc_response_on_density_unrestricted_many(reference_density_matrix: UnrestrictedMatrix[TMatrix], density_matrix_directions: list[UnrestrictedMatrix[TMatrix]], molecular_configuration: MolecularConfiguration) → list[UnrestrictedMatrix[TMatrix]]

Apply the unrestricted XC response to several density directions.

Parameters:
Return type:

list[UnrestrictedMatrix[TMatrix]]

get_available_exchange_correlation_functionals() → tuple[str, ...]

Return LibXC functionals available in the linked PySCF installation.

Return type:

tuple[str, …]

validate_libxc_functional(functional: str) → None

Validate that PySCF LibXC accepts an exchange-correlation functional.

Parameters:

functional (str) – PySCF LibXC functional expression.

Return type:

None