Recent Changes - Search:

HomePage

PmWiki

pmwiki.org

MpMatrix

The mp-matrix command writes the matrix elements of the MPS in a format suitable to read from another programming environment, such as Python or MATLAB.

Synopsis

mp-matrix [options] -w <psi> -o <file>

Writes the wavefunction <psi> to the file <file>. Currently there are two formats supported, Python and MATLAB. Both formats write the MPS as two structures, named MPS and RHO. MPS is a list of A-matrices in left-orthogonalized form. RHO is the density matrix at the right hand edge. It is real and diagonal.

The wavefunction is not allowed to have any quantum numbers. If the wavefunction has symmetries, you must use mp-reorder-symmetry first to remove them.

Options

--help

show help message

-f, --format=python

the output format. Possible choices are python (the default) and matlab.

-q, --quiet

suppress comments in the output file

--quiet

allow overwriting the output file, if it exists

Examples

In this example, we create a simple spin chain wavefunction and show some information about it, using Python.

# create a lattice file, spinchain with no symmetry
spinchain -o lat
# create a wavefunction, 2-site unit cell, 10 states kept
mp-idmrg-s3e -H lat:H_J1 -w psi --create -u 2 -m 10..10x100
# write the MPS as python format
mp-matrix -w psi -o psi.py

There is an example Python program in mptoolkit/python/mp-matrix-example.py. If we run this program it prints some basic information about the MPS,

python3 ./mp-matrix-example.py

Some example output is:

MPS has 2 sites
site 0 has a local basis dimension of 2
site 0 component 0 is a matrix of shape (10, 10)
site 0 component 1 is a matrix of shape (10, 10)
site 1 has a local basis dimension of 2
site 1 component 0 is a matrix of shape (10, 10)
site 1 component 1 is a matrix of shape (10, 10)

the diagonal components of the density matrix are  [8.02175077e-01 7.04383048e-02 6.53469823e-02 6.06325651e-02
 4.41867200e-04 3.90257372e-04 3.52228964e-04 2.13387496e-04
 5.04431385e-06 4.28528594e-06]

testing left-orthogonality condition of the A-matrices at site 0
A-matrix is orthogonal: True

testing left-orthogonality condition of the A-matrices at site 1
A-matrix is orthogonal: True

Notes

The MATLAB format is probably non-functional. This needs assistance from a MATLAB programmer.

Edit - History - Print - Recent Changes - Search
Page last modified on May 26, 2020, at 06:26 PM