Python Module dynamics

Dynamics.py Module to define time evolutions Currently under heavy development. last revision 090111-MLW See the manual sec.## for more information about the representation of a dynamical process in MPSPyLib.

dynamics.CheckOrDefault(p, parameter, default)[source]

Set default value in the dictionary, if key not already set

Arguments

pdictionary

dictionary to be checked and, if necessary, modified.

parameterstring, boolean, integer, float, tuple, …

key in the dictionary

defaultany

default value to be set for the key parameter if the key does not yes exist in p

dynamics.SetupGLQ(order, nexp=2)[source]

Set up the parameters for Gauss-Legendre quadrature and its Magnus variants. Returned is the 1D array x and the 2D array g.

Arguments

orderinteger, either 4 or 6

order of the Magnus variants??

nexpinteger, optional

number of exponentials for order=2, nexp can either be 2 or 3. for order=6, nexp must be 5.


class dynamics.QuenchList(H)[source]

Class defining a series of time-dependent changes of Hamiltonian parameters, aka “Quenches”. Once an instance of the Quenchlist class has been created, quenches are added using the AddQuench method. Quenches are communicated to the Fortran backend by specifying a QuenchList object as the element of the dynamicsParameters dictionary with key ‘Quenches’

Arguments

Hinstance of mps.MPO

the MPO defining the system (is equal for all through statics and all dynamics).

Variables

datalist

list where the quenches are added later on. This is not an argument in the constructor. The list contains one dictionary for each quench.

AddQuench(Hparams, time, deltat, funcs, ConvergenceParameters=None, stepsforoutput=1, timedep=None)[source]

Add a quench process to the specification of the dynamics.

Arguments

Hparamsstring or list of strings

containing the Hamiltonian parameters to be quenched. The name of the Hamiltonians parameters are identified via strings.

timefloat

total time for this quench

deltatfloat

infinitesimal time step of the quench

funcscallable or list of callables

functional forms describing the time-dependence of the Hamitlonian parameters in Hparams. The number of functions must correspond to the number of Hparams

ConvergenceParametersinstance of ConvParam for time evolultions

Specifies the time evolution method and its convergence parameters.

  • convergence.KrylovConvParam: slow but reliable.

  • convergence.TEBDConvParam : TEBD routines based on the Sornborger-Stewart decompositions (PRA 60, 1956 (1999)), which only work with nearest-neighbor Hamiltonians. Either 2nd or 4th order.

  • convergence.TDVPConvParam: TDVP_2 is the second-order time-dependent variational principle method of arXiv:1408.5056, which in principle works with any Hamiltonian.

  • convergence.LRKConvParam : not implemented are the LRK_2 and LRK_4 are second and fourth-order local Runge-Kutta methods (PRB 91, 165112 (2015)). LRK_2 is the default, as it works with any Hamiltonian and is fairly reliable.

Default: instance of convergence.KrylovConvParam is generated during the function containing the default values.

stepsforoutputinteger, optional

allows for coarser measurement default to 1

timedepboolean, optional

This flag, right now only used for the EDLib, signals that the couplings in the quench are time dependent (True), are time independent (False) or the time dependence of the coupling should be determined thourhg the length of the Hparams arguments (None). This flag might be used for a sudden quench where parameters change in regard to previous setting, but not over time. Default to None.

__str__()[source]

Return string representation

__unicode__()[source]

Return unicode string.

is_time_dependent(ii)[source]

Check if a quench is time dependent. Returns True for time dependent quenches and False for time independent quenches.

Arguments

iiint

Check for quench ii if it is time dependent. Time dependent quenches have at least one entry in the Hparams to be modified if flag timedep was not passed to quench.

write(filestub)[source]

Write the information about the quenches.

Arguments

filestubstring

filename where the information are written


class dynamics.QuantumCircuits[source]

Class defining the time evolution with quantum circuits or gates.

Variables

subcircuitdict

A dictionary storing subcircuits identified via keys.

evolutionlist

Evolution contains a list of keys, where each key must refer to one subcircuit to be applied.

__getitem__(key)[source]

Get a subcircuit.

Arguments

key :

Identifier for the subcircuit.

__iadd__(key)[source]

Add a subcircuit to the evolution.

Arguments

key :

Identifier for the subcircuit to be applied.

__iter__()[source]

Iterate over the subcircuits for the time evolution return the subcircuit.

__len__()[source]

Return the length of a quantum circuit identified by the number of subcircuits applied.

__setitem__(key, value)[source]

Add or renew a subcircuit with dictionary syntax.

Arguments

key

Identifier for the subcircuit being added or renewed.

valueDynamics.Subcircuit

The subcircuit to be added. If not of this class, it must provide similar class methods.

add(key)[source]

Add a subcircuit to the evolution.

Arguments

key :

Identifier for the subcircuit to be applied.

classname()[source]

Return the string QuantumCircuits, which is the name of the class.


class dynamics.Subcircuit(Ops)[source]

Class defining one application pattern for a circuit to a set of sites.

Arguments

Opsinstance of Ops.OperatorList

Operators containing the quantum gates specified via their string identifier.

Variables

gateslist of string

The string identifier for the gates in the order in which they should be applied. First string is applied first.

siteslisted list of integers

Each element in the list is a list of integers. The integers specify to which sites the gate on the corresponding position’ in the gates list is applied to.

timelist of floats

The time steps associate with the corresponding item in the gates list.

__iadd__(args)[source]

Short-cut to add a gate.

Arguments

argstuple or list

If two entries, then the string identifier for the gate and the list of integers where the gate is applied. If three entries, the last entry is the time.

__iter__()[source]

Iterator returns the operator as 2d array, the list of sites, and the time.

add(gate, sites, time=1.0)[source]

Add another gate to the sub-circuit.

Arguments

gatestr

String identifier for the gate.

siteslist of integers

Specifies the sites where the gate should be applied

timefloat, optional

Time associated with the gate. Default to 1.0

dynamics.swp_subcircuit(Opl, Opb, Opr, ll, Operators)[source]

Build a subcircuit for a three qubit gate in the SWP configuration.

Arguments

Oplstring

String identifier for the two qubit gate for the left boundary.

Opbstring

String identifier for the three qubit gate in the bulk of the system.

Oprstring

String identifier for the two qubit gate for the right boundary.

llint

Number of sites in the system.

Operatorsinstance of Ops.OperatorList

Operators containing the quantum gates specified via their string identifier.

dynamics.alt_subcircuit(Opl, Opb, Opr, ll, Operators)[source]

Build a subcircuit for a three qubit gate in the ALT configuration.

Arguments

Oplstring

String identifier for the two qubit gate for the left boundary.

Opbstring

String identifier for the three qubit gate in the bulk of the system.

Oprstring

String identifier for the two qubit gate for the right boundary.

llint

Number of sites in the system.

Operatorsinstance of Ops.OperatorList

Operators containing the quantum gates specified via their string identifier.

dynamics.blk_subcircuit(Opl, Opb, Opr, ll, Operators)[source]

Build a subcircuit for a three qubit gate in the BLK configuration.

Arguments

Oplstring

String identifier for the two qubit gate for the left boundary.

Opbstring

String identifier for the three qubit gate in the bulk of the system.

Oprstring

String identifier for the two qubit gate for the right boundary.

llint

Number of sites in the system.

Operatorsinstance of Ops.OperatorList

Operators containing the quantum gates specified via their string identifier.

dynamics.WriteDynamics(H, p, qtcopy, PostProcess=False)[source]

Write out the dynamics to a Fortran-readable file.

Arguments

Hinstance of mps.MPO

contains the information about the system Hamiltonian

pdictionary

containing the static parameters of a simulation as job_ID, unique_ID, etc.

qtcopycallable

copies files for quantum trajectories. Takes two arguments: filename and number of trajectories (eqauls to the number of copies needed).

PostProcessboolean, optional

False : write output file used in fortran simulation True : used within python postprocessing script default to False

Details

The first file (meta file) should be structured in the following way: 1) Number of quenches n 2) n lines with the corresponding quench data method e.g. krylov

The file for each quench contains the following information 1) number of time steps, step between measurements, time step dt 2) number of exponentials (for time-ordering) 3) 0 or 1, extradt (float, time steps size, only Krylov) 4) scale factors (time-ordering) 5) number of changed Hamiltonian parameters (integer) 6) indices of the changed Hamiltonian parameter

Looping over the times steps:

7a) Hamiltonian : looping over the decomposition, then one line for each changing Hamiltonian parameter with one float (space independent) or L floats (space dependent) 8) Measurements : for every changed parameter one line either containing one float (space independent) or couplings for all sites.

For the extradt (one time step):

9a) Hamiltonian for extradt: same string as for Hamiltonian 10) Measurements for extra dt: one float or line of floats.