mirror of
https://github.com/vale981/master-thesis
synced 2025-03-05 10:01:43 -05:00
upgrade 05 to new hops :P and new truncation scheme
This commit is contained in:
parent
9491e58363
commit
7c2f5624f4
3 changed files with 174 additions and 12 deletions
|
@ -6,10 +6,15 @@ This will be tangled into the [[file:config.py][config file]] that can be used w
|
|||
from hops.core.hierarchy_parameters import HIParams, HiP, IntP, SysP, ResultType
|
||||
from stocproc.stocproc import StocProc_TanhSinh
|
||||
from hops.util.bcf_fits import get_ohm_g_w
|
||||
from hops.util.truncation_schemes import TruncationScheme_Power_multi
|
||||
from hops.util.truncation_schemes import (
|
||||
TruncationScheme_Power_multi,
|
||||
BathMemory,
|
||||
)
|
||||
from hops.util.abstract_truncation_scheme import (
|
||||
TruncationScheme_Simplex
|
||||
)
|
||||
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
|
||||
|
@ -35,8 +40,10 @@ This will be tangled into the [[file:config.py][config file]] that can be used w
|
|||
bcf_terms: int = 4,
|
||||
t_max: float = 10,
|
||||
k_fac: float = 1.4,
|
||||
inf_tol: float = 0.1,
|
||||
sp_tol: float = 1e-3,
|
||||
bcf_scale: list[float] = [0.5, 0.5],
|
||||
truncation_scheme: str = "power",
|
||||
T: float = 0.3,
|
||||
):
|
||||
# The BCF fit
|
||||
|
@ -81,7 +88,13 @@ This will be tangled into the [[file:config.py][config file]] that can be used w
|
|||
result_type=ResultType.ZEROTH_AND_FIRST_ORDER,
|
||||
truncation_scheme=TruncationScheme_Power_multi.from_g_w(
|
||||
g=system.g, w=system.w, p=[1, 1], q=[0.5, 0.5], kfac=[k_fac] * 2
|
||||
),
|
||||
)
|
||||
if truncation_scheme == "power"
|
||||
else BathMemory.from_system(
|
||||
system, nonlinear=True, influence_tolerance=inf_tol
|
||||
)
|
||||
if truncation_scheme == "bath_memory"
|
||||
else TruncationScheme_Simplex(5),
|
||||
save_therm_rng_seed=True,
|
||||
),
|
||||
Eta=[
|
||||
|
@ -191,14 +204,15 @@ This will be tangled into the [[file:config.py][config file]] that can be used w
|
|||
- better
|
||||
*** 8 HO Levels
|
||||
#+begin_src jupyter-python :results none :async no :tangle config.py
|
||||
params = make_config(
|
||||
make_config(
|
||||
max_HO_level=8,
|
||||
bcf_terms=4,
|
||||
t_max=50,
|
||||
k_fac=1.5,
|
||||
inf_tol=.2,
|
||||
sp_tol=1e-6,
|
||||
bcf_scale=[.3, .3],
|
||||
T=.2
|
||||
T=.2,
|
||||
truncation_scheme="bath_memory"
|
||||
)
|
||||
#+end_src
|
||||
|
||||
|
@ -215,6 +229,89 @@ This will be tangled into the [[file:config.py][config file]] that can be used w
|
|||
logger.setLevel(logging.INFO)
|
||||
#+end_src
|
||||
|
||||
** Convergence Testing
|
||||
#+begin_src jupyter-python :results none
|
||||
with_power = make_config(
|
||||
max_HO_level=8,
|
||||
bcf_terms=4,
|
||||
t_max=50,
|
||||
k_fac=1.5,
|
||||
sp_tol=1e-6,
|
||||
bcf_scale=[.3, .3],
|
||||
T=.2
|
||||
)
|
||||
#+end_src
|
||||
|
||||
#+begin_src jupyter-python :results none
|
||||
with_inftol = make_config(
|
||||
max_HO_level=8,
|
||||
bcf_terms=4,
|
||||
t_max=50,
|
||||
inf_tol=.2,
|
||||
sp_tol=1e-6,
|
||||
bcf_scale=[.3, .3],
|
||||
T=.2,
|
||||
truncation_scheme="bath_memory"
|
||||
)
|
||||
#+end_src
|
||||
|
||||
#+begin_src jupyter-python :results none
|
||||
with_simplex = make_config(
|
||||
max_HO_level=8,
|
||||
bcf_terms=4,
|
||||
t_max=50,
|
||||
inf_tol=0.2,
|
||||
sp_tol=1e-6,
|
||||
bcf_scale=[0.3, 0.3],
|
||||
T=0.2,
|
||||
truncation_scheme="simplex",
|
||||
)
|
||||
#+end_src
|
||||
|
||||
#+begin_src jupyter-python :results none
|
||||
configs = [with_simplex, with_inftol, with_power]
|
||||
from hops.core.integration import HOPSSupervisor
|
||||
supervisors = [HOPSSupervisor(config, number_of_samples=1, data_name="data_conv") for config in configs]
|
||||
#+end_src
|
||||
|
||||
#+begin_src jupyter-python
|
||||
for sup in supervisors:
|
||||
sup.integrate_single_process()
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
:RESULTS:
|
||||
: INFO:hops.core.integration:Some 1 trajectories have to be integrated.
|
||||
: 0% 0/1 [00:00<?, ?it/s]INFO:hops.core.integration:Some 1 trajectories have to be integrated.
|
||||
: 0% 0/1 [00:00<?, ?it/s]INFO:hops.core.integration:Some 1 trajectories have to be integrated.
|
||||
: 0% 0/1 [00:00<?, ?it/s]
|
||||
:END:
|
||||
|
||||
#+begin_src jupyter-python :results none
|
||||
trajectories = []
|
||||
for supervisor in supervisors:
|
||||
with supervisor.get_data(True) as data:
|
||||
τ = data.get_time()
|
||||
trajectories.append(data.get_stoc_traj(0))
|
||||
#+end_src
|
||||
|
||||
#+begin_src jupyter-python :results none
|
||||
diffs = [np.linalg.norm(trajectories[0] - trajectories[1], axis=1), np.linalg.norm(trajectories[0] - trajectories[2], axis=1)]
|
||||
#+end_src
|
||||
|
||||
#+begin_src jupyter-python
|
||||
plt.plot(τ, diffs[0])
|
||||
plt.plot(τ, diffs[1], label="power")
|
||||
plt.legend()
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
:RESULTS:
|
||||
: <matplotlib.legend.Legend at 0x7fad74377670>
|
||||
[[file:./.ob-jupyter/c3d123861a6902621b521c00b1b23db0ec8fe931.svg]]
|
||||
:END:
|
||||
- yay, new criterion is way better ;P
|
||||
|
||||
** Init Gaussflow
|
||||
#+begin_src jupyter-python :results none
|
||||
from hopsflow import gaussflow_two as gf
|
||||
|
|
|
@ -46,6 +46,57 @@ import logging
|
|||
logger = logging.getLogger()
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
with_power = make_config(
|
||||
max_HO_level=8,
|
||||
bcf_terms=4,
|
||||
t_max=50,
|
||||
k_fac=1.5,
|
||||
sp_tol=1e-6,
|
||||
bcf_scale=[.3, .3],
|
||||
T=.2
|
||||
)
|
||||
|
||||
with_inftol = make_config(
|
||||
max_HO_level=8,
|
||||
bcf_terms=4,
|
||||
t_max=50,
|
||||
inf_tol=.2,
|
||||
sp_tol=1e-6,
|
||||
bcf_scale=[.3, .3],
|
||||
T=.2,
|
||||
truncation_scheme="bath_memory"
|
||||
)
|
||||
|
||||
with_simplex = make_config(
|
||||
max_HO_level=8,
|
||||
bcf_terms=4,
|
||||
t_max=50,
|
||||
inf_tol=0.2,
|
||||
sp_tol=1e-6,
|
||||
bcf_scale=[0.3, 0.3],
|
||||
T=0.2,
|
||||
truncation_scheme="simplex",
|
||||
)
|
||||
|
||||
configs = [with_simplex, with_inftol, with_power]
|
||||
from hops.core.integration import HOPSSupervisor
|
||||
supervisors = [HOPSSupervisor(config, number_of_samples=1, data_name="data_conv") for config in configs]
|
||||
|
||||
for sup in supervisors:
|
||||
sup.integrate_single_process()
|
||||
|
||||
trajectories = []
|
||||
for supervisor in supervisors:
|
||||
with supervisor.get_data(True) as data:
|
||||
τ = data.get_time()
|
||||
trajectories.append(data.get_stoc_traj(0))
|
||||
|
||||
diffs = [np.linalg.norm(trajectories[0] - trajectories[1], axis=1), np.linalg.norm(trajectories[0] - trajectories[2], axis=1)]
|
||||
|
||||
plt.plot(τ, diffs[0])
|
||||
plt.plot(τ, diffs[1], label="power")
|
||||
plt.legend()
|
||||
|
||||
from hopsflow import gaussflow_two as gf
|
||||
from hopsflow import util as util
|
||||
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
from hops.core.hierarchy_parameters import HIParams, HiP, IntP, SysP, ResultType
|
||||
from stocproc.stocproc import StocProc_TanhSinh
|
||||
from hops.util.bcf_fits import get_ohm_g_w
|
||||
from hops.util.truncation_schemes import TruncationScheme_Power_multi
|
||||
from hops.util.truncation_schemes import (
|
||||
TruncationScheme_Power_multi,
|
||||
BathMemory,
|
||||
)
|
||||
from hops.util.abstract_truncation_scheme import (
|
||||
TruncationScheme_Simplex
|
||||
)
|
||||
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
|
||||
|
@ -30,8 +35,10 @@ def make_config(
|
|||
bcf_terms: int = 4,
|
||||
t_max: float = 10,
|
||||
k_fac: float = 1.4,
|
||||
inf_tol: float = 0.1,
|
||||
sp_tol: float = 1e-3,
|
||||
bcf_scale: list[float] = [0.5, 0.5],
|
||||
truncation_scheme: str = "power",
|
||||
T: float = 0.3,
|
||||
):
|
||||
# The BCF fit
|
||||
|
@ -76,7 +83,13 @@ def make_config(
|
|||
result_type=ResultType.ZEROTH_AND_FIRST_ORDER,
|
||||
truncation_scheme=TruncationScheme_Power_multi.from_g_w(
|
||||
g=system.g, w=system.w, p=[1, 1], q=[0.5, 0.5], kfac=[k_fac] * 2
|
||||
),
|
||||
)
|
||||
if truncation_scheme == "power"
|
||||
else BathMemory.from_system(
|
||||
system, nonlinear=True, influence_tolerance=inf_tol
|
||||
)
|
||||
if truncation_scheme == "bath_memory"
|
||||
else TruncationScheme_Simplex(5),
|
||||
save_therm_rng_seed=True,
|
||||
),
|
||||
Eta=[
|
||||
|
@ -124,12 +137,13 @@ def make_config(
|
|||
|
||||
return params
|
||||
|
||||
params = make_config(
|
||||
make_config(
|
||||
max_HO_level=8,
|
||||
bcf_terms=4,
|
||||
t_max=50,
|
||||
k_fac=1.5,
|
||||
inf_tol=.2,
|
||||
sp_tol=1e-6,
|
||||
bcf_scale=[.3, .3],
|
||||
T=.2
|
||||
T=.2,
|
||||
truncation_scheme="bath_memory"
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue