# AKLTChain¶

Inheritance Diagram Methods

 AKLTChain.__init__(model_params) Calculate bond energies . AKLTChain.calc_H_MPO_from_bond([tol_zero]) Calculate the MPO Hamiltonian from the bond Hamiltonian. AKLTChain.calc_H_bond_from_MPO([tol_zero]) Calculate the bond Hamiltonian from the MPO Hamiltonian. Shallow copy of self. Repeat the unit cell for infinite MPS boundary conditions; in place. AKLTChain.extract_segment(*args, **kwargs) Return a (shallow) copy with extracted segment of MPS. AKLTChain.from_MPOModel(mpo_model) Initialize a NearestNeighborModel from a model class defining an MPO. AKLTChain.from_hdf5(hdf5_loader, h5gr, subpath) Load instance from a HDF5 file. AKLTChain.group_sites([n, grouped_sites]) Modify self in place to group sites. AKLTChain.save_hdf5(hdf5_saver, h5gr, subpath) Export self into a HDF5 file. AKLTChain.test_sanity() Return a NearestNeighborModel with same lattice, but trivial (H=0) bonds.

Class Attributes and Properties

 AKLTChain.logger class attribute.
class tenpy.models.aklt.AKLTChain(model_params)[source]

A simple implementation of the AKLT model.

Here we define the Hamiltonian on a chain of S=1 spins as originally defined by Affleck, Kennedy, Lieb, Tasaki in , but dropping the constant parts of 1/3 per bond and rescaling with a factor of 2, such that we expect a ground state energy of E_0 = - (L-1) 2/3 * J.

$H = J \sum_i 2* P^{S=2}_{i,i+1} + const = J \sum_i (\vec{S}_i \cdot \vec{S}_{i+1} +\frac{1}{3} (\vec{S}_i \cdot \vec{S}_{i+1})^2)$
bond_energies(psi)[source]

Calculate bond energies <psi|H_bond|psi>.

Parameters

psi (MPS) – The MPS for which the bond energies should be calculated.

Returns

E_bond – List of bond energies: for finite bc, E_Bond[i] is the energy of bond i, i+1. (i.e. we omit bond 0 between sites L-1 and 0); for infinite bc E_bond[i] is the energy of bond i-1, i.

Return type

1D ndarray

calc_H_MPO_from_bond(tol_zero=1e-15)[source]

Calculate the MPO Hamiltonian from the bond Hamiltonian.

Parameters

tol_zero (float) – Arrays with norm < tol_zero are considered to be zero.

Returns

H_MPO – MPO representation of the Hamiltonian.

Return type

MPO

calc_H_bond_from_MPO(tol_zero=1e-15)[source]

Calculate the bond Hamiltonian from the MPO Hamiltonian.

Parameters

tol_zero (float) – Arrays with norm < tol_zero are considered to be zero.

Returns

H_bond – Bond terms as required by the constructor of NearestNeighborModel. Legs are ['p0', 'p0*', 'p1', 'p1*']

Return type

list of Array

:raises ValueError : if the Hamiltonian contains longer-range terms.:

copy()[source]

Shallow copy of self.

enlarge_mps_unit_cell(factor=2)[source]

Repeat the unit cell for infinite MPS boundary conditions; in place.

This has to be done after finishing initialization and can not be reverted.

Parameters

factor (int) – The new number of sites in the MPS unit cell will be increased from N_sites to factor*N_sites_per_ring. Since MPS unit cells are repeated in the x-direction in our convetion, the lattice shape goes from (Lx, Ly, ..., Lu) to (Lx*factor, Ly, ..., Lu).

extract_segment(*args, **kwargs)[source]

Return a (shallow) copy with extracted segment of MPS.

Parameters
Returns

cp – A shallow copy of self with MPO and lattice extracted for the segment.

Return type

Model

classmethod from_MPOModel(mpo_model)[source]

Initialize a NearestNeighborModel from a model class defining an MPO.

This is especially usefull in combination with MPOModel.group_sites().

Parameters

mpo_model (MPOModel) – A model instance implementing the MPO. Does not need to be a NearestNeighborModel, but should only have nearest-neighbor couplings.

Examples

The SpinChainNNN2 has next-nearest-neighbor couplings and thus only implements an MPO:

>>> from tenpy.models.spins_nnn import SpinChainNNN2
>>> nnn_chain = SpinChainNNN2({'L': 20})
>>> print(isinstance(nnn_chain, NearestNeighborModel))
False
>>> print("range before grouping:", nnn_chain.H_MPO.max_range)
range before grouping: 2


By grouping each two neighboring sites, we can bring it down to nearest neighbors.

>>> grouped_sites = nnn_chain.group_sites(2)
>>> print("range after grouping:", nnn_chain.H_MPO.max_range)
range after grouping: 1


Yet, TEBD will not yet work, as the model doesn’t define H_bond. However, we can initialize a NearestNeighborModel from the MPO:

>>> nnn_chain_for_tebd = NearestNeighborModel.from_MPOModel(nnn_chain)
>>> isinstance(nnn_chain_for_tebd, NearestNeighborModel)
True


Load instance from a HDF5 file.

This method reconstructs a class instance from the data saved with save_hdf5().

Parameters
• hdf5_loader (Hdf5Loader) – Instance of the loading engine.

• h5gr (Group) – HDF5 group which is represent the object to be constructed.

• subpath (str) – The name of h5gr with a '/' in the end.

Returns

obj – Newly generated class instance containing the required data.

Return type

cls

group_sites(n=2, grouped_sites=None)[source]

Modify self in place to group sites.

Group each n sites together using the GroupedSite. This might allow to do TEBD with a Trotter decomposition, or help the convergence of DMRG (in case of too long range interactions).

This has to be done after finishing initialization and can not be reverted.

Parameters
• n (int) – Number of sites to be grouped together.

• grouped_sites (None | list of GroupedSite) – The sites grouped together.

Returns

grouped_sites – The sites grouped together.

Return type

list of GroupedSite

save_hdf5(hdf5_saver, h5gr, subpath)[source]

Export self into a HDF5 file.

This method saves all the data it needs to reconstruct self with from_hdf5().

This implementation saves the content of __dict__ with save_dict_content(), storing the format under the attribute 'format'.

Parameters
• hdf5_saver (Hdf5Saver) – Instance of the saving engine.

• h5gr (:classGroup) – HDF5 group which is supposed to represent self.

• subpath (str) – The name of h5gr with a '/' in the end.

trivial_like_NNModel()[source]

Return a NearestNeighborModel with same lattice, but trivial (H=0) bonds.