Skip to content

How to get the state vector in SGB mode? #124

Answered by hczhai
fqian5 asked this question in Q&A
Discussion options

You must be logged in to vote

I was trying to get state vector of the wavefunction of the MPS in SGB mode. Is there a way to do this?

As pyblock3 is a package mostly for fermion problems, it does not accept the SGB mode in block2. You can use pyblock2.algebra.io instead of pyblock3.block2.io, which works for most symmetry modes in block2.

So the final part of your script should be changed to the following:

from pyblock2.algebra.io import MPSTools

def get_mps_tensor(ket):
    ket = driver_obj.adjust_mps(ket, dot=1)[0]
    pyket = MPSTools.from_block2(ket)
    tensors = [x.blocks[0].reduced for x in pyket.tensors]
    ket = tensors[0]
    for i in range(len(tensors) - 1):
        ket = np.tensordot(ket, tensors[i + 1], 

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@hczhai
Comment options

Answer selected by hczhai
@fqian5
Comment options

@hczhai
Comment options

@fqian5
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants