Tensor Network Theory Library  Beta release 1.2.1
A library of routines for performing TNT-based operations
 All Data Structures Functions Variables Groups Pages
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
AMPS node to update
OCorresponding MPO node
betaPrecontracted nodes to left of A
gammaPrecontracted nodes to right of A
eigvpPoints to the eigenvalue found

Definition at line 181 of file tntMps1sDmrg.c.

References tntComplex::re, tntMpsVarMinMpo1sBuild(), tntMpsVarMinMpo1sContract(), tntNetworkFree(), tntNetworkMinSite(), tntNodeFree(), and tntNodeReplace().

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
AlLeft MPS node of pair
ArRight MPS node of par
OlLeft MPO node of pair
OrRight MPO node of pair
betaPrecontracted nodes to left of Al
gammaPrecontracted nodes to right of Ar
dirThe direction for performing the time-step
chiThe maximum internal dimension. All SVD's will be truncated to this value.
errpPoints to the cumulative error

Definition at line 216 of file tntMps1sDmrg.c.

References tntNodeCopy(), tntNodeDirectSum(), tntNodeFree(), tntNodeFuse(), tntNodeJoin(), tntNodeReplace(), tntNodeScaleReal(), tntNodeSplit(), tntNodeSqueeze(), and tntNodeSVD().

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
AlLeft MPS node of pair
ArRight MPS node of par
OlLeft MPO node of pair
OrRight MPO node of pair
betaPrecontracted nodes to left of A1
gammaPrecontracted nodes to right of A2
chiThe maximum internal dimension. All SVD's will be truncated to this value.
errpPoints to the cumulative error
eigvpPoints to the eigenvalue found

Definition at line 184 of file tntMps2sDmrg.c.

References tntComplex::re, tntMpsVarMinMpo2sBuild(), tntMpsVarMinMpo2sContract(), tntNetworkFree(), tntNetworkMinSite(), tntNodeContract(), tntNodeCopy(), tntNodeFindConn(), tntNodeFree(), tntNodeJoin(), tntNodeReplace(), and tntNodeSVD().

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.

mps_dmrg_heff.png

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
betaNode formed from contracting all nodes to the left of the A node.
gammaNode formed from contracting all nodes to the right of the A node.
AThe MPS node to be varied.
OThe MPO node on the same site as the MPS node to be varied.

Definition at line 164 of file tntMpsDmrgBlocks.c.

References tntNetworkCreate(), tntNodeCopy(), tntNodeInsertAtEnd(), tntNodeInsertAtStart(), and tntNodeJoin().

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

mps_dmrg_heff.png

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
AThe MPS node to contract with \(O_{\mathrm{eff}}\). Unchanged.
nwMVNetwork representing a term in the matrix * vector multiplication.

Definition at line 277 of file tntMpsDmrgBlocks.c.

References tntNetworkCopy(), tntNetworkToNodeGroup(), tntNodeCopy(), tntNodeFindConn(), tntNodeFindFirst(), tntNodeFindLast(), tntNodeFree(), tntNodeReplace(), and tntNodeSqueeze().

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
betaLeft precontracted nodes
gammaRight precontracted nodes
AMPS node
OMPO node

Definition at line 324 of file tntMpsDmrgBlocks.c.

References tntComplexToReal(), tntNodeContract(), tntNodeCopy(), tntNodeCopyConj(), tntNodeFree(), tntNodeGetFirstEl(), and tntNodeJoin().

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.

left_orth.png

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.

right_orth.png
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
mpsNetwork representing the MPS. Will be changed by the function to one that gives a smaller expectation of the operator given in mpo
dirThe direction for performing the time-step - either right to left using "L" or left to right using "R".
chiThe maximum internal dimension. All SVD's will be truncated to this value.
mpoThe network representing the MPO for the operator whose expectation to minimise (usually the system Hamiltonian).
betasLeft precontracted nodes in the MPS-MPO-MPS network
gammasRight precontracted nodes in the MPS-MPO-MPS network
errGives the sum of all the errors returned from the SVD.
start_siteGives the site to start the sweep on. Assumes you have set the orthogonality centre to be on this site.
end_siteGives 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.

References tntDmrg1sLocalOptimise(), tntDmrg1sSubspaceExpand(), tntMpsLength(), tntMpsVarMinMpo1sFullContract(), tntMpsVarMinMpoUpdate(), tntNodeFindConn(), tntNodeFindFirst(), and tntNodeFindLast().

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.

mps_dmrg_heff.png

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
betaNode formed from contracting all nodes to the left of the theta node.
gammaNode formed from contracting all nodes to the right of the theta node.
thetaNode formed from contracting the two MPS nodes to be varied.
ONode 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.

References tntNetworkCreate(), tntNodeCopy(), tntNodeInsertAtEnd(), tntNodeInsertAtStart(), and tntNodeJoin().

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

mps_dmrg_heff.png

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
thetaThe node to contract with \(O_{\mathrm{eff}}\). Unchanged by the function.
nwMVNetwork representing a term in the matrix * vector multiplication.

Definition at line 219 of file tntMpsDmrgBlocks.c.

References tntNetworkCopy(), tntNetworkToNodeGroup(), tntNodeCopy(), tntNodeFindConn(), tntNodeFindFirst(), tntNodeFindLast(), tntNodeFree(), tntNodeReplace(), and tntNodeSqueeze().

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.

mps_mpo_mps.png

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

mps_dmrg_theta.png

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:

mps_dmrg_heff.png

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.

left_orth.png

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.

right_orth.png
Returns
The current value of the MPS-MPO-MPS product.
Parameters
mpsNetwork representing the MPS. Will be changed by the function to one that gives a smaller expectation of the operator given in mpo
dirThe direction for performing the time-step - either right to left using "L" or left to right using "R".
chiThe maximum internal dimension. All SVD's will be truncated to this value.
mpoThe network representing the MPO for the operator whose expectation to minimise (usually the system Hamiltonian).
betasLeft precontracted nodes in the MPS-MPO-MPS network
gammasRight precontracted nodes in the MPS-MPO-MPS network
errGives the sum of all the errors returned from the SVD.
start_siteGives the site to start the sweep on. Assumes you have set the orthogonality centre to be on this site.
end_siteGives 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.

References tntDmrg2sLocalOps(), tntMpsLength(), tntMpsVarMinMpoUpdate(), tntNodeContract(), tntNodeFindConn(), tntNodeFindFirst(), tntNodeFindLast(), and tntNodeSVD().

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

mps_mpo_mps_fullnw.png

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:

mps_dmrg_betaup.png

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.

mps_dmrg_gammaup.png
Returns
No return value.
Parameters
AThe new MPS tensor to update with. Unchanged by the function.
OThe node in the MPO corresponding to the MPS node tnA. Unchanged by the function.
dirThe direction of the update
jThe site number of A
OeffA 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().