ExactDiag
full name: tenpy.algorithms.exact_diag.ExactDiag
parent module:
tenpy.algorithms.exact_diag
type: class
Inheritance Diagram
Methods
|
|
Calculate self.full_H from self.mpo. |
|
Calculate self.full_H from self.mpo. |
|
|
Return |
|
Wrapper taking directly an MPO instead of a Model. |
|
Initialize by extracting a finite segment from a |
|
Full diagonalization to obtain all eigenvalues and eigenvectors. |
|
Convert a full state (with a single leg) to an MPS. |
|
Pick the ground state energy and ground state from |
|
Allow to use self as LinearOperator for lanczos. |
Contract an MPS along the virtual bonds and combine its legs. |
|
|
|
|
Call |
- class tenpy.algorithms.exact_diag.ExactDiag(model, charge_sector=None, sparse=False, max_size=2000000.0)[source]
Bases:
object
(Full) exact diagonalization of the Hamiltonian.
- Parameters:
model (
MPOmodel
|CouplingModel
) – The model which is to be diagonalized.charge_sector (
None
| charges) – If notNone
, project onto the given charge sector.sparse (bool) – If
True
, don’t sort/bunch the LegPipe used to combine the physical legs. This results in array blocks with just one entry, requires much more charge data, and is not what np_conserved was designed for, so it’s not recommended.max_size (int) – The build_H_* functions will do nothing (but emit a warning) if the total size of the Hamiltonian would be larger than this.
- model
The model which is to be diagonalized.
- Type:
MPOmodel
|CouplingModel
- chinfo
The nature of the charge (which is the same for all sites).
- Type:
- charge_sector
If not
None
, we project onto the given charge sector.- Type:
None
| charges
- max_size
The
build_H_*
functions will do nothing (but emit a warning) if the total size of the Hamiltonian would be larger than this.- Type:
- full_H
The full Hamiltonian to be diagonalized with legs
'(p0.p1....)', '(p0*,p1*...)'
(in that order).None
if thebuild_H_*
functions haven’t been called yet, or if max_size would have been exceeded.- Type:
Array
|None
- E
1D array of eigenvalues.
- Type:
ndarray |
None
- V
Eigenvectors. First leg ‘ps’ are physical legs, the second leg
'ps*'
corresponds to the eigenvalues.- Type:
Array
|None
- _labels_p
The labels use for the physical legs; just
['p0', 'p1', ...., 'p{L-1}']
.
- _mask
Bool mask, which of the indices of the pipe are in the desired charge_sector.
- Type:
1D bool ndarray |
None
- classmethod from_infinite_model(model, first=0, last=None, enlarge=None, **kwargs)[source]
Initialize by extracting a finite segment from a
bc_MPS=infinite'
model.This method calls
extract_segment()
on the model and sets the boundary conditions to ‘finite’. For the ExactDiag, this little hack is equivalent to extracting all the coupling terms fitting within the segment specified by first, last and None, and generating a finite MPOModel from it.Note that it drops the H_bond if existent, since
build_full_H_from_bonds()
would not include the correct, full onsite-terms at the boundaries if just drop the H_bond going outside the segment. Hence you can only use thebuild_full_H_from_mpo()
method when initializing the ExactDiag with this method.- Parameters:
model (
tenpy.models.model.Model
) – Model with infinite bc and MPO.
- classmethod from_H_mpo(H_MPO, *args, **kwargs)[source]
Wrapper taking directly an MPO instead of a Model.
- Parameters:
H_MPO (
MPO
) – The MPO representing the Hamiltonian.*args – Further keyword arguments as for the
__init__
of the class.**kwargs – Further keyword arguments as for the
__init__
of the class.
- full_diagonalization(*args, **kwargs)[source]
Full diagonalization to obtain all eigenvalues and eigenvectors.
Arguments are given to
eigh
.
- groundstate(charge_sector=None)[source]
Pick the ground state energy and ground state from
self.V
.- Parameters:
charge_sector (None | 1D ndarray) – By default (
None
), consider all charge sectors. Alternatively, give the qtotal which the returned state should have.- Returns:
E0 (float) – Ground state energy (possibly in the given sector).
psi0 (
Array
) – Ground state (possibly in the given sector).