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 theHparams
arguments (None
). This flag might be used for a sudden quench where parameters change in regard to previous setting, but not over time. Default toNone
.
- is_time_dependent(ii)[source]¶
Check if a quench is time dependent. Returns
True
for time dependent quenches andFalse
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.
- 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.
- __iadd__(key)[source]¶
Add a subcircuit to the evolution.
Arguments
- key :
Identifier for the subcircuit to be applied.
- __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.
- value
Dynamics.Subcircuit
The subcircuit to be added. If not of this class, it must provide similar class methods.
- 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.
- Opsinstance of
- 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.