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

MPS emulator for LUCJ circuits #334

Open
wants to merge 120 commits into
base: main
Choose a base branch
from

Conversation

bartandrews
Copy link
Contributor

@bartandrews bartandrews commented Oct 25, 2024

The aims for this pull request:

  • Add a method to convert a molecular Hamiltonian to an MPO.
  • Add a method that can construct an LUCJ circuit as an MPS.
  • Create a "how-to guide" jupyter notebook.

@bartandrews bartandrews marked this pull request as draft October 27, 2024 09:52
@bartandrews bartandrews changed the title Add method to convert MolecularHamiltonian to MPO MPS emulator for LUCJ circuits Oct 27, 2024
@bartandrews bartandrews marked this pull request as ready for review October 29, 2024 14:51
@bartandrews
Copy link
Contributor Author

bartandrews commented Oct 29, 2024

Note that the mkl and mkl-devel packages (and cython) needs to be installed in the environment for TeNPy to be compiled against MKL for faster performance, see https://tenpy.readthedocs.io/en/latest/install/extra.html I'm not sure of the best way to incorporate this. It works fine without it, but power users need to make sure that TeNPy is compiled optimally.

Note that by default, i.e. after running pip install physics-tenpy, the cython code will be compiled, but the numpy/scipy versions will be linked against OpenBLAS, and not MKL. It seems debatable whether MKL is better than OpenBLAS. If we did want MKL, it is better to use conda rather than pip, since conda ships numpy/scipy packages linked against MKL (and these packages are maintained). pip does have packages like intel-numpy and intel-scipy but these packages are out-of-date (i.e. do not support the latest python version).

I think that this issue transcends tenpy and becomes a more general question of whether or not to link numpy/scipy against MKL, which is a matter of personal preference. Therefore, I suggest that we leave this as is.

Copy link
Collaborator

@kevinsung kevinsung left a comment

Choose a reason for hiding this comment

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

Thank you Bart! I'll begin with some high-level comments that will involve some code restructuring.

python/ffsim/hamiltonians/molecular_hamiltonian.py Outdated Show resolved Hide resolved
python/ffsim/tenpy/circuits/gates.py Outdated Show resolved Hide resolved
python/ffsim/tenpy/circuits/lucj_circuit.py Outdated Show resolved Hide resolved
python/ffsim/tenpy/circuits/lucj_circuit.py Outdated Show resolved Hide resolved
@bartandrews
Copy link
Contributor Author

Thank you Bart! I'll begin with some high-level comments that will involve some code restructuring.

Thank you for reviewing this! 😃 I will implement these changes asap

@bartandrews bartandrews marked this pull request as ready for review January 20, 2025 16:04
@bartandrews bartandrews requested a review from kevinsung January 21, 2025 14:14
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