qupled 1.3.3__tar.gz → 1.3.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {qupled-1.3.3 → qupled-1.3.5}/.gitignore +1 -1
- {qupled-1.3.3 → qupled-1.3.5}/PKG-INFO +1 -1
- {qupled-1.3.3 → qupled-1.3.5}/docs/examples.rst +4 -5
- {qupled-1.3.3 → qupled-1.3.5}/docs/qupled.rst +9 -9
- {qupled-1.3.3 → qupled-1.3.5}/examples/docs/fixed_adr.py +2 -5
- {qupled-1.3.3 → qupled-1.3.5}/examples/docs/initial_guess_stls.py +2 -3
- {qupled-1.3.3 → qupled-1.3.5}/examples/docs/solve_quantum_schemes.py +12 -11
- {qupled-1.3.3 → qupled-1.3.5}/examples/docs/solve_qvsstls.py +4 -7
- {qupled-1.3.3 → qupled-1.3.5}/examples/docs/solve_rpa_and_esa.py +2 -2
- {qupled-1.3.3 → qupled-1.3.5}/examples/docs/solve_stls.py +2 -3
- {qupled-1.3.3 → qupled-1.3.5}/examples/docs/solve_stls_iet.py +2 -4
- {qupled-1.3.3 → qupled-1.3.5}/examples/docs/solve_vsstls.py +2 -4
- {qupled-1.3.3 → qupled-1.3.5}/examples/readme/create_cover.py +5 -5
- {qupled-1.3.3 → qupled-1.3.5}/examples/tests/test_examples.py +4 -3
- {qupled-1.3.3 → qupled-1.3.5}/pyproject.toml +1 -1
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/database.py +91 -32
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/esa.py +11 -5
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/hf.py +141 -74
- qupled-1.3.5/src/qupled/mpi.py +104 -0
- qupled-1.3.5/src/qupled/native/include/database.hpp +27 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/input.hpp +3 -3
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/logger.hpp +4 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/mpi_util.hpp +7 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/qstls.hpp +13 -4
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/vsbase.hpp +1 -2
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/CMakeLists.txt +1 -0
- qupled-1.3.5/src/qupled/native/src/database.cpp +12 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/hf.cpp +1 -1
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/input.cpp +1 -0
- qupled-1.3.5/src/qupled/native/src/logger.cpp +14 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/mpi_util.cpp +16 -2
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/python_interface/inputs.cpp +8 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/python_interface/native.cpp +0 -7
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/python_interface/schemes.cpp +13 -1
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/python_interface/utilities.cpp +9 -18
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/qstls.cpp +71 -10
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/qstlsiet.cpp +8 -1
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/vsbase.cpp +1 -2
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/qstls.py +13 -10
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/qstlsiet.py +13 -10
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/qvsstls.py +13 -11
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/rpa.py +11 -7
- qupled-1.3.5/src/qupled/serialize.py +43 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/stls.py +29 -26
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/stlsiet.py +34 -25
- qupled-1.3.5/src/qupled/timer.py +33 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/vsstls.py +44 -42
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled.egg-info/PKG-INFO +1 -1
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled.egg-info/SOURCES.txt +3 -0
- {qupled-1.3.3 → qupled-1.3.5}/tests/test_database.py +72 -46
- {qupled-1.3.3 → qupled-1.3.5}/tests/test_esa.py +4 -8
- {qupled-1.3.3 → qupled-1.3.5}/tests/test_hf.py +21 -8
- qupled-1.3.5/tests/test_mpi.py +1 -0
- {qupled-1.3.3 → qupled-1.3.5}/tests/test_qstls.py +7 -11
- {qupled-1.3.3 → qupled-1.3.5}/tests/test_qstlsiet.py +11 -12
- {qupled-1.3.3 → qupled-1.3.5}/tests/test_qvsstls.py +8 -14
- {qupled-1.3.3 → qupled-1.3.5}/tests/test_rpa.py +4 -8
- {qupled-1.3.3 → qupled-1.3.5}/tests/test_stls.py +6 -12
- {qupled-1.3.3 → qupled-1.3.5}/tests/test_stlsiet.py +11 -12
- {qupled-1.3.3 → qupled-1.3.5}/tests/test_vsstls.py +15 -18
- qupled-1.3.3/src/qupled/mpi.py +0 -69
- qupled-1.3.3/src/qupled/native/include/database.hpp +0 -18
- qupled-1.3.3/src/qupled/native/src/logger.cpp +0 -11
- qupled-1.3.3/tests/test_mpi.py +0 -63
- {qupled-1.3.3 → qupled-1.3.5}/.clang-format +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/.devcontainer/Dockerfile +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/.devcontainer/devcontainer.json +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/.github/workflows/build-and-test.yml +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/.github/workflows/build-linux-wheels.yml +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/.github/workflows/build-macos-wheels.yml +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/.github/workflows/build-sdist.yml +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/.github/workflows/formatting.yml +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/.github/workflows/release.yml +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/.readthedocs.yaml +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/LICENSE +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/MANIFEST.in +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/README.md +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/dev/devtool.py +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/dev/requirements-apt.txt +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/dev/requirements-brew.txt +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/dev/requirements-pip.txt +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/devtool +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/docs/_static/css/rdt_theme_python_properties.css +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/docs/conf.py +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/docs/contribute.rst +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/docs/index.rst +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/docs/introduction.rst +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/docs/make.bat +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/docs/requirements.txt +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/examples/readme/qupled_animation_dark.svg +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/examples/readme/qupled_animation_light.svg +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/manylinux/Dockerfile.manylinux_2_28 +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/manylinux/build_manylinux_2_28 +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/setup.cfg +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/setup.py +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/__init__.py +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/chemical_potential.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/dual.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/esa.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/format.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/free_energy.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/hf.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/iet.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/internal_energy.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/num_util.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/numerics.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/python_interface/inputs.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/python_interface/schemes.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/python_interface/util.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/python_interface/utilities.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/qstlsiet.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/qvsstls.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/rdf.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/rpa.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/stls.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/stlsiet.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/thermo_util.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/vector2D.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/vector3D.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/vector_util.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/include/vsstls.hpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/chemical_potential.cpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/esa.cpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/free_energy.cpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/iet.cpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/internal_energy.cpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/num_util.cpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/numerics.cpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/python_interface/util.cpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/qvsstls.cpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/rdf.cpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/rpa.cpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/stls.cpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/stlsiet.cpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/thermo_util.cpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/vector2D.cpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/vector3D.cpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/vector_util.cpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/native/src/vsstls.cpp +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled/output.py +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled.egg-info/dependency_links.txt +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled.egg-info/not-zip-safe +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled.egg-info/requires.txt +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/src/qupled.egg-info/top_level.txt +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/tests/native/conftest.py +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/tests/native/test_esa_native.py +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/tests/native/test_hf_native.py +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/tests/native/test_qstls_iet_native.py +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/tests/native/test_qstls_native.py +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/tests/native/test_qvsstls_native.py +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/tests/native/test_rpa_native.py +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/tests/native/test_stls_iet_native.py +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/tests/native/test_stls_native.py +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/tests/native/test_vsstls_native.py +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/tests/test_output.py +0 -0
- {qupled-1.3.3 → qupled-1.3.5}/tox.ini +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: qupled
|
3
|
-
Version: 1.3.
|
3
|
+
Version: 1.3.5
|
4
4
|
Summary: qupled: a package to investigate quantum plasmas via the dielectric formalism
|
5
5
|
Author-email: Federico Lucco Castello <federico.luccocastello@gmail.com>
|
6
6
|
License-Expression: GPL-3.0-or-later
|
@@ -90,11 +90,10 @@ The quantum schemes can have a significant computational cost. There are two str
|
|
90
90
|
that can be employed to speed up the calculations:
|
91
91
|
|
92
92
|
* *Parallelization*: qupled supports both multithreaded calculations with OpenMP and
|
93
|
-
multiprocessors computations with MPI.
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
used concurrently by setting both the number of threads and the number of cores.
|
93
|
+
multiprocessors computations with MPI. OpenMP and MPI can be
|
94
|
+
used concurrently by setting both the number of threads and the number of cores in the
|
95
|
+
input dataclasses. Use `threads` to set the number of OMP threads and `processes` to
|
96
|
+
set the number of MPI processes.
|
98
97
|
|
99
98
|
* *Pre-computation*: The calculations for the quantum schemes can be made significantly
|
100
99
|
faster if part of the calculation of the auxiliary density response can be skipped.
|
@@ -35,7 +35,7 @@ The solution parameters are specified with a dedicated class called :obj:`qupled
|
|
35
35
|
After the solution is completed the results are stored in an object :obj:`qupled.hf.Result`
|
36
36
|
and written to the output database.
|
37
37
|
|
38
|
-
.. autoclass:: qupled.hf.
|
38
|
+
.. autoclass:: qupled.hf.Solver
|
39
39
|
:members:
|
40
40
|
|
41
41
|
.. autoclass:: qupled.hf.Input
|
@@ -55,7 +55,7 @@ The solution parameters are specified with a dedicated class called :obj:`qupled
|
|
55
55
|
After the solution is completed the results are stored in an object :obj:`qupled.hf.Result`
|
56
56
|
and written to the output database.
|
57
57
|
|
58
|
-
.. autoclass:: qupled.rpa.
|
58
|
+
.. autoclass:: qupled.rpa.Solver
|
59
59
|
:show-inheritance:
|
60
60
|
:members:
|
61
61
|
|
@@ -72,7 +72,7 @@ The solution parameters are specified with a dedicated class called :obj:`qupled
|
|
72
72
|
After the solution is completed the results are stored in an object :obj:`qupled.stls.Result`
|
73
73
|
and written to the output database.
|
74
74
|
|
75
|
-
.. autoclass:: qupled.stls.
|
75
|
+
.. autoclass:: qupled.stls.Solver
|
76
76
|
:show-inheritance:
|
77
77
|
:members:
|
78
78
|
|
@@ -97,7 +97,7 @@ The solution parameters are specified with a dedicated class called :obj:`qupled
|
|
97
97
|
After the solution is completed the results are stored in an object :obj:`qupled.stlsiet.Result`
|
98
98
|
and written to the output database.
|
99
99
|
|
100
|
-
.. autoclass:: qupled.stlsiet.
|
100
|
+
.. autoclass:: qupled.stlsiet.Solver
|
101
101
|
:show-inheritance:
|
102
102
|
:members:
|
103
103
|
|
@@ -122,7 +122,7 @@ The solution parameters are specified with a dedicated class called :obj:`qupled
|
|
122
122
|
After the solution is completed the results are stored in an object :obj:`qupled.vsstls.Result`
|
123
123
|
and written to the output database.
|
124
124
|
|
125
|
-
.. autoclass:: qupled.vsstls.
|
125
|
+
.. autoclass:: qupled.vsstls.Solver
|
126
126
|
:show-inheritance:
|
127
127
|
:members:
|
128
128
|
:exclude-members: get_free_energy_integrand
|
@@ -151,7 +151,7 @@ The solution parameters are specified with a dedicated class called :obj:`qupled
|
|
151
151
|
After the solution is completed the results are stored in an object :obj:`qupled.hf.Result`
|
152
152
|
and written to the output database.
|
153
153
|
|
154
|
-
.. autoclass:: qupled.esa.
|
154
|
+
.. autoclass:: qupled.esa.Solver
|
155
155
|
:show-inheritance:
|
156
156
|
:members:
|
157
157
|
|
@@ -171,7 +171,7 @@ TThe solution parameters are specified with a dedicated class called :obj:`quple
|
|
171
171
|
After the solution is completed the results are stored in an object :obj:`qupled.qstls.Result`
|
172
172
|
and written to the output database.
|
173
173
|
|
174
|
-
.. autoclass:: qupled.qstls.
|
174
|
+
.. autoclass:: qupled.qstls.Solver
|
175
175
|
:show-inheritance:
|
176
176
|
:members:
|
177
177
|
:exclude-members: find_fixed_adr_in_database
|
@@ -190,7 +190,7 @@ The solution parameters are specified with a dedicated class called :obj:`qupled
|
|
190
190
|
After the solution is completed the results are stored in an object :obj:`qupled.qstlsiet.Result`
|
191
191
|
and written to the output database.
|
192
192
|
|
193
|
-
.. autoclass:: qupled.qstlsiet.
|
193
|
+
.. autoclass:: qupled.qstlsiet.Solver
|
194
194
|
:show-inheritance:
|
195
195
|
:members:
|
196
196
|
:exclude-members: find_fixed_adr_in_database
|
@@ -207,7 +207,7 @@ for the solution of the QVStls schemes. The solution parameters are specified wi
|
|
207
207
|
called :obj:`qupled.qvsstls.Input`. After the solution is completed the results are stored in an
|
208
208
|
object :obj:`qupled.qvsstls.Result` and written to the output database.
|
209
209
|
|
210
|
-
.. autoclass:: qupled.qvsstls.
|
210
|
+
.. autoclass:: qupled.qvsstls.Solver
|
211
211
|
:show-inheritance:
|
212
212
|
:members:
|
213
213
|
:exclude-members: get_free_energy_integrand
|
@@ -1,13 +1,10 @@
|
|
1
1
|
import qupled.qstls as qstls
|
2
2
|
|
3
3
|
# Define the object used to solve the scheme
|
4
|
-
scheme = qstls.
|
4
|
+
scheme = qstls.Solver()
|
5
5
|
|
6
6
|
# Define the input parameters
|
7
|
-
inputs = qstls.Input(10.0, 1.0)
|
8
|
-
inputs.mixing = 0.5
|
9
|
-
inputs.matsubara = 16
|
10
|
-
inputs.threads = 16
|
7
|
+
inputs = qstls.Input(10.0, 1.0, mixing=0.5, matsubara=16, threads=16)
|
11
8
|
|
12
9
|
# Solve the QSTLS scheme and store the internal energy (v1 calculation)
|
13
10
|
scheme.compute(inputs)
|
@@ -1,11 +1,10 @@
|
|
1
1
|
import qupled.stls as stls
|
2
2
|
|
3
3
|
# Define the object used to solve the scheme
|
4
|
-
scheme = stls.
|
4
|
+
scheme = stls.Solver()
|
5
5
|
|
6
6
|
# Define the input parameters
|
7
|
-
inputs = stls.Input(10.0, 1.0)
|
8
|
-
inputs.mixing = 0.2
|
7
|
+
inputs = stls.Input(10.0, 1.0, mixing=0.2)
|
9
8
|
|
10
9
|
# Solve scheme
|
11
10
|
scheme.compute(inputs)
|
@@ -2,27 +2,28 @@ import qupled.qstls as qstls
|
|
2
2
|
import qupled.qstlsiet as qstlsiet
|
3
3
|
|
4
4
|
# Define a Qstls object to solve the QSTLS scheme
|
5
|
-
scheme = qstls.
|
5
|
+
scheme = qstls.Solver()
|
6
6
|
|
7
7
|
# Define the input parameters
|
8
|
-
inputs = qstls.Input(10.0, 1.0)
|
9
|
-
inputs.mixing = 0.5
|
10
|
-
inputs.matsubara = 16
|
11
|
-
inputs.threads = 16
|
8
|
+
inputs = qstls.Input(10.0, 1.0, mixing=0.5, matsubara=16, threads=16)
|
12
9
|
|
13
10
|
# Solve the QSTLS scheme
|
14
11
|
scheme.compute(inputs)
|
15
12
|
print(scheme.results.uint)
|
16
13
|
|
17
14
|
# Define a QstlsIet object to solve the QSTLS-IET scheme
|
18
|
-
scheme = qstlsiet.
|
15
|
+
scheme = qstlsiet.Solver()
|
19
16
|
|
20
17
|
# Define the input parameters for one of the QSTLS-IET schemes
|
21
|
-
inputs = qstlsiet.Input(
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
18
|
+
inputs = qstlsiet.Input(
|
19
|
+
10.0,
|
20
|
+
1.0,
|
21
|
+
theory="QSTLS-LCT",
|
22
|
+
mixing=0.5,
|
23
|
+
matsubara=16,
|
24
|
+
threads=16,
|
25
|
+
integral_strategy="segregated",
|
26
|
+
)
|
26
27
|
|
27
28
|
# solve the QSTLS-IET scheme
|
28
29
|
scheme.compute(inputs)
|
@@ -1,15 +1,12 @@
|
|
1
1
|
import qupled.qvsstls as qvsstls
|
2
2
|
|
3
3
|
# Define the object used to solve the scheme
|
4
|
-
scheme = qvsstls.
|
4
|
+
scheme = qvsstls.Solver()
|
5
5
|
|
6
6
|
# Define the input parameters
|
7
|
-
inputs = qvsstls.Input(
|
8
|
-
|
9
|
-
|
10
|
-
inputs.alpha = [-0.2, 0.4]
|
11
|
-
inputs.iterations = 100
|
12
|
-
inputs.threads = 16
|
7
|
+
inputs = qvsstls.Input(
|
8
|
+
1.0, 1.0, mixing=0.5, matsubara=16, alpha=[-0.2, 0.4], iterations=100, threads=16
|
9
|
+
)
|
13
10
|
|
14
11
|
# Solve scheme for rs = 1.0
|
15
12
|
scheme.compute(inputs)
|
@@ -5,12 +5,12 @@ from qupled.output import DataBase
|
|
5
5
|
|
6
6
|
# Define an Rpa object to solve the RPA scheme
|
7
7
|
print("######### Solving the RPA scheme #########")
|
8
|
-
rpa_scheme = rpa.
|
8
|
+
rpa_scheme = rpa.Solver()
|
9
9
|
rpa_scheme.compute(rpa.Input(10.0, 1.0))
|
10
10
|
|
11
11
|
# Define an ESA object to solve the ESA scheme
|
12
12
|
print("######### Solving the ESA scheme #########")
|
13
|
-
esa_scheme = esa.
|
13
|
+
esa_scheme = esa.Solver()
|
14
14
|
esa_scheme.compute(esa.Input(10.0, 1.0))
|
15
15
|
|
16
16
|
# Retrieve information from the output files
|
@@ -2,11 +2,10 @@ import qupled.stls as stls
|
|
2
2
|
from qupled.output import DataBase
|
3
3
|
|
4
4
|
# Define the object used to solve the scheme
|
5
|
-
scheme = stls.
|
5
|
+
scheme = stls.Solver()
|
6
6
|
|
7
7
|
# Define the input parameters
|
8
|
-
inputs = stls.Input(10.0, 1.0)
|
9
|
-
inputs.mixing = 0.5
|
8
|
+
inputs = stls.Input(10.0, 1.0, mixing=0.5)
|
10
9
|
|
11
10
|
# Solve scheme
|
12
11
|
scheme.compute(inputs)
|
@@ -1,12 +1,10 @@
|
|
1
1
|
import qupled.stlsiet as stlsiet
|
2
2
|
|
3
3
|
# Define the object used to solve the scheme
|
4
|
-
scheme = stlsiet.
|
4
|
+
scheme = stlsiet.Solver()
|
5
5
|
|
6
6
|
# Define the input parameters
|
7
|
-
inputs = stlsiet.Input(10.0, 1.0, "STLS-HNC")
|
8
|
-
inputs.mixing = 0.5
|
9
|
-
|
7
|
+
inputs = stlsiet.Input(10.0, 1.0, theory="STLS-HNC", mixing=0.5)
|
10
8
|
# Solve scheme with HNC bridge function
|
11
9
|
scheme.compute(inputs)
|
12
10
|
|
@@ -1,12 +1,10 @@
|
|
1
1
|
import qupled.vsstls as vsstls
|
2
2
|
|
3
3
|
# Define the object used to solve the scheme
|
4
|
-
scheme = vsstls.
|
4
|
+
scheme = vsstls.Solver()
|
5
5
|
|
6
6
|
# Define the input parameters
|
7
|
-
inputs = vsstls.Input(2.0, 1.0)
|
8
|
-
inputs.mixing = 0.5
|
9
|
-
inputs.alpha = [-0.2, 0.2]
|
7
|
+
inputs = vsstls.Input(2.0, 1.0, mixing=0.5, alpha=[-0.2, 0.2])
|
10
8
|
|
11
9
|
# Compute
|
12
10
|
scheme.compute(inputs)
|
@@ -49,7 +49,7 @@ def create_svg_files():
|
|
49
49
|
|
50
50
|
|
51
51
|
def get_plot_data():
|
52
|
-
scheme: qstls.
|
52
|
+
scheme: qstls.Solver = None
|
53
53
|
error: list[float] = []
|
54
54
|
while scheme is None or scheme.results.error > 1e-5:
|
55
55
|
scheme = solve_qstls(scheme.run_id if scheme is not None else scheme)
|
@@ -57,7 +57,7 @@ def get_plot_data():
|
|
57
57
|
return scheme, error
|
58
58
|
|
59
59
|
|
60
|
-
def create_one_svg_file(darkmode: bool, scheme: qstls.
|
60
|
+
def create_one_svg_file(darkmode: bool, scheme: qstls.Solver, error: np.array):
|
61
61
|
# Get plot settings
|
62
62
|
settings = PlotSettings(darkmode)
|
63
63
|
# Set style
|
@@ -80,7 +80,7 @@ def create_one_svg_file(darkmode: bool, scheme: qstls.Qstls, error: np.array):
|
|
80
80
|
|
81
81
|
|
82
82
|
def solve_qstls(guess_run_id: int):
|
83
|
-
scheme = qstls.
|
83
|
+
scheme = qstls.Solver()
|
84
84
|
inputs = qstls.Input(coupling=15.0, degeneracy=1.0)
|
85
85
|
inputs.mixing = 0.3
|
86
86
|
inputs.resolution = 0.1
|
@@ -97,7 +97,7 @@ def solve_qstls(guess_run_id: int):
|
|
97
97
|
return scheme
|
98
98
|
|
99
99
|
|
100
|
-
def plot_density_response(plt: plt, scheme: qstls.
|
100
|
+
def plot_density_response(plt: plt, scheme: qstls.Solver, settings: PlotSettings):
|
101
101
|
results = scheme.results
|
102
102
|
inputs = scheme.inputs
|
103
103
|
wvg_squared = results.wvg[:, np.newaxis] ** 2
|
@@ -127,7 +127,7 @@ def plot_density_response(plt: plt, scheme: qstls.Qstls, settings: PlotSettings)
|
|
127
127
|
plt.yticks(fontsize=settings.ticksz)
|
128
128
|
|
129
129
|
|
130
|
-
def plot_ssf(plt: plt, scheme: qstls.
|
130
|
+
def plot_ssf(plt: plt, scheme: qstls.Solver, settings: PlotSettings):
|
131
131
|
results = scheme.results
|
132
132
|
plt.subplot(2, 2, 4)
|
133
133
|
plt.plot(results.wvg, results.ssf, color=settings.color, linewidth=settings.width)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import importlib
|
2
2
|
import os
|
3
|
+
import shutil
|
3
4
|
import sys
|
4
5
|
|
5
6
|
import matplotlib.pyplot as plt
|
@@ -21,9 +22,9 @@ def run_before_each_test():
|
|
21
22
|
@pytest.fixture(autouse=True)
|
22
23
|
def run_after_each_test():
|
23
24
|
yield
|
24
|
-
|
25
|
-
if os.path.exists(
|
26
|
-
|
25
|
+
output_dir = DataBaseHandler.DATABASE_DIRECTORY
|
26
|
+
if os.path.exists(output_dir):
|
27
|
+
shutil.rmtree(output_dir)
|
27
28
|
|
28
29
|
|
29
30
|
@pytest.fixture(autouse=True)
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "qupled"
|
7
|
-
version = "v1.3.
|
7
|
+
version = "v1.3.5"
|
8
8
|
description = "qupled: a package to investigate quantum plasmas via the dielectric formalism"
|
9
9
|
readme = "README.md"
|
10
10
|
requires-python = ">=3.10, <3.14"
|
@@ -4,13 +4,14 @@ import struct
|
|
4
4
|
from datetime import datetime
|
5
5
|
from enum import Enum
|
6
6
|
from collections.abc import Callable
|
7
|
+
from pathlib import Path
|
7
8
|
|
8
9
|
import numpy as np
|
9
10
|
import sqlalchemy as sql
|
10
11
|
from sqlalchemy.dialects.sqlite import insert as sqlite_insert
|
11
12
|
import blosc2
|
12
13
|
|
13
|
-
from . import
|
14
|
+
from . import native
|
14
15
|
|
15
16
|
|
16
17
|
class DataBaseHandler:
|
@@ -20,10 +21,13 @@ class DataBaseHandler:
|
|
20
21
|
and deleting data, as well as managing the database schema."
|
21
22
|
"""
|
22
23
|
|
24
|
+
BLOB_STORAGE_DIRECTORY = "blob_data"
|
25
|
+
DATABASE_DIRECTORY = "qupled_store"
|
23
26
|
DEFAULT_DATABASE_NAME = "qupled.db"
|
24
|
-
|
27
|
+
FIXED_TABLE_NAME = "fixed"
|
25
28
|
INPUT_TABLE_NAME = "inputs"
|
26
29
|
RESULT_TABLE_NAME = "results"
|
30
|
+
RUN_TABLE_NAME = "runs"
|
27
31
|
|
28
32
|
class TableKeys(Enum):
|
29
33
|
COUPLING = "coupling"
|
@@ -42,10 +46,9 @@ class DataBaseHandler:
|
|
42
46
|
SUCCESS = "SUCCESS"
|
43
47
|
FAILED = "FAILED"
|
44
48
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
}
|
49
|
+
class ConflictMode(Enum):
|
50
|
+
FAIL = "FAIL"
|
51
|
+
UPDATE = "UPDATE"
|
49
52
|
|
50
53
|
def __init__(self, database_name: str | None = None):
|
51
54
|
"""
|
@@ -64,19 +67,29 @@ class DataBaseHandler:
|
|
64
67
|
result_table (sqlalchemy.Table): The table schema for storing result data.
|
65
68
|
run_id (int | None): The ID of the current run, or None if no run is active.
|
66
69
|
"""
|
67
|
-
|
68
|
-
|
70
|
+
# Database path
|
71
|
+
database_name = (
|
72
|
+
self.DEFAULT_DATABASE_NAME if database_name is None else database_name
|
69
73
|
)
|
70
|
-
|
71
|
-
|
74
|
+
database_path = Path(self.DATABASE_DIRECTORY) / database_name
|
75
|
+
database_path.parent.mkdir(parents=True, exist_ok=True)
|
76
|
+
# Blob data storage
|
77
|
+
self.blob_storage = (
|
78
|
+
Path(self.DATABASE_DIRECTORY) / self.BLOB_STORAGE_DIRECTORY / database_name
|
79
|
+
)
|
80
|
+
self.blob_storage.mkdir(parents=True, exist_ok=True)
|
81
|
+
self.blob_storage = str(self.blob_storage)
|
82
|
+
# Create database
|
83
|
+
self.engine = sql.create_engine(f"sqlite:///{database_path}")
|
84
|
+
# Set sqlite properties
|
72
85
|
DataBaseHandler._set_sqlite_pragma(self.engine)
|
86
|
+
# Create tables
|
73
87
|
self.table_metadata = sql.MetaData()
|
74
88
|
self.run_table = self._build_run_table()
|
75
89
|
self.input_table = self._build_inputs_table()
|
76
90
|
self.result_table = self._build_results_table()
|
77
91
|
self.run_id: int | None = None
|
78
92
|
|
79
|
-
@mpi.MPI.run_only_on_root
|
80
93
|
def insert_run(self, inputs):
|
81
94
|
"""
|
82
95
|
Inserts a new run into the database by storing the provided inputs and results.
|
@@ -91,7 +104,6 @@ class DataBaseHandler:
|
|
91
104
|
self._insert_run(inputs, self.RunStatus.RUNNING)
|
92
105
|
self.insert_inputs(inputs.__dict__)
|
93
106
|
|
94
|
-
@mpi.MPI.run_only_on_root
|
95
107
|
def insert_inputs(self, inputs: dict[str, any]):
|
96
108
|
"""
|
97
109
|
Inserts input data into the database for the current run.
|
@@ -114,8 +126,11 @@ class DataBaseHandler:
|
|
114
126
|
sql_mapping = lambda value: (self._to_json(value))
|
115
127
|
self._insert_from_dict(self.input_table, inputs, sql_mapping)
|
116
128
|
|
117
|
-
|
118
|
-
|
129
|
+
def insert_results(
|
130
|
+
self,
|
131
|
+
results: dict[str, any],
|
132
|
+
conflict_mode: ConflictMode = ConflictMode.FAIL,
|
133
|
+
):
|
119
134
|
"""
|
120
135
|
Inserts the given results into the database table associated with this instance.
|
121
136
|
|
@@ -130,7 +145,9 @@ class DataBaseHandler:
|
|
130
145
|
"""
|
131
146
|
if self.run_id is not None:
|
132
147
|
sql_mapping = lambda value: (self._to_bytes(value))
|
133
|
-
self._insert_from_dict(
|
148
|
+
self._insert_from_dict(
|
149
|
+
self.result_table, results, sql_mapping, conflict_mode
|
150
|
+
)
|
134
151
|
|
135
152
|
def inspect_runs(self) -> list[dict[str, any]]:
|
136
153
|
"""
|
@@ -149,26 +166,27 @@ class DataBaseHandler:
|
|
149
166
|
rows = self._execute(statement).mappings().all()
|
150
167
|
return [{key: row[key] for key in row.keys()} for row in rows]
|
151
168
|
|
152
|
-
def update_run_status(self, status:
|
169
|
+
def update_run_status(self, status: RunStatus) -> None:
|
153
170
|
"""
|
154
|
-
|
171
|
+
Update the status of a run in the database.
|
155
172
|
|
156
173
|
Args:
|
157
|
-
status (
|
158
|
-
code is not found in the INT_TO_RUN_STATUS mapping, the
|
159
|
-
status will default to RunStatus.FAILED.
|
174
|
+
status (RunStatus): The new status to set for the run.
|
160
175
|
|
161
176
|
Returns:
|
162
177
|
None
|
178
|
+
|
179
|
+
Notes:
|
180
|
+
This method updates the status of the run identified by `self.run_id` in the run table.
|
181
|
+
If `self.run_id` is None, no update is performed.
|
163
182
|
"""
|
164
183
|
if self.run_id is not None:
|
165
|
-
new_status = self.INT_TO_RUN_STATUS.get(status, self.RunStatus.FAILED)
|
166
184
|
statement = (
|
167
185
|
sql.update(self.run_table)
|
168
186
|
.where(
|
169
187
|
self.run_table.c[self.TableKeys.PRIMARY_KEY.value] == self.run_id
|
170
188
|
)
|
171
|
-
.values({self.TableKeys.STATUS.value:
|
189
|
+
.values({self.TableKeys.STATUS.value: status.value})
|
172
190
|
)
|
173
191
|
self._execute(statement)
|
174
192
|
|
@@ -241,8 +259,6 @@ class DataBaseHandler:
|
|
241
259
|
sql_mapping = lambda value: (self._from_bytes(value))
|
242
260
|
return self._get(self.result_table, run_id, names, sql_mapping)
|
243
261
|
|
244
|
-
@mpi.MPI.synchronize_ranks
|
245
|
-
@mpi.MPI.run_only_on_root
|
246
262
|
def delete_run(self, run_id: int) -> None:
|
247
263
|
"""
|
248
264
|
Deletes a run entry from the database based on the provided run ID.
|
@@ -253,6 +269,7 @@ class DataBaseHandler:
|
|
253
269
|
Returns:
|
254
270
|
None
|
255
271
|
"""
|
272
|
+
self._delete_blob_data_on_disk(run_id)
|
256
273
|
condition = self.run_table.c[self.TableKeys.PRIMARY_KEY.value] == run_id
|
257
274
|
statement = sql.delete(self.run_table).where(condition)
|
258
275
|
self._execute(statement)
|
@@ -390,16 +407,15 @@ class DataBaseHandler:
|
|
390
407
|
sql.PrimaryKeyConstraint(
|
391
408
|
self.TableKeys.RUN_ID.value, self.TableKeys.NAME.value
|
392
409
|
),
|
410
|
+
sql.Index(f"idx_{table_name}_run_id", self.TableKeys.RUN_ID.value),
|
411
|
+
sql.Index(f"idx_{table_name}_name", self.TableKeys.NAME.value),
|
393
412
|
)
|
394
413
|
self._create_table(table)
|
395
414
|
return table
|
396
415
|
|
397
|
-
@mpi.MPI.synchronize_ranks
|
398
|
-
@mpi.MPI.run_only_on_root
|
399
416
|
def _create_table(self, table):
|
400
417
|
table.create(self.engine, checkfirst=True)
|
401
418
|
|
402
|
-
@mpi.MPI.run_only_on_root
|
403
419
|
def _insert_run(self, inputs: any, status: RunStatus):
|
404
420
|
"""
|
405
421
|
Inserts a new run entry into the database.
|
@@ -432,6 +448,9 @@ class DataBaseHandler:
|
|
432
448
|
if run_id := result.inserted_primary_key:
|
433
449
|
self.run_id = run_id[0]
|
434
450
|
|
451
|
+
def _delete_blob_data_on_disk(self, run_id: int):
|
452
|
+
native.delete_blob_data_on_disk(self.engine.url.database, run_id)
|
453
|
+
|
435
454
|
@staticmethod
|
436
455
|
def _set_sqlite_pragma(engine):
|
437
456
|
"""
|
@@ -454,11 +473,15 @@ class DataBaseHandler:
|
|
454
473
|
def _set_pragma(dbapi_connection, connection_record):
|
455
474
|
cursor = dbapi_connection.cursor()
|
456
475
|
cursor.execute("PRAGMA foreign_keys=ON")
|
476
|
+
cursor.execute("PRAGMA journal_mode=WAL")
|
457
477
|
cursor.close()
|
458
478
|
|
459
|
-
@mpi.MPI.run_only_on_root
|
460
479
|
def _insert_from_dict(
|
461
|
-
self,
|
480
|
+
self,
|
481
|
+
table,
|
482
|
+
data: dict[str, any],
|
483
|
+
sql_mapping: Callable[[any], any],
|
484
|
+
conflict_mode: ConflictMode = ConflictMode.FAIL,
|
462
485
|
) -> None:
|
463
486
|
"""
|
464
487
|
Inserts data into a specified table by mapping values through a provided SQL mapping function.
|
@@ -473,10 +496,46 @@ class DataBaseHandler:
|
|
473
496
|
"""
|
474
497
|
for name, value in data.items():
|
475
498
|
if mapped_value := sql_mapping(value):
|
476
|
-
self._insert(table, name, mapped_value)
|
499
|
+
self._insert(table, name, mapped_value, conflict_mode)
|
500
|
+
|
501
|
+
def _insert(
|
502
|
+
self,
|
503
|
+
table: sql.Table,
|
504
|
+
name: str,
|
505
|
+
value: any,
|
506
|
+
conflict_mode: ConflictMode = ConflictMode.FAIL,
|
507
|
+
):
|
508
|
+
"""
|
509
|
+
Inserts a record into the specified SQL table with the given name and value, handling conflicts according to the specified mode.
|
510
|
+
Args:
|
511
|
+
table (sql.Table): The SQLAlchemy table object where the record will be inserted.
|
512
|
+
name (str): The name/key associated with the value to insert.
|
513
|
+
value (any): The value to be inserted into the table.
|
514
|
+
conflict_mode (ConflictMode, optional): Specifies how to handle conflicts on unique constraints.
|
515
|
+
Defaults to ConflictMode.FAIL. If set to ConflictMode.UPDATE, existing records with the same
|
516
|
+
run_id and name will be updated with the new value.
|
517
|
+
Returns:
|
518
|
+
None
|
519
|
+
Raises:
|
520
|
+
Any exceptions raised by the underlying database execution.
|
521
|
+
"""
|
522
|
+
data = {
|
523
|
+
self.TableKeys.RUN_ID.value: self.run_id,
|
524
|
+
self.TableKeys.NAME.value: name,
|
525
|
+
self.TableKeys.VALUE.value: value,
|
526
|
+
}
|
527
|
+
statement = sqlite_insert(table).values(data)
|
528
|
+
if conflict_mode == self.ConflictMode.UPDATE:
|
529
|
+
statement = statement.on_conflict_do_update(
|
530
|
+
index_elements=[
|
531
|
+
self.TableKeys.RUN_ID.value,
|
532
|
+
self.TableKeys.NAME.value,
|
533
|
+
],
|
534
|
+
set_={self.TableKeys.VALUE.value: value},
|
535
|
+
)
|
536
|
+
self._execute(statement)
|
477
537
|
|
478
|
-
|
479
|
-
def _insert(self, table: sql.Table, name: str, value: any):
|
538
|
+
def _insert_with_update(self, table: sql.Table, name: str, value: any):
|
480
539
|
"""
|
481
540
|
Inserts a record into the specified SQL table or updates it if a conflict occurs.
|
482
541
|
|
@@ -2,13 +2,17 @@ from __future__ import annotations
|
|
2
2
|
|
3
3
|
from . import hf
|
4
4
|
from . import native
|
5
|
+
from . import serialize
|
5
6
|
|
6
7
|
|
7
|
-
class
|
8
|
+
class Solver(hf.Solver):
|
8
9
|
"""
|
9
10
|
Class used to solve the ESA scheme.
|
10
11
|
"""
|
11
12
|
|
13
|
+
# Native classes used to solve the scheme
|
14
|
+
native_scheme_cls = native.ESA
|
15
|
+
|
12
16
|
def __init__(self):
|
13
17
|
super().__init__()
|
14
18
|
self.results: hf.Result = hf.Result()
|
@@ -16,12 +20,14 @@ class ESA(hf.HF):
|
|
16
20
|
self.native_scheme_cls = native.ESA
|
17
21
|
|
18
22
|
|
23
|
+
@serialize.serializable_dataclass
|
19
24
|
class Input(hf.Input):
|
20
25
|
"""
|
21
26
|
Class used to manage the input for the :obj:`qupled.esa.ESA` class.
|
22
27
|
"""
|
23
28
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
29
|
+
theory: str = "ESA"
|
30
|
+
|
31
|
+
|
32
|
+
if __name__ == "__main__":
|
33
|
+
Solver.run_mpi_worker(Input, hf.Result)
|