-
Notifications
You must be signed in to change notification settings - Fork 13
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
Current ortho fix #208
Current ortho fix #208
Conversation
…s.jl into CurrentOrthoFix
@mtfishman once you merge #207 I will update the formatting to be in line with |
@JoeyT1994 regarding the formatting, see ITensor/ITensors.jl#1536 (comment). |
The TTN type is designed like i): https://github.com/ITensor/ITensorNetworks.jl/blob/v0.11.21/src/treetensornetworks/treetensornetwork.jl#L11-L12, do you mean you also want that for non-tree networks? |
Ah I see okay I will leave the formatting as is then and avoid v2.0 of |
I see I didn't know the TTN type had that. I guess I was just thinking more generally, we could have an If the |
That's a good question, I don't remember why it was designed that way. It looks like |
@JoeyT1994 if it seems easier to just use the orthogonality center stored in the TTN, feel free to try to refactor it in that way. |
The function For This logic may not generalize to @JoeyT1994 The bugfix to |
Thanks for the explanation @b-kloss ! So in the code Why does
to orthogonalize onto the new region? I'll give a refactor a go with this plan in mind as it should be possible to simplify the code along these lines, unless I'm missing something. |
@mtfishman @b-kloss I have done a refactor of the code now. The changes done are as follows:
I think this simplifies the logic of things quite a bit. Note, I also had to reverse the direction of the edges in the reverse sweep of TDVP to make things align in the code which I did by just adding a keyword argument as I find it rather tricky to navigate the code for generating |
@JoeyT1994 this definitely looks like a nice simplification of the code, though I'm having trouble picturing how the old code and new code are working diagrammatically. Let's meet to discuss just so I make sure I understand what's going on and can be convinced that the new code and old code are doing the same thing (besides the cases that the new code fixes). This could help with something I was trying in the tensor network impurity solver. I was trying to automate finding the tree structure but for tree structures I was generating I was hitting a bug in the solver code, hopefully it was this bug that you're fixing here! (EDIT: I confirmed that this fixes the bug I was hitting.) |
Thanks @mtfishman . I incorporated some of your comments and yes let's meet to discuss how the logic works here. One slight flag here (which was also present in the previous version) is that the |
Looks good, thanks! |
This PR fixes an issue with the
current_ortho
function which causes thealternating_update
interface to break on more generic trees (current tests appeared to only check more standard cases like the comb tree so missed the bug). It also changes a test intest_dmrg
to use a tree for which the code was previously breaking.The issue appeared to be in the
overlapping_vertex
clause when at the end of a sweep which was assuming that the last vertex in the sweep was a neighbor of the previous vertex --- which may not always be true for the 'default_region_plan'. Removing the clause fixes the issue as theelse
clause always works anyway.@mtfishman I feel like the "current_ortho" should either i) be a trait carried around by the state (by having, e.g., an
orthogonal_tensornetwork
type that wraps anITensorNetwork
and av_orthocentre
) or ii) something that thealternating update
interface keeps track of as a variable and just re-assigns it each time a lawhere
orthogonalize
can utilize the idea that ifpsi
is a tree it just finds the shortest path betweenv
andv_centre
and does a sequence of QRs along that path for efficiency. Ifpsi
is not a tree it could run BP to put it in the Vidal gauge and then absorb square rootlambdas
everywhere except atv
where it absorbs the neighboringlambda
(making the BP environment identity at that site).