Skip to content

Explicit form of tensors from MPS/MPO in numpy arrays #35

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

You must be logged in to vote

Hi @Kowalikov, thanks for your interest in using block2. Here is an example python script for translating the MPS and MPO into explicit numpy arrays:

import numpy as np
from pyblock2._pyscf.ao2mo import integrals as itg
from pyblock2.driver.core import DMRGDriver, SymmetryTypes
from pyblock2.algebra.io import MPSTools, MPOTools

from pyscf import gto, scf

mol = gto.M(atom="N 0 0 0; N 0 0 1.1", basis="sto3g", symmetry="d2h", verbose=0)
mf = scf.RHF(mol).run(conv_tol=1E-14)
ncas, n_elec, spin, ecore, h1e, g2e, orb_sym = itg.get_rhf_integrals(mf,
    ncore=0, ncas=None, g2e_symm=8)

driver = DMRGDriver(scratch="./tmp", symm_type=SymmetryTypes.SZ, n_threads=4)
driver.initialize_system(n_sites=

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@meandmytram
Comment options

Answer selected by Kowalikov
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@meandmytram
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
3 participants