Skip to content

Commit 15ad695

Browse files
authored
Merge pull request #16 from PGelss/PauliMatrices
Pauli matrices
2 parents 3d3044e + 85bd0d1 commit 15ad695

20 files changed

Lines changed: 419 additions & 136 deletions

File tree

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = wave_train
3-
version = 1.0.10
3+
version = 1.0.11
44
author = Jerome Riedel, Patrick Gelß, Burkhard Schmidt
55
author_email = burkhard.schmidt@fu-berlin.de
66
description = Numerical quantum mechanics of chain-like systems based on tensor trains

test_scripts/Bath_Map_1/tdse_1.py

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
from wave_train.hamilton.bath_map_1 import Bath_Map_1
2+
from wave_train.dynamics.tdse import TDSE
3+
from wave_train.io.load import Load
4+
from wave_train.io.logging import TeeLogger
5+
from os.path import basename, splitext
6+
import numpy as np
7+
import matplotlib.pyplot as plt
8+
9+
def bath_map_1_tdse(batch_mode):
10+
# Detect name of this script file (without extension)
11+
base_name = basename(__file__)
12+
my_file = splitext(base_name)[0]
13+
14+
# logging instance: will be initialized with
15+
# class for logging to both console and logfile
16+
logger = None
17+
if not batch_mode:
18+
logger = TeeLogger(log_file=my_file + ".log")
19+
20+
# Set up the excitonic Hamiltonian for a chain
21+
hamilton = Bath_Map_1(
22+
n_site=50, # number of sites
23+
eta = 0.5, # coupling between TLS and first bath site
24+
s = 1, # type of spectral density function: s<1 sub-ohmic, s=1 ohmic, s>1 super-ohmic
25+
omega_c = 10, # cut-off frequency of spectral density function
26+
omega_0 = 1 # eigenfrequency of the TLS
27+
)
28+
29+
# Set up TT representation of the Hamiltonian
30+
hamilton.get_TT(
31+
n_basis=2, # size of electronic basis set
32+
qtt=False # using quantized TT format
33+
)
34+
35+
# Set up TDSE solver
36+
dynamics = TDSE(
37+
hamilton=hamilton, # choice of Hamiltonian, see above
38+
num_steps=10, # number of main time steps
39+
step_size=0.1, # size of main time steps
40+
sub_steps=1, # number of sub steps
41+
solver='vp', # can be 'se' (symmetrized Euler) or 'sm' (Strang-Marchuk splitting) or ...
42+
normalize=0, # whether|how to normalize the solution, can be 0|2
43+
max_rank=5, # max rank of solution
44+
repeats=15, # number of sweeps (implicit ODE solvers only!)
45+
threshold=1e-8, # threshold in ALS decomposition
46+
save_file=my_file+'.pic', # if not None, generated data will be saved to this file
47+
load_file=None, # if not None, reference data will be loaded from this file
48+
compare=None # How to do the comparison with reference data
49+
)
50+
51+
# Set up initial state
52+
dynamics.fundamental(list(np.eye(hamilton.n_site)[0,:])) # fundamental excitation near center of chain
53+
# dynamics.gaussian()
54+
# dynamics.sec_hyp(w_0=0.2)
55+
56+
# Batch mode
57+
if batch_mode:
58+
dynamics.solve() # Solve TDSE *without* visualization
59+
60+
# Interactive mode: Setup animated visualization
61+
else:
62+
from wave_train.graphics.factory import VisualTDSE
63+
graphics = VisualTDSE(
64+
dynamics=dynamics, # choice of dynamics (EoM), see above
65+
plot_type='Populations', # select your favorite plot type
66+
plot_expect=True, # toggle plotting of expectation values
67+
figure_pos=(100, 50), # specifying position (x,y) of upper left of figure [in pixels]
68+
figure_size=(1050, 450), # specifying size (w,h) of figure [in pixels]
69+
image_file=my_file+'.png', # if not None, image (last frame) will be written to this file
70+
movie_file=my_file+'.mp4', # if not None, animation will be written to this file
71+
snapshots=False, # save each snapshot
72+
frame_rate=1, # frames per second in mp4 animation file
73+
plot_style={}, # additional plot style information
74+
).create()
75+
graphics.solve() # Solve TDSE *with* visualization
76+
77+
78+
if __name__ == '__main__':
79+
bath_map_1_tdse(batch_mode=False)
80+
81+
82+
dynamics = Load(
83+
file_name='tdse_1',
84+
file_type = 'pic'
85+
)
86+
#print(dynamics.qu_numbr)
87+
plt.figure()
88+
for i in range(1,100,10):
89+
plt.plot(dynamics.qu_numbr[:,i])
90+
plt.show()
91+
92+
#print(dynamics.qu_sig_1)
93+
94+
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from wave_train.hamilton.coupled import Coupled
1+
from wave_train.hamilton.exc_pho_coupling import Exc_Pho_Coupling
22
from wave_train.dynamics.qcmd import QCMD
33
from wave_train.io.logging import TeeLogger
44
from os.path import basename, splitext
@@ -15,7 +15,7 @@ def coupled_qcmd(batch_mode):
1515
logger = TeeLogger(log_file=my_file + ".log")
1616

1717
# Set up the coupled exciton-phonon Hamiltonian for a chain
18-
hamilton = Coupled(
18+
hamilton = Exc_Pho_Coupling(
1919
n_site=15, # number of sites
2020
periodic=False, # periodic boundary conditions
2121
homogen=True, # homogeneous chain/ring
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from wave_train.hamilton.coupled import Coupled
1+
from wave_train.hamilton.exc_pho_coupling import Exc_Pho_Coupling
22
from wave_train.dynamics.qcmd import QCMD
33
from wave_train.io.logging import TeeLogger
44
from os.path import basename, splitext
@@ -17,7 +17,7 @@ def coupled_qcmd(batch_mode):
1717
# Define properties of chain/ring system
1818

1919
# Set up the coupled exciton-phonon Hamiltonian for a chain
20-
hamilton = Coupled(
20+
hamilton = Exc_Pho_Coupling(
2121
n_site=15, # number of sites
2222
periodic=False, # periodic boundary conditions
2323
homogen=True, # Homogeneous chain/ring
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from wave_train.hamilton.coupled import Coupled
1+
from wave_train.hamilton.exc_pho_coupling import Exc_Pho_Coupling
22
from wave_train.dynamics.qcmd import QCMD
33
from wave_train.io.logging import TeeLogger
44
from os.path import basename, splitext
@@ -15,7 +15,7 @@ def coupled_qcmd(batch_mode):
1515
logger = TeeLogger(log_file=my_file + ".log")
1616

1717
# Set up the coupled exciton-phonon Hamiltonian for a chain
18-
hamilton = Coupled(
18+
hamilton = Exc_Pho_Coupling(
1919
n_site=41, # number of sites
2020
periodic=True, # periodic boundary conditions
2121
homogen=True, # Homogeneous chain/ring
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from wave_train.hamilton.coupled import Coupled
1+
from wave_train.hamilton.exc_pho_coupling import Exc_Pho_Coupling
22
from wave_train.dynamics.qcmd import QCMD
33
from wave_train.io.logging import TeeLogger
44
from os.path import basename, splitext
@@ -15,7 +15,7 @@ def coupled_qcmd(batch_mode):
1515
logger = TeeLogger(log_file=my_file + ".log")
1616

1717
# Set up the coupled exciton-phonon Hamiltonian for a chain
18-
hamilton = Coupled(
18+
hamilton = Exc_Pho_Coupling(
1919
n_site=41, # number of sites
2020
periodic=False, # periodic boundary conditions
2121
homogen=True, # Homogeneous chain/ring
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from wave_train.hamilton.coupled import Coupled
1+
from wave_train.hamilton.exc_pho_coupling import Exc_Pho_Coupling
22
from wave_train.dynamics.tdse import TDSE
33
from wave_train.io.logging import TeeLogger
44
from os.path import basename, splitext
@@ -15,7 +15,7 @@ def coupled_tdse(batch_mode):
1515
logger = TeeLogger(log_file=my_file + ".log")
1616

1717
# Set up the coupled exciton-phonon Hamiltonian for a chain
18-
hamilton = Coupled(
18+
hamilton = Exc_Pho_Coupling(
1919
n_site=15, # number of sites
2020
periodic=False, # periodic boundary conditions
2121
homogen=True, # homogeneous chain/ring

test_scripts/Coupled/tdse_qe_1.py renamed to test_scripts/Exc_Pho_Coupling/tdse_qe_1.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from wave_train.hamilton.coupled import Coupled
1+
from wave_train.hamilton.exc_pho_coupling import Exc_Pho_Coupling
22
from wave_train.dynamics.tdse import TDSE
33
from wave_train.io.logging import TeeLogger
44
from os.path import basename, splitext
@@ -15,7 +15,7 @@ def coupled_qe_1(batch_mode):
1515
logger = TeeLogger(log_file=my_file + ".log")
1616

1717
# Set up the coupled exciton-phonon Hamiltonian for a chain
18-
hamilton = Coupled(
18+
hamilton = Exc_Pho_Coupling(
1919
n_site=3, # number of sites
2020
periodic=False, # periodic boundary conditions
2121
homogen=True, # homogeneous chain/ring
@@ -39,7 +39,7 @@ def coupled_qe_1(batch_mode):
3939

4040
# Set up TDSE solver
4141
dynamics = TDSE(
42-
hamilton=hamilton, # choice of Hamiltonian, see above
42+
hamilton=hamilton, # choice of Hamiltonian, see above
4343
num_steps=50, # number of main time steps
4444
step_size=20, # size of main time steps
4545
sub_steps=None, # dummy

test_scripts/Coupled/tdse_qe_2.py renamed to test_scripts/Exc_Pho_Coupling/tdse_qe_2.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from wave_train.hamilton.coupled import Coupled
1+
from wave_train.hamilton.exc_pho_coupling import Exc_Pho_Coupling
22
from wave_train.dynamics.tdse import TDSE
33
from wave_train.io.logging import TeeLogger
44
from os.path import basename, splitext
@@ -15,7 +15,7 @@ def coupled_qe_2(batch_mode):
1515
logger = TeeLogger(log_file=my_file + ".log")
1616

1717
# Set up the coupled exciton-phonon Hamiltonian for a chain
18-
hamilton = Coupled(
18+
hamilton = Exc_Pho_Coupling(
1919
n_site=3, # number of sites
2020
periodic=False, # periodic boundary conditions
2121
homogen=True, # homogeneous chain/ring
@@ -39,7 +39,7 @@ def coupled_qe_2(batch_mode):
3939

4040
# Set up TDSE solver
4141
dynamics = TDSE(
42-
hamilton=hamilton, # choice of Hamiltonian, see above
42+
hamilton=hamilton, # choice of Hamiltonian, see above
4343
num_steps=50, # number of main time steps
4444
step_size=20, # size of main time steps
4545
sub_steps=20, # number of sub steps

test_scripts/Coupled/tdse_qe_3.py renamed to test_scripts/Exc_Pho_Coupling/tdse_qe_3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from wave_train.hamilton.coupled import Coupled
1+
from wave_train.hamilton.exc_pho_coupling import Exc_Pho_Coupling
22
from wave_train.dynamics.qcmd import QCMD
33
from wave_train.io.logging import TeeLogger
44
from os.path import basename, splitext
@@ -15,7 +15,7 @@ def coupled_qe_3(batch_mode):
1515
logger = TeeLogger(log_file=my_file + ".log")
1616

1717
# Set up the coupled exciton-phonon Hamiltonian for a chain
18-
hamilton = Coupled(
18+
hamilton = Exc_Pho_Coupling(
1919
n_site=3, # number of sites
2020
periodic=False, # periodic boundary conditions
2121
homogen=True, # homogeneous chain/ring

0 commit comments

Comments
 (0)