edeprince3 / pdaggerq

Apache License 2.0
44 stars 10 forks source link

Cleaned up __repr__() inside various amplitude/integral classes. #69

Closed stephenyuwono closed 2 months ago

stephenyuwono commented 2 months ago

Currently, in pdaggerq/algebra.py, each of the various integrals and amplitude classes have __repr__ method that overwrite the corresponding method in BaseTerm.

The overridden __repr__ methods have hardcoded shape (e.g. Right1amps will be printed as r1(p,q)), but this is problematic for IP/EA-type operators. This PR clean those hardcoded __repr__ methods when unnecessarily used, because the BaseTerm.__repr__() method is enough to account for generalized amplitude/integral shapes. Only Kronecker delta and two-particle integrals have overridden __repr__ because they are printed differently than the actual variable name.

Another issue with IP/EA: Somewhat unrelated is the fact that pdaggerq/algebra.py will try to parse for the optimum einsum contraction path on line 282, but we could probably change the code to just say optimize=True (which unfortunately will always parse the most optimum path every single time the line is executed).