pykbe.two_time_var module#

class pykbe.two_time_var.TwoTimeVar(shape, ntimes=1, dt=0.1, dtype=<class 'numpy.float64'>, restricted=True)[source]#

Bases: object

Class to store two-time variables.

Methods

alloc([ntimes])

Allocate memory.

calc_propagator(Hfunc)

Second order Magnus scheme to get \(U(t)\) from \(H(t)\).

free()

Free memory.

from_time_dependent_H(Hfunc[, dm, mu])

Driver to calculate free \(G\) from time-dependent \(H\).

from_time_independent_H(H[, dm, mu])

Driver to calculate free \(G\) from time-independent \(H\).

les_at(i, j)

save(filename, groupname)

Save variable to HDF5 file.

tri_idx(i, j)

Index into a packed lower triangular array.

ret_at

alloc(ntimes=None)[source]#

Allocate memory.

Parameters:
ntimesint, optional

number of time points; by default None

calc_propagator(Hfunc)[source]#

Second order Magnus scheme to get \(U(t)\) from \(H(t)\).

The propagator is stored in the propagator attribute.

\[U(t) = \mathrm{Texp}\left(-i\int_{t_0}^t H(t')\, dt'\right)\]
Parameters:
Hfunccallable()

Time-dependent Hamiltonian.

free()[source]#

Free memory.

from_time_dependent_H(Hfunc, dm=None, mu=0.0)[source]#

Driver to calculate free \(G\) from time-dependent \(H\).

from_time_independent_H(H, dm=None, mu=0.0)[source]#

Driver to calculate free \(G\) from time-independent \(H\).

les_at(i, j)[source]#
ret_at(i, j)[source]#
save(filename, groupname)[source]#

Save variable to HDF5 file.

Parameters:
filenamestr

file name.

groupnamestr

HDF5 group name.

static tri_idx(i, j)[source]#

Index into a packed lower triangular array.

Parameters:
iint

row index.

jint

column index

Returns:
int

index into the packed lower triangular array.

Raises:
ValueError

Raised if you try to access an element in the upper triangle.

pykbe.two_time_var.calc_lescomp_free(dm, ntimes, lescomp, retcomp)[source]#

Calculate \(G^{<}(t_1, t_2)\) from density matrix and \(G^\mathrm{R}\).

Handles only the case \(t_1 \geq t_2\).

\[G^{<}(t_1, t_2) = G^\mathrm{R}(t_1, t_0) G^{<}(t_0, t_0) G^\mathrm{R}(t_2, t_0)^\dagger\]

where \(G^{<}(t_0, t_0) = -i \rho\) is calculated from the density matrix.

Parameters:
dmndarray

initial density matrix.

ntimesint

number of time points.

lescompndarray

lesser Green’s function; shape (ntimepair_tri, N, N).

retcompndarray

retarded Green’s function; shape (ntimepair_tri, N, N).

pykbe.two_time_var.retcomp_fast_from_propagator(ntimes, prop, retcomp)[source]#

Calculate \(G^\mathrm{R}(t_1, t_2)\) from propagator.

Handles only the case \(t_1 \geq t_2\).

\[G^\mathrm{R}(t_1, t_2) = -i \theta(t_1 - t_2) U(t_1) U^\dagger(t_2)\]
Parameters:
ntimesint

number of time points.

propndarray

propagator; shape (ntimes + 1, N, N).

retcompndarray

retarded Green’s function; shape (ntimepair_tri, N, N).

pykbe.two_time_var.retcomp_fast_time_independent_H(heigs, heigvecs, ntimes, dt, retcomp)[source]#

Calculate \(G^\mathrm{R}(t_1, t_2)\) from time-indep. Hamiltonian.

Handles only the case \(t_1 \geq t_2\).

\[\begin{split}G^\mathrm{R}(t_1, t_2) &= -i \theta(t_1 - t_2) U(t_1) U^\dagger(t_2) \\ &= -i \theta(t_1 - t_2) \exp\left(-i H (t_1 - t_2)\right).\end{split}\]
Parameters:
ntimesint

number of time points.

propndarray

propagator; shape (ntimes + 1, N, N).

retcompndarray

retarded Green’s function; shape (ntimepair_tri, N, N).

pykbe.two_time_var.test_free()[source]#