Python Module state

This module provides various types of initial states. The initial states for the qIMPS routine can be defined via

Non-symmetry conserving MPS states may be obtained through

  • State.ProductState

  • State.PartlyProduct

state.nint(x)[source]

Return the integer nearest x (only defined for x \ge 0).

state.tupleadd(xs, ys, nqns, ncs)[source]

Addition of tuples with intermediate conversion to numpy array.

state.tupledist(xl, xr, mf, nqns)[source]

Distance of tuples calculated with conversion to numpy array.

state.GenerateqInitialState(fileID, qnums, pnums, L, qOperators)[source]

Generates an initial state obeying the symmetry according to State.qProductState.

Arguments

fileIDstr

Basis for the complete file. The complete file name is fileID + InitialState.dat

qnumslist

List containing the quantum numbers of the U(1) symmetry.

pnumslist

List containint the quantum numbers for the Z2 symmetry.

Lint

number of sites in the system

qOperatorsinstance of Ops.OperatorList

The symmetry conserving operators have to be generated in Ops.OperatorList before creating a qProductState.

state.GenerateParityState(fileID, L, N0, N1)[source]

Generate a product state on L sites with N0 particles in state |0 \rangle and N1 particles in state |1 \rangle. N0 + N1 cannot be greater than the system size, but there can be empty site | E \rangle. The particles are placed in the middle:

| E \ldots E 0 \ldots 0 1 \ldots 1 E \ldots E \rangle

Arguments

fileIDstr

Basis for the complete file. The complete file name is fileID + InitialState.dat

Lint

system size.

N0int

Number of particles in the state 0.

N1int

Number of particles in the state 1.


class state.qProductState(qnums, pnums, L, qOperators)[source]

Generate an initial state on L sites with the quantum numbers qnums and the Hilbert space in qOperators. The routine attempts to make the state as uniform as possible by defining a mean filling and filling as many sites as possible with that filling. The “exceptional” sites are then filled with the excess quantum numbers. This routine is a work in progress for multiple quantum numbers-MLW 090111.

Arguments

qnumslist

List containing the quantum numbers of the U(1) symmetry.

pnumslist

List containint the quantum numbers for the Z2 symmetry.

Lint

number of sites in the system

qOperatorsinstance of Ops.OperatorList

The symmetry conserving operators have to be generated in Ops.OperatorList before creating a qProductState.

Details

  1. In the first step generate four lists containing:

    • meanfilling: rounded quantum number in system divided by system size L. This is done for every quantum number.

    • excess: Difference between the mean filling just calculated and the targeted quantum number. Negative when mean filling too big. Never used again.

    • nexceptionall (!!! two l’s at the end !!!): number of exceptional sites.

    • nrmex: sign/signum function of excess.

  2. Specify particles injected on each iteration. ninject contains the two times the mean filling (except single site) and substracts/adds exceptionall on the last injections

  3. Injections are carried out on two-site blocks. Therefore the quantum numbers on a two-site block is derived and stored in a dictionary.

  4. Select from those two-site blocks, for each injection, the injection which is closest to the mean-filling. E.g. for one quantum number with U(1) symmetry, choose (1, 1) over (2, 0) or (0, 2) for mean-filling of two particles. Z2 symmetries have always a distance of 0.

  5. Write out states is covered through State.qProductState.write().

write(fileID)[source]

Write out the state.

Arguments

fileIDstr

Basis for the complete file. The complete file name is fileID + InitialState.dat


class state.QProductState(qOperators, qnums_per_site=None, pnums_per_site=None, func_subspace=None)[source]

Generate an initial state defined by the user. The state is defined in terms of the quantum numbers and must be a product state.

Arguments

qOperatorsinstance of Ops.OperatorList

The symmetry conserving operators have to be generated in Ops.OperatorList before creating a qProductState.

qnums_per_site2d numpy array (floats), optional

The sites run over the columns, the different quantum numbers run over the rows. At system with 10 sites and 2 abelian quantum numbers has a (2 x 10) shape. Default to None.

pnums_per_site2d numpy array (floats), optional

The sites run over the columns, the different quantum numbers run over the rows. At system with 10 sites and 2 discrete quantum numbers has a (2 x 10) shape. Default to None.

func_subspacecallable, optional

Can be used to pass state for degenerate subspace. If not given, an equal superposition is assumed. The function must take the following arguments in exactly this order: (1) dimension of the subspace (2) site index (3) the q-quantum numbers for U1-type symmetries, and (4) the p-quantum numbers for Z2-type symmetries. It must return a vector of the dimension of the subspace.

Details

For degenerate subspaces in one symmetry sector, equal weight is assigned to each state. The functions takes care of the shifting and scaling the quantum numbers to integer-quantum numbers starting at zero.

The system size is deducted from the second dimension of the array qnums_per_site and pnums_per_site. Either qnums_per_site or pnums_per_site must be given.

write(filename)[source]

Write out the state.

Arguments

filenamestr

The complete filename.


class state.ProductState(state_matrix)[source]

Create an unnormalized Product (or Fock) state. State will be normalized upon writing. This class can currently not take care of symmetries.

Arguments

state_matrixnumpy 2d array

The number of sites in the system is defined through the number of columns and the local dimension (equal for each site) through the number of rows. In conclusion each column defines a local state of the global Product/Fock state.

write(filename, enforce_cmplx=False)[source]

Write state to file

Arguments

filenamestring

Filename for saving the state to file.

enforce_cmplxBool, optional

Enforce writting a complex MPS even if all entries in the state are real which is necessary when complex Hamiltonians are passed. Default to False.

write_complex(flnm)[source]

Write an unnormalized Fock state with complex entries.

Arguments

flnmstring

Filename for saving the state to file.

write_real(flnm)[source]

Write the unnormalized Fock state with completely real entries.

Arguments

flnmstring

Filename for saving the state to file.


class state.PartlyProduct(ld)[source]

Define an input state build of pure states possibly defined on several lattice sites. Use the iadd (+=) to add vectors and mps_state.write() to write your state to a file. This class can currently not take care of symmetries.

Arguments

ldint

local dimension of the Hilbert space

Variables

ldint

local dimension of the Hilbert space

purestateslist of numpy 1d array

the list contains state vectors possibly spanning multiple sites. The order in which they are added corresponds the first (left) site to the last (right) site.

cutofffloat

cut singular values smaller than cutoff. default to 1e-14

cutchiint

cut bond dimension above cutchi default to 500

Details

Where the Fock state (| \psi_1 \rangle \otimes
| \psi_2 \rangle \otimes \ldots \otimes | psi_L \rangle) this kind of state can handle entangled sites, e.g. in the case of qubits up to 20 neighboring sites entangled with each other: | \psi_{1,2,3} \rangle \otimes | \psi_{4} \rangle \otimes \ldots
| \psi_{L-1, L} \rangle

__iadd__(purestate)[source]

Add a state list to the list.

Arguments

purestatenumpy 1d array

state spanning possible multiple sites. If n is the number of sites spanned, the shape with l_d the local dimension should be (l_d)^n.

check_isometry(tensors)[source]

Check isometry and normalization condition

Arguments

tensorslist of numpy rank-3 arrays

containing the tensors for the initial MPS with orthogonality center on the first site.

decompose()[source]

Decompose pure states spanning multiple sites into tensors. Returned is a list with the local tensors (internal use).

get_entry_complex(entry)[source]

Return the entry of a tensor as a string of a complex number (internal use).

Arguments

entryfloat, complex float

entry of a tensor

get_entry_real(entry)[source]

Return the (real-valued) entry of a tensor as a string (internal use).

Arguments

entryfloat

entry of a tensor, real-valued

has_complex_state()[source]

Check for complex states in the list. Return True if complex numbers occur, else False (internal use).

write(flnm, enforce_complex=False)[source]

Write the initial mps state to a file.

Arguments

flnmstring

filename for the initial mps state.

enforce_cmplxBool, optional

Enforce writting a complex MPS even if all entries in the state are real which is necessary when complex Hamiltonians are passed. Default to False.

write_file(ts, ld, flnm)[source]

Open file handle and write the state (internal use).

Arguments

tslist contain 3d numpy arrays

representing the normalized ond orthogonalized tensors for the initial state.

ldinteger

local dimension of the sites

filenamestring

Filename for saving the state to file.


class state.State(L)[source]

This class represents a State object on L sites. (dj: Apparantly it is not used in the library and it is unclear to me how to use it.)

Arguments

Lint

Number of sites for the state.

Variables

datadictionary

Dictionary contains keys for system size L and states and weights. The latter two are represented as lists.

addProductState(state, weight=1.0)[source]

Add a product state to the State object. If weight is supplied, the product state is weighted by this factor.

normalizeWeights()[source]

Normalize the weights of a State, in effect normalizing the state.

writeState(fileStub)[source]

Write the state represented by the State object to a file.

writeqState(fileStub, qOperators)[source]

Translate the states in the State to the qState representation using the qOperators structure, and then write to a file.