Model

Inheritance Diagram

Inheritance diagram of tenpy.models.model.Model

Methods

Model.__init__(lattice)

Initialize self.

Model.enlarge_mps_unit_cell([factor])

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

Model.from_hdf5(hdf5_loader, h5gr, subpath)

Load instance from a HDF5 file.

Model.group_sites([n, grouped_sites])

Modify self in place to group sites.

Model.save_hdf5(hdf5_saver, h5gr, subpath)

Export self into a HDF5 file.

class tenpy.models.model.Model(lattice)[source]

Bases: tenpy.tools.hdf5_io.Hdf5Exportable

Base class for all models.

The common base to all models is the underlying Hilbert space and geometry, specified by a Lattice.

Parameters

lattice (Lattice) – The lattice defining the geometry and the local Hilbert space(s).

lat

The lattice defining the geometry and the local Hilbert space(s).

Type

Lattice

dtype

The data type of the Hamiltonian

Type

dtype

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).

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

classmethod from_hdf5(hdf5_loader, h5gr, subpath)[source]

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

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 (:class`Group`) – HDF5 group which is supposed to represent self.

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