nomad-coe / greenx Goto Github PK
View Code? Open in Web Editor NEWLibrary for Green’s function based electronic structure theory calculations
Home Page: https://nomad-coe.github.io/greenX/
License: Apache License 2.0
Library for Green’s function based electronic structure theory calculations
Home Page: https://nomad-coe.github.io/greenX/
License: Apache License 2.0
For the time-being, we are considering support make, as well as Cmake. The minimax library therefore needs its makefile updating, such that minimax is compiled as a library and links to the test binary.
We should also consider adding the makefile build to the CI
Dear all,
Could you please write your comments here to decide about answering Dario's comment?
Here is the comment:
"I suggest you to include here at lest a simple example illustrating the efficiency of the minimax grids. Maybe it could be done by integrating a toy function, but I also would like to see if you can get an estimate of how much it is reduced the prefactor of low-scaling MP2/RPA/GW calculations to justify the exclusive use of this particular quadrature.
Another related question. In line 150 of the pdf you specify that the number of time/frequency points in the library ranges from 2 to 64, how are these values related to the final accuracy of correlation and quasi-particle energies?"
As we discussed, Here is my answer:
As the length of the paper is already long, we can provide here an example which is public and accessible to all.
Here, the evaluation of the RPA total energy with the GL, mod-GL and minimax imaginary frequency grids for the a) water molecule and the b) MgO are shown. All the values are in eV. As it is clear, using 16 grid points, the results obtained by GX-TimeFrequncy are converged.
@gonzex @JWilhelm @dgolze @fdelesma @Panadestein @AlexBuccheri @gulans @claudia-draxl @PatrickRinke @gmatteo
GreenX should have a style guide defined. In analogy to clangformat, we should consider putting our preferred formatting into fprettify (CP2K fork).
Some documentation may also need to be written
GX-TimeFrequency/test/test_gx_minimax_grid.py
currently tests gx_minimax_grid
using only one choice of Min/Max transtion energies, specifically (2., 30.). This can be extended to sweep some range of values using pytest's paramterize fixture.
In particular, (0,0), (1, 0), (0, 1) should be tested to check for error-handling.
Very large transition ratio should also be used.
Define a schema for array shapes, and make this visible in the library repository,
Add rescaling of minimax grids, for a gain in efficiency
In the License file, the following line from the template of the Apache 2 licence should be replaced.
Copyright [yyyy] [name of copyright owner]
Reformat the minimax grid data to contain the grid sizes in the header, for simpler parsing.
Header should contain a) Number of blocks and b) block length in an easily-parsable manner
Add doxygen support:
cd greenX/build
make test
Running tests...
Test project /root/WorkSpace/greenX/build
Start 1: REG_TEST_test_minimax
1/1 Test #1: REG_TEST_test_minimax ............***Failed 0.45 sec
0% tests passed, 1 tests failed out of 1
Total Test time (real) = 0.45 sec
The following tests FAILED:
1 - REG_TEST_test_minimax (Failed)
Errors while running CTest
make: *** [Makefile:95: test] Error 8
In the Testing/Temporary/LastTest.log, we found :
ImportError while importing test module '/root/WorkSpace/greenX/GX-TimeFrequency/tests/test_minimax/test_minimax.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
GX-TimeFrequency/tests/test_minimax/test_minimax.py:13: in <module>
from python.run import BinaryRunner, BuildType
E ModuleNotFoundError: No module named 'python'
Try to modify CMakeLists.txt with :
set(ENV{PYTHONPATH} "${CMAKE_CURRENT_SOURCE_DIR}/python")
or
list(APPEND PYTHONPATH "${CMAKE_CURRENT_SOURCE_DIR}/python")
without success
working with :
export PYTHONPATH="${PYTHONPATH}:../python"
Certain modules should be consistent for all libraries in GreenX. Move these to a GreenX Core. For example:
Need some verification that the grid data has been correctly copy-pasted from CP2K. This could be:
a) An application test that parses and asserts on the grid size
b) Put back into CP2K and confirm the results don;'t change
c) Add some checking when parsing in fortran
In the README.md, "GreenX is documented using Doxygen, and documentation support is enabled by default."
But in the cmake file it seems to be disabled by default. I could only build the documentations by manually switching it to ON.
Based on my @AlexBuccheri 's CMake notes, and @gmatteo 's abinit references, set default compiler flags for each build type.
It is not clear from the documentation that pygreenx should be installed for the unit tests. And the way to install it should be added too, although the source code can be found in the python directory. Indeed without knowing that the unit tests 2 and 3 will fail.
I run the unit tests and it seems the test3 failed. I attach the log below.
FYI, I tested on ubuntu23.04/gfortran 12.2/ openblas 0.3.21 /AMD Ryzen 3500U.
Log:
Test project /home/hexu/projects/greenX/build
Start 1: UNITTEST_test_pade_approximant
1/3 Test #1: UNITTEST_test_pade_approximant ... Passed 0.00 sec
Start 2: test_gx_minimax_grid
2/3 Test #2: test_gx_minimax_grid ............. Passed 1.78 sec
Start 3: test_gx_tabulate_minimax
3/3 Test #3: test_gx_tabulate_minimax .........***Failed 6.40 sec
============================= test session starts ==============================
platform linux -- Python 3.11.2, pytest-7.2.1, pluggy-1.0.0+repack
rootdir: /home/hexu/projects/greenX/build
plugins: xonsh-0.13.4
collected 1 item
test_gx_tabulate_minimax.py Binary source: /home/hexu/projects/greenX/build/bin/gx_tabulate_grids.exe
FTestdir: /tmp/pytest-of-hexu/pytest-3/test_tabulate_gx_minimax_grid0
=================================== FAILURES ===================================
________________________ test_tabulate_gx_minimax_grid _________________________
fortran_binary = PosixPath('/home/hexu/projects/greenX/build/bin/gx_tabulate_grids.exe')
def test_tabulate_gx_minimax_grid(fortran_binary):
e_trans = ETrans(0.4, 100.0)
ref_errors_small_grid = np.array([[6, 0, 2.51200821E-04, 1.88667240E-03, 6.86380679E-03, 5.56242714E-02, 2.50000000E+02],
[8, 0, 9.26518238E-04, 7.02310800E-04, 8.97132915E-04, 1.49383520E-02, 2.50000000E+02],
[10, 0, 2.93904398E-02, 4.15097815E-04, 9.85375147E-04, 3.87442807E-03, 2.50000000E+02],
[12, 0, 1.22980779E-03, 5.40966369E-05, 3.23113268E-05, 9.86318209E-04, 2.50000000E+02],
[14, 0, 1.23655331E-03, 1.47661838E-05, 6.49328520E-06, 2.46521564E-04, 2.50000000E+02],
[16, 0, 3.23839478E-03, 4.75444516E-06, 7.88188993E-07, 7.70304736E-05, 2.50000000E+02],
[18, 0, 6.23300174E-03, 1.34768466E-06, 3.45186001E-07, 1.94942501E-05, 2.50000000E+02],
[20, 0, 2.62469251E-03, 2.86296043E-07, 3.67016068E-08, 4.88850816E-06, 2.50000000E+02],
[22, 0, 1.90928278E-02, 6.87320737E-08, 2.59110779E-07, 2.68402248E-07, 2.50000000E+02]])
ref_errors_big_grid = np.array([[24, 0, 2.49244180E-02, 1.41793908E-08, 1.44000650E-08, 1.31534820E-07, 2.50000000E+02],
[26, 0, 2.64119033E-01, 4.12358436E-09, 4.74668548E-09, 3.78405299E-08, 2.50000000E+02],
[28, 0, 4.13766945E+04, 3.93976513E-09, 5.94764298E-09, 4.30436032E-08, 2.50000000E+02],
[30, 0, 1.24498840E+06, 4.50563448E-09, 3.15970462E-08, 5.14232632E-08, 2.50000000E+02],
[32, 0, 1.29256892E+06, 4.17286994E-09, 6.30107694E-08, 4.94132290E-08, 2.50000000E+02],
[34, 0, 1.32139161E+06, 8.10191277E-09, 3.86664983E-07, 6.66088501E-08, 2.50000000E+02]])
tabulated_errors = get_tabulated_errors(fortran_binary, e_trans)
tabulated_errors_small_grids = tabulated_errors[0:9, :]
tabulated_errors_large_grids = tabulated_errors[9:, :]
# Grids for which values do not get large or very small
assert np.allclose(tabulated_errors_small_grids[:, Column.CosFTDualityError.value],
ref_errors_small_grid[:, Column.CosFTDualityError.value])
assert np.allclose(tabulated_errors_small_grids[:, Column.MaxErrCosFTTimeToFreq.value],
ref_errors_small_grid[:, Column.MaxErrCosFTTimeToFreq.value])
assert np.allclose(tabulated_errors_small_grids[:, Column.MaxErrCosFTFreqToTime.value],
ref_errors_small_grid[:, Column.MaxErrCosFTFreqToTime.value])
assert np.allclose(tabulated_errors_small_grids[:, Column.MaxErrSinFTimeToFreq.value],
ref_errors_small_grid[:, Column.MaxErrSinFTimeToFreq.value])
# Grids for which values do get large or very small
assert np.allclose(tabulated_errors_large_grids[:, Column.MaxErrCosFTTimeToFreq.value],
ref_errors_big_grid[:, Column.MaxErrCosFTTimeToFreq.value],
atol=1.e-7)
assert np.allclose(tabulated_errors_large_grids[:, Column.MaxErrCosFTFreqToTime.value],
ref_errors_big_grid[:, Column.MaxErrCosFTFreqToTime.value],
atol=1.e-7)
E assert False
E + where False = <function allclose at 0x7fb559e44a40>(array([1.44000655e-08, 4.74668609e-09, 5.94594904e-09, 7.14314387e-09,\n 1.21514300e-08, 6.46172347e-08]), array([1.44000650e-08, 4.74668548e-09, 5.94764298e-09, 3.15970462e-08,\n 6.30107694e-08, 3.86664983e-07]), atol=1e-07)
E + where <function allclose at 0x7fb559e44a40> = np.allclose
/home/hexu/projects/greenX/build/test/time-frequency/test_gx_tabulate_minimax.py:116: AssertionError
=========================== short test summary info ============================
FAILED test_gx_tabulate_minimax.py::test_tabulate_gx_minimax_grid - assert False
============================== 1 failed in 4.74s ===============================
67% tests passed, 1 tests failed out of 3
Total Test time (real) = 8.19 sec
The following tests FAILED:
3 - test_gx_tabulate_minimax (Failed)
Update the README on building and running tests
Extend IO and storage of eigenvalues to include k-points
Assuming multiple grid routines will be present, structure TimeFrequency as:
GX-TimeFrequency/
src/
minimax/
minimax.F90
CMakeLists.txt
contour/
contour.f90
CMakeLists.txt
gx_timefrequency.f90
tests/
test_minimax/
test_minimax.f90
test_minimax.py
input/
ref/
test_contour/
data/
CMakeLists.txt
README.md
where gx_timefrequency.f90
is a module to expose the individual libs which comprise GX-TimeFrequency
Add a unit test framework as an external dependency. Requires:
Read the time grid (as well as frequency) and store in separate arrays
Currently only the 32-point gris is regression-tested. We should extend this to all minimax grids.
Tentatively tagged @aziziph in this.
Hi all! I am trying to build the GreenX minimax utility. When building at the GreenX root with command
FC=ifort cmake -B build
an error is thrown as follows
-- Python 3 interpreter version: 3.9.12
-- Analytic continuation unit tests written to: /home/minyez/software/greenX-github/build/unit_tests/analytic-continuation
CMake Error at GX-AnalyticContinuation/CMakeLists.txt:51 (create_unit_test_executable):
Unknown CMake command "create_unit_test_executable".
IMO wrapping create_unit_test_executable
with ENABLE_UNITTEST
condition should fix it
diff --git a/GX-AnalyticContinuation/CMakeLists.txt b/GX-AnalyticContinuation/CMakeLists.txt
index a002a96..f369af1 100644
--- a/GX-AnalyticContinuation/CMakeLists.txt
+++ b/GX-AnalyticContinuation/CMakeLists.txt
@@ -47,6 +47,8 @@ message("-- Analytic continuation unit tests written to: ${UNIT_TEST_DIR}")
set(LIBS_FOR_UNIT_TESTS LibGXAC)
# For unit tests for many modules, put this in a loop
-create_unit_test_executable(TARGET_TEST_DIR ${UNIT_TEST_DIR}
- TEST_NAME "test_pade_approximant"
- REQUIRED_LIBS ${LIBS_FOR_UNIT_TESTS})
+if (${ENABLE_UNITTESTS})
+ create_unit_test_executable(TARGET_TEST_DIR ${UNIT_TEST_DIR}
+ TEST_NAME "test_pade_approximant"
+ REQUIRED_LIBS ${LIBS_FOR_UNIT_TESTS})
+endif()
Cheers
Minye Zhang
Hello, as the title suggest, it would be nice to add a short sentence summarizing what Green-X is, and also tags to the GitHub repository. We could also link the NOMAD website there (or ideally deploy a GitHub pages there). See the image below, this is empty in our repo:
This is a very common thing, and it helps to project gain visibility. Unfortunately, I do not have permission to do it myself. Can you take care of it @aziziph or @AlexBuccheri ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.