-
Notifications
You must be signed in to change notification settings - Fork 34
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
Expand exact_diagonalization
and FiniteMPS
docstrings
#261
Conversation
I was looking at this, and I don't really know how this could work when |
Codecov ReportAttention: Patch coverage is
|
Thanks for the clarifications. As a question, should we consider actually swapping the sector for the dual? Since the current charge is added to the left, it has an outgoing arrow, which is why it is somehow the opposite of what most people expect, and I don't like that it does not align with the results of calling eigvals on the dense hamiltonian |
I would kind of like this, since this means that for example targeting a state containing I think that if we instead
Things should be clear to users and still consistent internally. |
We could also just change this package-wide, and make a breaking release? |
If we change it everywhere that's also fine, I would definitely find this more intuitive. |
I agree that this would be much more intuitive and in line with how I would think this would have been implemented 😄 . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the above and an internal poll, let's merge this set of changes, and settle on changing the convention in the next breaking release. This way, I can still include this in a released version before that.
Let's keep the other issue open as a reminder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok when tests pass.
Sorry to bother you, but I’d like to raise a related question here. Since the MPSKit documentation doesn’t explicitly describe how to create a charged state A=c^+∣0>, my previous solution was to add a trivial leg to the 3-leg tensor c^+ and place it at the desired site in the FiniteMPO. On the side of the trivial leg, I filled the sites with the identity operator function chargedMPO(operator::AbstractTensorMap, site::Integer, nsites::Integer)
pspace = domain(operator)[1]
if (length(domain(operator)) == 2)&&(length(codomain(operator)) == 1)
Z, vspace = fZ(operator), domain(operator)[2]
I = isomorphism(storagetype(operator), oneunit(vspace)*pspace, pspace*oneunit(vspace))
mpo = FiniteMPO([i < site ? I : i == site ? add_single_util_leg(operator) : Z for i in 1:nsites])
......
function fZ(operator::AbstractTensorMap)
length(domain(operator))==2 ? vspace=domain(operator)[2] : length(codomain(operator))==2 ? vspace=codomain(operator)[1] : throw(ArgumentError("invalid creation or annihilation operator"))
pspace = domain(operator)[1]
iso₁ = isomorphism(storagetype(operator), vspace, vspace)
iso₂ = isomorphism(storagetype(operator), pspace, pspace)
@planar Z[-1 -2; -3 -4] := iso₁[-1; 1] * iso₂[-2; 2] * τ[1 2; 3 4] * iso₂[3; -3] * iso₁[4; -4]
return Z
end While this approach solved the problem (and matches my exact diagonalization in multiple test cases), it feels somewhat inelegant. What would be the most appropriate way to handle this in MPSKit? |
That's definitely the way to do it if you really need a specific charged state. Note that it's a bit annoying to try and automatically handle these things, for the particular reason that you can arbitrarily choose the left or the right side to push this auxiliary charge into, but you really need to be consistent. I would gladly have a better interface for this, but I just don't have the time to think it through properly. (also, if you want to continue this discussion, it's a bit more convenient to open a separate issue/discussion for that, since this is not necessarily related to this PR and should not block merging it) |
Thank you for your explanation, I see, currently it’s good enough for me.
|
Some docstring additions on how to obtain charged eigenstates using
exact_diagonalization
. I also added a line on charged states in theFiniteMPS
docstring, since this is very related and there have been complaints about this not being clear in the past.See also #260.