Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add solve_hci function #34

Merged
merged 6 commits into from
Oct 9, 2024
Merged

Add solve_hci function #34

merged 6 commits into from
Oct 9, 2024

Conversation

kevinsung
Copy link
Collaborator

Adds solve_hci, which allows using Dice as a general HCI solver. Differences from solve_fermion:

  • Bitstrings are optional.
  • Bitstrings, if passed, must be specified as integers rather than bit array. This aligns with PySCF.
  • norb and nelec are required to be passed.
  • Accepts additional solver options.
  • Returns the SCI strings in addition to the SCI coefficients.

I called the strings "addresses" here for consistency with the rest of the code. They should be changed all together in #28 .

hcore: Core Hamiltonian matrix representing single-electron integrals.
eri: Electronic repulsion integrals representing two-electron integrals.
norb: The number of spatial orbitals.
nelec: The numbers of spin up and spin down electrons.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a description of ci_strings here. We should definitely state what happens in default case (HF bitstring used). It may be worth even mentioning that in docstring description. Up to you on that

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've documented the ci_strs argument. I chose not to add anything to the docstring because I think the ideal behavior is to do whatever Dice itself does by default. If I'm not mistaken, mainline Dice does not accept any bitstrings. Here, I just used the Hartree-Fock bitstrings because it required minimal understanding on my part as to how the rest of the code works, and we might change this down the line.

ci_strs = bitstring_matrix_to_ci_strs(bitstring_matrix)
num_up = format(ci_strs[0][0], "b").count("1")
num_dn = format(ci_strs[1][0], "b").count("1")
e_dice, sci_coefficients, _, avg_occupancies = solve_hci(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you. I was hoping you'd take care of this :)

Copy link
Collaborator

@caleb-johnson caleb-johnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM when you're ready, Thanks!

@kevinsung kevinsung merged commit ed5480a into Qiskit:main Oct 9, 2024
5 checks passed
@kevinsung kevinsung deleted the solve-hci branch October 9, 2024 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants