2022-01-17 17:40:33 +01:00
|
|
|
|
#+PROPERTY: header-args :session 01_zero_temp :kernel python :pandoc t :async yes
|
2021-11-05 10:19:19 +01:00
|
|
|
|
|
|
|
|
|
* Configuration and Setup
|
2022-01-17 17:40:33 +01:00
|
|
|
|
This will be tangled into the [[file:config.py][config file]] that can be used with the HOPS cli.
|
|
|
|
|
#+begin_src jupyter-python :results none :tangle config.py
|
|
|
|
|
from hops.core.hierarchy_parameters import HIParams, HiP, IntP, SysP, ResultType
|
|
|
|
|
from hops.core.hierarchyLib import HI
|
|
|
|
|
from hops.util.bcf_fits import get_ohm_g_w
|
|
|
|
|
from hops.util.truncation_schemes import TruncationScheme_Power_multi
|
|
|
|
|
import hops.util.bcf
|
|
|
|
|
import numpy as np
|
|
|
|
|
import hops.util.matrixLib as ml
|
|
|
|
|
from stocproc import StocProc_FFT
|
|
|
|
|
|
2022-03-15 11:25:30 +01:00
|
|
|
|
wc = 2
|
2022-01-17 17:40:33 +01:00
|
|
|
|
s = 1
|
|
|
|
|
|
|
|
|
|
# The BCF fit
|
2022-03-15 11:25:30 +01:00
|
|
|
|
bcf_terms = 5
|
2022-01-17 17:40:33 +01:00
|
|
|
|
g, w = get_ohm_g_w(bcf_terms, s, wc)
|
|
|
|
|
|
|
|
|
|
integration = IntP(t_max=30, t_steps=int(30 // 0.01))
|
|
|
|
|
system = SysP(
|
|
|
|
|
H_sys=0.5 * np.array([[-1, 0], [0, 1]]),
|
|
|
|
|
L=0.5 * np.array([[0, 1], [1, 0]]),
|
|
|
|
|
psi0=np.array([0, 1]),
|
|
|
|
|
g=g,
|
|
|
|
|
w=w,
|
2022-03-15 11:25:30 +01:00
|
|
|
|
bcf_scale=0.5,
|
2022-01-17 17:40:33 +01:00
|
|
|
|
T=0,
|
|
|
|
|
)
|
2021-11-05 10:19:19 +01:00
|
|
|
|
|
2022-01-17 17:40:33 +01:00
|
|
|
|
params = HIParams(
|
|
|
|
|
SysP=system,
|
|
|
|
|
IntP=integration,
|
|
|
|
|
HiP=HiP(
|
|
|
|
|
nonlinear=True,
|
|
|
|
|
normalized_by_hand=True,
|
|
|
|
|
result_type=ResultType.ZEROTH_AND_FIRST_ORDER,
|
|
|
|
|
truncation_scheme=TruncationScheme_Power_multi.from_g_w(
|
2022-03-15 11:25:30 +01:00
|
|
|
|
g=.5 * g, w=w, p=1, q=0.5, kfac=1.7
|
2022-01-17 17:40:33 +01:00
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Eta=StocProc_FFT(
|
|
|
|
|
spectral_density=hops.util.bcf.OhmicSD_zeroTemp(
|
|
|
|
|
s,
|
|
|
|
|
1,
|
|
|
|
|
wc,
|
|
|
|
|
),
|
|
|
|
|
alpha=hops.util.bcf.OhmicBCF_zeroTemp(
|
|
|
|
|
s,
|
|
|
|
|
1,
|
|
|
|
|
wc,
|
|
|
|
|
),
|
|
|
|
|
t_max=integration.t_max,
|
2022-03-15 11:25:30 +01:00
|
|
|
|
intgr_tol=1e-5,
|
|
|
|
|
intpl_tol=1e-5,
|
2022-01-17 17:40:33 +01:00
|
|
|
|
negative_frequencies=False,
|
|
|
|
|
),
|
|
|
|
|
EtaTherm=None,
|
|
|
|
|
)
|
2021-11-05 10:19:19 +01:00
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
* Hops Integration
|
|
|
|
|
We can use multiple avenues.
|
|
|
|
|
|
|
|
|
|
** Local Integration
|
|
|
|
|
#+begin_src vterm :term-name integration
|
2022-01-17 17:40:33 +01:00
|
|
|
|
hi 500 integrate
|
2021-11-05 10:19:19 +01:00
|
|
|
|
#+end_src
|
|
|
|
|
|
2022-01-17 17:40:33 +01:00
|
|
|
|
#+RESULTS:
|
2022-03-16 11:27:53 +01:00
|
|
|
|
:RESULTS:
|
|
|
|
|
Linux ArLeenUX 5.16.8-zen1 x86_64
|
|
|
|
|
15:57:39 up 1 day 5:47, 1 user, load average: 1.55, 1.58, 1.91
|
|
|
|
|
impure ~/D/P/U/m/m/p/e/01_zero_temperature hi 500 integrate
|
|
|
|
|
Loading the configuration from config.py. This might take a while... -
|
|
|
|
|
:END:
|
2021-11-05 10:19:19 +01:00
|
|
|
|
|
|
|
|
|
And there we go. It is better to run the above command in a
|
|
|
|
|
vterm-session.
|
|
|
|
|
|
|
|
|
|
** Remote/Distributed Integration
|
|
|
|
|
We start the server locally.
|
|
|
|
|
#+begin_src vterm :term-name local-server
|
2022-01-17 17:40:33 +01:00
|
|
|
|
hi 1000 start-server
|
2021-11-05 10:19:19 +01:00
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+RESULTS:
|
|
|
|
|
:RESULTS:
|
2022-01-17 17:40:33 +01:00
|
|
|
|
Linux ArLeenUX 5.15.11-zen1 x86_64
|
|
|
|
|
16:34:02 up 2 days 19:58, 1 user, load average: 1.08, 1.67, 2.52
|
|
|
|
|
impure ~/D/P/U/m/m/p/e/01_zero_temperature hi 1000 start-server
|
|
|
|
|
Loading the configuration from config.py. This might take a while... /
|
|
|
|
|
JobManager started on ArLeenUX:42524 (bytearray(b'hierarchy'))
|
|
|
|
|
[TET-00:12:05--[43.6c/min]-TTG-0.00ms-------------------------100%-------------------------ETA-20220117_16:46:11-ORT-00:12:05]
|
|
|
|
|
res_q #0 14.84GB/s 10.51TB|rem.:0, done:500, failed:0, prog.:0
|
2021-11-05 10:19:19 +01:00
|
|
|
|
|
|
|
|
|
############## in JM SERVER EXIT
|
|
|
|
|
|
|
|
|
|
|
2022-01-17 17:40:33 +01:00
|
|
|
|
HIServer start at 2022-01-17 16:34:05.075876 | runtime 7.280e+02s
|
|
|
|
|
HIServer total number of jobs : 500
|
|
|
|
|
| processed : 500
|
|
|
|
|
| succeeded : 500
|
|
|
|
|
| failed : 0
|
|
|
|
|
| timing in sec: min 1.386e+01 | max 4.145e+01 | avr 2.478e+01
|
|
|
|
|
| not processed : 0
|
|
|
|
|
| queried : 0
|
|
|
|
|
| not queried yet : 0
|
2021-11-05 10:19:19 +01:00
|
|
|
|
:END:
|
|
|
|
|
|
|
|
|
|
And jack in with a remote client. In this case my box at home.
|
|
|
|
|
|
2022-01-17 17:40:33 +01:00
|
|
|
|
** Client
|
|
|
|
|
Starting a client is trivial.
|
2021-11-11 16:10:25 +01:00
|
|
|
|
|
2022-01-17 17:40:33 +01:00
|
|
|
|
#+begin_src vterm :term-name local-client
|
|
|
|
|
client localhost
|
2021-11-11 16:10:25 +01:00
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+RESULTS:
|
2022-01-17 17:40:33 +01:00
|
|
|
|
:RESULTS:
|
2022-03-15 11:25:30 +01:00
|
|
|
|
Linux ArLeenUX 5.16.8-zen1 x86_64
|
|
|
|
|
16:06:00 up 5:55, 1 user, load average: 1.29, 0.91, 1.18
|
2022-01-17 17:40:33 +01:00
|
|
|
|
impure ~/D/P/U/m/m/p/e/01_zero_temperature client localhost
|
2022-03-15 11:25:30 +01:00
|
|
|
|
connection to (('localhost', 42524), 'hierarchy') could not be established due to '<class 'ConnectionRefusedError'
|
|
|
|
|
>'
|
|
|
|
|
File "/nix/store/xyw00clxkmn0hgfw4lr7plyn61clhxyy-python3-3.9.9-env/lib/python3.9/site-packages/jobmanager/jobmana
|
|
|
|
|
ger.py", line 343, in connect
|
|
|
|
|
self.manager_objects = self.create_manager_objects()
|
|
|
|
|
connection refused error
|
|
|
|
|
FAILED to connect to (('localhost', 42524), 'hierarchy')
|
|
|
|
|
Traceback (most recent call last):
|
|
|
|
|
File "/nix/store/cphpkvyd3ni0b3b9nfvbnh1xc3cqc4i2-python3.9-hops-1.0/bin/.client-wrapped", line 9, in <module>
|
|
|
|
|
sys.exit(main())
|
|
|
|
|
File "/nix/store/xyw00clxkmn0hgfw4lr7plyn61clhxyy-python3-3.9.9-env/lib/python3.9/site-packages/cli/client.py",
|
|
|
|
|
line 86, in main
|
|
|
|
|
typer.run(start_client)
|
|
|
|
|
File "/nix/store/xyw00clxkmn0hgfw4lr7plyn61clhxyy-python3-3.9.9-env/lib/python3.9/site-packages/typer/main.py",
|
|
|
|
|
line 864, in run
|
|
|
|
|
app()
|
|
|
|
|
File "/nix/store/xyw00clxkmn0hgfw4lr7plyn61clhxyy-python3-3.9.9-env/lib/python3.9/site-packages/typer/main.py",
|
|
|
|
|
line 214, in __call__
|
|
|
|
|
return get_command(self)(*args, **kwargs)
|
|
|
|
|
File "/nix/store/xyw00clxkmn0hgfw4lr7plyn61clhxyy-python3-3.9.9-env/lib/python3.9/site-packages/click/core.py",
|
|
|
|
|
line 1128, in __call__
|
|
|
|
|
return self.main(*args, **kwargs)
|
|
|
|
|
File "/nix/store/xyw00clxkmn0hgfw4lr7plyn61clhxyy-python3-3.9.9-env/lib/python3.9/site-packages/click/core.py",
|
|
|
|
|
line 1053, in main
|
|
|
|
|
rv = self.invoke(ctx)
|
|
|
|
|
File "/nix/store/xyw00clxkmn0hgfw4lr7plyn61clhxyy-python3-3.9.9-env/lib/python3.9/site-packages/click/core.py",
|
|
|
|
|
line 1395, in invoke
|
|
|
|
|
return ctx.invoke(self.callback, **ctx.params)
|
|
|
|
|
File "/nix/store/xyw00clxkmn0hgfw4lr7plyn61clhxyy-python3-3.9.9-env/lib/python3.9/site-packages/click/core.py",
|
|
|
|
|
line 754, in invoke
|
|
|
|
|
return __callback(*args, **kwargs)
|
|
|
|
|
File "/nix/store/xyw00clxkmn0hgfw4lr7plyn61clhxyy-python3-3.9.9-env/lib/python3.9/site-packages/typer/main.py",
|
|
|
|
|
line 500, in wrapper
|
|
|
|
|
return callback(**use_params) # type: ignore
|
|
|
|
|
File "/nix/store/xyw00clxkmn0hgfw4lr7plyn61clhxyy-python3-3.9.9-env/lib/python3.9/site-packages/cli/client.py",
|
|
|
|
|
line 82, in start_client
|
|
|
|
|
cl.start()
|
|
|
|
|
File "/nix/store/xyw00clxkmn0hgfw4lr7plyn61clhxyy-python3-3.9.9-env/lib/python3.9/site-packages/jobmanager/jobma
|
|
|
|
|
nager.py", line 657, in start
|
|
|
|
|
raise JMConnectionError("Can not start Client with no connection to server (shared objetcs are not available)"
|
|
|
|
|
)
|
|
|
|
|
ConnectionError: Can not start Client with no connection to server (shared objetcs are not available)
|
2022-01-17 17:40:33 +01:00
|
|
|
|
:END:
|
2021-11-11 16:10:25 +01:00
|
|
|
|
|
2022-01-17 17:40:33 +01:00
|
|
|
|
* Using the Data
|
|
|
|
|
** Jupyter Setup
|
|
|
|
|
#+begin_src jupyter-python :results none
|
|
|
|
|
import matplotlib.pyplot as plt
|
|
|
|
|
import numpy as np
|
|
|
|
|
import utilities as ut
|
2022-03-15 11:25:30 +01:00
|
|
|
|
import figsaver as fs
|
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
Let's export some infos about the model to TeX.
|
|
|
|
|
#+begin_src jupyter-python
|
|
|
|
|
fs.tex_value(system.bcf_scale, prec=1, save="bcf_scale", prefix="η="), fs.tex_value(
|
|
|
|
|
wc, prec=0, save="cutoff_freq", prefix="ω_c="
|
|
|
|
|
)
|
2021-11-11 16:10:25 +01:00
|
|
|
|
#+end_src
|
|
|
|
|
|
2022-03-15 11:25:30 +01:00
|
|
|
|
#+RESULTS:
|
2022-03-28 14:28:41 +02:00
|
|
|
|
:RESULTS:
|
|
|
|
|
| \(η=0.5\) | \(ω_c=2\) |
|
2022-03-16 11:27:53 +01:00
|
|
|
|
| \(η=0.5\) | \(ω_c=2\) |
|
2022-03-28 14:28:41 +02:00
|
|
|
|
:END:
|
2022-03-15 11:25:30 +01:00
|
|
|
|
|
2021-11-11 16:10:25 +01:00
|
|
|
|
|
2022-01-17 17:40:33 +01:00
|
|
|
|
** Load the Data
|
|
|
|
|
#+begin_src jupyter-python :results none
|
|
|
|
|
from hopsflow import hopsflow, util
|
2022-03-16 11:27:53 +01:00
|
|
|
|
from hops.core.hierarchyData import HIMetaData
|
2021-11-11 16:10:25 +01:00
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
Now we read the trajectory data.
|
|
|
|
|
#+begin_src jupyter-python
|
|
|
|
|
class result:
|
2022-03-16 11:27:53 +01:00
|
|
|
|
hd = HIMetaData("data", ".").get_HIData(params, read_only=True)
|
|
|
|
|
N = 8000
|
|
|
|
|
τ = hd.get_time()
|
|
|
|
|
ψ_1 = hd.aux_states
|
|
|
|
|
ψ = hd.stoc_traj
|
|
|
|
|
|
|
|
|
|
|
2022-03-15 11:25:30 +01:00
|
|
|
|
fs.tex_value(result.N, prefix="N=", save="samples")
|
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+RESULTS:
|
2022-03-28 14:28:41 +02:00
|
|
|
|
:RESULTS:
|
2022-03-16 11:27:53 +01:00
|
|
|
|
: \(N=8000\)
|
2022-03-28 14:28:41 +02:00
|
|
|
|
: \(N=8000\)
|
|
|
|
|
:END:
|
2022-03-15 11:25:30 +01:00
|
|
|
|
|
|
|
|
|
#+begin_src jupyter-python
|
|
|
|
|
with fs.hiro_style():
|
|
|
|
|
ts = np.linspace(0, 4, 1000)
|
|
|
|
|
fs.plot_complex(ts, hops.util.bcf.OhmicBCF_zeroTemp(
|
|
|
|
|
s,
|
|
|
|
|
1,
|
|
|
|
|
wc,
|
|
|
|
|
)(ts))
|
|
|
|
|
plt.title(r"$α$")
|
|
|
|
|
plt.xlabel(r"$τ$")
|
|
|
|
|
plt.title(rf"$J=η Γ(s+1) / (1 + iω_c τ)^{{s+1}}$")
|
|
|
|
|
plt.text(1, 1, rf"$ω_c={wc}$, $s={s}$")
|
|
|
|
|
plt.gcf().set_size_inches(fs.get_figsize(200, 1, .8))
|
|
|
|
|
fs.export_fig("ohmic_bcf")
|
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+RESULTS:
|
2022-03-28 14:28:41 +02:00
|
|
|
|
:RESULTS:
|
|
|
|
|
[[file:./.ob-jupyter/e8263ad2e4b1c1613215313a7dfbc6ed216c2c95.svg]]
|
|
|
|
|
[[file:./.ob-jupyter/9a4de25aea7ef4a4260362c4f6a95fe799468df0.svg]]
|
|
|
|
|
:END:
|
2022-03-15 11:25:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#+begin_src jupyter-python
|
|
|
|
|
with fs.hiro_style():
|
|
|
|
|
ωs = np.linspace(0, 50, 1000)
|
|
|
|
|
|
|
|
|
|
plt.plot(ωs, hops.util.bcf.OhmicSD_zeroTemp(
|
|
|
|
|
s,
|
|
|
|
|
1,
|
|
|
|
|
wc,
|
|
|
|
|
)(ωs))
|
|
|
|
|
plt.gcf().set_size_inches(fs.get_figsize(200, 1, .8))
|
|
|
|
|
plt.title(rf"$J=η e^{{-ω/ω_c}} ω^s$")
|
|
|
|
|
plt.text(25, .5, rf"$ω_c={wc}$, $s={s}$")
|
|
|
|
|
plt.xlabel(r"$ω$")
|
|
|
|
|
fs.export_fig("ohmic_sd")
|
2021-11-11 16:10:25 +01:00
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+RESULTS:
|
2022-03-28 14:28:41 +02:00
|
|
|
|
:RESULTS:
|
|
|
|
|
[[file:./.ob-jupyter/e012b8343aea466de837bd13040e5ff970d3fe73.svg]]
|
|
|
|
|
[[file:./.ob-jupyter/6239e2de72f9def50629c25f04d4a00aab9544f3.svg]]
|
|
|
|
|
:END:
|
2021-11-11 16:10:25 +01:00
|
|
|
|
|
|
|
|
|
** Calculate System Energy
|
|
|
|
|
Simple sanity check.
|
|
|
|
|
#+begin_src jupyter-python
|
2022-01-17 17:40:33 +01:00
|
|
|
|
_, e_sys, σ_e_sys = util.operator_expectation_ensemble(
|
|
|
|
|
iter(result.ψ),
|
|
|
|
|
system.H_sys,
|
|
|
|
|
result.N,
|
|
|
|
|
params.HiP.nonlinear,
|
|
|
|
|
save="./results/energy.npy"
|
|
|
|
|
)
|
|
|
|
|
|
2022-03-15 11:25:30 +01:00
|
|
|
|
with fs.hiro_style():
|
|
|
|
|
plt.gcf().set_size_inches(fs.get_figsize(239, 1, .8))
|
|
|
|
|
plt.errorbar(result.τ, e_sys.real, yerr=σ_e_sys.real, ecolor="yellow")
|
|
|
|
|
plt.ylabel(r"$\langle H_S\rangle$")
|
|
|
|
|
plt.xlabel(r"$τ$")
|
|
|
|
|
|
|
|
|
|
fs.export_fig("system_energy")
|
2021-11-11 16:10:25 +01:00
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+RESULTS:
|
2022-03-28 14:28:41 +02:00
|
|
|
|
:RESULTS:
|
|
|
|
|
[[file:./.ob-jupyter/56225cef8d7c7e496366bed4550d164fea3577c0.svg]]
|
|
|
|
|
[[file:./.ob-jupyter/605e229b808be7ecd7e77051097440946861864d.svg]]
|
|
|
|
|
:END:
|
2021-11-11 16:10:25 +01:00
|
|
|
|
|
|
|
|
|
The energy bleeds out of the system. We don't reach the steady state
|
|
|
|
|
yet. Also we don't loose all the energy.
|
|
|
|
|
|
|
|
|
|
The energy eigenvalues of the system are.
|
|
|
|
|
#+begin_src jupyter-python
|
2022-01-17 17:40:33 +01:00
|
|
|
|
np.linalg.eig(system.H_sys)[0]
|
2021-11-11 16:10:25 +01:00
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+RESULTS:
|
2022-03-28 14:28:41 +02:00
|
|
|
|
:RESULTS:
|
2021-11-11 16:10:25 +01:00
|
|
|
|
: array([-0.5, 0.5])
|
2022-03-28 14:28:41 +02:00
|
|
|
|
: array([-0.5, 0.5])
|
|
|
|
|
:END:
|
2021-11-11 16:10:25 +01:00
|
|
|
|
|
|
|
|
|
The begin and and values of the system energy expectation are.
|
|
|
|
|
#+begin_src jupyter-python
|
2022-01-17 17:40:33 +01:00
|
|
|
|
e_sys[0].real, e_sys[-1].real
|
2021-11-11 16:10:25 +01:00
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+RESULTS:
|
2022-03-28 14:28:41 +02:00
|
|
|
|
:RESULTS:
|
2022-03-16 11:27:53 +01:00
|
|
|
|
| 0.5 | -0.47523035186448653 |
|
2022-03-28 14:28:41 +02:00
|
|
|
|
| 0.5 | -0.47523035186448653 |
|
|
|
|
|
:END:
|
2021-11-11 16:10:25 +01:00
|
|
|
|
|
|
|
|
|
And the total energy lost is:
|
|
|
|
|
#+begin_src jupyter-python
|
2022-01-17 17:40:33 +01:00
|
|
|
|
e_sys[0].real - e_sys[-1].real
|
2021-11-11 16:10:25 +01:00
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+RESULTS:
|
2022-03-28 14:28:41 +02:00
|
|
|
|
:RESULTS:
|
2022-03-16 11:27:53 +01:00
|
|
|
|
: 0.9752303518644865
|
2022-03-28 14:28:41 +02:00
|
|
|
|
: 0.9752303518644865
|
|
|
|
|
:END:
|
2021-11-11 16:10:25 +01:00
|
|
|
|
|
|
|
|
|
We do start in the state.
|
|
|
|
|
#+begin_src jupyter-python
|
2022-01-17 17:40:33 +01:00
|
|
|
|
system.psi0
|
2021-11-11 16:10:25 +01:00
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+RESULTS:
|
2022-03-28 14:28:41 +02:00
|
|
|
|
:RESULTS:
|
2021-11-11 16:10:25 +01:00
|
|
|
|
: array([0, 1])
|
2022-03-28 14:28:41 +02:00
|
|
|
|
: array([0, 1])
|
|
|
|
|
:END:
|
2021-11-11 16:10:25 +01:00
|
|
|
|
|
|
|
|
|
** Calculate the Heat Flow
|
|
|
|
|
Now let's calculate the heatflow. In this simple case it is engouh to
|
|
|
|
|
know the first hierarchy states.
|
|
|
|
|
|
|
|
|
|
First we set up some parameter objects for the alogrithm.
|
2022-01-17 17:40:33 +01:00
|
|
|
|
#+begin_src jupyter-python :results none
|
2021-11-11 16:10:25 +01:00
|
|
|
|
hf_system = hopsflow.SystemParams(
|
2022-01-17 17:40:33 +01:00
|
|
|
|
system.L, system.g, system.w, system.bcf_scale, params.HiP.nonlinear
|
2021-11-11 16:10:25 +01:00
|
|
|
|
)
|
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Now we can apply our tooling to one trajectory for testing.
|
|
|
|
|
#+begin_src jupyter-python
|
|
|
|
|
hf_sample_run = hopsflow.HOPSRun(result.ψ[0], result.ψ_1[0], hf_system)
|
|
|
|
|
first_flow = hopsflow.flow_trajectory_coupling(hf_sample_run, hf_system)
|
2022-03-15 11:25:30 +01:00
|
|
|
|
with fs.hiro_style():
|
2022-01-17 17:40:33 +01:00
|
|
|
|
plt.plot(result.τ, first_flow)
|
2021-11-11 16:10:25 +01:00
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+RESULTS:
|
2022-03-28 14:28:41 +02:00
|
|
|
|
:RESULTS:
|
|
|
|
|
[[file:./.ob-jupyter/839bee0359e74368e15d081004c52a4ade7f0a2b.svg]]
|
|
|
|
|
[[file:./.ob-jupyter/eeb3f8a5e4b6b819e982709971ca1cc53b191b48.svg]]
|
|
|
|
|
:END:
|
2021-11-11 16:10:25 +01:00
|
|
|
|
|
|
|
|
|
And now for all trajectories.
|
|
|
|
|
#+begin_src jupyter-python
|
2022-01-17 17:40:33 +01:00
|
|
|
|
full_flow = hopsflow.heat_flow_ensemble(
|
2022-03-16 11:27:53 +01:00
|
|
|
|
result.ψ, result.ψ_1, hf_system, result.N, every=result.N // 2, save="results/flow_1.npy"
|
2022-01-17 17:40:33 +01:00
|
|
|
|
)
|
|
|
|
|
|
2022-03-15 11:25:30 +01:00
|
|
|
|
with fs.hiro_style():
|
|
|
|
|
fig, ax = fs.plot_convergence(result.τ, full_flow, transform=lambda y: -y)
|
|
|
|
|
fig.set_size_inches(fs.get_figsize(239, 1, .8))
|
2022-01-17 17:40:33 +01:00
|
|
|
|
ax.legend()
|
2022-03-15 11:25:30 +01:00
|
|
|
|
ax.set_xlabel("$τ$")
|
|
|
|
|
ax.set_ylabel("$-J$")
|
|
|
|
|
fs.export_fig("flow", fig)
|
2021-11-11 16:10:25 +01:00
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+RESULTS:
|
2022-03-28 14:28:41 +02:00
|
|
|
|
:RESULTS:
|
|
|
|
|
[[file:./.ob-jupyter/d9d54851709c858057226b9308f61a373df1b095.svg]]
|
|
|
|
|
[[file:./.ob-jupyter/a39c40d4d098cbbd255acbc20dd995b8606ed55d.svg]]
|
|
|
|
|
:END:
|
2021-11-11 16:10:25 +01:00
|
|
|
|
|
|
|
|
|
We can integrate the energy change in the bath:
|
|
|
|
|
#+begin_src jupyter-python
|
2022-03-16 11:27:53 +01:00
|
|
|
|
import scipy.integrate
|
|
|
|
|
|
|
|
|
|
e_bath = np.array([0] + [
|
|
|
|
|
scipy.integrate.simpson(-full_flow[-1][1][:i], result.τ[:i])
|
|
|
|
|
for i in range(1, len(result.τ))
|
|
|
|
|
])
|
2021-11-11 16:10:25 +01:00
|
|
|
|
plt.plot(result.τ, e_bath)
|
2022-03-16 11:27:53 +01:00
|
|
|
|
σ_e_bath = np.sqrt(np.array([0] + [
|
|
|
|
|
scipy.integrate.simpson(full_flow[-1][2][:i]**2, result.τ[:i])
|
|
|
|
|
for i in range(1, len(result.τ))
|
|
|
|
|
])).real
|
|
|
|
|
plt.errorbar(result.τ, e_bath, yerr=σ_e_bath, ecolor="yellow")
|
2021-11-11 16:10:25 +01:00
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+RESULTS:
|
|
|
|
|
:RESULTS:
|
2022-03-16 11:27:53 +01:00
|
|
|
|
: <ErrorbarContainer object of 3 artists>
|
2022-03-28 14:28:41 +02:00
|
|
|
|
[[file:./.ob-jupyter/f41b325da0fb83184132c9153a7aa644b1e8acbf.svg]]
|
|
|
|
|
: <ErrorbarContainer object of 3 artists>
|
|
|
|
|
[[file:./.ob-jupyter/7268d10b9985d46cfc7c37b862b40c0bf5c0b7fb.svg]]
|
2021-11-11 16:10:25 +01:00
|
|
|
|
:END:
|
2022-03-21 15:12:49 +01:00
|
|
|
|
** Initial Slip
|
|
|
|
|
|
|
|
|
|
#+begin_src jupyter-python
|
|
|
|
|
bcf_im = hops.util.bcf.OhmicBCF_zeroTemp(
|
|
|
|
|
s,
|
|
|
|
|
1,
|
|
|
|
|
wc,
|
|
|
|
|
)(result.τ).imag
|
|
|
|
|
plt.plot(result.τ, bcf_im / np.abs(bcf_im).max())
|
|
|
|
|
plt.plot(result.τ, first_flow / np.abs(first_flow).max())
|
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+RESULTS:
|
|
|
|
|
:RESULTS:
|
2022-03-28 14:28:41 +02:00
|
|
|
|
| <matplotlib.lines.Line2D | at | 0x7f055991c700> |
|
|
|
|
|
[[file:./.ob-jupyter/0110541064f53964a9c95e377894ff5deb25980c.svg]]
|
|
|
|
|
| <matplotlib.lines.Line2D | at | 0x7f055a2a5520> |
|
|
|
|
|
[[file:./.ob-jupyter/58fdbc06f0806b834325ca3c4691b47fd7237d01.svg]]
|
2022-03-21 15:12:49 +01:00
|
|
|
|
:END:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#+begin_src jupyter-python
|
|
|
|
|
plt.plot(result.τ, bcf_im / np.abs(bcf_im).max())
|
|
|
|
|
plt.plot(result.τ, full_flow[-1][1] / np.abs(full_flow[-1][1]).max())
|
|
|
|
|
np.abs(bcf_im).max() / np.abs(full_flow[-1][1]).max()
|
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+RESULTS:
|
|
|
|
|
:RESULTS:
|
|
|
|
|
: 3.3334210815243313
|
2022-03-28 14:28:41 +02:00
|
|
|
|
[[file:./.ob-jupyter/554fea708ef42a3e62404d22d08128ead4938758.svg]]
|
|
|
|
|
: 3.3334210815243313
|
|
|
|
|
[[file:./.ob-jupyter/0fd2ba3362bb5dcff965bdb4f0b96c0588303d34.svg]]
|
2022-03-21 15:12:49 +01:00
|
|
|
|
:END:
|
|
|
|
|
|
|
|
|
|
#+begin_src jupyter-python :results none
|
|
|
|
|
_, L_exp_sys, σ_L_exp = util.operator_expectation_ensemble(
|
|
|
|
|
iter(result.ψ),
|
|
|
|
|
system.L @ system.L,
|
|
|
|
|
result.N,
|
|
|
|
|
params.HiP.nonlinear,
|
|
|
|
|
save="./results/L2.npy"
|
|
|
|
|
)
|
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+begin_src jupyter-python
|
|
|
|
|
plt.plot(result.τ, bcf_im * L_exp_sys.real * system.bcf_scale * 2)
|
|
|
|
|
plt.plot(result.τ, full_flow[-1][1], linestyle="--")
|
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+RESULTS:
|
|
|
|
|
:RESULTS:
|
2022-03-28 14:28:41 +02:00
|
|
|
|
| <matplotlib.lines.Line2D | at | 0x7f055987d3d0> |
|
|
|
|
|
[[file:./.ob-jupyter/3d1b22e410bdd499f6cf5a3ff9119ba90179c55e.svg]]
|
|
|
|
|
| <matplotlib.lines.Line2D | at | 0x7f055922a880> |
|
|
|
|
|
[[file:./.ob-jupyter/ec64dec84b680bcafb182ae480d9bd188e1fb3e2.svg]]
|
2022-03-21 15:12:49 +01:00
|
|
|
|
:END:
|
|
|
|
|
|
|
|
|
|
#+begin_src jupyter-python
|
|
|
|
|
import scipy.optimize
|
|
|
|
|
|
|
|
|
|
maxind = np.argmax(np.abs(full_flow[-1][1]))
|
|
|
|
|
res = scipy.optimize.minimize(
|
|
|
|
|
lambda s: np.sum(
|
|
|
|
|
((bcf_im * L_exp_sys.real * s * system.bcf_scale * 2 - full_flow[-1][1]) ** 2)[
|
|
|
|
|
0:maxind - 15
|
|
|
|
|
]
|
|
|
|
|
),
|
|
|
|
|
1,
|
|
|
|
|
tol=1e-4,
|
|
|
|
|
)
|
|
|
|
|
scale = res.x
|
|
|
|
|
res
|
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+RESULTS:
|
2022-03-28 14:28:41 +02:00
|
|
|
|
:RESULTS:
|
|
|
|
|
: fun: 0.00019313991029083397
|
|
|
|
|
: hess_inv: array([[1.38958965]])
|
|
|
|
|
: jac: array([3.63797881e-12])
|
|
|
|
|
: message: 'Optimization terminated successfully.'
|
|
|
|
|
: nfev: 6
|
|
|
|
|
: nit: 2
|
|
|
|
|
: njev: 3
|
|
|
|
|
: status: 0
|
|
|
|
|
: success: True
|
|
|
|
|
: x: array([1.0465576])
|
2022-03-21 15:12:49 +01:00
|
|
|
|
: fun: 0.00019313991029083397
|
|
|
|
|
: hess_inv: array([[1.38958965]])
|
|
|
|
|
: jac: array([3.63797881e-12])
|
|
|
|
|
: message: 'Optimization terminated successfully.'
|
|
|
|
|
: nfev: 6
|
|
|
|
|
: nit: 2
|
|
|
|
|
: njev: 3
|
|
|
|
|
: status: 0
|
|
|
|
|
: success: True
|
|
|
|
|
: x: array([1.0465576])
|
2022-03-28 14:28:41 +02:00
|
|
|
|
:END:
|
2022-03-21 15:12:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#+begin_src jupyter-python
|
|
|
|
|
plt.plot(result.τ, -bcf_im * L_exp_sys.real * 2 * system.bcf_scale * scale)
|
|
|
|
|
#plt.plot(result.τ, -bcf_im * L_exp_sys.real * 2 * system.bcf_scale)
|
|
|
|
|
plt.plot(result.τ, -full_flow[-1][1], linestyle="--")
|
|
|
|
|
plt.yscale('log')
|
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+RESULTS:
|
2022-03-28 14:28:41 +02:00
|
|
|
|
:RESULTS:
|
|
|
|
|
[[file:./.ob-jupyter/db469eea8f92bdb0f4b0eff02b235f1eecc29069.svg]]
|
|
|
|
|
[[file:./.ob-jupyter/9525681d3c3f15cc84033d73bb2272d32f8dff39.svg]]
|
|
|
|
|
:END:
|
2022-03-21 15:12:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#+begin_src jupyter-python
|
|
|
|
|
plt.plot(result.τ, np.abs(-bcf_im * L_exp_sys.real * 2 * system.bcf_scale * scale + full_flow[-1][1]))
|
|
|
|
|
plt.plot(result.τ, np.abs(-bcf_im * L_exp_sys.real * 2 * system.bcf_scale + full_flow[-1][1]), linestyle="--")
|
|
|
|
|
plt.xlim((0, .4))
|
|
|
|
|
plt.yscale('log')
|
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+RESULTS:
|
2022-03-28 14:28:41 +02:00
|
|
|
|
:RESULTS:
|
|
|
|
|
[[file:./.ob-jupyter/d377ba40fb72d3648d216600a8c33e526d0b1374.svg]]
|
|
|
|
|
[[file:./.ob-jupyter/9a8e4f67eed9973430c368eded35af984d848e0f.svg]]
|
|
|
|
|
:END:
|
2022-03-21 15:12:49 +01:00
|
|
|
|
|
|
|
|
|
Unscaled actually fits better for small times :P.
|
2021-11-11 16:10:25 +01:00
|
|
|
|
|
|
|
|
|
** Calculate the Interaction Energy
|
|
|
|
|
First we calculate it from energy conservation.
|
|
|
|
|
#+begin_src jupyter-python
|
2022-01-17 17:40:33 +01:00
|
|
|
|
e_int = (1/2 - e_sys - e_bath).real
|
2022-03-16 11:27:53 +01:00
|
|
|
|
σ_e_int = np.sqrt(σ_e_sys ** 2 + σ_e_bath ** 2).real
|
|
|
|
|
plt.errorbar(result.τ, e_int, yerr=σ_e_int, ecolor="yellow")
|
2021-11-11 16:10:25 +01:00
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+RESULTS:
|
2022-03-16 11:27:53 +01:00
|
|
|
|
:RESULTS:
|
|
|
|
|
: <ErrorbarContainer object of 3 artists>
|
2022-03-28 14:28:41 +02:00
|
|
|
|
[[file:./.ob-jupyter/d1f6581fa97e2cf681ac5f802c829d193ffd2ffa.svg]]
|
|
|
|
|
: <ErrorbarContainer object of 3 artists>
|
|
|
|
|
[[file:./.ob-jupyter/5a97f4646d7e9854e02ce808f69ecbdd9bbbf580.svg]]
|
2022-03-16 11:27:53 +01:00
|
|
|
|
:END:
|
2021-11-11 16:10:25 +01:00
|
|
|
|
|
|
|
|
|
And then from first principles:
|
|
|
|
|
#+begin_src jupyter-python
|
2022-03-28 14:28:41 +02:00
|
|
|
|
_, e_int_ex, σ_e_int_ex = hopsflow.interaction_energy_ensemble(result.ψ, result.ψ_1, hf_system, result.N, save="inten")
|
2022-03-15 11:25:30 +01:00
|
|
|
|
with fs.hiro_style():
|
2022-01-17 17:40:33 +01:00
|
|
|
|
plt.errorbar(result.τ, e_int_ex, yerr=σ_e_int_ex, ecolor="yellow")
|
2021-11-11 16:10:25 +01:00
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+RESULTS:
|
|
|
|
|
:RESULTS:
|
2022-03-28 14:28:41 +02:00
|
|
|
|
: 100% 7999/7999 [00:26<00:00, 305.42it/s]
|
|
|
|
|
[[file:./.ob-jupyter/f514f5a25b7e830920c9c19e1b598deca3d23873.svg]]
|
2021-11-11 16:10:25 +01:00
|
|
|
|
:END:
|
|
|
|
|
|
|
|
|
|
And both together:
|
|
|
|
|
#+begin_src jupyter-python
|
2022-03-15 11:25:30 +01:00
|
|
|
|
with fs.hiro_style():
|
2022-03-16 11:27:53 +01:00
|
|
|
|
plt.errorbar(result.τ, e_int, yerr=σ_e_int, label="from energy conservation", ecolor="yellow")
|
|
|
|
|
plt.errorbar(result.τ, e_int_ex, yerr=σ_e_int_ex, label="direct", ecolor="pink")
|
|
|
|
|
plt.gcf().set_size_inches(fs.get_figsize(239, 1, .8))
|
|
|
|
|
plt.legend()
|
|
|
|
|
plt.ylabel(r"$\langle H_I\rangle$")
|
|
|
|
|
plt.xlabel(r"$τ$")
|
|
|
|
|
fs.export_fig("interaction")
|
2021-11-11 16:10:25 +01:00
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
|
#+RESULTS:
|
2022-03-28 14:28:41 +02:00
|
|
|
|
:RESULTS:
|
|
|
|
|
[[file:./.ob-jupyter/e43dee028684661d30cf72ff39a1b2dcd626e98b.svg]]
|
|
|
|
|
[[file:./.ob-jupyter/88c1e4d9f19caaec1df4f9bcec98a46f8256c4c7.svg]]
|
|
|
|
|
:END:
|