upgrade 03

This commit is contained in:
Valentin Boettcher 2022-01-18 16:43:11 +01:00
parent dca315c7d9
commit 102b79ee97
6 changed files with 286 additions and 468 deletions

View file

@ -92,7 +92,7 @@ Now we read the trajectory data.
#+begin_src jupyter-python
class result:
hd = HIMetaData("data", ".").get_HIData(params, read_only=True)
N = 2000 #hd.samples
N = hd.samples
τ = hd.get_time()
ψ_1 = hd.aux_states
ψ = hd.stoc_traj

View file

@ -1,283 +1,113 @@
#+PROPERTY: header-args :session comparison_hops_gauss :kernel python :pandoc yes :async yes
* Configuration and Setup
The main process configuration is to be found [[file:stg.py][here]].
This will be tangled into the [[file:config.py][config file]] that can be used with the HOPS cli.
** Stochastic Processes
We then proceed to initialize the stochastic processes.
#+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
np.__config__.blas_opt_info = np.__config__.blas_ilp64_opt_info # fix for qutip
import qutip
#+begin_src vterm
python ../hops/sp.py -s stg.py
max_HO_level = 25
wc = 2
s = 1
# The BCF fit
bcf_terms = 5
g, w = get_ohm_g_w(bcf_terms, s, wc)
integration = IntP(t_max=16, t_steps=int(16 // 0.01))
q = (qutip.operators.create(max_HO_level) + qutip.operators.destroy(max_HO_level)).data.todense()
p = ((qutip.operators.destroy(max_HO_level) - qutip.operators.create(max_HO_level)) / 1j).data.todense()
system = SysP(
H_sys=0.25 * (p ** 2 + q ** 2),
L=0.5 * q,
psi0=np.array(qutip.states.fock(max_HO_level, n=1).data.todense()).flatten(),
g=g,
w=w,
bcf_scale=0.5,
T=0,
)
hops_bcf = hops.util.bcf.OhmicBCF_zeroTemp(
s,
1,
wc,
)
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(
g=g, w=w, p=1, q=0.5, kfac=1.4
),
save_therm_rng_seed=True,
),
Eta=StocProc_FFT(
spectral_density=hops.util.bcf.OhmicSD_zeroTemp(
s,
1,
wc,
),
alpha=hops_bcf,
t_max=integration.t_max,
intgr_tol=1e-4,
intpl_tol=1e-4,
negative_frequencies=False,
),
EtaTherm=None,
)
#+end_src
#+RESULTS:
:RESULTS:
Linux ArLeenUX 5.15.2-zen1 x86_64
14:56:17 up 3:23, 2 users, load average: 0.58, 0.95, 1.23
impure  ~/D/P/U/m/m/p/e/03_gaussian  python ../hops/sp.py -s stg.py
stocproc.stocproc - INFO - non neg freq only
non neg freq only
stocproc.method_ft - INFO - get_dt_for_accurate_interpolation, please wait ...
get_dt_for_accurate_interpolation, please wait ...
stocproc.method_ft - INFO - acc interp N 33 dt 1.56e+00 -> diff 4.52e-01
acc interp N 33 dt 1.56e+00 -> diff 4.52e-01
stocproc.method_ft - INFO - acc interp N 65 dt 7.81e-01 -> diff 2.19e-01
acc interp N 65 dt 7.81e-01 -> diff 2.19e-01
stocproc.method_ft - INFO - acc interp N 129 dt 3.91e-01 -> diff 5.71e-02
acc interp N 129 dt 3.91e-01 -> diff 5.71e-02
stocproc.method_ft - INFO - acc interp N 257 dt 1.95e-01 -> diff 1.17e-02
acc interp N 257 dt 1.95e-01 -> diff 1.17e-02
stocproc.method_ft - INFO - acc interp N 513 dt 9.77e-02 -> diff 2.69e-03
acc interp N 513 dt 9.77e-02 -> diff 2.69e-03
stocproc.method_ft - INFO - acc interp N 1025 dt 4.88e-02 -> diff 6.59e-04
acc interp N 1025 dt 4.88e-02 -> diff 6.59e-04
stocproc.method_ft - INFO - acc interp N 2049 dt 2.44e-02 -> diff 1.64e-04
acc interp N 2049 dt 2.44e-02 -> diff 1.64e-04
stocproc.method_ft - INFO - acc interp N 4097 dt 1.22e-02 -> diff 4.09e-05
acc interp N 4097 dt 1.22e-02 -> diff 4.09e-05
stocproc.method_ft - INFO - requires dt < 1.221e-02
requires dt < 1.221e-02
stocproc.method_ft - INFO - get_N_a_b_for_accurate_fourier_integral, please wait ...
get_N_a_b_for_accurate_fourier_integral, please wait ...
stocproc.method_ft - INFO - J_w_min:1.00e-02 N 32 yields: interval [0.00e+00,6.47e+00] diff 9.83e-03
J_w_min:1.00e-02 N 32 yields: interval [0.00e+00,6.47e+00] diff 9.83e-03
stocproc.method_ft - INFO - J_w_min:1.00e-03 N 32 yields: interval [0.00e+00,9.12e+00] diff 8.12e-03
J_w_min:1.00e-03 N 32 yields: interval [0.00e+00,9.12e+00] diff 8.12e-03
stocproc.method_ft - INFO - J_w_min:1.00e-02 N 64 yields: interval [0.00e+00,6.47e+00] diff 1.11e-02
J_w_min:1.00e-02 N 64 yields: interval [0.00e+00,6.47e+00] diff 1.11e-02
stocproc.method_ft - INFO - increasing N while shrinking the interval does lower the error -> try next level
increasing N while shrinking the interval does lower the error -> try next level
stocproc.method_ft - INFO - J_w_min:1.00e-04 N 32 yields: interval [0.00e+00,1.17e+01] diff 1.32e-02
J_w_min:1.00e-04 N 32 yields: interval [0.00e+00,1.17e+01] diff 1.32e-02
stocproc.method_ft - INFO - J_w_min:1.00e-03 N 64 yields: interval [0.00e+00,9.12e+00] diff 2.05e-03
J_w_min:1.00e-03 N 64 yields: interval [0.00e+00,9.12e+00] diff 2.05e-03
stocproc.method_ft - INFO - J_w_min:1.00e-02 N 128 yields: interval [0.00e+00,6.47e+00] diff 1.14e-02
J_w_min:1.00e-02 N 128 yields: interval [0.00e+00,6.47e+00] diff 1.14e-02
stocproc.method_ft - INFO - increasing N while shrinking the interval does lower the error -> try next level
increasing N while shrinking the interval does lower the error -> try next level
stocproc.method_ft - INFO - J_w_min:1.00e-05 N 32 yields: interval [0.00e+00,1.42e+01] diff 1.94e-02
J_w_min:1.00e-05 N 32 yields: interval [0.00e+00,1.42e+01] diff 1.94e-02
stocproc.method_ft - INFO - J_w_min:1.00e-04 N 64 yields: interval [0.00e+00,1.17e+01] diff 3.35e-03
J_w_min:1.00e-04 N 64 yields: interval [0.00e+00,1.17e+01] diff 3.35e-03
stocproc.method_ft - INFO - J_w_min:1.00e-03 N 128 yields: interval [0.00e+00,9.12e+00] diff 8.98e-04
J_w_min:1.00e-03 N 128 yields: interval [0.00e+00,9.12e+00] diff 8.98e-04
stocproc.method_ft - INFO - J_w_min:1.00e-02 N 256 yields: interval [0.00e+00,6.47e+00] diff 1.15e-02
J_w_min:1.00e-02 N 256 yields: interval [0.00e+00,6.47e+00] diff 1.15e-02
stocproc.method_ft - INFO - increasing N while shrinking the interval does lower the error -> try next level
increasing N while shrinking the interval does lower the error -> try next level
stocproc.method_ft - INFO - J_w_min:1.00e-06 N 32 yields: interval [0.00e+00,1.66e+01] diff 2.65e-02
J_w_min:1.00e-06 N 32 yields: interval [0.00e+00,1.66e+01] diff 2.65e-02
stocproc.method_ft - INFO - J_w_min:1.00e-05 N 64 yields: interval [0.00e+00,1.42e+01] diff 4.93e-03
J_w_min:1.00e-05 N 64 yields: interval [0.00e+00,1.42e+01] diff 4.93e-03
stocproc.method_ft - INFO - J_w_min:1.00e-04 N 128 yields: interval [0.00e+00,1.17e+01] diff 5.42e-04
J_w_min:1.00e-04 N 128 yields: interval [0.00e+00,1.17e+01] diff 5.42e-04
stocproc.method_ft - INFO - J_w_min:1.00e-03 N 256 yields: interval [0.00e+00,9.12e+00] diff 1.06e-03
J_w_min:1.00e-03 N 256 yields: interval [0.00e+00,9.12e+00] diff 1.06e-03
stocproc.method_ft - INFO - increasing N while shrinking the interval does lower the error -> try next level
increasing N while shrinking the interval does lower the error -> try next level
stocproc.method_ft - INFO - J_w_min:1.00e-07 N 32 yields: interval [0.00e+00,1.91e+01] diff 3.44e-02
J_w_min:1.00e-07 N 32 yields: interval [0.00e+00,1.91e+01] diff 3.44e-02
stocproc.method_ft - INFO - J_w_min:1.00e-06 N 64 yields: interval [0.00e+00,1.66e+01] diff 6.78e-03
J_w_min:1.00e-06 N 64 yields: interval [0.00e+00,1.66e+01] diff 6.78e-03
stocproc.method_ft - INFO - J_w_min:1.00e-05 N 128 yields: interval [0.00e+00,1.42e+01] diff 9.98e-04
J_w_min:1.00e-05 N 128 yields: interval [0.00e+00,1.42e+01] diff 9.98e-04
stocproc.method_ft - INFO - J_w_min:1.00e-04 N 256 yields: interval [0.00e+00,1.17e+01] diff 9.67e-05
J_w_min:1.00e-04 N 256 yields: interval [0.00e+00,1.17e+01] diff 9.67e-05
stocproc.method_ft - INFO - return, cause tol of 0.0001 was reached
return, cause tol of 0.0001 was reached
stocproc.method_ft - INFO - requires dx < 4.557e-02
requires dx < 4.557e-02
stocproc.stocproc - INFO - Fourier Integral Boundaries: [0.000e+00, 6.199e+02]
Fourier Integral Boundaries: [0.000e+00, 6.199e+02]
stocproc.stocproc - INFO - Number of Nodes : 16384
Number of Nodes : 16384
stocproc.stocproc - INFO - yields dx : 3.784e-02
yields dx : 3.784e-02
stocproc.stocproc - INFO - yields dt : 1.013e-02
yields dt : 1.013e-02
stocproc.stocproc - INFO - yields t_max : 1.660e+02
yields t_max : 1.660e+02
added StocProc to database 'SPCache' at '.'
:END:
The stochastic process is initialized and cached in ~./SPCache~.
* Hops Integration
We can use multiple avenues.
** Local Integration
#+begin_src vterm :term-name integration
python ../hops/hi.py -s stg.py
#+end_src
#+RESULTS:
:RESULTS:
Linux ArLeenUX 5.15.2-zen1 x86_64
17:39:20 up 6:06, 2 users, load average: 0.19, 0.88, 1.71
impure  ~/D/P/U/m/m/p/e/03_gaussian  python ../hops/hi.py -s stg.py
run integrate
init Hi class, use 3550 equation
is up event is False
wait ...
[in server process] add args to server ...
^C
############## in JM SERVER EXIT
HI_Server start at 2021-11-26 17:39:24.291498 | runtime 6.000e+00s
HI_Server total number of jobs : 289457
| processed : 0
| succeeded : 0
| failed : 0
| not processed : 289457
| queried : 0
| not queried yet : 289457
Traceback (most recent call last):
File "/home/hiro/Documents/Projects/UNI/master/masterarb/python/energy_flow_proper/03_gaussian/../hops/hi.py", line 828, in
<module>
hi.integrate(
File "/home/hiro/Documents/Projects/UNI/master/masterarb/python/energy_flow_proper/hops/hops/core/hierarchyLib.py", line 147
2, in integrate
mp_is_up_event.wait()
File "/nix/store/cy49x6xnmzf4b7q8la495ic1lp91awq9-python3-3.9.4/lib/python3.9/multiprocessing/synchronize.py", line 349, in
wait
self._cond.wait(timeout)
File "/nix/store/cy49x6xnmzf4b7q8la495ic1lp91awq9-python3-3.9.4/lib/python3.9/multiprocessing/synchronize.py", line 261, in
wait
return self._wait_semaphore.acquire(True, timeout)
KeyboardInterrupt
Process Process-1:
Traceback (most recent call last):
File "/nix/store/cy49x6xnmzf4b7q8la495ic1lp91awq9-python3-3.9.4/lib/python3.9/multiprocessing/process.py", line 315, in _boo
tstrap
self.run()
File "/nix/store/cy49x6xnmzf4b7q8la495ic1lp91awq9-python3-3.9.4/lib/python3.9/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/home/hiro/Documents/Projects/UNI/master/masterarb/python/energy_flow_proper/hops/hops/core/hierarchyLib.py", line 142
4, in run_server
hi_integrator_server.put_arg(arg)
File "/nix/store/nv44kxf8ljllk4lad7pwlrjiwl0yfrwn-python3-3.9.4-env/lib/python3.9/site-packages/jobmanager/jobmanager.py", l
ine 1763, in put_arg
self.job_q.put(copy.copy(a))
File "/nix/store/nv44kxf8ljllk4lad7pwlrjiwl0yfrwn-python3-3.9.4-env/lib/python3.9/site-packages/jobmanager/jobmanager.py", l
ine 1289, in put
self.data[str_id] = item
KeyboardInterrupt
!  impure  ~/D/P/U/m/m/p/e/03_gaussian  exti 10.6s
exti: command not found
:END:
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
python ../hops/hi.py -s stg.py server
#+end_src
#+RESULTS:
:RESULTS:
Linux ArLeenUX 5.15.2-zen1 x86_64
17:24:00 up 5:51, 2 users, load average: 0.54, 0.86, 1.60
impure  ~/D/P/U/m/m/p/e/03_gaussian  python ../hops/hi.py -s stg.py server
run server
init Hi class, use 1420 equation
JobManager started on ArLeenUX:35254 (bytearray(b'SBM'))
hi server is running
[T[TET 00:00:18 [0.0c/s] TTG -- 0.0% ETA -- ORT -
[TET-00:06:37--[16.9c/min]-TTG-0.00ms-------------------------100%-------------------------ETA-20211126_17:30:41-ORT-00:06:37]
res_q #0 20.52GB/s 5.31TB|rem.:0, done:100, failed:0, prog.:0
############## in JM SERVER EXIT
HI_Server start at 2021-11-26 17:24:03.735185 | runtime 3.990e+02s
HI_Server total number of jobs : 100
| processed : 100
| succeeded : 100
| failed : 0
| timing in sec: min 2.121e+01 | max 5.025e+01 | avr 4.283e+01
| not processed : 0
| queried : 0
| not queried yet : 0
:END:
And jack in with a remote client. In this case my box at home.
** Local Client
#+begin_src vterm :term-name local-client
python ../hops/hi.py -s stg.py client
#+end_src
#+RESULTS:
:RESULTS:
Linux ArLeenUX 5.15.2-zen1 x86_64
17:24:25 up 5:51, 2 users, load average: 0.86, 0.92, 1.60
impure  ~/D/P/U/m/m/p/e/03_gaussian  python ../hops/hi.py -s stg.py client
run client
timeout from args None
start client on host ArLeenUX
/nix/store/nv44kxf8ljllk4lad7pwlrjiwl0yfrwn-python3-3.9.4-env/lib/python3.9/site-packages/jobmanager/jobmanager.py:130: UserWa
rning: num_threads could not be set, MKL / openblas not found
warnings.warn("num_threads could not be set, MKL / openblas not found")
/nix/store/nv44kxf8ljllk4lad7pwlrjiwl0yfrwn-python3-3.9.4-env/lib/python3.9/site-packages/jobmanager/jobmanager.py:130: UserWa
rning: num_threads could not be set, MKL / openblas not found
warnings.warn("num_threads could not be set, MKL / openblas not found")
/nix/store/nv44kxf8ljllk4lad7pwlrjiwl0yfrwn-python3-3.9.4-env/lib/python3.9/site-packages/jobmanager/jobmanager.py:130: UserWa
rning: num_threads could not be set, MKL / openblas not found
warnings.warn("num_threads could not be set, MKL / openblas not found")
/nix/store/nv44kxf8ljllk4lad7pwlrjiwl0yfrwn-python3-3.9.4-env/lib/python3.9/site-packages/jobmanager/jobmanager.py:130: UserWa
rning: num_threads could not be set, MKL / openblas not found
warnings.warn("num_threads could not be set, MKL / openblas not found")
w1:00:06:00 [1.5c/min] #9 - [TET 00:00:17 [0.0c/s] TTG -- 0.0% ETA -- ORT --]
w2:00:06:00 [1.6c/min] #10 - [TET 5.72s [0.0c/s] TTG -- 0.0% ETA -- ORT --]
w3:00:06:00 [1.5c/min] #9 - [TET 00:00:19 [0.0c/s] TTG -- 0.0% ETA -- ORT --]
w4:00:06:00 [1.6c/min] #10 - [TET 5.75s [0.0c/s] TTG -- 0.0% ETA -- ORT --]
local res_q 0 236.4GB/s
:END:
Churn in with our local machine :).
* Heat Flow HOPS
** Jupyter Setup
#+begin_src jupyter-python :results none
import numpy as np
import matplotlib.pyplot as plt
import stg_helper
import stg
from hopsflow import util, hopsflow
import utilities as ut
from hops.core.hierarchyData import HIMetaData
#+end_src
** Loading the Data
#+begin_src jupyter-python :results none
system_params = stg_helper.get_system_param(stg)
#+end_src
Now we can load the data.
#+begin_src jupyter-python :results none
#+begin_src jupyter-python
class result:
hd = stg_helper.get_hierarchy_data(stg, read_only=True)
N = hd.samples[0]
hd = HIMetaData("data", ".").get_HIData(params, read_only=True)
N = hd.samples
τ = hd.get_time()
# ρ = hd.get_rho_t()
ψ_1 = hd.aux_states
ψ = hd.stoc_traj
#therm_y = hd.therm_y
result.N
#+end_src
#+RESULTS:
: 10
We calculate the sytem energy just for fun.
#+begin_src jupyter-python
_, e_sys, σ_e_sys = util.operator_expectation_ensemble(
iter(result.ψ),
system_params.H_sys.todense(),
system.H_sys,
result.N,
stg.__HI_nonlinear,
params.HiP.nonlinear,
)
#+end_src
#+RESULTS:
: 100%|██████████| 999/999 [00:23<00:00, 41.67it/s]
: 100% 9/9 [00:00<00:00, 124.55it/s]
#+begin_src jupyter-python
@ -287,26 +117,26 @@ We calculate the sytem energy just for fun.
#+RESULTS:
:RESULTS:
: <ErrorbarContainer object of 3 artists>
[[file:./.ob-jupyter/e5a69bd7754bca0aa1af09eb146b618116a6c869.svg]]
[[file:./.ob-jupyter/32a477f6ab175e22012ea4278d072c264fee212b.svg]]
:END:
** Heat Flow
First we set up some parameter objects for the alogrithm.
#+begin_src jupyter-python :results none
hf_system = hopsflow.SystemParams(
system_params.L.todense(), stg.__g, stg.__w, stg.__bcf_scale, stg.__HI_nonlinear
system.L, system.g, system.w, system.bcf_scale, params.HiP.nonlinear
)
#+end_src
And then we calculate the flow.
#+begin_src jupyter-python
full_flow = hopsflow.heat_flow_ensemble(
iter(result.ψ), iter(result.ψ_1), hf_system, result.N, every=int(result.N / 6)
iter(result.ψ), iter(result.ψ_1), hf_system, result.N, every=int(result.N // 6)
)
#+end_src
#+RESULTS:
: 100%|██████████| 999/999 [01:19<00:00, 12.63it/s]
: 100% 9/9 [00:00<00:00, 36.82it/s]
#+begin_src jupyter-python
with ut.hiro_style():
@ -314,7 +144,7 @@ And then we calculate the flow.
#+end_src
#+RESULTS:
[[file:./.ob-jupyter/4ba72b691569b11043e33f3d8e6bcf1e6b6a035d.svg]]
[[file:./.ob-jupyter/32304a750ffed797cfa8c65c28cafe14a7053074.svg]]
** Analytic
#+begin_src jupyter-python :results none
@ -324,15 +154,15 @@ And then we calculate the flow.
Setting up the BCFs.
#+begin_src jupyter-python :results none
α_0 = gf.BCF(
stg.t_max,
stg.__bcf_zero_temp,
params.IntP.t_max,
hops_bcf,
num_terms=4,
resolution=0.001,
)
α_0_dot = gf.BCF(
stg.t_max,
lambda t: 2 / (1j * np.pi) * (stg.wc / (1 + 1j * stg.wc * t)) ** 3,
params.IntP.t_max,
lambda t: 2 / (1j * np.pi) * (wc / (1 + 1j * wc * t)) ** 3,
num_terms=5,
resolution=0.001,
)
@ -340,7 +170,7 @@ Setting up the BCFs.
We can now initialize the parameter object for the alogrithm.
#+begin_src jupyter-python :results none
sys = gf.SystemParams(Ω=stg.OMEGA, η=stg.eta, α_0=α_0)
sys = gf.SystemParams(Ω=1, η=system.bcf_scale, α_0=α_0)
#+end_src
Now we can define the flow:
@ -358,8 +188,8 @@ And plot it against the numerically obtained flow.
#+RESULTS:
:RESULTS:
: <matplotlib.legend.Legend at 0x7ffaf9d490d0>
[[file:./.ob-jupyter/c50861ae1d5935f9ccefaedcfb65294291d1a9f0.svg]]
: <matplotlib.legend.Legend at 0x7fcae05550a0>
[[file:./.ob-jupyter/495974be9b87f35c9d2005aa7bf4996b23653198.svg]]
:END:
#+begin_src jupyter-python
@ -373,6 +203,6 @@ And plot it against the numerically obtained flow.
#+RESULTS:
:RESULTS:
: <matplotlib.legend.Legend at 0x7ffae03e6100>
[[file:./.ob-jupyter/9b75b8cedc82092c5fbe9bb22a72a6265296e455.svg]]
: <matplotlib.legend.Legend at 0x7fcae18f7bb0>
[[file:./.ob-jupyter/19aa40be77dc83e8bc59155e0bfc391e07a0a0f0.svg]]
:END:

View file

@ -0,0 +1,65 @@
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
np.__config__.blas_opt_info = np.__config__.blas_ilp64_opt_info # fix for qutip
import qutip
max_HO_level = 25
wc = 2
s = 1
# The BCF fit
bcf_terms = 5
g, w = get_ohm_g_w(bcf_terms, s, wc)
integration = IntP(t_max=16, t_steps=int(16 // 0.01))
q = (qutip.operators.create(max_HO_level) + qutip.operators.destroy(max_HO_level)).data.todense()
p = ((qutip.operators.destroy(max_HO_level) - qutip.operators.create(max_HO_level)) / 1j).data.todense()
system = SysP(
H_sys=0.25 * (p ** 2 + q ** 2),
L=0.5 * q,
psi0=np.array(qutip.states.fock(max_HO_level, n=1).data.todense()).flatten(),
g=g,
w=w,
bcf_scale=0.5,
T=0,
)
hops_bcf = hops.util.bcf.OhmicBCF_zeroTemp(
s,
1,
wc,
)
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(
g=g, w=w, p=1, q=0.5, kfac=1.4
),
save_therm_rng_seed=True,
),
Eta=StocProc_FFT(
spectral_density=hops.util.bcf.OhmicSD_zeroTemp(
s,
1,
wc,
),
alpha=hops_bcf,
t_max=integration.t_max,
intgr_tol=1e-4,
intpl_tol=1e-4,
negative_frequencies=False,
),
EtaTherm=None,
)

View file

@ -0,0 +1,126 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1638122382,
"narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1610051610,
"narHash": "sha256-U9rPz/usA1/Aohhk7Cmc2gBrEEKRzcW4nwPWMPwja4Y=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3982c9903e93927c2164caa727cd3f6a0e6d14cc",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1642104392,
"narHash": "sha256-m71b7MgMh9FDv4MnI5sg9MiBVW6DhE1zq+d/KlLWSC8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5aaed40d22f0d9376330b6fa413223435ad6fee5",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1642104392,
"narHash": "sha256-m71b7MgMh9FDv4MnI5sg9MiBVW6DhE1zq+d/KlLWSC8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5aaed40d22f0d9376330b6fa413223435ad6fee5",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1610729867,
"narHash": "sha256-bk/SBaBLqZX/PEqal27DMQwAHHl0dcZMp8NNksQr80s=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "04af07c659c6723a2259bb6bc00a47ec53330f20",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"poetry2nix": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1641997288,
"narHash": "sha256-l/oldhMwpIhKbsHrm0Uzl+UbtS0p/2uL4fjV0KMw980=",
"owner": "nix-community",
"repo": "poetry2nix",
"rev": "cf1547ba2b009e20d92d5aab0691c5286408e2bb",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "poetry2nix",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"utils": "utils"
}
},
"utils": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_2",
"poetry2nix": "poetry2nix"
},
"locked": {
"lastModified": 1642512830,
"narHash": "sha256-73733rniMobC1gGsqMjvEgEYkKtX7VfQj5eafWGx9dQ=",
"owner": "vale981",
"repo": "hiro-flake-utils",
"rev": "b8cca753d3cc543b7ecb1313b136cc95582fecb1",
"type": "github"
},
"original": {
"owner": "vale981",
"repo": "hiro-flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View file

@ -324,7 +324,7 @@ develop = false
[package.dependencies]
lmfit = "^1.0.3"
numpy = "^1.21.4"
numpy = "^1.20.0"
scipy = "^1.7.3"
sqlitedict = "^1.7.0"
stocproc = {git = "https://github.com/vale981/stocproc", branch = "master"}
@ -334,7 +334,7 @@ tqdm = "^4.62.3"
type = "git"
url = "https://github.com/vale981/hopsflow"
reference = "main"
resolved_reference = "37f384a0ff37c8a05e82ff4289c61268c24591e1"
resolved_reference = "9e33c9ca5085cba3f082ca37f0847db4af741ffa"
[[package]]
name = "ipykernel"

View file

@ -1,203 +0,0 @@
# native
import pathlib
import traceback
import pickle
# third party
import numpy as np
from scipy.special import gamma as gamma_func
import qutip
# hops
import hops.core.hierarchyData as hid
import hops.util.bcf as bcf
import hops.util.matrixLib as ml
import hops.util.truncation_schemes as truncation_schemes
import stg_helper
from hops.data.path import get_path as get_hops_data_path
################################################
#
# OVERALL PARAMETERS
#
# may be overwritten in later definitions
#
################################################
max_HO_level = 25
OMEGA = 1
wc = 2
s = 1
__BCF_FIT_n = 5
__T = 0
__HI_eta_type = "fft"
__HI_eta_temperature_type = "fft"
eta = .5
p_trunc = 1.5
q_trunc = 0.5
n_eq = None
kfac = 1.4
kmax_list_pre_sqrt = True
__HI_k_max = None
t_max = 16
sp_tol = 1e-4
__HI_seed = 0
__HI_accum_only = False
__HI_number_of_samples = 1000
__BCF_FIT_good_data_path = get_hops_data_path() + "/good_fit_data_abs_brute_force"
with open(__BCF_FIT_good_data_path, "rb") as f:
good_fit_data_abs = pickle.load(f)
try:
_, g_tilde, w_tilde = good_fit_data_abs[(__BCF_FIT_n, s)]
__g = 1 / np.pi * gamma_func(s + 1) * wc ** (s + 1) * np.asarray(g_tilde)
__w = wc * np.asarray(w_tilde)
__HI_truncation_scheme = stg_helper.get_truncation_scheme(
kmax_list_pre_sqrt=kmax_list_pre_sqrt,
g=__g,
w=__w,
q=q_trunc,
p=p_trunc,
kfac=kfac,
)
except KeyError:
raise KeyError(
"no fit data in {} for n={} and s={}".format(
__BCF_FIT_good_data_path, __BCF_FIT_n, s
)
)
__BCF_FIT_gw_hash = None
__temp_method = "stoc_pot"
__bcf_scale = eta
# print("eta", __bcf_scale)
__bcf_zero_temp = bcf.OhmicBCF_zeroTemp(s=s, eta=1, w_c=wc)
__spd_zero_temp = bcf.OhmicSD_zeroTemp(s=s, eta=1, w_c=wc)
if __T == 0:
__bcf = __bcf_zero_temp
__spec_dens = __spd_zero_temp
__stoc_temp_corr = None
__stoc_temp_dens = None
beta = np.inf
__HI_save_therm_y = False
else:
__bcf = bcf.OhmicBCF_nonZeroTemp(s=s, eta=1, w_c=wc, beta=1 / __T)
__spec_dens = bcf.PseudoSD(sd_at_t_zero=__spd_zero_temp, T=__T)
__stoc_temp_corr = bcf.Ohmic_StochasticPotentialCorrelations(
s=s, eta=1, w_c=wc, beta=1 / __T
)
__stoc_temp_dens = bcf.Ohmic_StochasticPotentialDensity(
s=s, eta=1, w_c=wc, beta=1 / __T
)
beta = 1 / __T
__HI_save_therm_y = True
q = qutip.operators.create(max_HO_level) + qutip.operators.destroy(max_HO_level)
p = (qutip.operators.destroy(max_HO_level) - qutip.operators.create(max_HO_level)) / 1j
__L = 0.5 * q
__H_sys = 0.25 * OMEGA * (p ** 2 + q ** 2)
__L = ml.Operator(data=__L, fmt="coo")
__H_sys = ml.Operator(data=__H_sys, fmt="coo")
#################################################
#
# settings for stoc proc
#
#################################################
__SP_t_max = t_max
__SP_db_name = "SPCache"
__SP_db_path = "."
__SP_KLE_tol = sp_tol
__SP_KLE_ng_fac = 4
__SP_KLE_meth = "fourpoint"
# __SP_KLE_meth = 'trapz'
# __SP_KLE_diff_method = 'full'
# __SP_KLE_dm_random_samples = None
__SP_KLE_diff_method = "random"
__SP_KLE_dm_random_samples = 10000
if __temp_method == "stoc_pot":
__SP_FFT_neg_frequ = False
else:
if __T == 0:
__SP_FFT_neg_frequ = False
else:
__SP_FFT_neg_frequ = True
# __SP_FFT_intgr_tol = 5e-3
# __SP_FFT_intpl_tol = 5e-3
__SP_FFT_intgr_tol = sp_tol
__SP_FFT_intpl_tol = sp_tol
################################################
#
# System and Hierarchy parameters
#
################################################
# __g = None
# __w = None
__H_dyn = []
__psi0 = np.array(qutip.states.fock(max_HO_level, n=1).data.todense()).flatten()
# for image: stoch_trj.png
# __INTGR_t_max = 6
# __INTGR_t_steps = 750
__INTGR_t_max = t_max
__INTGR_t_steps = int(t_max / 0.01)
__INTGR_name = "zvode"
__INTGR_atol = "1e-8"
__INTGR_rtol = "1e-8"
__INTGR_order = 5
__INTGR_nsteps = 10_000
__INTGR_method = "bdf"
__HI_g_scale = None
__HI_sample_method = "random"
__HI_nonlinear = True
__HI_normalized = False
__HI_normalized_by_hand = True
__HI_with_terminator = False
# __HI_result_data = hid.RESULT_TYPE_ZEROTH_ORDER_ONLY
__HI_result_data = hid.ResultType.ZEROTH_AND_FIRST_ORDER
#################################################
#
# DB and Server/Client parameters
#
#################################################
__db_name = "SBM"
__db_path = "."
__host = "localhost"
__verbose = 1
__authkey = __db_name
__desc = __db_name
__port = 35254
__nproc = 0
__nice = 19