diff --git a/python/energy_flow_proper/10_antizeno_engine/10_first_anti_zeno.py b/python/energy_flow_proper/10_antizeno_engine/10_first_anti_zeno.py index ebc0ba7..f5b4cf4 100644 --- a/python/energy_flow_proper/10_antizeno_engine/10_first_anti_zeno.py +++ b/python/energy_flow_proper/10_antizeno_engine/10_first_anti_zeno.py @@ -20,7 +20,17 @@ import logging logging_setup(logging.INFO, show_stocproc=False) def anti_zeno_engine( - Δ=5, γ=0.1 / 2, ω_c=1, ω_0=6, ε=1e-3, ε_couple=1 / 2, n=6, cycle_scale=1, switch_cycles=3, detune = 0 + Δ=5, + γ=0.1 / 2, + ω_c=1, + ω_0=6, + ε=1e-3, + ε_couple=1 / 2, + n=6, + cycle_scale=1, + switch_cycles=3, + detune=0, + δ=[2]*2 ): # τ_bath = 1 / ω_c τ_mod = 2 * np.pi / Δ @@ -65,7 +75,7 @@ def anti_zeno_engine( model = QubitModelMutliBath( δ=[2, 2], ω_c=[ω_c, ω_c], - ω_s=[ω_0 - Δ - ω_c + detune, ω_0 + Δ - ω_c - detune], + ω_s=[ω_0 - Δ - ω_c - detune, ω_0 + Δ - ω_c - detune], t=ut.linspace_with_strobe(0, t_max, n * 1000, Δ), ψ_0=(0 * qt.basis([2], [0]) + qt.basis([2], [1])), description=f"Building the anti-zento-engine", @@ -80,14 +90,15 @@ def anti_zeno_engine( therm_methods=["tanhsinh", "fft"], ) - return model, (τ_mod, τ_c, τ_bath, cycles, model.ω_s) + return model, Δ, (τ_mod, τ_c, τ_bath, cycles, model.ω_s) -model, params = anti_zeno_engine(ε=1/2, ε_couple=1e-10, n=1, detune=.5) +model, Δ, params = anti_zeno_engine(ε=1/2, ε_couple=1e-10, n=1, detune=5, ω_0 = 10) +#model, params = anti_zeno_engine(ε=1/2, ε_couple=1e-4, n=1, detune=.5, δ=[.1,.1]) params -aux.integrate(model, 1000) +aux.integrate(model, 100) _, ax = fs.plot_energy_overview(model, markersize=1) # with aux.get_data(model) as data: diff --git a/python/energy_flow_proper/10_antizeno_engine/anti_zeno_engine.org b/python/energy_flow_proper/10_antizeno_engine/anti_zeno_engine.org index b668d1a..762e88f 100644 --- a/python/energy_flow_proper/10_antizeno_engine/anti_zeno_engine.org +++ b/python/energy_flow_proper/10_antizeno_engine/anti_zeno_engine.org @@ -26,7 +26,7 @@ Init ray and silence stocproc. #+end_src #+RESULTS: -: RayContext(dashboard_url='', python_version='3.9.12', ray_version='1.12.1', ray_commit='4863e33856b54ccf8add5cbe75e41558850a1b75', address_info={'node_ip_address': '192.168.5.199', 'raylet_ip_address': '192.168.5.199', 'redis_address': None, 'object_store_address': '/tmp/ray/session_2022-06-13_10-34-07_952574_13972/sockets/plasma_store', 'raylet_socket_name': '/tmp/ray/session_2022-06-13_10-34-07_952574_13972/sockets/raylet', 'webui_url': '', 'session_dir': '/tmp/ray/session_2022-06-13_10-34-07_952574_13972', 'metrics_export_port': 53066, 'gcs_address': '192.168.5.199:65472', 'address': '192.168.5.199:65472', 'node_id': '07f03a66362d550884894637c253be83263961b18a3d40ac2cf5eb2c'}) +: RayContext(dashboard_url='', python_version='3.9.12', ray_version='1.12.1', ray_commit='4863e33856b54ccf8add5cbe75e41558850a1b75', address_info={'node_ip_address': '192.168.5.199', 'raylet_ip_address': '192.168.5.199', 'redis_address': None, 'object_store_address': '/tmp/ray/session_2022-06-13_11-24-26_407050_23528/sockets/plasma_store', 'raylet_socket_name': '/tmp/ray/session_2022-06-13_11-24-26_407050_23528/sockets/raylet', 'webui_url': '', 'session_dir': '/tmp/ray/session_2022-06-13_11-24-26_407050_23528', 'metrics_export_port': 50809, 'gcs_address': '192.168.5.199:52030', 'address': '192.168.5.199:52030', 'node_id': '0535cf462e326eb68669025c6e3b1dc9896e726fe3b70941a8c6c6b3'}) #+begin_src jupyter-python :results none from hops.util.logging_setup import logging_setup @@ -37,7 +37,17 @@ Init ray and silence stocproc. * Model Definition #+begin_src jupyter-python :results none def anti_zeno_engine( - Δ=5, γ=0.1 / 2, ω_c=1, ω_0=6, ε=1e-3, ε_couple=1 / 2, n=6, cycle_scale=1, switch_cycles=3, detune = 0 + Δ=5, + γ=0.1 / 2, + ω_c=1, + ω_0=6, + ε=1e-3, + ε_couple=1 / 2, + n=6, + cycle_scale=1, + switch_cycles=3, + detune=0, + δ=[2]*2 ): # τ_bath = 1 / ω_c τ_mod = 2 * np.pi / Δ @@ -82,7 +92,7 @@ Init ray and silence stocproc. model = QubitModelMutliBath( δ=[2, 2], ω_c=[ω_c, ω_c], - ω_s=[ω_0 - Δ - ω_c + detune, ω_0 + Δ - ω_c - detune], + ω_s=[ω_0 - Δ - ω_c - detune, ω_0 + Δ - ω_c - detune], t=ut.linspace_with_strobe(0, t_max, n * 1000, Δ), ψ_0=(0 * qt.basis([2], [0]) + qt.basis([2], [1])), description=f"Building the anti-zento-engine", @@ -97,18 +107,19 @@ Init ray and silence stocproc. therm_methods=["tanhsinh", "fft"], ) - return model, (τ_mod, τ_c, τ_bath, cycles, model.ω_s) + return model, Δ, (τ_mod, τ_c, τ_bath, cycles, model.ω_s) #+end_src * Model Definition #+begin_src jupyter-python - model, params = anti_zeno_engine(ε=1/2, ε_couple=1e-10, n=1, detune=.5) + model, Δ, params = anti_zeno_engine(ε=1/2, ε_couple=1e-10, n=1, detune=5, ω_0 = 10) + #model, params = anti_zeno_engine(ε=1/2, ε_couple=1e-4, n=1, detune=.5, δ=[.1,.1]) params #+end_src #+RESULTS: -| 1.2566370614359172 | 348.08846601774906 | 347.6950495572053 | 277 | (0.5 9.5) | +| 1.2566370614359172 | 348.08846601774906 | 347.6950495572053 | 277 | (-1 9) | Let's test the assumptions of the paper. @@ -122,34 +133,112 @@ Let's test the assumptions of the paper. return model.bcf(1)(t) + 2 * (model.thermal_correlations(1)(t).real) plt.plot(model.t, np.abs(thermal_bcf(model.t))/np.abs(thermal_bcf(0))) plt.plot(model.t, model.L[0].operator_norm(model.t)) - #plt.plot(model.t, model.H.operator_norm(model.t) - ω_0/2) + plt.plot(model.t, model.H.operator_norm(model.t)/model.H.max_operator_norm(model.t.max())) plt.plot(model.t, np.exp(- model.t * np.min(np.array(model.bcf_coefficients()[1][0]).real))) #+end_src #+RESULTS: :RESULTS: -| | -[[file:./.ob-jupyter/69cb662158ab6d839a8f0254c23d8d29a846be2d.svg]] +| | +[[file:./.ob-jupyter/d68cd13212be9df27c475423cb36714795dc5870.svg]] :END: #+begin_src jupyter-python :tangle nil ωs = np.linspace(0, 20, 1000) plt.plot(ωs, model.spectral_density(0)(ωs)) plt.plot(ωs, model.spectral_density(1)(ωs)) + plt.axvline(model.H.operator_norm(0) * 2 + Δ) + plt.axvline(model.H.operator_norm(0) * 2 - Δ) #+end_src #+RESULTS: :RESULTS: -| | -[[file:./.ob-jupyter/7c8fbae15d5d9ea0c78371aa8253c2c167834f08.svg]] +: +[[file:./.ob-jupyter/72084cacfca9cdc33725619b1585143f92f10b51.svg]] :END: ** TODO Integration #+begin_src jupyter-python - aux.integrate(model, 1000) + aux.integrate(model, 100) #+end_src +#+RESULTS: +:RESULTS: +: [INFO hops.core.integration 22464] Choosing the nonlinear integrator. +: /home/hiro/src/hops/hops/core/hierarchy_data.py:497: UserWarning: test_file_version FAILED with exception Unable to open file (file is already open for write/SWMR write (may use to clear file consistency flags)) +: warnings.warn( +: /home/hiro/src/hops/hops/core/hierarchy_data.py:500: UserWarning: hdf5_name .data/5dcdeeef6e79bd5c4ee636c23a1905053441c9fa49ea5b8f516844fd17e69033/_3/5dcdeeef6e79bd5c4ee636c23a1905053441c9fa49ea5b8f516844fd17e69033_3a50d7c5e5577f16c8ee57fead7fa546_1.h5 +: warnings.warn("hdf5_name {}".format(self.hdf5_name)) +: /home/hiro/src/hops/hops/core/hierarchy_data.py:503: UserWarning: Moving .data/5dcdeeef6e79bd5c4ee636c23a1905053441c9fa49ea5b8f516844fd17e69033/_3/5dcdeeef6e79bd5c4ee636c23a1905053441c9fa49ea5b8f516844fd17e69033_3a50d7c5e5577f16c8ee57fead7fa546_1.h5 to .data/5dcdeeef6e79bd5c4ee636c23a1905053441c9fa49ea5b8f516844fd17e69033/_3/5dcdeeef6e79bd5c4ee636c23a1905053441c9fa49ea5b8f516844fd17e69033_3a50d7c5e5577f16c8ee57fead7fa546_1.h5backup_1655110347.2761068 and starting fresh. +: warnings.warn( +# [goto error] +#+begin_example + --------------------------------------------------------------------------- + RaySystemError Traceback (most recent call last) + Input In [8], in () + ----> 1 aux.integrate(model, 100) + + File ~/src/two_qubit_model/hiro_models/model_auxiliary.py:108, in integrate(model, n, data_path, clear_pd) +  98 # with model_db(data_path) as db: +  99 # if hash in db and "data" db[hash] +  101 supervisor = HOPSSupervisor( +  102 model.hops_config, +  103 n, +  104 data_path=data_path, +  105 data_name=hash, +  106 ) + --> 108 supervisor.integrate(clear_pd) +  110 with supervisor.get_data(True) as data: +  111 with model_db(data_path) as db: + + File ~/src/hops/hops/core/integration.py:1238, in HOPSSupervisor.integrate(self, clear_pd) +  1235 with self.get_data_and_maybe_clear(clear_pd) as data: +  1236 t = data.get_time() + -> 1238 num_integrators = int(ray.available_resources().get("CPU", 0)) +  1240 if num_integrators == 0: +  1241 raise RuntimeError("No cpu available for integration!") + + File /nix/store/pwhaggpgvxhy410r6vlx448v9lp8n08s-python3-3.9.12-env/lib/python3.9/site-packages/ray/_private/client_mode_hook.py:105, in client_mode_hook..wrapper(*args, **kwargs) +  103 if func.__name__ != "init" or is_client_mode_enabled_by_default: +  104 return getattr(ray, func.__name__)(*args, **kwargs) + --> 105 return func(*args, **kwargs) + + File /nix/store/pwhaggpgvxhy410r6vlx448v9lp8n08s-python3-3.9.12-env/lib/python3.9/site-packages/ray/state.py:912, in available_resources() +  898 @DeveloperAPI +  899 @client_mode_hook(auto_init=False) +  900 def available_resources(): +  901 """Get the current available cluster resources. +  902 +  903  This is different from `cluster_resources` in that this will return idle +  (...) +  910  resource in the cluster. +  911  """ + --> 912 return state.available_resources() + + File /nix/store/pwhaggpgvxhy410r6vlx448v9lp8n08s-python3-3.9.12-env/lib/python3.9/site-packages/ray/state.py:724, in GlobalState.available_resources(self) +  712 def available_resources(self): +  713 """Get the current available cluster resources. +  714 +  715  This is different from `cluster_resources` in that this will return +  (...) +  722  resource in the cluster. +  723  """ + --> 724 self._check_connected() +  726 available_resources_by_id = self._available_resources_per_node() +  728 # Calculate total available resources. + + File /nix/store/pwhaggpgvxhy410r6vlx448v9lp8n08s-python3-3.9.12-env/lib/python3.9/site-packages/ray/state.py:48, in GlobalState._check_connected(self) +  46 # _really_init_global_state should have set self.global_state_accessor +  47 if self.global_state_accessor is None: + ---> 48 raise ray.exceptions.RaySystemError( +  49 "Ray has not been started yet. You can start Ray with 'ray.init()'." +  50 ) + + RaySystemError: System error: Ray has not been started yet. You can start Ray with 'ray.init()'. +#+end_example +:END: + #+begin_src jupyter-python _, ax = fs.plot_energy_overview(model, markersize=1) @@ -161,8 +250,36 @@ Let's test the assumptions of the paper. #+RESULTS: :RESULTS: -: -[[file:./.ob-jupyter/508e73e3013240ee3be5f6c1f1282dfd9af71d98.svg]] +# [goto error] +#+begin_example + --------------------------------------------------------------------------- + RuntimeError Traceback (most recent call last) + Input In [51], in () + ----> 1 _, ax = fs.plot_energy_overview(model, markersize=1) +  2 # with aux.get_data(model) as data: +  3 # fs.plot_with_σ(model.t, model.total_energy(data), ax=ax) +  5 ax.legend() + + File ~/Documents/Projects/UNI/master/masterarb/python/energy_flow_proper/10_antizeno_engine/figsaver.py:495, in plot_energy_overview(model, ensemble_args, **kwargs) +  491 ensemble_args = {} +  493 fig, ax = plt.subplots() + --> 495 with aux.get_data(model) as data: +  496 system_energy = model.system_energy(data, **ensemble_args) +  497 bath_energy = model.bath_energy(data, **ensemble_args) + + File ~/src/two_qubit_model/hiro_models/model_auxiliary.py:146, in get_data(model, data_path, read_only, **kwargs) +  135 return HIData( +  136 path, +  137 hi_key=model.hops_config, +  (...) +  142 **kwargs, +  143 ) +  145 else: + --> 146 raise RuntimeError(f"No data found for model with hash '{hexhash}'.") + + RuntimeError: No data found for model with hash '3d9833cf167312158bc916c6bd14d7af84a33e3a83974fa07c121059176438ec'. +#+end_example +[[file:./.ob-jupyter/644935f5bd4c8d288ddfc65c0c2b7d99c4abe4d1.svg]] :END: - **too fast decoupling kills it** @@ -233,7 +350,7 @@ We need the time points where we sample the total energy. #+end_src #+RESULTS: -[[file:./.ob-jupyter/a5c8087ba2dd5cedc8d7fa99833ee0725d40a9d4.svg]] +[[file:./.ob-jupyter/f6f9936f1326d0a6d63fdfb7293f6f354acd5b54.svg]] #+begin_src jupyter-python with aux.get_data(model) as data: