-
Notifications
You must be signed in to change notification settings - Fork 15
Add shift kwarg to solve_fermion #201
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
Conversation
If ``None``, no spin will be imposed. | ||
shift: Level shift for states which have different spin. :math:`(H + shift * S^2)|ψ> = E|ψ>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this equation should go up in the spin_sq
description? Maybe even in top-level description of this function?
@kevinsung it seems like if you pass a |
Actually, we should set a default numerical value for the |
qiskit_addon_sqd/fermion.py
Outdated
@@ -75,6 +75,7 @@ def solve_fermion( | |||
*, | |||
open_shell: bool = False, | |||
spin_sq: float | None = None, | |||
shift: float | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mentioned in the comment, we should make the default a number. From https://pyscf.org/_modules/pyscf/fci/addons.html it's either 0.2 or 0.1, but it's unclear which one. To be sure, we would need to run some code and print it out or use the debugger.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have been calling fix_spin_
with the default value, so I think 0.1 is what has been the default for us
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to make the type hint float
and cast to np.float64
inside. The linter didn't want me to use np.float64()
in the annotation. I could do shift: np.number | float = 0.1
, but I figured this is fine
qiskit_addon_sqd/fermion.py
Outdated
if isinstance(bitstring_matrix, tuple): | ||
ci_strs = bitstring_matrix | ||
else: | ||
ci_strs = bitstring_matrix_to_ci_strs(bitstring_matrix, open_shell=open_shell) | ||
ci_strs = _check_ci_strs(ci_strs) | ||
shift = np.float64(shift) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the code actually break without this type conversion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I just did it bc its what pyscf says it wants
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. In that case, I think you can delete it.
I think we need to change the default spin_sq to |
I did that for the |
Fixes #139