OneSiteH

class tenpy.algorithms.mps_sweeps.OneSiteH(env, i0, combine=False, move_right=True, ortho_to_envs=[])[source]

Bases: tenpy.algorithms.mps_sweeps.EffectiveH

Class defining the one-site effective Hamiltonian for Lanczos.

The effective one-site Hamiltonian looks like this:

|        .---    ---.
|        |    |     |
|       LP----W0----RP
|        |    |     |
|        .---    ---.

If combine is True, we define either LHeff as contraction of LP with W (in the case move_right is True) or RHeff as contraction of RP and W.

Parameters
envMPOEnvironment

Environment for contraction <psi|H|psi>.

i0int

Index of the active site if length=1, or of the left-most active site if length>1.

combinebool

Whether to combine legs into pipes. This combines the virtual and physical leg for the left site (when moving right) or right side (when moving left) into pipes. This reduces the overhead of calculating charge combinations in the contractions, but one matvec() is formally more expensive, \(O(2 d^3 \chi^3 D)\). Is originally from the wo-site method; unclear if it works well for 1 site.

move_rightbool

Whether the the sweep is moving right or left for the next update.

Attributes
lengthint

Number of (MPS) sites the effective hamiltonian covers.

combine, move_rightbool

See above.

LHeff, RHeffArray

Only set combine, and only one of them depending on move_right. If move_right was True, LHeff is set with labels '(vR*.p0)', 'wR', '(vR.p0*)' for bra, MPO, ket; otherwise RHeff is set with labels '(p0*.vL)', 'wL', '(p0, vL*)'

LP, W0, RPArray

Tensors making up the network of self.

Methods

combine_Heff(self)

Combine LP and RP with W to form LHeff and RHeff, depending on the direction.

combine_theta(self, theta)

Combine the legs of theta, such that fit to how we combined the legs of self.

matvec(self, theta)

Apply the effective Hamiltonian to theta.

matvec_theta_ortho(self, theta)

Apply self to theta, and orthogonalize against self.theta_ortho.

to_matrix(self)

Contract self to a matrix.

matvec(self, theta)[source]

Apply the effective Hamiltonian to theta.

Parameters
thetaArray

Labels: vL, p0, vR if combine=False, (vL.p0), vR or vL, (p0.vR) if True (depending on the direction of movement)

Returns
theta Array

Product of theta and the effective Hamiltonian.

combine_Heff(self)[source]

Combine LP and RP with W to form LHeff and RHeff, depending on the direction.

In a move to the right, we need LHeff. In a move to the left, we need RHeff. Both contain the same W.

combine_theta(self, theta)[source]

Combine the legs of theta, such that fit to how we combined the legs of self.

Parameters
thetaArray

Wave function with labels 'vL', 'p0', 'p1', 'vR'

Returns
thetaArray

Wave function with labels 'vL', 'p0', 'p1', 'vR'

to_matrix(self)[source]

Contract self to a matrix.

matvec_theta_ortho(self, theta)

Apply self to theta, and orthogonalize against self.theta_ortho. __ We implement this by effectively replacing H -> P H P with the projector P = 1 - sum_o |o> <o| projecting out the states from theta_ortho.

Parameter and return value as for matvec() (which this function replaces, if the class was initialized with non-empty ortho_to_envs.)