All Modules¶
tempo.base_api¶
Module for base classes of API objects.
-
class
time_evolving_mpo.base_api.
BaseAPIClass
(name: Optional[str] = None, description: Optional[str] = None, description_dict: Optional[Dict] = None)[source]¶ Base class for API objects
- Parameters
name (str) – An optional name for the object.
description (str) – An optional description of the object.
description_dict (dict) – An optional dictionary with descriptive data.
-
property
description
¶ Detailed description of the object.
-
property
description_dict
¶ A dictionary for descriptive data.
-
property
name
¶ Name of the object.
tempo.bath¶
Module on physical information on the bath and its coupling to the system.
-
class
time_evolving_mpo.bath.
Bath
(coupling_operator: numpy.ndarray, correlations: time_evolving_mpo.correlations.BaseCorrelations, name: Optional[str] = None, description: Optional[str] = None, description_dict: Optional[Dict] = None)[source]¶ Bases:
time_evolving_mpo.base_api.BaseAPIClass
Represents the bath degrees of freedom with a specific coupling operator (to the system) and a specific auto-correlation function.
- Parameters
coupling_operator (np.ndarray) – The system operator to which the bath couples.
correlations (BaseCorrelations) – The bath’s auto correlation function.
name (str) – An optional name for the bath.
description (str) – An optional description of the bath.
description_dict (dict) – An optional dictionary with descriptive data.
- Raises
ValueError: – If the temperature \(T\) is smaller then 0.
-
property
correlations
¶ The correlations of the bath.
-
property
coupling_operator
¶ The diagonalised system operator to which the bath couples.
-
property
dimension
¶ Hilbert space dimension of the coupling operator.
-
property
unitary_transform
¶ The unitary that makes the coupling operator diagonal.
tempo.correlations¶
Module for environment correlations.
-
class
time_evolving_mpo.correlations.
BaseCorrelations
(name: Optional[str] = None, description: Optional[str] = None, description_dict: Optional[Dict] = None)[source]¶ Bases:
time_evolving_mpo.base_api.BaseAPIClass
Base class for environment auto-correlations.
-
correlation
(tau: Any, epsrel: Optional[float] = 1.4901161193847656e-08, subdiv_limit: Optional[int] = 256) → Any[source]¶ Auto-correlation function.
\[C(\tau) = C(t, t-\tau) \ = \langle F(t) F(t-\tau) \rangle_\mathrm{env}\]where \(\tau\) is the time difference tau and \(F(t)\) is the the environment part of the coupling operator in Heisenberg picture with respect to the environment Hamiltonian.
- Parameters
tau (ndarray) – Time difference \(\tau\)
epsrel (float) – Relative error tollerance.
subdiv_limit (int) – Maximal number of interval subdivisions for numerical integration.
- Returns
correlation – The auto-correlation function \(C(\tau)\) at time \(\tau\).
- Return type
ndarray
-
correlation_2d_integral
(time_1: float, delta: float, shape: Optional[str] = 'square', epsrel: Optional[float] = 1.4901161193847656e-08, subdiv_limit: Optional[int] = 256) → complex[source]¶ 2D integrals of the correlation function
\[ \begin{align}\begin{aligned}\eta(t_1,\Delta)_\mathrm{square} = \int_{t_1}^{t_1+\Delta} \int_{0}^{\Delta} C(t'-t'') dt'' dt'\\\eta(t_1,\Delta)_\mathrm{upper-triangle} = \int_{t_1}^{t_1+\Delta} \int_{0}^{t'-t_1} C(t'-t'') dt'' dt'\\\eta(t_1,\Delta)_\mathrm{lower-triangle} = \int_{t_1}^{t_1+\Delta} \int_{t'-t_1}^{\Delta} C(t'-t'') dt'' dt'\end{aligned}\end{align} \]for shape either
'square'
,'upper-triangle'
or'lower-triangle'
.- Parameters
time_1 (float) – Lower bound of integration interval of \(dt'\).
delta (float) – Length of integration intevals.
shape (str (default =
'square'
)) – The shape of the 2D integral. Shapes are: {'square'
,'upper-triangle'
,'lower-triangle'
}epsrel (float) – Relative error tollerance.
subdiv_limit (int) – Maximal number of interval subdivisions for numerical integration.
- Returns
integral – The numerical value for the two dimensional integral \(\eta(t_1,\Delta)_\mathrm{shape}\).
- Return type
float
-
property
max_correlation_time
¶ Maximal correlation time.
-
-
class
time_evolving_mpo.correlations.
CustomCorrelations
(correlation_function: Callable[[float], float], max_correlation_time: Optional[float] = None, name: Optional[str] = None, description: Optional[str] = None, description_dict: Optional[Dict] = None)[source]¶ Bases:
time_evolving_mpo.correlations.BaseCorrelations
Encodes a custom auto-correlation function
\[C(\tau) = C(t, t-\tau) = \langle F(t) F(t-\tau) \rangle_\mathrm{env}\]with time difference tau \(\tau\) and \(F(t)\) is the the environment part of the coupling operator in Heisenberg picture with respect to the environment Hamiltonian. We assume that \(C(\tau) = 0\) for all \(\tau > \tau_\mathrm{max}\).
- Parameters
correlation_function (callable) – The correlation function \(C\).
max_correlation_time (float) – The maximal occuring correlation time \(\tau_\mathrm{max}\).
name (str) – An optional name for the correlations.
description (str) – An optional description of the correlations.
description_dict (dict) – An optional dictionary with descriptive data.
-
correlation
(tau: Any, epsrel: Optional[float] = None, subdiv_limit: Optional[int] = None) → Any[source]¶ Auto-correlation function.
\[C(\tau) = C(t, t-\tau) \ = \langle F(t) F(t-\tau) \rangle_\mathrm{env}\]with time difference tau \(\tau\) and \(F(t)\) is the the environment part of the coupling operator in Heisenberg picture with respect to the environment Hamiltonian.
- Parameters
tau (ndarray) – Time difference \(\tau\)
epsrel (float) – Relative error tollerance (has no effect here).
subdiv_limit (int) – Maximal number of interval subdivisions for numerical integration (has no effect here).
- Returns
correlation – The auto-correlation function \(C(\tau)\) at time \(\tau\).
- Return type
ndarray
-
correlation_2d_integral
(time_1: float, delta: float, shape: Optional[str] = 'square', epsrel: Optional[float] = 1.4901161193847656e-08, subdiv_limit: Optional[int] = 256) → complex[source]¶ 2D integrals of the auto-correlation function
\[ \begin{align}\begin{aligned}\eta(t_1,\Delta)_\mathrm{square} = \int_{t_1}^{t_1+\Delta} \int_{0}^{\Delta} C(t'-t'') dt'' dt'\\\eta(t_1,\Delta)_\mathrm{upper-triangle} = \int_{t_1}^{t_1+\Delta} \int_{0}^{t'-t_1} C(t'-t'') dt'' dt'\\\eta(t_1,\Delta)_\mathrm{lower-triangle} = \int_{t_1}^{t_1+\Delta} \int_{t'-t_1}^{\Delta} C(t'-t'') dt'' dt'\end{aligned}\end{align} \]for shape either
'square'
,'upper-triangle'
or'lower-triangle'
.- Parameters
time_1 (float) – Lower bound of integration interval of \(dt'\).
delta (float) – Length of integration intevals.
shape (str{
'square'
,'upper-triangle'
,'lower-triangle'
}) – The shape of the 2D integral.epsrel (float) – Relative error tollerance.
subdiv_limit (int) – Maximal number of interval subdivisions for numerical integration.
- Returns
integral – The numerical value for the two dimensional integral \(\eta(t_1,\Delta)_\mathrm{shape}\).
- Return type
float
-
class
time_evolving_mpo.correlations.
CustomSD
(j_function: Callable[[float], float], cutoff: float, cutoff_type: Optional[str] = 'exponential', temperature: Optional[float] = 0.0, max_correlation_time: Optional[float] = None, name: Optional[str] = None, description: Optional[str] = None, description_dict: Optional[Dict] = None)[source]¶ Bases:
time_evolving_mpo.correlations.BaseCorrelations
Correlations corresponding to a custom spectral density. The resulting spectral density is
\[J(\omega) = j(\omega) X(\omega,\omega_c) ,\]with j_function \(j\), cutoff \(\omega_c\) and a cutoff type \(X\).
If cutoff_type is
'hard'
then \(X(\omega,\omega_c)=\Theta(\omega_c-\omega)\), where \(\Theta\) is the Heaviside step function.'exponential'
then \(X(\omega,\omega_c)=\exp(-\omega/\omega_c)\).'gaussian'
then \(X(\omega,\omega_c)=\exp(-\omega^2/\omega_c^2)\).
- Parameters
j_function (callable) – The spectral density \(j\) without the cutoff.
cutoff (float) – The cutoff frequency \(\omega_c\).
cutoff_type (str (default =
'exponential'
)) – The cutoff type. Types are: {'hard'
,'exponential'
,'gaussian'
}temperature (float) – The environment’s temperature.
max_correlation_time (float) – The maximal occuring correlation time \(\tau_\mathrm{max}\).
name (str) – An optional name for the correlations.
description (str) – An optional description of the correlations.
description_dict (dict) – An optional dictionary with descriptive data.
-
correlation
(tau: Any, epsrel: Optional[float] = 1.4901161193847656e-08, subdiv_limit: Optional[int] = 256) → Any[source]¶ Auto-correlation function associated to the spectral density at the given temperature \(T\)
\[C(\tau) = \int_0^{\infty} J(\omega) \ \left[ \cos(\omega \tau) \ \coth\left( \frac{\omega}{2 T}\right) \ - i \sin(\omega \tau) \right] \mathrm{d}\omega .\]with time difference tau \(\tau\).
- Parameters
tau (ndarray) – Time difference \(\tau\)
epsrel (float) – Relative error tollerance.
epsrel – Relative error tollerance.
subdiv_limit (int) – Maximal number of interval subdivisions for numerical integration.
- Returns
correlation – The auto-correlation function \(C(\tau)\) at time \(\tau\).
- Return type
ndarray
-
correlation_2d_integral
(time_1: float, delta: float, shape: Optional[str] = 'square', epsrel: Optional[float] = 1.4901161193847656e-08, subdiv_limit: Optional[int] = 256) → complex[source]¶ 2D integrals of the correlation function
\[ \begin{align}\begin{aligned}\eta(t_1,\Delta)_\mathrm{square} = \int_{t_1}^{t_1+\Delta} \int_{0}^{\Delta} C(t'-t'') dt'' dt'\\\eta(t_1,\Delta)_\mathrm{upper-triangle} = \int_{t_1}^{t_1+\Delta} \int_{0}^{t'-t_1} C(t'-t'') dt'' dt'\\\eta(t_1,\Delta)_\mathrm{lower-triangle} = \int_{0}^{\Delta} \int_{t_1}^{t_1+dt''} C(t'-t'') dt' dt''\end{aligned}\end{align} \]for shape either
'square'
,'upper-triangle'
or'lower-triangle'
.- Parameters
time_1 (float) – Lower bound of integration interval of \(dt'\).
delta (float) – Length of integration intevals.
shape (str{
'square'
,'upper-triangle'
,'lower-triangle'
}) – The shape of the 2D integral.epsrel (float) – Relative error tollerance.
subdiv_limit (int) – Maximal number of interval subdivisions for numerical integration.
- Returns
integral – The numerical value for the two dimensional integral \(\eta(t_1,\Delta)_\mathrm{shape}\).
- Return type
float
-
spectral_density
(omega: Any) → Any[source]¶ The resulting spectral density (including the cutoff).
- Parameters
omega (ndarray) – The frequency \(\omega\) for which we want to know the spectral density.
- Returns
spectral_density – The resulting spectral density \(J(\omega)\) at the frequency \(\omega\).
- Return type
ndarray
-
class
time_evolving_mpo.correlations.
PowerLawSD
(alpha: float, zeta: float, cutoff: float, cutoff_type: str = 'exponential', temperature: Optional[float] = 0.0, max_correlation_time: Optional[float] = None, name: Optional[str] = None, description: Optional[str] = None, description_dict: Optional[Dict] = None)[source]¶ Bases:
time_evolving_mpo.correlations.CustomSD
Correlations corresponding to the spectral density of the standard form
\[J(\omega) = 2 \alpha \frac{\omega^\zeta}{\omega_c^{\zeta-1}} \ X(\omega,\omega_c)\]with alpha \(\alpha\), zeta \(\zeta\) and a cutoff type \(X\).
If cutoff_type is
'hard'
then \(X(\omega,\omega_c)=\Theta(\omega_c-\omega)\), where \(\Theta\) is the Heaviside step function.'exponential'
then \(X(\omega,\omega_c)=\exp(-\omega/\omega_c)\).'gaussian'
then \(X(\omega,\omega_c)=\exp(-\omega^2/\omega_c^2)\).
- Parameters
alpha (float) – The coupling strenght \(\alpha\).
zeta (float) – The exponent \(\zeta\) (corresponds to the dimensionality of the environment). The environment is called ohmic if \(\zeta=1\), superohmic if \(\zeta>1\) and subohmic if \(\zeta<1\)
cutoff (float) – The cutoff frequency \(\omega_c\).
cutoff_type (str (default =
'exponential'
)) – The cutoff type. Types are: {'hard'
,'exponential'
,'gaussian'
}temperature (float) – The environment’s temperature.
max_correlation_time (float) – The maximal occuring correlation time \(\tau_\mathrm{max}\).
name (str) – An optional name for the correlations.
description (str) – An optional description of the correlations.
description_dict (dict) – An optional dictionary with descriptive data.
tempo.dynamics¶
Module on the discrete time evolution of a density matrix.
-
class
time_evolving_mpo.dynamics.
Dynamics
(times: Optional[List[float]] = None, states: Optional[List[numpy.ndarray]] = None, name: Optional[str] = None, description: Optional[str] = None, description_dict: Optional[Dict] = None)[source]¶ Bases:
time_evolving_mpo.base_api.BaseAPIClass
Represents a specific time evolution of a density matrix.
- Parameters
times (List[float] (default = None)) – A list of points in time.
states (List[ndarray] (default = None)) – A list of states at the times times.
name (str) – An optional name for the dynamics.
description (str) – An optional description of the dynamics.
description_dict (dict) – An optional dictionary with descriptive data.
-
add
(time: float, state: numpy.ndarray) → None[source]¶ Append a state at a specific time to the time evolution.
- Parameters
time (float) – The point in time.
state (ndarray) – The state at the time time.
-
expectations
(operator: Optional[numpy.ndarray] = None, real: Optional[bool] = False) → Tuple[numpy.ndarray, numpy.ndarray][source]¶ Return the time evolution of the expectation value of specific operator. The expectation for \(t\) is
\[\langle \hat{O}(t) \rangle = \mathrm{Tr}\{ \hat{O} \rho(t) \}\]with operator \(\hat{O}\).
- Parameters
operator (ndarray (default = None)) – The operator \(\hat{O}\). If operator is None then the trace of \(\rho(t)\) is returned.
real (bool (default = False)) – If set True then only the real part of the expectation is returned.
- Returns
times (ndarray) – The points in time \(t\).
expectations (ndarray) – Expectation values \(\langle \hat{O}(t) \rangle\).
-
export
(filename: str, overwrite: bool = False) → None[source]¶ Save dynamics to a file (format TempoDynamicsFormat version 1.0).
- Parameters
filename (str) – Path and filename to file that should be created.
overwrite (bool (default = False)) – If set True then file is overwritten in case it already exists.
-
property
shape
¶ Numpy shape of the states.
-
property
states
¶ States of the dynamics.
-
property
times
¶ Times of the dynamics.
-
time_evolving_mpo.dynamics.
import_dynamics
(filename: str) → time_evolving_mpo.dynamics.Dynamics[source]¶ Load dynamics from a file (format TempoDynamicsFormat version 1.0).
- Parameters
filename (str) – Path and filename to file that should read in.
- Returns
dynamics – The time evolution stored in the file filename.
- Return type
tempo.exceptions¶
Custom TEMPO Warings and Errors.
tempo.file_formats¶
Module to define/check the export/import file formats.
-
time_evolving_mpo.file_formats.
assert_process_tensor_dict
(p_t_dict: Dict) → None[source]¶ Assert that the data is of correct .processTensor form, which is:
Dict[ "version" : "1.0", "name" : None / Text, "description" : None / Text, "description_dict" : None / Dict, "times" : None / float / ndarray, "initial_tensor" : None / ndarray, "tensors" : List[ndarray] ]
If the field times is None this amounts to no information on the time slots of the process tensor (only “initial step”, “first step”, etc). If the field times is a float it signals that the time steps are uniformly spaced. If the field times is an numpy.ndarray it has to be a vector of the time slots considered in this process tensor in ascending order. In this case the length of times must be the length of tensors plus 1.
If the field initial_tensor is None this amounts to no given initial state. If the field initial_tensor is an numpy.ndarray it must be a 2-legged tensor (i.e. a matrix) where the first leg is the internal leg connecting to the next part of the array of tensors that represent the process tensor. The second leg is vectorised initial state (in fact the first slot in the process tensor).
The field tensors is list of three or four legged tensors. The first and second legs are the internal legs that connect to the previous and next tensor. If initial_tensor is None the first leg of the first tensor must be a dummy leg of dimension 1. The second leg of the last tensor must always be a dummy leg of dimension 1. The third leg is the “incoming” leg of the previous time slot, while the fourth leg is the “resulting” leg of the following time slot. If the tensor has only three legs, a Kronecker-delta between the third and fourth leg is assumed.
- Parameters
p_t_dict (dict) – Data dictionary of the process tensor.
- Raises
AssertionError – If p_t_dict is not of the correct process tensor form.
-
time_evolving_mpo.file_formats.
assert_process_tensor_file
(filename: str) → None[source]¶ Assert that the file is of correct .processTensor form [see tempo.assert_process_tensor_file() for more details].
- Parameters
filename (str) – Path to the file.
- Raises
AssertionError – If the data found in the file is not of the correct .processTensor form.
-
time_evolving_mpo.file_formats.
assert_tempo_dynamics_dict
(t_dyn_dict: Dict) → None[source]¶ Assert that the data is of correct .tempoDynamics form, which is:
Dict[ "version" : "1.0", "name" : None / Text, "description" : None / Text, "description_dict" : None / Dict, "times" : ndarray, "states" : ndarray ]
where times is a 1D array of floats and states is a 1D array of square matrices of the same length.
- Parameters
t_dyn_dict (dict) – Data dictionary of the .tempoDynamics file.
- Raises
AssertionError – If t_dyn_dict is not of the correct .tempoDynamics form.
-
time_evolving_mpo.file_formats.
assert_tempo_dynamics_file
(filename: str) → None[source]¶ Assert that the file is of correct .tempoDynamics form [see tempo.assert_tempo_dynamics_file() for more details].
- Parameters
filename (str) – Path to the file.
- Raises
AssertionError – If the data found in the file is not of the correct .tempoDynamics form.
-
time_evolving_mpo.file_formats.
check_process_tensor_file
(filename: str) → bool[source]¶ Check if file is of correct .processTensor form [see tempo.assert_process_tensor_file() for more details].
- Parameters
filename (str) – Path to the file.
- Returns
True or False – True if the file has the correct format.
- Return type
bool
-
time_evolving_mpo.file_formats.
check_tempo_dynamics_file
(filename: str) → bool[source]¶ Check if file is of correct .tempoDynamics form. [see tempo.assert_tempo_dynamics_file() for more details].
- Parameters
filename (str) – Path to the file.
- Returns
True or False – True if the file has the correct format.
- Return type
bool
-
time_evolving_mpo.file_formats.
print_process_tensor_dict
(p_t_dict: Dict) → None[source]¶ Print header of .processTensor data.
-
time_evolving_mpo.file_formats.
print_process_tensor_file
(filename: str) → None[source]¶ Print header of .processTensor file.
tempo.helpers¶
Handy helper functions.
-
time_evolving_mpo.helpers.
plot_correlations_with_parameters
(correlations: time_evolving_mpo.correlations.BaseCorrelations, parameters: time_evolving_mpo.tempo.TempoParameters, ax: matplotlib.axes._axes.Axes = None) → matplotlib.axes._axes.Axes[source]¶ Plot the correlation function on a grid that corresponds to some tempo parameters. For comparison, it also draws a solid line that is 10% longer and has two more sampling points per interval.
- Parameters
correlations (BaseCorrelations) – The correlation obeject we are interested in.
parameters (TempoParameters) – The tempo parameters that determine the grid.
tempo.operators¶
Shorthand for commonly used operators.
-
time_evolving_mpo.operators.
create
(n: int)[source]¶ Bosonic creation operator of dimension n x n.
- Parameters
n (int) – Dimension of the Hilbert space.
- Returns
create – Creation operator matrix of dimension n x n.
- Return type
ndarray
-
time_evolving_mpo.operators.
destroy
(n: int)[source]¶ Bosonic annihilation operator of dimension n x n.
- Parameters
n (int) – Dimension of the Hilbert space.
- Returns
create – Annihilation operator matrix of dimension n x n.
- Return type
ndarray
-
time_evolving_mpo.operators.
identity
(n: int)[source]¶ Identity matrix of dimension n x n.
- Parameters
n (int) – Dimension of the square matrix.
- Returns
identity – Identity matrix of dimension n x n.
- Return type
ndarray
tempo.process_tensor¶
Module for the process tensor (PT) object. This code is based on [Pollock2018].
[Pollock2018] F. A. Pollock, C. Rodriguez-Rosario, T. Frauenheim, M. Paternostro, and K. Modi, Non-Markovian quantumprocesses: Complete framework and efficient characterization, Phys. Rev. A 97, 012127 (2018).
-
class
time_evolving_mpo.process_tensor.
ProcessTensor
(times: Union[float, numpy.ndarray], tensors: List[numpy.ndarray], initial_tensor: Optional[numpy.ndarray] = None, backend: Optional[str] = None, backend_config: Optional[Dict] = None, name: Optional[str] = None, description: Optional[str] = None, description_dict: Optional[Dict] = None)[source]¶ Bases:
time_evolving_mpo.base_api.BaseAPIClass
Represents a specific process tensor.
If the field times is None this amounts to no information on the time slots of the process tensor (only “initial step”, “first step”, etc). If the field times is a float it signals that the time steps are uniformly spaced. If the field times is an numpy.ndarray it has to be a vector of the time slots considered in this process tensor in ascending order. In this case the length of times must be the length of tensors plus 1.
If the field initial_tensor is None this amounts to no given initial state. If the field initial_tensor is an numpy.ndarray it must be a 2-legged tensor (i.e. a matrix) where the first leg is the internal leg connecting to the next part of the array of tensors that represent the process tensor. The second leg is vectorised initial state (in fact the first slot in the process tensor).
The field tensors is list of three or four legged tensors. The first and second legs are the internal legs that connect to the previous and next tensor. If initial_tensor is None the first leg of the first tensor must be a dummy leg of dimension 1. The second leg of the last tensor must always be a dummy leg of dimension 1. The third leg is the “incoming” leg of the previous time slot, while the fourth leg is the “resulting” leg of the following time slot. If the tensor has only three legs, a Kronecker-delta between the third and fourth leg is assumed.
- Parameters
times (ndarray / float / None) – Time slots of process tensor. See description above.
tensors (list(ndarray)) – Process tensor tensors in MPS form. See description above.
initial_tensor (ndarray) – Initial tensor of process tensor in MPS form. See description above.
backend (str (default = None)) – The name of the backend to use foe computations. If backend is
None
then the default backend is used.backend_config (dict (default = None)) – The configuration of the backend. If backend_config is
None
then the default backend configuration is used.name (str) – An optional name for the process tensor.
description (str) – An optional description of the process tensor.
description_dict (dict) – An optional dictionary with descriptive data.
-
compute_dynamics_from_system
(system: time_evolving_mpo.system.BaseSystem, initial_state: Optional[numpy.ndarray] = None) → time_evolving_mpo.dynamics.Dynamics[source]¶ Compute the system dynamics for a given system Hamiltonian.
- Parameters
system (BaseSystem) – Object containing the system Hamiltonian information.
- Returns
dynamics – The system dynamics for the given system Hamiltonian (accounting for the interaction with the environment).
- Return type
-
compute_final_state_from_system
(system: time_evolving_mpo.system.BaseSystem, initial_state: Optional[numpy.ndarray] = None) → time_evolving_mpo.dynamics.Dynamics[source]¶ Compute final state for a given system Hamiltonian.
- Parameters
system (BaseSystem) – Object containing the system Hamiltonian information.
- Returns
final_state – The final system system state for the given system Hamiltonian (accounting for the interaction with the environment).
- Return type
ndarray
-
export
(filename: str, overwrite: bool = False) → None[source]¶ Save process tensor to a file (format ProcessTensorFormat version 1.0).
- Parameters
filename (str) – Path and filename to file that should be created.
overwrite (bool (default = False)) – If set True then file is overwritten in case it already exists.
-
get_bond_dimensions
() → numpy.ndarray[source]¶ Return the bond dimensions of the MPS form of the process tensor.
-
property
times
¶ Times of the dynamics.
-
time_evolving_mpo.process_tensor.
import_process_tensor
(filename: str) → time_evolving_mpo.process_tensor.ProcessTensor[source]¶ Load process tensor from a file (format ProcessTensorFormat version 1.0).
- Parameters
filename (str) – Path and filename to file that should read in.
- Returns
process_tensor – The process tensor stored in the file filename.
- Return type
tempo.pt_tempo¶
Module for the process tensor time evolving matrix product operator algorithm (PT-TEMPO). This code is based on [Strathearn2018, Pollock2018, Jorgensen2019, Fux2021].
[Strathearn2018] A. Strathearn, P. Kirton, D. Kilda, J. Keeling and B. W. Lovett, Efficient non-Markovian quantum dynamics using time-evolving matrix product operators, Nat. Commun. 9, 3322 (2018).
[Pollock2018] F. A. Pollock, C. Rodriguez-Rosario, T. Frauenheim, M. Paternostro, and K. Modi, Non-Markovian quantumprocesses: Complete framework and efficient characterization, Phys. Rev. A 97, 012127 (2018).
[Jorgensen2019] M. R. Jørgensen and F. A. Pollock, Exploiting the causal tensor network structure of quantum processes to efficiently simulate non-markovian path integrals, Phys. Rev. Lett. 123, 240602 (2019)
[Fux2021] G. E. Fux, E. Butler, P. R. Eastham, B. W. Lovett, and J. Keeling, Efficient exploration of Hamiltonian parameter space for optimal control of non-Markovian open quantum systems, arXiv2101.03071 (2021).
-
class
time_evolving_mpo.pt_tempo.
PtTempo
(bath: time_evolving_mpo.bath.Bath, start_time: float, end_time: float, parameters: time_evolving_mpo.pt_tempo.PtTempoParameters, backend: Optional[str] = None, backend_config: Optional[Dict] = None, name: Optional[str] = None, description: Optional[str] = None, description_dict: Optional[Dict] = None)[source]¶ Bases:
time_evolving_mpo.base_api.BaseAPIClass
Class to facilitate a PT-TEMPO computation.
- Parameters
bath (Bath) – The Bath (includes the coupling operator to the sytem).
parameters (PtTempoParameters) – The parameters for the PT-TEMPO computation.
start_time (float) – The start time.
backend (str (default = None)) – The name of the backend to use for the computation. If backend is
None
then the default backend is used.backend_config (dict (default = None)) – The configuration of the backend. If backend_config is
None
then the default backend configuration is used.name (str (default = None)) – An optional name for the tempo object.
description (str (default = None)) – An optional description of the tempo object.
description_dict (dict (default = None)) – An optional dictionary with descriptive data.
-
compute
(progress_type: Optional[str] = None) → None[source]¶ Propagate (or continue to propagete) the TEMPO tensor network to time end_time.
- Parameters
end_time (float) – The time to which the TEMPO should be computed.
progress_type (str (default = None)) – The progress report type during the computation. Types are: {
silent
,simple`, ``bar
}. If None then the default progress type is used.
-
property
dimension
¶ Hilbert space dimension.
-
get_process_tensor
(progress_type: Optional[str] = None, backend: Optional[str] = None, backend_config: Optional[Dict] = None) → time_evolving_mpo.process_tensor.ProcessTensor[source]¶ Returns a the computed process tensor. It performs the computation if it hasn’t been already done.
- Parameters
backend (str (default = None)) – The name of the backend for the following process tensor computations. If backend is
None
then the default backend is used.backend_config (dict (default = None)) – The configuration of the backend. If backend_config is
None
then the default backend configuration is used.
- Returns
process_tensor – The computed process tensor.
- Return type
-
class
time_evolving_mpo.pt_tempo.
PtTempoParameters
(dt: float, dkmax: int, epsrel: float, name: Optional[str] = None, description: Optional[str] = None, description_dict: Optional[Dict] = None)[source]¶ Bases:
time_evolving_mpo.tempo.TempoParameters
Parameters for the PT-TEMPO computation.
- Parameters
dt (float) – Length of a time step \(\delta t\). - It should be small enough such that a trotterisation between the system Hamiltonian and the environment it valid, and the environment auto-correlation function is reasonably well sampled.
dkmax (int) – Number of time steps \(K\in\mathbb{N}\) that should be included in the non-Markovian memory. - It must be large enough such that \(\delta t \times K$ is larger than the neccessary memory time :math:\)tau_mathrm{cut}`.
epsrel (float) – The maximal relative error in the singular value truncation (done in the underlying tensor network algorithm). - It must be small enough such that the numerical compression (using tensor network algorithms) does not truncate relevant correlations.
-
time_evolving_mpo.pt_tempo.
guess_pt_tempo_parameters
(bath: time_evolving_mpo.bath.Bath, start_time: float, end_time: float, tollerance: Optional[float] = 0.0039) → time_evolving_mpo.pt_tempo.PtTempoParameters[source]¶ Function to roughly estimate appropriate parameters for a PT-TEMPO computation.
Warning
No guarantie that resulting PT-TEMPO calculation converges towards the correct dynamics! Please refere to the TEMPO documentation and check convergence by varying the parameters for PT-TEMPO manually.
- Parameters
bath (Bath) – The bath.
start_time (float) – The start time.
end_time (float) – The time to which the TEMPO should be computed.
tollerance (float) – Tollerance for the parameter estimation.
- Returns
pt_tempo_parameters – Estimate of appropropriate tempo parameters.
- Return type
-
time_evolving_mpo.pt_tempo.
pt_tempo_compute
(bath: time_evolving_mpo.bath.Bath, start_time: float, end_time: float, parameters: Optional[time_evolving_mpo.pt_tempo.PtTempoParameters] = None, tollerance: Optional[float] = 0.0039, backend: Optional[str] = None, backend_config: Optional[Dict] = None, progress_type: Optional[str] = None, name: Optional[str] = None, description: Optional[str] = None, description_dict: Optional[Dict] = None) → time_evolving_mpo.process_tensor.ProcessTensor[source]¶ Shortcut for creating a process tensor by performing a PT-TEMPO computation.
- Parameters
bath (Bath) – The Bath (includes the coupling operator to the sytem).
start_time (float) – The start time.
end_time (float) – The time to which the PT-TEMPO should be computed.
parameters (PtTempoParameters) – The parameters for the PT-TEMPO computation.
tollerance (float) – Tollerance for the parameter estimation (only applicable if parameters is None).
backend (str (default = None)) – The name of the backend to use for the computation. If backend is
None
then the default backend is used.backend_config (dict (default = None)) – The configuration of the backend. If backend_config is
None
then the default backend configuration is used.progress_type (str (default = None)) – The progress report type during the computation. Types are: {
'silent'
,'simple'
,'bar'
}. If None then the default progress type is used.name (str (default = None)) – An optional name for the tempo object.
description (str (default = None)) – An optional description of the tempo object.
description_dict (dict (default = None)) – An optional dictionary with descriptive data.
tempo.system¶
Module on physical information of the system.
-
class
time_evolving_mpo.system.
BaseSystem
(dimension: int, name: Optional[str] = None, description: Optional[str] = None, description_dict: Optional[Dict] = None)[source]¶ Bases:
time_evolving_mpo.base_api.BaseAPIClass
Base class for systems.
-
property
dimension
¶ Hilbert space dimension of the system.
-
liouvillian
(t: Optional[float] = None) → numpy.ndarray[source]¶ Returns the Liouvillian super-operator \(\mathcal{L}(t)\) with
\[\mathcal{L}(t)\rho = -i [\hat{H}(t), \rho] + \sum_n^N \gamma_n \left( \hat{A}_n(t) \rho \hat{A}_n^\dagger(t) - \frac{1}{2} \hat{A}_n^\dagger(t) \hat{A}_n(t) \rho - \frac{1}{2} \rho \hat{A}_n^\dagger(t) \hat{A}_n(t) \right),\]with time \(t\).
- Parameters
t (float (default = None)) – time \(t\).
- Returns
liouvillian – Liouvillian \(\mathcal{L}(t)\) at time \(t\).
- Return type
ndarray
-
property
-
class
time_evolving_mpo.system.
System
(hamiltonian: numpy.ndarray, gammas: Optional[List[float]] = None, lindblad_operators: Optional[List[numpy.ndarray]] = None, name: Optional[str] = None, description: Optional[str] = None, description_dict: Optional[Dict] = None)[source]¶ Bases:
time_evolving_mpo.system.BaseSystem
Represents a system (without any coupling to a non-Markovian bath). It is possible to include Lindblad terms in the master equation. The equations of motion for a system density matrix (without any coupling to a non-Markovian bath) is then:
\[\begin{split}\frac{d}{dt}\rho(t) = &-i [\hat{H}, \rho(t)] \\ &+ \sum_n^N \gamma_n \left( \hat{A}_n \rho(t) \hat{A}_n^\dagger - \frac{1}{2} \hat{A}_n^\dagger \hat{A}_n \rho(t) - \frac{1}{2} \rho(t) \hat{A}_n^\dagger \hat{A}_n \right)\end{split}\]with hamiltionian \(\hat{H}\), the rates gammas \(\gamma_n\) and linblad_operators \(\hat{A}_n\).
- Parameters
hamiltonian (ndarray) – System-only Hamiltonian \(\hat{H}\).
gammas (List(float)) – The rates \(\gamma_n\).
lindblad_operators (list(ndarray)) – The Lindblad operators \(\hat{A}_n\).
name (str) – An optional name for the system.
description (str) – An optional description of the system.
description_dict (dict) – An optional dictionary with descriptive data.
-
property
gammas
¶ List of gammas.
-
property
hamiltonian
¶ The system Hamiltonian.
-
property
lindblad_operators
¶ List of lindblad operators.
-
liouvillian
[source]¶ Returns the Liouvillian super-operator \(\mathcal{L}\) with
\[\mathcal{L}\rho = -i [\hat{H}, \rho] + \sum_n^N \gamma_n \left( \hat{A}_n \rho \hat{A}_n^\dagger - \frac{1}{2} \hat{A}_n^\dagger \hat{A}_n \rho - \frac{1}{2} \rho \hat{A}_n^\dagger \hat{A}_n \right) .\]- Returns
liouvillian – Liouvillian \(\mathcal{L}\).
- Return type
ndarray
-
class
time_evolving_mpo.system.
TimeDependentSystem
(hamiltonian: Callable[[float], numpy.ndarray], gammas: Optional[List[Callable[[float], float]]] = None, lindblad_operators: Optional[List[Callable[[float], numpy.ndarray]]] = None, name: Optional[str] = None, description: Optional[str] = None, description_dict: Optional[Dict] = None)[source]¶ Bases:
time_evolving_mpo.system.BaseSystem
Represents an explicitly time dependent system (without any coupling to a non-Markovian bath). It is possible to include (also explicitly time dependent) Lindblad terms in the master equation. The equations of motion for a system density matrix (without any coupling to a non-Markovian bath) is then:
\[\begin{split}\frac{d}{dt}\rho(t) = &-i [\hat{H}(t), \rho(t)] \\ &+ \sum_n^N \gamma_n(t) \left( \hat{A}_n(t) \rho(t) \hat{A}_n(t)^\dagger - \frac{1}{2} \hat{A}_n^\dagger(t) \hat{A}_n(t) \rho(t) - \frac{1}{2} \rho(t) \hat{A}_n^\dagger(t) \hat{A}_n(t) \right)\end{split}\]with the time dependent hamiltionian \(\hat{H}(t)\), the time dependent rates gammas \(\gamma_n(t)\) and the time dependent linblad_operators \(\hat{A}_n(t)\).
- Parameters
hamiltonian (callable) – System-only Hamiltonian \(\hat{H}(t)\).
gammas (List(callable)) – The rates \(\gamma_n(t)\).
lindblad_operators (list(callable)) – The Lindblad operators \(\hat{A}_n(t)\).
name (str) – An optional name for the system.
description (str) – An optional description of the system.
description_dict (dict) – An optional dictionary with descriptive data.
-
property
gammas
¶ List of gammas.
-
property
hamiltonian
¶ The system Hamiltonian.
-
property
lindblad_operators
¶ List of lindblad operators.
-
liouvillian
(t: Optional[float] = None) → numpy.ndarray[source]¶ Returns the Liouvillian super-operator \(\mathcal{L}(t)\) with
\[\mathcal{L}(t)\rho = -i [\hat{H}(t), \rho] + \sum_n^N \gamma_n \left( \hat{A}_n(t) \rho \hat{A}_n^\dagger(t) - \frac{1}{2} \hat{A}_n^\dagger(t) \hat{A}_n(t) \rho - \frac{1}{2} \rho \hat{A}_n^\dagger(t) \hat{A}_n(t) \right),\]with time \(t\).
- Parameters
t (float (default = None)) – time \(t\).
- Returns
liouvillian – Liouvillian \(\mathcal{L}(t)\) at time \(t\).
- Return type
ndarray
- Raises
ValueError – If t = None
tempo.tempo¶
Module on for the original time evolving matrix product operator (TEMPO) algorithm. This code is based on [Strathearn2018].
[Strathearn2018] A. Strathearn, P. Kirton, D. Kilda, J. Keeling and B. W. Lovett, Efficient non-Markovian quantum dynamics using time-evolving matrix product operators, Nat. Commun. 9, 3322 (2018).
-
class
time_evolving_mpo.tempo.
Tempo
(system: time_evolving_mpo.system.BaseSystem, bath: time_evolving_mpo.bath.Bath, parameters: time_evolving_mpo.tempo.TempoParameters, initial_state: numpy.ndarray, start_time: float, backend: Optional[str] = None, backend_config: Optional[Dict] = None, name: Optional[str] = None, description: Optional[str] = None, description_dict: Optional[Dict] = None)[source]¶ Bases:
time_evolving_mpo.base_api.BaseAPIClass
Class representing the entire TEMPO tensornetwork as introduced in [Strathearn2018].
- Parameters
system (BaseSystem) – The system.
bath (Bath) – The Bath (includes the coupling operator to the sytem).
parameters (TempoParameters) – The parameters for the TEMPO computation.
initial_state (ndarray) – The initial density matrix of the sytem.
start_time (float) – The start time.
backend (str (default = None)) – The name of the backend to use for the computation. If backend is
None
then the default backend is used.backend_config (dict (default = None)) – The configuration of the backend. If backend_config is
None
then the default backend configuration is used.name (str (default = None)) – An optional name for the tempo object.
description (str (default = None)) – An optional description of the tempo object.
description_dict (dict (default = None)) – An optional dictionary with descriptive data.
-
compute
(end_time: float, progress_type: str = None) → time_evolving_mpo.dynamics.Dynamics[source]¶ Propagate (or continue to propagete) the TEMPO tensor network to time end_time.
- Parameters
end_time (float) – The time to which the TEMPO should be computed.
progress_type (str (default = None)) – The progress report type during the computation. Types are: {
'silent'
,'simple'
,'bar'
}. If None then the default progress type is used.
- Returns
dynamics – The instance of Dynamics associated with the TEMPO object.
- Return type
-
property
dimension
¶ Hilbert space dimension.
-
class
time_evolving_mpo.tempo.
TempoParameters
(dt: float, dkmax: int, epsrel: float, name: Optional[str] = None, description: Optional[str] = None, description_dict: Optional[Dict] = None)[source]¶ Bases:
time_evolving_mpo.base_api.BaseAPIClass
Parameters for the TEMPO computation.
- Parameters
dt (float) – Length of a time step \(\delta t\). - It should be small enough such that a trotterisation between the system Hamiltonian and the environment it valid, and the environment auto-correlation function is reasonably well sampled.
dkmax (int) – Number of time steps \(K\in\mathbb{N}\) that should be included in the non-Markovian memory. - It must be large enough such that \(\delta t \times K\) is larger than the neccessary memory time \(\tau_\mathrm{cut}\).
epsrel (float) – The maximal relative error in the singular value truncation (done in the underlying tensor network algorithm). - It must be small enough such that the numerical compression (using tensor network algorithms) does not truncate relevant correlations.
-
property
dkmax
¶ Number of time steps that should be included in the non-Markovian memory.
-
property
dt
¶ Length of a time step.
-
property
epsrel
¶ The maximal relative error in the singular value truncation.
-
time_evolving_mpo.tempo.
guess_tempo_parameters
(bath: time_evolving_mpo.bath.Bath, start_time: float, end_time: float, system: Optional[time_evolving_mpo.system.BaseSystem] = None, tollerance: Optional[float] = 0.0039) → time_evolving_mpo.tempo.TempoParameters[source]¶ Function to roughly estimate appropriate parameters for a TEMPO computation.
Warning
No guarantie that resulting TEMPO calculation converges towards the correct dynamics! Please refere to the TEMPO documentation and check convergence by varying the parameters for TEMPO manually.
- Parameters
bath (Bath) – The bath.
start_time (float) – The start time.
end_time (float) – The time to which the TEMPO should be computed.
system (BaseSystem) – The system.
tollerance (float) – Tollerance for the parameter estimation.
- Returns
tempo_parameters – Estimate of appropropriate tempo parameters.
- Return type
-
time_evolving_mpo.tempo.
tempo_compute
(system: time_evolving_mpo.system.BaseSystem, bath: time_evolving_mpo.bath.Bath, initial_state: numpy.ndarray, start_time: float, end_time: float, parameters: Optional[time_evolving_mpo.tempo.TempoParameters] = None, tollerance: Optional[float] = 0.0039, backend: Optional[str] = None, backend_config: Optional[Dict] = None, progress_type: Optional[str] = None, name: Optional[str] = None, description: Optional[str] = None, description_dict: Optional[Dict] = None) → time_evolving_mpo.dynamics.Dynamics[source]¶ Shortcut for creating a Tempo object and runing the computation.
- Parameters
system (BaseSystem) – The system.
bath (Bath) – The Bath (includes the coupling operator to the sytem).
initial_state (ndarray) – The initial density matrix of the sytem.
start_time (float) – The start time.
end_time (float) – The time to which the TEMPO should be computed.
parameters (TempoParameters) – The parameters for the TEMPO computation.
tollerance (float) – Tollerance for the parameter estimation (only applicable if parameters is None).
backend (str (default = None)) – The name of the backend to use for the computation. If backend is
None
then the default backend is used.backend_config (dict (default = None)) – The configuration of the backend. If backend_config is
None
then the default backend configuration is used.progress_type (str (default = None)) – The progress report type during the computation. Types are: {
'silent'
,'simple'
,'bar'
}. If None then the default progress type is used.name (str (default = None)) – An optional name for the tempo object.
description (str (default = None)) – An optional description of the tempo object.
description_dict (dict (default = None)) – An optional dictionary with descriptive data.
tempo.util¶
Module for utillities.
-
class
time_evolving_mpo.util.
ProgressBar
(max_value)[source]¶ Class to display the computation progress with a nice progress bar.
-
class
time_evolving_mpo.util.
ProgressSilent
(max_value)[source]¶ Class NOT to display the computation progress.
-
class
time_evolving_mpo.util.
ProgressSimple
(max_value)[source]¶ Class to display the computation progress step by step.
-
time_evolving_mpo.util.
acommutator
(operator: numpy.ndarray) → numpy.ndarray[source]¶ Construct anti-commutator superoperator from operator.
-
time_evolving_mpo.util.
commutator
(operator: numpy.ndarray) → numpy.ndarray[source]¶ Construct commutator superoperator from operator.
-
time_evolving_mpo.util.
get_progress
(progress_type: str = None) → time_evolving_mpo.util.BaseProgress[source]¶ Get a progress class from the progress_type.
-
time_evolving_mpo.util.
left_right_super
(left_operator: numpy.ndarray, right_operator: numpy.ndarray) → numpy.ndarray[source]¶ Construct left and right acting superoperator from operators.
-
time_evolving_mpo.util.
left_super
(operator: numpy.ndarray) → numpy.ndarray[source]¶ Construct left acting superoperator from operator.
-
time_evolving_mpo.util.
load_object
(filename: str) → Any[source]¶ Load an object from a file using pickle.
tempo.backends¶
base_backends¶
Module for base classes of backends.
-
class
time_evolving_mpo.backends.base_backends.
BaseProcessTensorBackend
(tensors: List[numpy.ndarray], initial_tensor: Optional[numpy.ndarray], config: Dict)[source]¶ Base class for process tensor backends.
If initial_tensor is None this amounts to no given initial state. If initial_tensor is an numpy.ndarray it must be a 2-legged tensor (i.e. a matrix) where the first leg is the internal leg connecting to the next part of the array of tensors that represent the process tensor. The second leg is vectorised initial state (in fact the first slot in the process tensor).
The parameter tensors is list of three or four legged tensors. The first and second legs are the internal legs that connect to the previous and next tensor. If initial_tensor is None the first leg of the first tensor must be a dummy leg of dimension 1. The second leg of the last tensor must always be a dummy leg of dimension 1. The third leg is the “incoming” leg of the previous time slot, while the fourth leg is the “resulting” leg of the following time slot. If the tensor has only three legs, a Kronecker-delta between the third and fourth leg is assumed.
- Parameters
tensors (list(ndarray)) – The tensors that make up the MPO representation of the process tensor.
initial_tensor (ndarray) – The zeroth/initial tensor of the process tensor.
-
compute_dynamics
(controls: Callable[[int], Tuple[numpy.ndarray, numpy.ndarray]], initial_state: Optional[numpy.ndarray] = None) → time_evolving_mpo.dynamics.Dynamics[source]¶ Compute the Dynamics for a given set of controls.
- Parameters
controls (callable(int) -> ndarray, ndarray) – Callable that takes an integer step and returns the pre and post control at that time step.
initial_state (ndarray) – Initial state vector.
- Returns
dynamics – The dynamics of the system.
- Return type
-
compute_final_state
(controls: Callable[[int], Tuple[numpy.ndarray, numpy.ndarray]], initial_state: Optional[numpy.ndarray] = None) → numpy.ndarray[source]¶ Compute final state for a given set of controls.
- Parameters
controls (callable(int) -> ndarray, ndarray) – Callable that takes an integer step and returns the pre and post control at that time step.
initial_state (ndarray) – Initial state vector.
- Returns
final_state – The final state of the system.
- Return type
ndarray
-
class
time_evolving_mpo.backends.base_backends.
BasePtTempoBackend
(dimension: int, influence: Callable[[int], numpy.ndarray], unitary_transform: numpy.ndarray, sum_north: numpy.ndarray, sum_west: numpy.ndarray, num_steps: int, dkmax: int, epsrel: float, config: Dict)[source]¶ Base class for process tensor tempo backends.
- Parameters
influence (callable(int) -> ndarray) – Callable that takes an integer step and returns the influence super operator of that step.
unitary_transform (ndarray) – ToDo
sum_north (ndarray) – The summing vector for the north leggs.
sum_west (ndarray) – The summing vector for the west leggs.
dkmax (int) – Number of influences to include. If
dkmax == -1
then all influences are included.epsrel (float) – Maximal relative SVD truncation error.
-
property
num_steps
¶ The current step in the PT-TEMPO computation.
-
property
step
¶ The current step in the PT-TEMPO computation.
-
class
time_evolving_mpo.backends.base_backends.
BaseTempoBackend
(initial_state: numpy.ndarray, influence: Callable[[int], numpy.ndarray], unitary_transform: numpy.ndarray, propagators: Callable[[int], Tuple[numpy.ndarray, numpy.ndarray]], sum_north: numpy.ndarray, sum_west: numpy.ndarray, dkmax: int, epsrel: float, config: Dict)[source]¶ Base class for tempo backends.
- Parameters
initial_state (ndarray) – The initial density matrix (as a vector).
influence (callable(int) -> ndarray) – Callable that takes an integer step and returns the influence super operator of that step.
unitary_transform (ndarray) – Unitary that transforms the coupling operator into a diagonal form.
propagators (callable(int) -> ndarray, ndarray) – Callable that takes an integer step and returns the first and second half of the system propagator of that step.
sum_north (ndarray) – The summing vector for the north leggs.
sum_west (ndarray) – The summing vector for the west leggs.
dkmax (int) – Number of influences to include. If
dkmax == -1
then all influences are included.epsrel (float) – Maximal relative SVD truncation error.
-
compute_step
() → Tuple[int, numpy.ndarray][source]¶ Takes a step in the TEMPO tensor network computation.
- Returns
step (int) – The current step count.
state (ndarray) – Density matrix at the current step.
-
initialize
() → Tuple[int, numpy.ndarray][source]¶ Initializes the TEMPO tensor network.
- Returns
step (int = 0) – The current step count, which after initialization, is 0 .
state (ndarray) – Density matrix (as a vector) at the current step, which after initialization, is just the initial state.
-
property
step
¶ The current step in the TEMPO computation.