shuaigroup / Renormalizer

Quantum dynamics package based on tensor network states
https://shuaigroup.github.io/Renormalizer/
Apache License 2.0
51 stars 16 forks source link

Add support for multiple quntum numbers #146

Closed liwt31 closed 1 year ago

liwt31 commented 1 year ago
jiangtong1000 commented 1 year ago

very nice. Just to note that in cv/finitet.py and the finiteT_cv function in mps/mpo.py, the qn has been designed in the form of array([[0, 1], [1, 0]]).

jiangtong1000 commented 1 year ago

very nice. Just to note that in cv/finitet.py and the finiteT_cv function in mps/mpo.py, the qn has been designed in the form of array([[0, 1], [1, 0]]).

oh you just rewritten these two parts I mentioned above. Thanks

liwt31 commented 1 year ago

very nice. Just to note that in cv/finitet.py and the finiteT_cv function in mps/mpo.py, the qn has been designed in the form of array([[0, 1], [1, 0]]).

Actually I'm not sure if the cv part is implemented correctly. The internal qn representation in cv happens to be compatible with the new implementation. It will be nice if you can run more tests and see if there are any more bugs.

codecov[bot] commented 1 year ago

Codecov Report

Base: 85.12% // Head: 85.23% // Increases project coverage by +0.11% :tada:

Coverage data is based on head (897dde3) compared to base (bac8bed). Patch coverage: 94.80% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #146 +/- ## ========================================== + Coverage 85.12% 85.23% +0.11% ========================================== Files 105 105 Lines 9915 9986 +71 ========================================== + Hits 8440 8512 +72 + Misses 1475 1474 -1 ``` | [Impacted Files](https://codecov.io/gh/shuaigroup/Renormalizer/pull/146?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=shuaigroup) | Coverage Δ | | |---|---|---| | [renormalizer/mps/tests/test\_sbm.py](https://codecov.io/gh/shuaigroup/Renormalizer/pull/146?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=shuaigroup#diff-cmVub3JtYWxpemVyL21wcy90ZXN0cy90ZXN0X3NibS5weQ==) | `100.00% <ø> (ø)` | | | [renormalizer/spectra/tests/test\_spectra.py](https://codecov.io/gh/shuaigroup/Renormalizer/pull/146?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=shuaigroup#diff-cmVub3JtYWxpemVyL3NwZWN0cmEvdGVzdHMvdGVzdF9zcGVjdHJhLnB5) | `100.00% <ø> (ø)` | | | [renormalizer/model/model.py](https://codecov.io/gh/shuaigroup/Renormalizer/pull/146?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=shuaigroup#diff-cmVub3JtYWxpemVyL21vZGVsL21vZGVsLnB5) | `88.53% <75.00%> (-0.26%)` | :arrow_down: | | [renormalizer/model/op.py](https://codecov.io/gh/shuaigroup/Renormalizer/pull/146?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=shuaigroup#diff-cmVub3JtYWxpemVyL21vZGVsL29wLnB5) | `84.46% <83.33%> (+0.33%)` | :arrow_up: | | [renormalizer/model/h\_qc.py](https://codecov.io/gh/shuaigroup/Renormalizer/pull/146?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=shuaigroup#diff-cmVub3JtYWxpemVyL21vZGVsL2hfcWMucHk=) | `98.00% <87.50%> (+0.19%)` | :arrow_up: | | [renormalizer/model/basis.py](https://codecov.io/gh/shuaigroup/Renormalizer/pull/146?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=shuaigroup#diff-cmVub3JtYWxpemVyL21vZGVsL2Jhc2lzLnB5) | `89.46% <94.73%> (+0.35%)` | :arrow_up: | | [renormalizer/mps/mp.py](https://codecov.io/gh/shuaigroup/Renormalizer/pull/146?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=shuaigroup#diff-cmVub3JtYWxpemVyL21wcy9tcC5weQ==) | `88.49% <96.00%> (+0.28%)` | :arrow_up: | | [renormalizer/mps/svd\_qn.py](https://codecov.io/gh/shuaigroup/Renormalizer/pull/146?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=shuaigroup#diff-cmVub3JtYWxpemVyL21wcy9zdmRfcW4ucHk=) | `94.96% <96.29%> (+0.56%)` | :arrow_up: | | [renormalizer/mps/mps.py](https://codecov.io/gh/shuaigroup/Renormalizer/pull/146?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=shuaigroup#diff-cmVub3JtYWxpemVyL21wcy9tcHMucHk=) | `90.55% <97.56%> (+0.05%)` | :arrow_up: | | [renormalizer/cv/tests/test\_H\_chain.py](https://codecov.io/gh/shuaigroup/Renormalizer/pull/146?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=shuaigroup#diff-cmVub3JtYWxpemVyL2N2L3Rlc3RzL3Rlc3RfSF9jaGFpbi5weQ==) | `100.00% <100.00%> (ø)` | | | ... and [11 more](https://codecov.io/gh/shuaigroup/Renormalizer/pull/146?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=shuaigroup) | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=shuaigroup). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=shuaigroup)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

liwt31 commented 1 year ago

The quantum chemistry tests are sensitive to the initial guess. On my local machine, the test can pass with M=24 or more. On the CI machine, the test can pass with M=22 but not M=24. So I increase M to 30 for robustness.

jiangtong1000 commented 1 year ago

The quantum chemistry tests are sensitive to the initial guess. On my local machine, the test can pass with M=24 or more. On the CI machine, the test can pass with M=22 but not M=24. So I increase M to 30 for robustness.

Will fixing a random seed be useful?

liwt31 commented 1 year ago

The quantum chemistry tests are sensitive to the initial guess. On my local machine, the test can pass with M=24 or more. On the CI machine, the test can pass with M=22 but not M=24. So I increase M to 30 for robustness.

Will fixing a random seed be useful?

In principle it should work but in practice it does not. I didn't delve into the problem and simply solve by increasing M

jjren commented 1 year ago

extremely good PR, the one I have been looking for many years!

liwt31 commented 1 year ago

extremely good PR, the one I have been looking for many years!

Thanks. The new quantum number feature is not widely tested though. It may take more effort to make it work for production-level scripts.

jiangtong1000 commented 1 year ago

very nice. Just to note that in cv/finitet.py and the finiteT_cv function in mps/mpo.py, the qn has been designed in the form of array([[0, 1], [1, 0]]).

Actually I'm not sure if the cv part is implemented correctly. The internal qn representation in cv happens to be compatible with the new implementation. It will be nice if you can run more tests and see if there are any more bugs.

I also examined in cases apart from the test case in the package, I think the implementation is correct.

jjren commented 1 year ago

very nice. Just to note that in cv/finitet.py and the finiteT_cv function in mps/mpo.py, the qn has been designed in the form of array([[0, 1], [1, 0]]).

oh you just rewritten these two parts I mentioned above. Thanks

I don't think Weitang has touched these two parts. Only the zeroT cv subroutine is consistent with the current qn implementation. But not the finiteT subroutine. Maybe, the finiteT subroutine can reuse some parts of the new implementation. But they have subtle differences.

jjren commented 1 year ago

One improvement of the current PR is to generalize the current arithmetic + (qntot = qn1 + qn2) to fulfill more general U1 symmetry. For example in Abelian point group symmetry, the arithmetic + is replaced with the product of irrep representation (A \times B = C). It is helpful for QC calculation of symmetry molecules. Of course, this kind of improvement can be added in a future PR.

liwt31 commented 1 year ago

One improvement of the current PR is to generalize the current arithmetic + (qntot = qn1 + qn2) to fulfill more general U1 symmetry.

This is an interesting direction. How much effort we plan to invest into the implementation depends on how much we want reno to be capable of handling electronic structure problems. From my point of view, these improvements are marginal if we stick to the current MPS/MPO backend. I'd prefer first look at how to increase M to 1000 before utilizing the symmetry.

jjren commented 1 year ago

It will be a big improvement if reno can routinely handle \~40 spatial orbitals with M\~1000.

liwt31 commented 1 year ago

The new commit fixes the document problem in Op and BTW enhances the __str__/__repr__ formatting of BasisSet class

Another quick enhance to add product method for OpSum is included below