Python Module convergence

Module convergence.py is taking care of the convergence parameters for all openMPS simulations.

Mapping for the dynamic simulations:

Method name

Integer

Krylov

0

TEBD_2

1

TEBD_4

2

TDVP_2

3

LRK_2

4

LRK_4

5

MPDO+ TEBD2

6

Expm, EDLib

7


class convergence.ConvParam[source]

Base class for the convergence parameters of all simulations of the MPSPyLib involving MPS.

AddModifiedConvergenceParameters(copywhich, modifywhich, whichparameters)[source]

Copy the parameters in element copywhich of the current MPSConvergenceParameters object and replace the parameters in modifywhich with the values in whichparameters.

Arguments

copywhichinteger

Take these convergence parameters as basis and replace selected arguments before adding it to the list. Starts with 0.

modifywhichstring or list

key or keys of the dictionary with the convergence parameters. For possible keys see in the description of the class MPSConvergenceParameters

whichparameterssingle argument or list

the new parameters for the convergence parameters. The length must match the length of modifywhich. The types must match the original argument types

check(ii)[source]

Empty check.

get_hash()[source]

Create a hash from the convergence parameters. Use the sorted keys for setting up the order.

get_method(ii=0)[source]

Return the integer specifying the method.

Arguments

iiint

Look in the ii-th set of convergence parameters.

write(filestub)[source]

Write out the data in the MPSConvergenceParameters object to the file object filehandle. Intended for internal use only.

Arguments

filestubstring

filename where the information are written

Details

The order, line by line, in the file is the following:

  1. Number of sets of convergence parameters

  2. min_num_sweeps

  3. max_num_sweeps

  4. max_outer_sweeps

  5. warmup_bond_dimension

  6. max_bond_dimension

  7. MaxnLanczosIterations

  8. max_n_iMPS_iterations (dummy value)

  9. warmup_tol

  10. lanczos_tol

  1. local_tol

  2. variance_tol

  3. min_num_sweeps (of the next set)


class convergence.MPSConvParam(variance_tol=1e-10, max_bond_dimension=500, local_tol=- 1, min_num_sweeps=1, max_num_sweeps=2, max_outer_sweeps=3, lanczos_tol=1e-12, max_num_lanczos_iter=100, warmup_bond_dimension=170, warmup_tol=1e-12, method='V', max_num_isteps=- 1, steps_for_ijudge=100, idt=0.01, imethod='TEBD2')[source]

Defines the convergence parameters for the static MPS algorithm for finite size systems. The following list contains all optional arguments for the algorithms, their meaning, and their default value.

The variational algorithms, i.e., MPS and eMPS are controlled with the following arguments.

Parameter (MPS,eMPS)

Meaning

default

variance_tol

Variance tolerance \epsilon_{\mathrm{v}}.

1e-10

max_bond_dimension

Maximum allowed bond dimension \chi_{\mathrm{max}}.

500

local_tol

Local truncation tolerance \epsilon_{\mathrm{local}}.

(-1)= var iance_tol / (4L)

min_num_sweeps

The minimum number of inner sweeps.

1

max_num_sweeps

The maximum number of inner sweeps.

2

max_outer_sweeps

The maximum number of outer sweeps.

3

lanczos_tol

The residual tolerance of the Lanczos iteration \epsilon_{\mathrm{l}}.

1e-12

max_num_lanczos_iter

The maximum number of Lanczos iterations n_{\mathrm{l}}.

100

method

Decides on the convergence method. Either variance (‘V’) or biggest difference of first singular values across all bipartitions (‘S’).

‘V’

warmup_bond_dimension

Maximum allowed bond dimension \chi_{warmup}. This is for the initial ansatz via iMPS.

170

warmup_tol

Local truncation tolerance \epsilon{\mathrm{warmup}}. This is for the initial ansatz via iMPS.

1e-12

If you prefer to use imaginary time evolution, the following parameters are important (repeated ones are not inserted yet).

Parameter (initial)

Meaning

default

max_num_isteps

Maximum number of steps in the imaginary time evolution. This variable is used as switch for between variational search and imaginary time evolution. If negative, variational method is used.

-1

steps_for_ijudge

Steps between checking convergence criteria in imaginary time evolution.

100

idt

Size time step in imaginary time evolution

0.01

imethod

Time evolution method for imaginary time evolution. Options are TEBD2, TEBD4, or TDVP. Krylov, LRK2, and LRK4 not enabled.

TEBD2

Variables

datalist

list of dictionaries where each dictionary contains one set of convergence parameters

nconvint

number of sets of convergence parameters

Details

The convergence parameters for the initial ansatz via iMPS are only relevant in the first set of convergence parameters. This statement is valid for MPS (ground state) and eMPS (excited state) algorithm. The excited state search uses the iMPS warmup parameters to find the maximal energy state.

AddConvergenceParameters(variance_tol=1e-10, max_bond_dimension=500, local_tol=- 1, min_num_sweeps=1, max_num_sweeps=2, max_outer_sweeps=3, lanczos_tol=1e-12, max_num_lanczos_iter=100, warmup_bond_dimension=170, warmup_tol=1e-12, method='V', max_num_isteps=- 1, steps_for_ijudge=100, idt=0.01, imethod='TEBD2')[source]

Adding another set of convergence parameters iteratively executed after the previous one. For the optional arguments look into the table of MPSConvParam.

check(ii)[source]

Run some checks on ii-th convergent parameter.

Arguments

iiint

Check the ii-th set of convergence parameters.


class convergence.MPDOConvParam(variance_tol=1e-10, max_bond_dimension=500, local_tol=- 1, min_num_sweeps=1, max_num_sweeps=2, max_outer_sweeps=3, lanczos_tol=1e-12, max_num_lanczos_iter=100, warmup_bond_dimension=170, warmup_tol=1e-12, method='V', max_num_isteps=- 1, steps_for_ijudge=100, idt=0.01, imethod='TEBD2')[source]

Defines the convergence parameters of a variational open system steady state search.

AddConvergenceParameters(variance_tol=1e-10, max_bond_dimension=500, local_tol=- 1, min_num_sweeps=1, max_num_sweeps=2, max_outer_sweeps=3, lanczos_tol=1e-12, max_num_lanczos_iter=100, warmup_bond_dimension=170, warmup_tol=1e-12, method='V', max_num_isteps=- 1, steps_for_ijudge=100, idt=0.01, imethod='TEBD2')[source]

Adding another set of convergence parameters iteratively executed after the previous one. For the optional arguments look into the table of MPSConvParam.


class convergence.iMPSConvParam(variance_tol=1e-12, max_bond_dimension=500, local_tol=1e-12, min_num_sweeps=1, max_num_imps_iter=1000, lanczos_tol=1e-12, max_num_lanczos_iter=100)[source]

Defines the convergence parameters for variational algorithm iMPS. The following list contains all optional arguments for the algorithm, their meaning, and their default values.

Parameter (iMPS)

Meaning

default

variance_tol

The orthogonality fidelity tolerance if the truncation error is zero.

1e-12

max_bond_dimension

Maximum allowed bond dimension \chi_{max}.

500

local_tol

Local truncation tolerance \epsilon_{\mathrm{local}}.

1e-12

min_num_sweeps

Number of optimization sweeps performed on unit cell.

1

max_num_imps_iter

Maximum number of iMPS iterations.

1000

lanczos_tol

The residual tolerance of the Lanczos iteration \epsilon_{\mathrm{l}}.

1e-12

max_num_lanczos_iter

The maximum number of Lanczos iterations n_{\mathrm{l}}.

100

Variables

datalist

list of dictionaries where each dictionary contains one set of convergence parameters

nconvint

number of sets of convergence parameters.

AddConvergenceParameters(variance_tol=1e-12, max_bond_dimension=500, local_tol=1e-12, min_num_sweeps=1, max_num_imps_iter=1000, lanczos_tol=1e-12, max_num_lanczos_iter=100)[source]

Adding another set of convergence parameters iteratively executed after the previous one. For the optional arguments look into the table of MPSConvParam.

check(ii)[source]

Run some checks on ii-th convergent parameter.

Arguments

iiint

Check the ii-th set of convergence parameters.


class convergence.FiniteTConvParam(QL, deltat=0.01, start_temperature=1.0, nmeas=10, final_temperature=0.1, tn_type='D', imethod='TEBD2', **kwargs)[source]

Defines the convergence parameters for a finite temperature imaginary time evolution. The following list contains all optional arguments for the algorithm, their meaning and their default value.

Parameters

Meaning

default

QL

Empty QuenchList object

required

max_bond_dimension

Maximum allowed bond dimension \chi_{\mathrm{max}}.

100

local_tol

Local truncation tolerance \epsilon_{\mathrm{local}}.

1e-12

deltat

Time step of the imaginary time evolution

0.01

start_temperature

First temperature to be measured (highest temperature).

1.0

nmeas

Number of measurements including Tstart and Tfinal.

10

final_temperature

Last temperature to be measured (lowest temperature)

0.1

kb

Boltzmann constant

1.0

tn_type

Choosing tensor network, MPDO is ‘R’ or LTPN (‘L’)

‘D’

imethod

Time evolution method for imaginary time evolution. Options are TEBD2, TEBD4, TDVP, or Krylov.

TDVP

Other key word arguments

The convergence settings are passed to the corresponding class.

Variables

datalist

list containing one dictionary containing a set of convergence parameters.

nconvint

number of sets of convergence parameters (limited to 1).

AddModifiedConvergenceParameters(*args, **kwargs)[source]

Overwriting method. Not available for FiniteT.

check(ii)[source]

Check if the final temperature is smaller than the first measured temperature. Further first time step should not shoot over the first measurement.

get_Tgrid()[source]

Return the measured temperatures.

get_nmeas()[source]

Return number of measurements.

write(filestub)[source]

Write all files for a FiniteT time evolution.

Arguments

filestubstring

filename where the information are written


class convergence.ImagConvParam(max_bond_dimension=100, local_tol=1e-12, tolerance=1e-12, deltat=0.01, steps_meas=10, max_num_steps=5000)[source]

Defines the convergence parameters for an imaginary time evolution. It is not meant to find the ground state (use variational search), but rather for checks or comparing to finite-T evolutions.

Parameters

Meaning

default

max_bond_dimension

Maximum allowed bond dimension between sites \chi_{\mathrm{max}}.

100

local_tol

Local truncation tolerance \epsilon_{\mathrm{local}}.

1e-12

tolerance

Stop search if energy difference is below tolerance between two measurements.

1e-12

deltat

Time step for evolution

0.01

steps_meas

Steps between the measurements of energy.

10

max_num_steps

Maximal number of time steps.

5000

Variables

datalist

list containing dictionaries with the set of convergence parameters.

nconvint

number of sets of convergence parameters.

AddConvergenceParameters(max_bond_dimension=100, local_tol=1e-12, tolerance=1e-12, deltat=0.01, steps_meas=10, max_num_steps=5000)[source]

Adding another set of convergence parameters iteratively executed after the previous one. For the optional arguments look into the table of ImagConvParam.

AddModifiedConvergenceParameters(*args, **kwargs)[source]

Overwriting method. Not available ImagConvParam due to dictionary keys. Use AddConvergenceParameters instead.


class convergence.DynConvParam[source]

Base class for the convergence parameters of all time evolution methods. Overwrites methods from ConvParam, which are never necessary for dynamic simulations. In addition it defines the write method for convergence parameters.

AddConvergenceParameters(*args, **kwargs)[source]

Overwriting default method not valid for time evolutions.

AddModifiedConvergenceParameters(copywhich, modifywhich, whichparameters)[source]

Overwriting default method not valid for time evolutions.

get_TO()[source]

Return time ordering or default value for it.

get_method()[source]

Return the integer specifying the method.

write(filestub)[source]

Write out the data in the KrylovConvergenceParameters object to the file object filehandle. Intended for internal use only.

Arguments

filestubstring

filename for the Krylov convergence parameters

Details

The lines are written in this order:

  1. Number of sets of convergence parameters (always 1)

  2. min_num_sweeps

  3. max_num_sweeps

  4. max_outer_sweeps

  5. warmup_bond_dimension (dummy)

  6. max_bond_dimension

  7. MaxnLanczosIterations

  8. max_n_iMPS_iterations (dummy)

  9. warmup_tol (dummy)

  10. Hpsi_tol

  11. Hlocal_tol

  12. psi_tol

  13. psilocal_tol

  14. lanczos_tol


class convergence.KrylovConvParam(psi_tol=1e-10, hpsi_tol=1e-10, max_bond_dimension=500, psi_local_tol=- 1, hpsi_local_tol=- 1, min_num_sweeps=1, max_num_sweeps=6, max_outer_sweeps=3, lanczos_tol=1e-12, max_num_lanczos_iter=100, timeordering='2', tn_type='D', edlibmode=- 1)[source]

Defines the convergence parameters for the Krylov time evolution. The following list contains all optional arguments, their meaning and their default value.

Parameter (Krylov)

Meaning

default

psi_tol

Tolerance \epsilon_{\mathrm{\psi}} for fitting states.

1e-10

hpsi_tol

Tolerance \epsilon_{\mathrm{H}} for fitting operators to states.

1e-10

max_bond_dimension

Maximum allowed bond dimension \chi_{max}.

500

psi_local_tol

Local truncation tolerance \epsilon_{\psi\mathrm{local}} for fitting states.

-1 = psi_tol / (4L)

hpsi_local_tol

Local truncation tolerance \epsilon_{\mathrm{Hlocal}} for fitting operators to states

-1 Hpsi_tol / (4L)

min_num_sweeps

Minimum number of optimization sweeps

1

max_num_sweeps

Maximum number of optimization sweeps

6

max_outer_sweeps

TBA

3

lanczos_tol

The residual tolerance of the Lanczos iteration \epsilon_1.

1e-12

max_num_lanczos_iter

The maximum number of Lanczos iterations n_1.

100

timeordering

the order (in delta t) of the commutator-free Magnus expansion used for time ordering. Can be ‘2’ which is one exponential, ‘4_2’ or ‘4_3’, which are fourth-order with 2 or 3 exponentials, or ‘6’, which is sixth-order with 5 exponentials.

‘2’ (str)

edlibmode

Defines method for ED library within OSMPS: automatic (-1), built-in scipy with complete operator (0), EDLib Krylov with complete operator (1), EDLib Krylov with MPO | v > (2), EDLib Krylov with MPO and saving Krylov vectors to hard disk (3) (No effect on tensor network methods)

-1

tn_type

Type of the tensor network. Either ‘D’ for default, ‘M’ for MPS, ‘Q’ for quantum trajectories with MPS, ‘R’ for MPDO, or ‘L’ for LPTN. The default setting depends on the MPO.

‘D’

Variables

datalist

list of dictionaries where each dictionary contains one set of convergence parameters

nconvint

number of sets of convergence parameters. Limited to 1.

check(ii)[source]

Run some checks on ii-th convergent parameter.

Arguments

iiint

ii-th entry of the list is checked, since time evolution ii = 0.


class convergence.TEBDConvParam(psi_tol=1e-10, max_bond_dimension=500, psi_local_tol=- 1, lanczos_tol=1e-12, max_num_lanczos_iter=100, order=4, timeordering='2', tn_type='D', max_kappa=500, ktebd=False)[source]

Defines the convergence parameter for time evolution with TEBD methods. The following list contains all optional arguments, their meaning, and their default values.

Parameter (TEBD)

Meaning

default

psi_tol

Tolerance \epsilon_{\mathrm{\psi}} for splitting states via an SVD if psi_local_tol < 0. Then divided by 4 L

1e-10

max_bond_dimension

Maximum allowed bond dimension \chi_{max}.

500

psi_local_tol

Local truncation tolerance \epsilon_{\psi\mathrm{local}} for fitting states.

-1 = psi_tol / (4L)

lanczos_tol

The residual tolerance of the Lanczos iteration \epsilon_1.

1e-12

max_num_lanczos_iter

The maximum number of Lanczos iterations n_1.

100

order

Order of the Trotter decomposition can be 2 or 4.

4

timeordering

the order (in delta t) of the commutator-free Magnus expansion used for time ordering. Can be ‘2’ which is one exponential, ‘4_2’ or ‘4_3’, which are fourth-order with 2 or 3 exponentials, or ‘6’, which is sixth-order with 5 exponentials.

‘2’ (str)

tn_type

Type of the tensor network. Either ‘D’ for default, ‘M’ for MPS, ‘Q’ for quantum trajectories with MPS, ‘R’ for MPDO, or ‘L’ for LPTN. The default setting depends on the MPO.

‘D’

max_kappa

For LPTN only : the maximal bond dimension between X and X^{\dagger} on each site, where the density matrix is X X^{\dagger}.

500

ktebd

Switch to use local Krylov (True). If false, matrix exponential is used

False

Variables

datalist

list of dictionaries where each dictionary contains one set of convergence parameters

nconvint

number of sets of convergence parameters

check(ii)[source]

Run some checks on ii-th convergent parameter.

Arguments

iiint

ii-th entry of the list is checked, since time evolution ii = 0.


class convergence.TDVPConvParam(psi_tol=1e-10, max_bond_dimension=500, psi_local_tol=- 1, lanczos_tol=1e-12, max_num_lanczos_iter=100, timeordering='2', tn_type='D')[source]

Defining the convergence parameter for time evolution with TDVP method. The following list contains all optional arguments for the algorithm, their meaning, and their default values

Parameter (TDVP)

Meaning

default

psi_tol

Tolerance \epsilon_{\mathrm{\psi}} for fitting states.

1e-10

max_bond_dimension

Maximum allowed bond dimension \chi_{max}.

500

psi_local_tol

Local truncation tolerance \epsilon_{\psi\mathrm{local}} for fitting states.

-1 = psi_tol / (4L)

lanczos_tol

The residual tolerance of the Lanczos iteration \epsilon_1.

1e-12

max_num_lanczos_iter

The maximum number of Lanczos iterations n_1.

100

timeordering

the order (in delta t) of the commutator-free Magnus expansion used for time ordering. Can be ‘2’ which is one exponential, ‘4_2’ or ‘4_3’, which are fourth-order with 2 or 3 exponentials, or ‘6’, which is sixth-order with 5 exponentials.

‘2’ (str)

tn_type

Type of the tensor network. Either ‘D’ for default, ‘M’ for MPS, ‘Q’ for quantum trajectories with MPS, ‘R’ for MPDO, or ‘L’ for LPTN. The default setting depends on the MPO.

‘D’

Variables

datalist

list of dictionaries where each dictionary contains one set of convergence parameters

nconvint

number of sets of convergence parameters


class convergence.LRKConvParam(max_bond_dimension=500, hpsi_tol=1e-10, hpsi_local_tol=- 1, min_num_sweeps=1, max_num_sweeps=6, max_outer_sweeps=3, order=4, timeordering='2', tn_type='D')[source]

Defines the convergence parameter for time evolution with LRK method. The following list contains all optioinal arguments for the algorithms, their meaning, and their default value.

Parameter (LRK)

Meaning

default

max_bond_dimension

Maximum allowed bond dimension \chi_{max}.

500

hpsi_tol

Tolerance for fitting operators to states \epsilon_{\mathrm{H}}

1e-10

hpsi_local_tol

Local truncation tolerance \epsilon_{\mathrm{Hlocal}} for fitting operators to states

-1 Hpsi_tol / (4L)

min_num_sweeps

Minimum number of optimization sweeps

1

max_num_sweeps

Maximum number of optimization sweeps

6

max_outer_sweeps

TBA

3

order

Order can be 2 or 4

4

timeordering

the order (in delta t) of the commutator-free Magnus expansion used for time ordering. Can be ‘2’ which is one exponential, ‘4_2’ or ‘4_3’, which are fourth-order with 2 or 3 exponentials, or ‘6’, which is sixth-order with 5 exponentials.

‘2’ (str)

tn_type

Type of the tensor network. Either ‘D’ for default, ‘M’ for MPS, ‘Q’ for quantum trajectories with MPS, ‘R’ for MPDO, or ‘L’ for LPTN. The default setting depends on the MPO.

‘D’

Variables

datalist

list of dictionaries where each dictionary contains one set of convergence parameters

nconvint

number of sets of convergence parameters

check(ii)[source]

Run some checks on ii-th convergent parameter.

Arguments

iiint

ii-th entry of the list is checked, since time evolution ii = 0.


class convergence.MpdoplusConvParam(max_bond_dimension=40, max_kraus_dimension=20, local_bond_tol=1e-08, local_kraus_tol=1e-08)[source]

Defines the convergence parameter for the time evolution with TEBD methods for open systems using MPDO+. The following list contains all optional arguments, their meaning, and their default values.

Parameter (TEBD for MPDO+)

Meaning

default

max_bond_dimension

Maximum allowed bond dimension between sites \chi_{max}.

40

max_kraus_dimension

Maximum allowed bond dimension between layers.

20

local_bond_tol

Local truncation tolerance between sites.

1e-8

local_kraus_tol

Local truncation tolerance between layers.

1e-8

Variables

datalist

list of dictionaries where each dictionary contains one set of convergence parameters

nconvint

number of sets of convergence parameters. Limited to 1.


class convergence.ExpmConvParam[source]

This class purely used in the EDLib part of OSMPS, specifies to use the matrix exponential as time evolution method.