MPOModel¶
full name: tenpy.models.model.MPOModel
parent module:
tenpy.models.model
type: class
Inheritance Diagram

Methods
|
|
|
Calculate the bond Hamiltonian from the MPO Hamiltonian. |
Shallow copy of self. |
|
|
Repeat the unit cell for infinite MPS boundary conditions; in place. |
|
Return a (shallow) copy with extracted segment of MPS. |
|
Load instance from a HDF5 file. |
|
Modify self in place to group sites. |
|
Export self into a HDF5 file. |
|
|
|
Reconstruct Hamiltonian for time-dependent models, potentially (!) in-place. |
Class Attributes and Properties
class attribute. |
|
Reproducible numpy pseudo random number generator. |
- class tenpy.models.model.MPOModel(lattice, H_MPO)[source]¶
Bases:
Model
Base class for a model with an MPO representation of the Hamiltonian.
In this class, the Hamiltonian gets represented by an
MPO
. Thus, instances of this class are suitable for MPO-based algorithms like DMRGdmrg
and MPO time evolution.- Parameters
H_MPO (
MPO
) – The Hamiltonian rewritten as an MPO.
- H_MPO¶
MPO representation of the Hamiltonian. If the explicit_plus_hc flag of the MPO is True, the represented Hamiltonian is
H_MPO + hermitian_cojugate(H_MPO)
.
- extract_segment(*args, **kwargs)[source]¶
Return a (shallow) copy with extracted segment of MPS.
- Parameters
first (int) – See
extract_segment()
.last (int) – See
extract_segment()
.enlarge (int) – See
extract_segment()
.
- Returns
cp – A shallow copy of self with MPO and lattice extracted for the segment.
- Return type
- 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
- 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.:
- classmethod from_hdf5(hdf5_loader, h5gr, subpath)[source]¶
Load instance from a HDF5 file.
Same as
from_hdf5()
, but handlerng
.
- logger = <Logger tenpy.models.model.Model (WARNING)>¶
class attribute.
- Type
- Type
An instance of a logger; see Logging and terminal output. NB
- property rng¶
Reproducible numpy pseudo random number generator.
If you want to add randomness/disorder to your model, it is recommended use this random number generator for reproducibility of the model:
self.rng.random(size=[3, 5])
Especially for models with time-dependence, you can/will otherwise end up generating a new disordered at each time-step!
Options
- random_seed :: None | int
Defaults to 123456789. Seed for numpy pseudo random number generator which can be used as e.g.
self.rng.random(...)
.
- save_hdf5(hdf5_saver, h5gr, subpath)[source]¶
Export self into a HDF5 file.
Same as
save_hdf5()
, but handlerng
.
- update_time_parameter(new_time)[source]¶
Reconstruct Hamiltonian for time-dependent models, potentially (!) in-place.
For
TimeDependentHAlgorithm
, we assume that the model reads out the parameterself.options['time']
, and reinitialize/update the model calling this method.- Parameters
new_time (float) – Time at which the (time-dependent) Hamiltonian should be constructed.
- Returns
updated_model – Model of the same class as self with Hamiltonian at time new_time. Note that it can just be a reference to self if modified in place, or an entirely new constructed model.
- Return type
model