<jupyter_start><jupyter_text>Details on the pt_tempo module **For a description on how to use the most important functionality, please checkout the tutorials and the API documentation.**The following example code shows how to use most of the functionality of the `tempo.pt_tempo` module (in comparison to the `tempo.tempo` module. This code is *suplementary* to the documentation and also includes functionality that is only relevant to the inner workings of the TimeEvolvingMPO package.**Contents:*** A: Independent Spin Boson Model* B: TEMPO* C: Process Tensor  TEMPO* D: Analytic Solution* E: Plots<jupyter_code>import sys
sys.path.insert(0,'..')
import os
from time import time

os.environ['OPENBLAS_NUM_THREADS'] = '1'
os.environ['MKL_NUM_THREADS'] = '1'
os.environ['OMP_NUM_THREADS'] = '1'
os.environ['NUMEXPR_NUM_THREADS'] = '1'

import time_evolving_mpo as tempo
import numpy as np
import matplotlib.pyplot as plt
# %matplotlib notebook<jupyter_output><empty_output><jupyter_text>A: Independent Spin Boson Model<jupyter_code>Omega = 1.0
omega_cutoff = 3.0
alpha = 0.1
temperature = 0.0
start_time = 0.0
end_time = 10.0
initial_state = tempo.operators.spin_dm("y+")

system = tempo.System(0.0 * Omega * tempo.operators.sigma("x"))
correlations = tempo.PowerLawSD(alpha=alpha, 
                                zeta=3, 
                                cutoff=omega_cutoff, 
                                cutoff_type='exponential',
                                temperature=temperature)
bath = tempo.Bath(0.5 * tempo.operators.sigma("z"), correlations)
dt = 0.1 # 0.01
dkmax = 20 # 200
epsrel = 1.0e-6# 1.0e-7<jupyter_output><empty_output><jupyter_text>B: TEMPO<jupyter_code>tempo_parameters = tempo.TempoParameters(dt=dt, dkmax=dkmax, epsrel=epsrel)
tempo_sys = tempo.Tempo(system=system,
                        bath=bath,
                        parameters=tempo_parameters,
                        initial_state=initial_state,
                        start_time=start_time)
tempo_sys.compute(end_time=end_time, progress_type='bar')

dynamics = tempo_sys.get_dynamics()
t1, s1_y = dynamics.expectations(tempo.operators.sigma("y"), real=True)<jupyter_output>100.0%  100 of  100 [########################################] 00:00:07
Elapsed time: 7.2s<jupyter_text>C: Process Tensor  TEMPO<jupyter_code>pt_tempo_parameters = tempo.PtTempoParameters(dt=dt, dkmax=dkmax, epsrel=epsrel)
pt = tempo.pt_tempo_compute(bath=bath,
                            start_time=start_time,
                            end_time=end_time,
                            parameters=pt_tempo_parameters,
                            progress_type='bar')
pt.export("details_pt_tempo.processTensor",overwrite=True)
pt = tempo.import_process_tensor("details_pt_tempo.processTensor")

st = time()
state = pt.compute_final_state_from_system(system=system, initial_state=initial_state)
et = time()

print(et-st)
print(state)
st = time()
dyn = pt.compute_dynamics_from_system(system=system, initial_state=initial_state)
et = time()
print(et-st)
print(dyn)
t2, s2_y = dyn.expectations(tempo.operators.sigma("y"), real=True)<jupyter_output><empty_output><jupyter_text>D: Analytic Solution<jupyter_code>def analytic_solution(t):
    x = (t*omega_cutoff)**2
    phi = 2 * alpha * (1 + (x-1)/(x+1)**2)
    return np.exp(-phi)
sy_exact = analytic_solution(t1)<jupyter_output><empty_output><jupyter_text>E: Plots<jupyter_code>%matplotlib notebook
plt.plot(t1, s1_y, label=r'$\alpha=0.1$ tempo')
plt.plot(t2, s2_y, label=r'$\alpha=0.1$ pt-tempo', linestyle="dashed")
plt.plot(t1, sy_exact, label=r'$\alpha=0.1$ exact', linestyle="dotted", color="yellow")
plt.xlabel(r'$t\,\Omega$')
plt.ylabel(r'$<S_y>$')
plt.legend()
pt.get_bond_dimensions()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1320855614973262, 'fraction_numerical': 0.021122994652406416, 'mean_word_length': 4.089795918367347, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '225583', 'license': 'Apache-2.0', 'n_tokens_mistral': 1365, 'n_tokens_neox': 1281, 'n_words': 251, 'path': 'examples/details_pt_tempo.ipynb', 'repo_name': 'ebutler414/TimeEvolvingMPO', 'size': '3740'}