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

Code duplication in hamiltonians #45

Open
rmlarose opened this issue Nov 17, 2020 · 2 comments
Open

Code duplication in hamiltonians #45

rmlarose opened this issue Nov 17, 2020 · 2 comments
Assignees

Comments

@rmlarose
Copy link
Collaborator

There's a few things that can be cleaned up with these classes, notably the methods diagonal_coulomb, diagonal, etc. Some of these can just be inferred from the type, i.e. using isinstance(ham, DiagonalCoulomb) instead of

def diagonal_coulomb(self) -> bool:
    """Returns whether or not the Hamiltonian is diagonal_coulomb."""
    return True

Alternatively, one define Hamiltonian with arguments for is_diagonal, is_diagonal_coulomb, etc., which would clean things up.

I think the inheritance structure could be fixed in some places. E.g., DiagonalCoulomb should inherit from Diagonal instead of from Hamiltonian as far as I understand.

@rmlarose rmlarose self-assigned this Nov 17, 2020
@ncrubin
Copy link
Collaborator

ncrubin commented Nov 19, 2020

Hey Ryan, I also think it would be nice if we had a way to use FQE wavefunctions to calculate expectation values of FermionOperators that obey the symmetries of the wavefunction. The simplest thing one could do is partition the FermionOperator into individual terms and then convert to a SparseOperator and calculate the expectation value. It would be better if this happened behind an API. Any interest in implementing this?

@rmlarose
Copy link
Collaborator Author

Hey Ryan, I also think it would be nice if we had a way to use FQE wavefunctions to calculate expectation values of FermionOperators that obey the symmetries of the wavefunction. The simplest thing one could do is partition the FermionOperator into individual terms and then convert to a SparseOperator and calculate the expectation value. It would be better if this happened behind an API. Any interest in implementing this?

Sure thing! I think I have a clear idea how to do this but may need to ask some domain-specific questions, though.

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

No branches or pull requests

2 participants