qdk_chemistry.utils.wavefunction module

Wavefunction utilities.

qdk_chemistry.utils.wavefunction.calculate_sparse_wavefunction(reference_wavefunction, hamiltonian, reference_energy, energy_tolerance, max_determinants, pmc_calculator='macis_pmc')[source]

Screen the wavefunction down to a sparse-CI subset based on energy tolerance w.r.t. a reference energy.

Return type:

tuple[float, Wavefunction]

Parameters:
  • reference_wavefunction (Wavefunction) – The initial wavefunction to be screened.

  • hamiltonian (Hamiltonian) – The Hamiltonian corresponding to the wavefunction.

  • reference_energy (float) – The reference energy to compare against.

  • energy_tolerance (float) – The acceptable energy difference from the reference energy.

  • max_determinants (int) – The maximum number of determinants to consider.

  • pmc_calculator (str) – The PMC calculator to use for energy projection.

Returns:

Energy value and a Wavefunction object representing the sparse-CI wavefunction.

qdk_chemistry.utils.wavefunction.get_active_determinants_info(wavefunction, max_determinants=None)[source]

Generate a string representation of the CI coefficients and configurations.

Return type:

str

Parameters:
  • wavefunction (Wavefunction) – The Wavefunction object.

  • max_determinants (int | None) – Maximum number of determinants to include in the summary. If None, include all determinants.

Returns:

A formatted string listing CI coefficients and their corresponding configurations.

qdk_chemistry.utils.wavefunction.get_top_determinants(wavefunction, max_determinants=None)[source]

Return a list of determinants ranked by absolute CI coefficient.

Return type:

dict[Configuration, float | complex]

Parameters:
  • wavefunction (Wavefunction) – The wavefunction from which to extract determinants.

  • max_determinants (int | None) – Number of top determinants to return. If None, return all.

Returns:

A dictionary containing (Configuration, CI coefficient) pairs consisting of the top determinants.