 Tensor Network Theory Library  Beta release 1.2.1 A library of routines for performing TNT-based operations
Variational Minimisation

## Detailed Description

This section describes MPS functions which are useful for performing variational minimisation algorithms e.g. DMRG, although they are not limited to this.

## Functions

tntNode tntDmrg1sLocalOptimise (tntNode A, tntNode O, tntNode beta, tntNode gamma, double *eigvp)

tntNode tntDmrg1sSubspaceExpand (tntNode Al, tntNode Ar, tntNode Ol, tntNode Or, tntNode beta, tntNode gamma, tntLegLabel dir, int chi, double *errp)

tntNode tntDmrg2sLocalOps (tntNode Al, tntNode Ar, tntNode Ol, tntNode Or, tntNode beta, tntNode gamma, int chi, double *errp, double *eigvp)

tntNetwork tntMpsVarMinMpo1sBuild (tntNode beta, tntNode gamma, tntNode A, tntNode O)

tntNode tntMpsVarMinMpo1sContract (tntNode A, tntNetwork nwMV)

double tntMpsVarMinMpo1sFullContract (tntNode beta, tntNode gamma, tntNode A, tntNode O)

double tntMpsVarMinMpo1sSweep (tntNetwork mps, tntLegLabel dir, int chi, tntNetwork mpo, tntNodeArray *betas, tntNodeArray *gammas, double *err, int start_site, int end_site)

tntNetwork tntMpsVarMinMpo2sBuild (tntNode beta, tntNode gamma, tntNode theta, tntNode O)

tntNode tntMpsVarMinMpo2sContract (tntNode theta, tntNetwork nwMV)

double tntMpsVarMinMpo2sSweep (tntNetwork mps, tntLegLabel dir, int chi, tntNetwork mpo, tntNodeArray *betas, tntNodeArray *gammas, double *err, int start_site, int end_site)

void tntMpsVarMinMpoUpdate (tntNode A, tntNode O, tntLegLabel dir, unsigned j, tntNodeArray *Oeff)

## Function Documentation

 tntNode tntDmrg1sLocalOptimise ( tntNode A, tntNode O, tntNode beta, tntNode gamma, double * eigvp )

Performs the one-site optimisatopm required in the sweeps in tntMpsVarMinMpo1sSweep(). The updates do not depend on direction.

Returns
The optimised MPS node.
Parameters
 A MPS node to update O Corresponding MPO node beta Precontracted nodes to left of A gamma Precontracted nodes to right of A eigvp Points to the eigenvalue found

Definition at line 181 of file tntMps1sDmrg.c.

Referenced by tntMpsVarMinMpo1sSweep().

 tntNode tntDmrg1sSubspaceExpand ( tntNode Al, tntNode Ar, tntNode Ol, tntNode Or, tntNode beta, tntNode gamma, tntLegLabel dir, int chi, double * errp )

Expands the internal basis of a pair of nodes using the environment tensors, then performs an SVD to truncate this basis down to chi.

Returns
The expanded then truncated MPS node - left of the pair if the direction is "R" and right of the pair if the direction is "L".
Parameters
 Al Left MPS node of pair Ar Right MPS node of par Ol Left MPO node of pair Or Right MPO node of pair beta Precontracted nodes to left of Al gamma Precontracted nodes to right of Ar dir The direction for performing the time-step chi The maximum internal dimension. All SVD's will be truncated to this value. errp Points to the cumulative error

Definition at line 216 of file tntMps1sDmrg.c.

Referenced by tntMpsVarMinMpo1sSweep().

 tntNode tntDmrg2sLocalOps ( tntNode Al, tntNode Ar, tntNode Ol, tntNode Or, tntNode beta, tntNode gamma, int chi, double * errp, double * eigvp )

Performs the two-site updates required in the sweeps in tntMpsVarMinMpo2sSweep(). The updates do not depend on direction. It returns the node containing the singular values found by SVDing the two-site node that minimises the energy on these pair of sites. The new MPS nodes can then be found by identifying the nodes to the right and left of S in the network.

Returns
The singular values of the two-site node that minimises the energy.
Parameters
 Al Left MPS node of pair Ar Right MPS node of par Ol Left MPO node of pair Or Right MPO node of pair beta Precontracted nodes to left of A1 gamma Precontracted nodes to right of A2 chi The maximum internal dimension. All SVD's will be truncated to this value. errp Points to the cumulative error eigvp Points to the eigenvalue found

Definition at line 184 of file tntMps2sDmrg.c.

Referenced by tntMpsVarMinMpo2sSweep().

 tntNetwork tntMpsVarMinMpo1sBuild ( tntNode beta, tntNode gamma, tntNode A, tntNode O )

Builds the network representing the effective operator for a single site $$j$$, which will later be used in the variational minimisation routine. The function does not need to have knowledge of $$j$$, since the correct nodes are chosen by the calling function. The network is built using copies of all the operators passed as arguments, so they are unchanged by the function. This means that when this network is no longer required it should be freed.

Returns
The network for the effective operator times vector.
Parameters
 beta Node formed from contracting all nodes to the left of the A node. gamma Node formed from contracting all nodes to the right of the A node. A The MPS node to be varied. O The MPO node on the same site as the MPS node to be varied.

Definition at line 164 of file tntMpsDmrgBlocks.c.

Referenced by tntDmrg1sLocalOptimise().

 tntNode tntMpsVarMinMpo1sContract ( tntNode A, tntNetwork nwMV )

Performs the network contraction of $$\beta_j$$, $$\hat{O}_{j}$$, $$\gamma_{j}$$ and $$A_{j}$$ as defined in the network below (to be updated). This contraction is needed for each iteration of the eigenvalue routine to variationally minimise the expecation value of the operator over a single site $$j$$. This contraction is equal to a matrix-times-vector multiplication, where $$\beta_j$$, $$\hat{o}_{j}$$, $$\gamma_{j}$$ form the matrix $$O_{\mathrm{eff}}$$ and $$A_{j}$$ is the vector. The contraction is carried out in the order which leads to the smallest intermediate tensors, rather than forming the matrix first.

Returns
The node that is the result of the matrix times vector contraction, the node having the same form as a standard MPS node.
Parameters
 A The MPS node to contract with $$O_{\mathrm{eff}}$$. Unchanged. nwMV Network representing a term in the matrix * vector multiplication.

Definition at line 277 of file tntMpsDmrgBlocks.c.

Referenced by tntDmrg1sLocalOptimise().

 double tntMpsVarMinMpo1sFullContract ( tntNode beta, tntNode gamma, tntNode A, tntNode O )

Contracts the left pre-contracted part of the network and right pre-contracted part of the network, and returns the scalar value that results. The input nodes are unchanged.

Returns
Returns the real part (or the absolute value if it is complex) of the contracted network
Parameters
 beta Left precontracted nodes gamma Right precontracted nodes A MPS node O MPO node

Definition at line 324 of file tntMpsDmrgBlocks.c.

Referenced by tntMpsVarMinMpo1sSweep().

 double tntMpsVarMinMpo1sSweep ( tntNetwork mps, tntLegLabel dir, int chi, tntNetwork mpo, tntNodeArray * betas, tntNodeArray * gammas, double * err, int start_site, int end_site )

Performs a sweep varying the elements of the supplied MPS, one at a time, in order to minimise the result of the MPS-MPO-MPS network contraction. If the MPS represents a wave function $$|\psi\rangle$$ and the MPO represents a site-wide operator $$\hat{O}$$, the network to contract represents $$\langle\psi|\hat{O}|\psi\rangle$$. In this case the operator will usually by the system Hamiltonian, so this sweep can be used in a routine to minimise the energy i.e. find the ground state of the system. The function applies updates to single site in either a left-to-right or right-to-left sweep depending on the direction specified in the arguments.

This function uses the strictly single site algorithm described in PRB 91, 155115(2015) Hubig, McCulloch, Schollwoeck and Wolf.

The twist or orthogonality centre is moved as the one-site optimisations are performed. Note that after completion of a left to right sweep the orthogonality centre will be on the last site, i.e. all sites apart from the last site (site $$L-1$$) will obey the condition. and after the completion of a right to left sweep the orthogonality centre will be on the first site, i.e. all sites apart from the first site (site 0) will obey following the condition. Returns
The current value of the MPS-MPO-MPS product.
Note
This is a beta version of the routine. Some tuning of parameters may still need optimisation. This will be addressed in future releases.
Parameters
 mps Network representing the MPS. Will be changed by the function to one that gives a smaller expectation of the operator given in mpo dir The direction for performing the time-step - either right to left using "L" or left to right using "R". chi The maximum internal dimension. All SVD's will be truncated to this value. mpo The network representing the MPO for the operator whose expectation to minimise (usually the system Hamiltonian). betas Left precontracted nodes in the MPS-MPO-MPS network gammas Right precontracted nodes in the MPS-MPO-MPS network err Gives the sum of all the errors returned from the SVD. start_site Gives the site to start the sweep on. Assumes you have set the orthogonality centre to be on this site. end_site Gives the site to finish the sweep on (last update is actually the site before this). The orthogonality centre will be on this site once the routine is complete

Definition at line 43 of file tntMps1sDmrg.c.

Referenced by tntMpsVarMinMpo1sStep().

 tntNetwork tntMpsVarMinMpo2sBuild ( tntNode beta, tntNode gamma, tntNode theta, tntNode O )

Builds the network representing the effective operator for two sites $$j, j+1$$, which will later be used in the variational minimisation routine. The function does not need to have knowledge of $$j$$, since the correct nodes are chosen by the calling function. The network is built using copies of all the operators passed as arguments, so they are unchanged by the function. This means that when this network is no longer required it should be freed.

Returns
The network for the effective operator times vector.
Parameters
 beta Node formed from contracting all nodes to the left of the theta node. gamma Node formed from contracting all nodes to the right of the theta node. theta Node formed from contracting the two MPS nodes to be varied. O Node formed from contracting the two MPO nodes on the sites of the two MPS nodes to be varied.

Definition at line 110 of file tntMpsDmrgBlocks.c.

Referenced by tntDmrg2sLocalOps().

 tntNode tntMpsVarMinMpo2sContract ( tntNode theta, tntNetwork nwMV )

Performs the network contraction of $$\beta_j$$, $$\hat{O}_{j,j+1}$$, $$\gamma_{j+1}$$ and $$\Theta_{j,j+1}$$ as defined in the network below. This contraction is needed for each iteration of the eigenvalue routine to variationally minimise the expecation value of the operator over two sites $$j,j+1$$. This contraction is equal to a matrix-times-vector multiplication, where $$\beta_j$$, $$\hat{o}_{j,j+1}$$, $$\gamma_{j+1}$$ form the matrix $$O_{\mathrm{eff}}$$ and $$\Theta_{j,j+1}$$ is the vector. The contraction is carried out in the order which leads to the smallest intermediate tensors, rather than forming the matrix first.

Returns
The node that is the result of the matrix times vector contraction, the node having the same form as theta.
Parameters
 theta The node to contract with $$O_{\mathrm{eff}}$$. Unchanged by the function. nwMV Network representing a term in the matrix * vector multiplication.

Definition at line 219 of file tntMpsDmrgBlocks.c.

Referenced by tntDmrg2sLocalOps().

 double tntMpsVarMinMpo2sSweep ( tntNetwork mps, tntLegLabel dir, int chi, tntNetwork mpo, tntNodeArray * betas, tntNodeArray * gammas, double * err, int start_site, int end_site )

Performs a sweep varying the elements of the supplied MPS, two at a time, in order to minimise the result of the MPS-MPO-MPS network contraction. If the MPS represents a wave function $$|\psi\rangle$$ and the MPO represents a site-wide operator $$\hat{O}$$, the network to contract represents $$\langle\psi|\hat{O}|\psi\rangle$$. In this case the operator will usually by the system Hamiltonian, so this sweep can be used in a routine to minimise the energy i.e. find the ground state of the system. The function applies updates to each pair of sites in either a left-to-right or right-to-left sweep depending on the direction specified in the arguments.

The sweep consists of first building the network representing the MPS-MPO-MPS product, illustrated below for a six site system. The two sites to be updated are then contracted with one another to form a $$\Theta$$ node, as are the corresponding operators (illustrated below for sites 2 and 3). The effective operator for this pair of sites is then built by contracting all nodes to the left and to the right of the sites to be updated. However, rather than contracting the nodes each time, the pre-contracted nodes that are passed as arguments are used to build a new network. The resulting network has the following form: It corresponds to a matrix-times-vector multiplication, where $$\Theta$$ is the vector and $$\beta$$, $$h$$ and $$\gamma$$ together form the matrix that represents the effective operator. Rather than contracting the latter 3 nodes to form the matrix explicitly, this network is passed to the core function tntNetworkMinSite(). This function uses an efficient contraction pattern (defined in tntMpsVarMinMpo2sContract()) to iteratively perform the matrix-times-vector multiplication. In doing so it finds the $$\Theta$$ node which represents the eigenvector of the matrix having the smallest eigenvalue.

Once this $$\Theta$$ node is found, it is replaced in the network, and an SVD is performed to reform two $$A$$ nodes. This SVD will be trunctated to $$\chi$$ (passed in the input argument chi), and the sum of all truncation errors is passed to the value pointed to by argument err.

The precontracted nodes to the left and right an be generated using tntMpsVarMinMpoInit() if this function is being called for the first time. The nodes are updated during the routine for use in subsequent sweeps.

The twist or orthogonality centre is moved as the two-site optimisations are performed. Note that after completion of a left to right sweep the orthogonality centre will be on the last site, i.e. all sites apart from the last site (site $$L-1$$) will obey the condition. and after the completion of a right to left sweep the orthogonality centre will be on the first site, i.e. all sites apart from the first site (site 0) will obey following the condition. Returns
The current value of the MPS-MPO-MPS product.
Parameters
 mps Network representing the MPS. Will be changed by the function to one that gives a smaller expectation of the operator given in mpo dir The direction for performing the time-step - either right to left using "L" or left to right using "R". chi The maximum internal dimension. All SVD's will be truncated to this value. mpo The network representing the MPO for the operator whose expectation to minimise (usually the system Hamiltonian). betas Left precontracted nodes in the MPS-MPO-MPS network gammas Right precontracted nodes in the MPS-MPO-MPS network err Gives the sum of all the errors returned from the SVD. start_site Gives the site to start the sweep on. Assumes you have set the orthogonality centre to be on this site. end_site Gives the site to finish the sweep on (last update is actually the site before this). The orthogonality centre will be on this site once the routine is complete

Definition at line 63 of file tntMps2sDmrg.c.

Referenced by tntMpsVarMinMpo2sStep().

 void tntMpsVarMinMpoUpdate ( tntNode A, tntNode O, tntLegLabel dir, unsigned j, tntNodeArray * Oeff )

Prepares the nodes required for performing a variational minimisation sweep using tntMpsVarMinMpo2sSweep() by pre-contracting nodes in the MPS-MPO-MPS network. If the MPS represents a wave function $$|\psi\rangle$$ and the MPO represents a site-wide operator $$\hat{O}$$, the returned network represents $$\langle\psi|\hat{O}|\psi\rangle$$. The function updates a single entry of one of the arrays of pre-contracted nodes $$\mathbf{\hat{beta}}$$ if dir is "R" and $$\mathbf{\hat{gamma}}$$ if dir is "L". It uses the new updated MPS node $$A$$ for site $$j$$, and the corresponding MPO node $$\hat{O}$$.

The array entry $$\beta_j$$ is the node that represents all nodes to the left of site $$j$$, so in this case $$A$$, its Hermitian conjugate, $$O$$ and $$\beta_j$$ are contracted to update the entry $$\beta_{j+1}$$ as follows: The array entry $$\gamma_j$$ is the node that represents all nodes to the right of site $$j$$, so in this case $$A$$, its Hermitian conjugate, $$\hat{O}$$ and $$\gamma_j$$ are contracted to update the entry $$\gamma_{j-1}$$ as follows. Returns
No return value.
Parameters
 A The new MPS tensor to update with. Unchanged by the function. O The node in the MPO corresponding to the MPS node tnA. Unchanged by the function. dir The direction of the update j The site number of A Oeff A pointer to the array that will contain the node to be updated.

Definition at line 38 of file tntMpsDmrgBlocks.c.

References tntNodeCopy(), tntNodeFree(), and tntNodeJoin().

Referenced by tntMpsVarMinMpo1sSweep(), and tntMpsVarMinMpo2sSweep().