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

Fermionic OpSum to TTN constructor #122

Merged
merged 41 commits into from
Jan 22, 2024

Conversation

b-kloss
Copy link
Contributor

@b-kloss b-kloss commented Jan 12, 2024

This PR generalizes the construction of TTNs from OpSums to systems with fermionic degrees of freedom when ITensors.using_auto_fermion()==true.
The implementation closely follows the logic in the OpSum to MPO constructor in ITensors.jl (in fact replicates quite a bit of code) and does not expose the auto_fermion logic.
The functionality passes tests (test/test_opsum_to_ttno.jl) for fermions and electrons.

Tests added:

  • test_opsum_ttn.jl: tests for non-fermionic QN inds on comb graph, and comb graph with a single internal vertex. These tests contract the Hamiltonian TTNO and compare with one generated by ITensors.MPO.
  • test_opsum_ttn.jl: tests for fermionic QN inds on comb graph for NNN tight-binding model on comb graph. Since comparison \approxeq between fermionic ITensors is broken, the Hamiltonian is cast into a dense matrix for both TTN and MPO format (using Combiners) and compared.
  • test_treetensornetworks/test_solvers/test_dmrg.jl: tests added for NNN heisenberg and hubbard model on comb graph, comparison of ground state energies with result from ITensors.dmrg. Tests for single-site DMRG with QNs have been removed due to missing random_ttn and lack of subspace_expansion.

To Do:

  • Implement fermionic permutation sign in ttn_svd.
  • Cleanup convoluted (fermion/arrow-direction related) logic inside svd_ttn.
  • Implement tests for fermionic systems.
  • Test DMRG for NNN Hubbard Model on comb tree.
  • Figure out whether comparison of fermionic ITensors is broken.
  • Add more tests for solvers including fermionic systems?
  • Add test that verifies that vanishing coefficient terms do not influence final bond dimension. (Probably better in another PR since it's unrelated to the fermion implementation.)

@codecov-commenter
Copy link

codecov-commenter commented Jan 12, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (5ec5228) 72.55% compared to head (5a24c2a) 72.90%.

Files Patch % Lines
src/models.jl 98.27% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #122      +/-   ##
==========================================
+ Coverage   72.55%   72.90%   +0.35%     
==========================================
  Files          71       71              
  Lines        4055     4097      +42     
==========================================
+ Hits         2942     2987      +45     
+ Misses       1113     1110       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@b-kloss
Copy link
Contributor Author

b-kloss commented Jan 12, 2024

@mtfishman @emstoudenmire
It looks like svd_ttn is working for fermions now and the logic for the fermion-sign really only comes in for the permutation w.r.t. the direct product in the last step.

src/models.jl Outdated Show resolved Hide resolved
@emstoudenmire
Copy link
Contributor

Nice! So did you find & fix that other bug that was showing up for electrons but was related to QNs?

@b-kloss
Copy link
Contributor Author

b-kloss commented Jan 13, 2024 via email

@emstoudenmire
Copy link
Contributor

I'm excited to hear it's already working. Is it passing tests on multiple fermionic cases? If so this is a big development.

@b-kloss
Copy link
Contributor Author

b-kloss commented Jan 14, 2024

It's working for spinless fermions and the Hubbard model (including next-nearest neighbors in both cases).
DMRG results on a tree agree with MPS calculations.
Comparing two fermionic ITensors @test A ≈ B seems to be broken but I checked by casting to a Dense matrix that the elements agree.

@b-kloss b-kloss marked this pull request as ready for review January 15, 2024 00:35
@emstoudenmire
Copy link
Contributor

Those are some pretty strenuous tests. Great. We can discuss the failing ITensor comparison test, since maybe that's more of a low-level bug with ITensors.jl ?

src/models.jl Outdated Show resolved Hide resolved
src/models.jl Outdated Show resolved Hide resolved
@mtfishman mtfishman changed the title Add compatibility with fermionic site indices for TTN constructor. Fermionic OpSum to TTN constructor Jan 22, 2024
@mtfishman mtfishman changed the title Fermionic OpSum to TTN constructor Fermionic OpSum to TTN constructor Jan 22, 2024
@mtfishman
Copy link
Member

mtfishman commented Jan 22, 2024

Looks good, thanks a lot @b-kloss. This is a big step forward for ITensor!

I think it is ready to merge once the new round of comments are addressed.

src/models.jl Outdated Show resolved Hide resolved
@mtfishman
Copy link
Member

Looks good, thanks again. I'll merge once tests pass.

@mtfishman mtfishman merged commit 56fcb93 into ITensor:main Jan 22, 2024
6 of 9 checks passed
@b-kloss b-kloss deleted the AutoTTNO-fix-fermion branch February 2, 2024 19:32
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.

4 participants