updates of project 06

This commit is contained in:
Valentin Boettcher 2022-03-04 16:29:19 +01:00
parent 7cfdd80c07
commit 6f1e51ecf9
No known key found for this signature in database
GPG key ID: E034E12B7AF56ACE
10 changed files with 85 additions and 28 deletions

View file

@ -1 +0,0 @@
{"N": 10, "every": null, "const_args": ["<not serializable>", "<not serializable>", false], "const_kwargs": {}, "function_name": "_heat_flow_ensemble_body", "first_iterator_value": "<not serializable>"}

View file

@ -1 +0,0 @@
{"N": 2000, "every": null, "const_args": ["<not serializable>", null, false], "const_kwargs": {}, "function_name": "_heat_flow_ensemble_body", "first_iterator_value": "<not serializable>"}

View file

@ -1 +0,0 @@
{"N": 2000, "every": null, "const_args": ["<not serializable>", "<not serializable>", false], "const_kwargs": {}, "function_name": "_heat_flow_ensemble_body", "first_iterator_value": "<not serializable>"}

View file

@ -0,0 +1 @@
{"N": 500, "every": null, "const_args": ["<not serializable>", null, false], "const_kwargs": {}, "function_name": "_heat_flow_ensemble_body", "first_iterator_value": "<not serializable>"}

View file

@ -50,18 +50,30 @@ def plot_complex(x, y, *args, ax=None, label="", **kwargs):
@wrap_plot @wrap_plot
def plot_convergence( def plot_convergence(
x, y, ax=None, label="", transform=lambda y: y, slice=None, linestyle="-" x,
y,
ax=None,
label="",
transform=lambda y: y,
slice=None,
linestyle="-",
bath: int = 0,
): ):
label = label + ", " if (len(label) > 0) else "" label = label + ", " if (len(label) > 0) else ""
slice = (0, -1) if not slice else slice slice = (0, -1) if not slice else slice
for n, val, _ in y[slice[0] : slice[1]]: for n, val, _ in y[slice[0] : slice[1]]:
plt.plot( plt.plot(
x, transform(val), label=f"{label}n={n}", alpha=n / y[-1][0], linestyle="--" x,
transform(val[bath]),
label=f"{label}n={n}",
alpha=n / y[-1][0],
linestyle="--",
) )
ax.errorbar( ax.errorbar(
x, x,
transform(y[-1][1]), transform(y[-1][1][bath]),
yerr=y[-1][2], yerr=y[-1][2][bath],
ecolor="yellow", ecolor="yellow",
label=f"{label}n={y[-1][0]}", label=f"{label}n={y[-1][0]}",
color="red", color="red",

View file

@ -20,7 +20,7 @@ We have to find the name of the data file.
#+end_src #+end_src
#+RESULTS: data_file #+RESULTS: data_file
: .zz_xx_test/_7/data_77a4c2652ef00388cafbeded1407b887_1.h5 : .zz_xx_test/_5/data_5ede531da3f2d49c7f3a7de1e5225c79_1.h5
* Set up the Python Model Stuff * Set up the Python Model Stuff
Let's define the model. Let's define the model.
@ -65,7 +65,7 @@ Let's plot the density matrix.
#+end_src #+end_src
#+RESULTS: #+RESULTS:
[[file:./.ob-jupyter/db3b91250a9b801150682ff6685622cb783cce55.svg]] [[file:./.ob-jupyter/68c2783708648f0a403bca88c15ae30aebdedda5.svg]]
And the variance. And the variance.
#+begin_src jupyter-python #+begin_src jupyter-python
@ -75,8 +75,8 @@ And the variance.
#+RESULTS: #+RESULTS:
:RESULTS: :RESULTS:
| <matplotlib.lines.Line2D | at | 0x7f1e701e1fa0> | | <matplotlib.lines.Line2D | at | 0x7fa737875910> |
[[file:./.ob-jupyter/49ad46289dc4ac413c6a6d14ae516dc06b1490c0.svg]] [[file:./.ob-jupyter/8fd846327bc2132be1f74839e8128cc26f444b70.svg]]
:END: :END:
@ -92,7 +92,7 @@ And the variance.
#+RESULTS: #+RESULTS:
:RESULTS: :RESULTS:
| <Figure | size | 432x288 | with | 1 | Axes> | <AxesSubplot:> | | <Figure | size | 432x288 | with | 1 | Axes> | <AxesSubplot:> |
[[file:./.ob-jupyter/c59f93f046036dd58b3259c61f571f117c5d8eb4.svg]] [[file:./.ob-jupyter/bee3e7c767880ffe022e3c03fc9cb9da2d199030.svg]]
:END: :END:
#+begin_src jupyter-python #+begin_src jupyter-python
@ -103,7 +103,7 @@ And the variance.
#+RESULTS: #+RESULTS:
:RESULTS: :RESULTS:
| <Figure | size | 576x432 | with | 2 | Axes> | <AxesSubplot:> | | <Figure | size | 576x432 | with | 2 | Axes> | <AxesSubplot:> |
[[file:./.ob-jupyter/e8b80d1adb1ae3ff23448492623b2a1b8a0858b3.svg]] [[file:./.ob-jupyter/c9d57a382cbc0b162aa1972b17a17a32811d0c13.svg]]
:END: :END:
Let's calculate the system energy. Let's calculate the system energy.
@ -117,8 +117,8 @@ Let's calculate the system energy.
#+RESULTS: #+RESULTS:
:RESULTS: :RESULTS:
| <matplotlib.lines.Line2D | at | 0x7f1e6f9507f0> | | <matplotlib.lines.Line2D | at | 0x7fa72e94e820> |
[[file:./.ob-jupyter/5f14fbb8395caa26acf96099923202fbfec63393.svg]] [[file:./.ob-jupyter/7d1ecd2e5b40e4635aca3fe209e0e51cfb7a6cfd.svg]]
:END: :END:
The density matrix is not thermal. The density matrix is not thermal.
@ -127,10 +127,10 @@ The density matrix is not thermal.
#+end_src #+end_src
#+RESULTS: #+RESULTS:
: array([[0.00028261, 0.00012042, 0.00017604, 0.04725103], : array([[0.00028215, 0.00011577, 0.00017104, 0.04726899],
: [0.00012042, 0.03759883, 0.00297758, 0.00044194], : [0.00011577, 0.03761938, 0.00298941, 0.00044884],
: [0.00017604, 0.00297758, 0.03759883, 0.00047171], : [0.00017104, 0.00298941, 0.03761938, 0.00047356],
: [0.04725103, 0.00044194, 0.00047171, 0.00028261]]) : [0.04726899, 0.00044884, 0.00047356, 0.00028215]])
Let's split up the energy. Let's split up the energy.
#+begin_src jupyter-python #+begin_src jupyter-python
@ -161,8 +161,8 @@ Let's split up the energy.
#+RESULTS: #+RESULTS:
:RESULTS: :RESULTS:
: <matplotlib.legend.Legend at 0x7f1e7000da90> : <matplotlib.legend.Legend at 0x7fa72e581e20>
[[file:./.ob-jupyter/7d395d8ab10acdc617ffa5e353f1587dc305ff11.svg]] [[file:./.ob-jupyter/1e597c3e4009902f3b031333cf0f8ac533c2ac8f.svg]]
:END: :END:
* Energy Flow * Energy Flow
@ -188,6 +188,45 @@ Let's split up the energy.
therm_run = hf.ThermalRunParams(therm_params, data.rng_seed[0]) therm_run = hf.ThermalRunParams(therm_params, data.rng_seed[0])
#+end_src #+end_src
#+RESULTS:
#+begin_example
/home/hiro/src/hops/hops/util/bcf.py:265: UserWarning: this implementation uses mpmath to evaluate the zeta_function! for a better performance consider the 'OhmEnv' package
warnings.warn(
stocproc.stocproc - INFO - non neg freq only
INFO:stocproc.stocproc:non neg freq only
stocproc.stocproc - INFO - get_dt_for_accurate_interpolation, please wait ...
INFO:stocproc.stocproc:get_dt_for_accurate_interpolation, please wait ...
stocproc.method_ft - INFO - acc interp N 33 dt 1.88e+00 -> diff 2.19e-01
INFO:stocproc.method_ft:acc interp N 33 dt 1.88e+00 -> diff 2.19e-01
stocproc.method_ft - INFO - acc interp N 65 dt 9.38e-01 -> diff 8.26e-02
INFO:stocproc.method_ft:acc interp N 65 dt 9.38e-01 -> diff 8.26e-02
stocproc.method_ft - INFO - acc interp N 129 dt 4.69e-01 -> diff 1.88e-02
INFO:stocproc.method_ft:acc interp N 129 dt 4.69e-01 -> diff 1.88e-02
stocproc.method_ft - INFO - acc interp N 257 dt 2.34e-01 -> diff 4.03e-03
INFO:stocproc.method_ft:acc interp N 257 dt 2.34e-01 -> diff 4.03e-03
stocproc.method_ft - INFO - acc interp N 513 dt 1.17e-01 -> diff 9.62e-04
INFO:stocproc.method_ft:acc interp N 513 dt 1.17e-01 -> diff 9.62e-04
stocproc.method_ft - INFO - acc interp N 1025 dt 5.86e-02 -> diff 2.38e-04
INFO:stocproc.method_ft:acc interp N 1025 dt 5.86e-02 -> diff 2.38e-04
stocproc.method_ft - INFO - acc interp N 2049 dt 2.93e-02 -> diff 5.93e-05
INFO:stocproc.method_ft:acc interp N 2049 dt 2.93e-02 -> diff 5.93e-05
stocproc.stocproc - INFO - requires dt < 2.930e-02
INFO:stocproc.stocproc:requires dt < 2.930e-02
stocproc.stocproc - INFO - yields N = 1025 (time domain)
INFO:stocproc.stocproc:yields N = 1025 (time domain)
stocproc.stocproc - INFO - find accurate discretisation in frequency domain
INFO:stocproc.stocproc:find accurate discretisation in frequency domain
stocproc.stocproc - INFO - wmax:8.977470233936439
INFO:stocproc.stocproc:wmax:8.977470233936439
n:32 d:0.6692598501571181 tol:0.0001
n:64 d:0.41535419936251716 tol:0.0001
n:128 d:0.15058338362442436 tol:0.0001
stocproc.stocproc - INFO - perform numeric check of entire time axis [0,30.0] N:1025
INFO:stocproc.stocproc:perform numeric check of entire time axis [0,30.0] N:1025
n:256 d:9.75406609938787e-06 tol:0.0001
done!
#+end_example
#+begin_src jupyter-python :results none #+begin_src jupyter-python :results none
flow = hf.flow_trajectory(run, sys, therm_run) flow = hf.flow_trajectory(run, sys, therm_run)
@ -200,28 +239,36 @@ Let's split up the energy.
#+RESULTS: #+RESULTS:
:RESULTS: :RESULTS:
| <matplotlib.lines.Line2D | at | 0x7f1e560af730> | | <matplotlib.lines.Line2D | at | 0x7fa72e7cff10> |
[[file:./.ob-jupyter/c75cf2b5621a8d86f86ed96baac9cad2e4abf0ef.svg]] [[file:./.ob-jupyter/0a0e43bd788d4fbd01a3bd724a2feaada5234730.svg]]
:END: :END:
#+begin_src jupyter-python #+begin_src jupyter-python
flow_total = hf.heat_flow_ensemble(iter(data.stoc_traj), iter(data.aux_states), sys, 2000, None, save="flow") flow_total = hf.heat_flow_ensemble(iter(data.stoc_traj), iter(data.aux_states), sys, data.samples, (data.rng_seed, therm_params))
#+end_src #+end_src
#+RESULTS: #+RESULTS:
: 100% 1999/1999 [00:15<00:00, 129.99it/s] : 100% 99999/99999 [30:05<00:00, 55.38it/s]
#+begin_src jupyter-python #+begin_src jupyter-python
plt.plot(τ, flow_total[1][0])
plt.plot(τ, flow_total[1][1]) plt.plot(τ, flow_total[1][1])
#plt.plot(τ, flow_total[1][1]) plt.plot(τ, flow_total[1][0] + flow_total[1][1])
#+end_src #+end_src
#+RESULTS: #+RESULTS:
:RESULTS: :RESULTS:
| <matplotlib.lines.Line2D | at | 0x7f1e5601e3d0> | | <matplotlib.lines.Line2D | at | 0x7fa72e021130> |
[[file:./.ob-jupyter/ddf2da7a776aeeb7e02e2ff0c8f0170ff36b0587.svg]] [[file:./.ob-jupyter/2a673d1b36801d45148847ff35d293ba4aed3c72.svg]]
:END: :END:
Sweet. Right as expected. A modest flow. :P.
#+begin_src jupyter-python :results none
ut.plot_convergence(τ, flow_total, bath=0)
#+end_src
* Conculisions * Conculisions
- steady state reached very fast - steady state reached very fast
- some fluctuations in steady state -> statistics? - some fluctuations in steady state -> statistics?