Tip

Run this Jupyter Notebook locally: Download Notebook

Tutorial evolution#

We demonstrate the use of a KPM expansion to handle the evolution in time of set of initial states under a defined Hamiltonian.

Note that this module only addresses the time evolution of closed systems. For time evolution in scattering problems, please refer to TKwant.

Defining the system#

We make some basic imports and define a linear chain.

[1]:
import numpy as np
import kwant


import matplotlib.pyplot, matplotlib.backends
from matplotlib import pyplot as plt

import holoviews as hv
hv.notebook_extension()
[2]:
from kpm_tools.evolution import evolve_vectors, _max_num_moments, evolve_vectors_time_steps
[3]:
chain_length = 100
lat = kwant.lattice.chain(norbs=1)
syst = kwant.builder.Builder()
for i in range(chain_length):
    syst[lat(i)] = 0
syst[lat.neighbors()] = -1
fsyst = syst.finalized()
kwant.plot(fsyst);
../_images/tutorials_tutorial_time_evolution_5_0.png

Time evolution#

We will demonstrate the time evolution using two initial states, one at the center of the chain, and one at the edge.

[4]:
vector_factory = kwant.kpm.LocalVectors(fsyst, where=[fsyst.sites[chain_length // 2], fsyst.sites[0]])
vectors = np.array([v for v in vector_factory])

time_steps, dt = np.linspace(0, 64, 256, retstep=True)
[5]:
%%time

accuracy = 0.5e-16

eee = evolve_vectors_time_steps(
    fsyst,
    time_steps=time_steps,
    vectors=vectors,
    accuracy=accuracy
)
CPU times: user 1.4 s, sys: 0 ns, total: 1.4 s
Wall time: 1.4 s
[6]:
%%opts QuadMesh [aspect="square" colorbar=True]
(
    hv.QuadMesh(
        (time_steps, np.arange(len(fsyst.sites)), np.abs(eee[:,0].T)),
        kdims=[r'$t$',r'$x[a]$'], vdims=r'LDOS', label="start at the center"
    ) +
    hv.QuadMesh(
        (time_steps, np.arange(len(fsyst.sites)), np.abs(eee[:,1].T)),
        kdims=[r'$t$',r'$x[a]$'], vdims=r'LDOS', label="start at the edge"
    )
).opts(title="Evolution of LDOS over time")
[6]:

Vector normalization over time#

Like with every evolution method, there is the risk of loosing the normalization of the initial vectors.

Here, we control this by setting the accuracy of the time evolution. Note that for consecutive applications of the time evolution expansion, the errors can accumulate. Thanks to the KPM stability and the efficiency of the time evolution expansion, the errors do not blow exponentially.

See Performance of evolution for more details.

[7]:
hv.Scatter((time_steps, abs(np.linalg.norm(eee[:,0], axis=1)-1)),
         vdims=hv.Dimension('y', label=r'$|\rho(t)-1|$',)
        )
[7]: