From 3913cebc9767e599965270c8d223cc4e44795113 Mon Sep 17 00:00:00 2001 From: "T.Tian" Date: Sat, 23 Nov 2024 08:03:56 +0800 Subject: [PATCH 1/8] merge categories and datatypes in docparser subdirs --- sparc/docparser.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sparc/docparser.py b/sparc/docparser.py index 48a33ace..a42697b7 100644 --- a/sparc/docparser.py +++ b/sparc/docparser.py @@ -375,11 +375,23 @@ def json_from_directory(cls, directory=".", include_subdirs=True, **kwargs): try: sub_dict = cls(directory=subdir, parse_version=False).to_dict() except FileNotFoundError: - print(subdir, " Latex files not found. Check naming conventions for Manual.tex. Expects format *Manual.tex") + print( + subdir, + " Latex files not found. Check naming conventions for Manual.tex. Expects format *Manual.tex", + ) continue for param, param_desc in sub_dict["parameters"].items(): if param not in root_dict["parameters"]: root_dict["parameters"][param] = param_desc + # Combine the subdir categories + for sub_category in sub_dict["categories"]: + if sub_category not in root_dict["categories"]: + root_dict["categories"].append(sub_category) + # Combine data types + for sub_dt in sub_dict["data_types"]: + if sub_dt not in root_dict["data_types"]: + root_dict["data_types"].append(sub_dt) + json_string = json.dumps(root_dict, indent=True) return json_string From 4ad29038e5a2b787e3c81839648ddb257edd4956 Mon Sep 17 00:00:00 2001 From: "T.Tian" Date: Sun, 24 Nov 2024 10:52:17 +0800 Subject: [PATCH 2/8] update json schema api wk --- .github/workflows/api_version_probe.py | 4 ++-- .github/workflows/update_api.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/api_version_probe.py b/.github/workflows/api_version_probe.py index cfefe10a..de3c756b 100644 --- a/.github/workflows/api_version_probe.py +++ b/.github/workflows/api_version_probe.py @@ -12,10 +12,10 @@ def compare_versions(): if version.parse(default_version) < version.parse(new_version): print(f"Version changed from {default_version} to {new_version}") - sys.exit(1) # Exit with a non-zero status to indicate change + sys.exit(1) else: print("No version change") - sys.exit(0) # Exit with zero status to indicate no change + sys.exit(0) if __name__ == "__main__": diff --git a/.github/workflows/update_api.yml b/.github/workflows/update_api.yml index 6bd80435..f7a7dcf4 100644 --- a/.github/workflows/update_api.yml +++ b/.github/workflows/update_api.yml @@ -19,10 +19,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: conda-incubator/setup-miniconda@v2 with: - python-version: "3.10" + python-version: "3.11" mamba-version: "*" channels: conda-forge,alchem0x2a,defaults channel-priority: true From 1dda31a9c88540b96b638c97b8d25c82d9bea485 Mon Sep 17 00:00:00 2001 From: "T.Tian" Date: Sun, 24 Nov 2024 11:05:02 +0800 Subject: [PATCH 3/8] add more debug probes in api workflow --- .github/workflows/update_api.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update_api.yml b/.github/workflows/update_api.yml index f7a7dcf4..03888b51 100644 --- a/.github/workflows/update_api.yml +++ b/.github/workflows/update_api.yml @@ -39,14 +39,17 @@ jobs: - name: Test if json api is newer than current id: probe run: | + # exit 0 --> no version change if python .github/workflows/api_version_probe.py; then echo "UPDATE_NEEDED=false" >> $GITHUB_ENV else echo "UPDATE_NEEDED=true" >> $GITHUB_ENV fi + echo UPDATE_NEEDED is "${UPDATE_NEEDED}" + echo API version is "${API_VERSION}" continue-on-error: true - name: Create Pull Request - if: env.UPDATE_NEEDED == true + if: env.UPDATE_NEEDED == 'true' run: | git config --global user.email "alchem0x2a@gmail.com" git config --global user.name "Github Action Bot" @@ -56,6 +59,9 @@ jobs: git add sparc/sparc_json_api/parameters.json git commit -m "Add new json api version ${API_VERSION}" git push --set-upstream origin api_version - gh pr create --base master --title "[PR Bot] New JSON API version ${API_VERSION}" --body "Merge new JSON API version ${API_VERSION} into master" -R ${{ github.repository_owner }}/SPARC-X-API + gh pr create --base master \ + --title "[PR Bot] New JSON API version ${API_VERSION}" \ + --body "Hello! This is an automatic PR to merge new JSON schema version ${API_VERSION} into master" \ + -R ${{ github.repository_owner }}/SPARC-X-API env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 657c3ac29ef53422991ff446f9c96e48aa167e23 Mon Sep 17 00:00:00 2001 From: "T.Tian" Date: Sun, 24 Nov 2024 16:04:43 +0800 Subject: [PATCH 4/8] update api workflow --- .github/workflows/update_api.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update_api.yml b/.github/workflows/update_api.yml index 03888b51..48919a27 100644 --- a/.github/workflows/update_api.yml +++ b/.github/workflows/update_api.yml @@ -59,9 +59,18 @@ jobs: git add sparc/sparc_json_api/parameters.json git commit -m "Add new json api version ${API_VERSION}" git push --set-upstream origin api_version + body_msg="" + body_msg="${body_msg}## Automated JSON API Update\n" + body_msg="${body_msg}Hello! This is an automatic pull request to merge the new JSON API version **${API_VERSION}** into the master branch.\n\n" + body_msg="${body_msg}### Details:\n" + body_msg="${body_msg}- **Workflow Trigger**: This update is triggered by the **Update JSON API (recurring job)** workflow.\n" + body_msg="${body_msg}- **Reason for Update**: A new JSON schema version was generated that differs from the existing one in the repository.\n\n" + body_msg="${body_msg}### Notes:\n" + body_msg="${body_msg}- If you notice any issues or have questions regarding this update, please contact @alchem0x2a or other maintainers of the repository.\n\n" + body_msg="${body_msg}Thank you for keeping the SPARC-X-API project up-to-date! 🚀\n" gh pr create --base master \ --title "[PR Bot] New JSON API version ${API_VERSION}" \ - --body "Hello! This is an automatic PR to merge new JSON schema version ${API_VERSION} into master" \ + --body ${body_msg} \ -R ${{ github.repository_owner }}/SPARC-X-API env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 3c4283db68b79666a966676c7e4bcda7f4421592 Mon Sep 17 00:00:00 2001 From: "T.Tian" Date: Sun, 24 Nov 2024 16:10:23 +0800 Subject: [PATCH 5/8] use ephemeral branch --- .github/workflows/update_api.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update_api.yml b/.github/workflows/update_api.yml index 48919a27..bb9370e6 100644 --- a/.github/workflows/update_api.yml +++ b/.github/workflows/update_api.yml @@ -54,11 +54,13 @@ jobs: git config --global user.email "alchem0x2a@gmail.com" git config --global user.name "Github Action Bot" echo "New version is ${API_VERSION}" - git checkout -b api_version + BRANCH_NAME="update-api-${GITHUB_RUN_ID}" + echo "Checking new branch ${BRANCH_NAME}" + git checkout -b $BRANCH_NAME mv parameters.json sparc/sparc_json_api/ git add sparc/sparc_json_api/parameters.json git commit -m "Add new json api version ${API_VERSION}" - git push --set-upstream origin api_version + git push --force --set-upstream origin api_version body_msg="" body_msg="${body_msg}## Automated JSON API Update\n" body_msg="${body_msg}Hello! This is an automatic pull request to merge the new JSON API version **${API_VERSION}** into the master branch.\n\n" From 86e649edc5f66eb2188338e68713930b546f1fc4 Mon Sep 17 00:00:00 2001 From: "T.Tian" Date: Sat, 23 Nov 2024 00:43:04 +0800 Subject: [PATCH 6/8] implement changes from Phanish --- paper/paper.md | 93 +++++++++++++++++--------------------------------- 1 file changed, 32 insertions(+), 61 deletions(-) diff --git a/paper/paper.md b/paper/paper.md index 844b0d77..b2da6071 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -76,40 +76,40 @@ real-space methods. # Statement of Need -DFT has unargubaly become one of the cornerstones -of electronic structure simulations in chemical and materials sciences due to -its simplicity and wide range of applicability. While -many researchers primarily associate DFT with the plane-wave -pseudopotential method, due to the maturity and wide availability of -such codes, these approaches do have limitations. One long-standing -challenge in DFT is to develop methods that overcomes the huge -computational cost for solving the Kohn-Sham equation, which scales -cubically with respect to the system size. This becomes -especially problematic in massively parallel computing environments, -where the extensive global communication required during Fourier -transformations limits the scalability, making it challenging to -efficiently simulate very large systems in plane-wave DFT. -In plane-wave methods, the global nature of the Fourier basis used limits the ability to -achieve linear scaling [@bowler_order_n_dft_2012]. Moreover, -the periodic nature of the Fourier basis enforces the use of periodic -boundary conditions, making the simulation setup of isolated and -semi-finite systems non-straightforward. A compelling -alternative to overcome these limitations is to solve the Kohn-Sham -equations using a finite-difference (FD) approach on real-space -grids. The locality of the FD method makes real-space DFT methods -inherently scalable, and paves the way for the development of -linearly-scaling solutions to the Kohn-Sham equations. -Real-space DFT also naturally supports both periodic and Dirichlet -boundary conditions, and combinations thereof, -allowing for the flexible treatment of systems in -any dimensionality. +DFT has unargubaly become one of the cornerstones of electronic +structure simulations in chemical and materials sciences due to its +simplicity and wide range of applicability. Among the various +numerical implementations of DFT, the plane-wave pseudopotential +method has gained significant popularity, owing to both its robustness +and the maturity of associated software packages. However, despite +their widespread use, plane-wave methods are not without limitations. +One long-standing challenge in DFT is to develop methods that +overcomes the huge computational cost for solving the Kohn-Sham +equation, which scales cubically with respect to the system size. +This becomes especially problematic in massively parallel computing +environments, where the extensive global communication required during +Fourier transformations limits the scalability, making it challenging +to efficiently simulate very large systems in plane-wave DFT. In +plane-wave methods, the global nature of the Fourier basis used limits +the ability to achieve linear scaling +[@bowler_order_n_dft_2012]. Moreover, the periodic nature of the +Fourier basis enforces the use of periodic boundary conditions, making +the simulation setup of isolated and semi-finite systems +non-straightforward. A compelling alternative to overcome these +limitations is to solve the Kohn-Sham equations using a +finite-difference (FD) approach on real-space grids. The locality of +the FD method makes real-space DFT methods inherently scalable, and +paves the way for the development of linearly-scaling solutions to the +Kohn-Sham equations. Real-space DFT also naturally supports both +periodic and Dirichlet boundary conditions, and combinations thereof, +allowing for the flexible treatment of systems in any dimensionality. In the past few years, the SPARC-X project ([https://github.com/SPARC-X](https://github.com/SPARC-X)) has led efforts to develop an open-source, real-space DFT code that is both user-friendly and competitive with state-of-the-art plane-wave codes. The philosophy of the SPARC-X project is to provide codes that -are highly efficient and portable (i.e. straightforward to install and +are highly efficient and portable (i.e., straightforward to install and use across various computational environments). The codes also seek to be user-friendly and developer-friendly to facilitate the implementation of new algorithms. In line with this, SPARC-X offers @@ -119,8 +119,8 @@ prototyping and small-system simulations, with no external dependencies other than Matlab itself, and 2) C/C++ based SPARC [@xu_sparc-1.0_2021; @zhang_sparc-2.0_2024] for large-scale production calculations that can accommodate a wide range of system sizes and -requires only MPI and MKL/BLAS for compilation. New development of -SPARC has covered topics including spin-orbit coupling, dispersion +requires only MPI and MKL/BLAS for compilation. New features of +SPARC include spin-orbit coupling, dispersion interactions, and advanced exchange-correlation (xc) functionals [@zhang_sparc-2.0_2024], linear-scaling Spectral Quadrature (SQ) method [@suryanarayana_sparc_sq_2018], cyclic/helical symmetry @@ -160,36 +160,7 @@ in a few key aspects, including 1) supporting SPARC-specific features in an ASE-comatible API, 2) a parameter validation mechanism based on SPARC's `LaTeX` documentation, and 3) a versatile socket communication layer for efficient high-throughput calculations. Details will be -discussed in the Features and Functionalities section. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +discussed next. ![Overview of SPARC-X-API in the SPARC-X project system \label{fig:sparc-overview} @@ -395,7 +366,7 @@ The SPARC-X-API is released as source code in github repository and as a `conda-forge` package [`sparc-x-api`](https://anaconda.org/conda-forge/sparc-x-api). When installed using `conda-forge`, the package is bundled with the -optimized pseudopotentials [@shojaei_sparc_pseudopot_2023], and +optimized SPMS pseudopotentials [@shojaei_sparc_pseudopot_2023], and compatible with the [`sparc`](https://anaconda.org/conda-forge/sparc-x) package that contains the compiled SPARC binary. From fd9c282cc468b1c8607c3d0aa7dcb902d0eb810b Mon Sep 17 00:00:00 2001 From: "T.Tian" Date: Sun, 24 Nov 2024 16:14:06 +0800 Subject: [PATCH 7/8] typo --- .github/workflows/update_api.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update_api.yml b/.github/workflows/update_api.yml index bb9370e6..6a5620a3 100644 --- a/.github/workflows/update_api.yml +++ b/.github/workflows/update_api.yml @@ -60,7 +60,7 @@ jobs: mv parameters.json sparc/sparc_json_api/ git add sparc/sparc_json_api/parameters.json git commit -m "Add new json api version ${API_VERSION}" - git push --force --set-upstream origin api_version + git push --force --set-upstream origin ${BRANCH_NAME} body_msg="" body_msg="${body_msg}## Automated JSON API Update\n" body_msg="${body_msg}Hello! This is an automatic pull request to merge the new JSON API version **${API_VERSION}** into the master branch.\n\n" From 59e23be7a21251a56bd1c6c164d6304eabcd1312 Mon Sep 17 00:00:00 2001 From: "T.Tian" Date: Sun, 24 Nov 2024 16:18:08 +0800 Subject: [PATCH 8/8] explicit quotes --- .github/workflows/update_api.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update_api.yml b/.github/workflows/update_api.yml index 6a5620a3..cfa95cfe 100644 --- a/.github/workflows/update_api.yml +++ b/.github/workflows/update_api.yml @@ -72,7 +72,7 @@ jobs: body_msg="${body_msg}Thank you for keeping the SPARC-X-API project up-to-date! 🚀\n" gh pr create --base master \ --title "[PR Bot] New JSON API version ${API_VERSION}" \ - --body ${body_msg} \ + --body "${body_msg}" \ -R ${{ github.repository_owner }}/SPARC-X-API env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}