From 8bbb0faf13cc34f4e8429629d489b7e4b6c2550d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 25 Feb 2025 10:25:01 +0800 Subject: [PATCH 01/27] [pre-commit.ci] pre-commit autoupdate (#1722) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.9.6 → v0.9.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.6...v0.9.7) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 234821eeb..8a1a8954b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: # Python - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.6 + rev: v0.9.7 hooks: - id: ruff args: ["--fix"] From 5fdcc702ed03727126ce3a57a9dfae65f8de4610 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 5 Mar 2025 09:16:17 +0800 Subject: [PATCH 02/27] [pre-commit.ci] pre-commit autoupdate (#1723) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.9.7 → v0.9.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.7...v0.9.9) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8a1a8954b..e96b9616a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: # Python - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.7 + rev: v0.9.9 hooks: - id: ruff args: ["--fix"] From b7f94403810fe0f975a5bae8c20363199085fcfd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 08:19:05 +0800 Subject: [PATCH 03/27] [pre-commit.ci] pre-commit autoupdate (#1724) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.9.9 → v0.9.10](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.9...v0.9.10) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e96b9616a..484ee797b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: # Python - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.9 + rev: v0.9.10 hooks: - id: ruff args: ["--fix"] From 34a5c63eb6e61359e383cbf0453a0780e2a188bc Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 11:18:49 +0800 Subject: [PATCH 04/27] [pre-commit.ci] pre-commit autoupdate (#1726) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.9.10 → v0.11.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.10...v0.11.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 484ee797b..0e9877176 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: # Python - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.10 + rev: v0.11.0 hooks: - id: ruff args: ["--fix"] From 4fa1e5a77ccae2f134cf2bc6e4b101380663a550 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 25 Mar 2025 11:35:19 +0800 Subject: [PATCH 05/27] [pre-commit.ci] pre-commit autoupdate (#1732) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.11.0 → v0.11.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.0...v0.11.2) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0e9877176..eb2df56b2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: # Python - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.0 + rev: v0.11.2 hooks: - id: ruff args: ["--fix"] From 9e994f2120a5d2ae77d9c8ff58f45d468dba905c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 08:40:15 +0800 Subject: [PATCH 06/27] [pre-commit.ci] pre-commit autoupdate (#1738) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.11.2 → v0.11.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.2...v0.11.4) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index eb2df56b2..ade794a8a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: # Python - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.2 + rev: v0.11.4 hooks: - id: ruff args: ["--fix"] From c0b95dc7bb51f46fe0b2acea3efc1908cc1cfa7d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Apr 2025 10:54:11 +0800 Subject: [PATCH 07/27] [pre-commit.ci] pre-commit autoupdate (#1742) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.11.4 → v0.11.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.4...v0.11.5) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ade794a8a..e9abb3886 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: # Python - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.4 + rev: v0.11.5 hooks: - id: ruff args: ["--fix"] From 0256de759faba10415002f211542b3dda12a2368 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 08:32:38 +0800 Subject: [PATCH 08/27] [pre-commit.ci] pre-commit autoupdate (#1744) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.11.5 → v0.11.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.5...v0.11.6) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e9abb3886..b788ed2ca 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: # Python - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.5 + rev: v0.11.6 hooks: - id: ruff args: ["--fix"] From d5e62ef6802328809b298b79b526979a81e9d141 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 29 Apr 2025 16:54:36 +0800 Subject: [PATCH 09/27] [pre-commit.ci] pre-commit autoupdate (#1746) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.11.6 → v0.11.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.6...v0.11.7) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b788ed2ca..8d1258598 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: # Python - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.6 + rev: v0.11.7 hooks: - id: ruff args: ["--fix"] From 8281fb764eab9af753b414254902cceae3c4aef8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 14:45:14 +0800 Subject: [PATCH 10/27] [pre-commit.ci] pre-commit autoupdate (#1747) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.11.7 → v0.11.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.7...v0.11.8) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8d1258598..fa25b7305 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: # Python - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.7 + rev: v0.11.8 hooks: - id: ruff args: ["--fix"] From d24845917af42f4f2c26694561ec9f000b4c4963 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 6 May 2025 15:17:30 +0800 Subject: [PATCH 11/27] fix(init_bulk): include the last perturbation in collected vasp data (#1748) Fix #1745 ## Summary by CodeRabbit - **Bug Fixes** - Improved the processing of molecular dynamics data directories to ensure all relevant perturbation indices are included during data collection. Signed-off-by: Jinzhe Zeng --- dpgen/data/gen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpgen/data/gen.py b/dpgen/data/gen.py index f0a88bcb4..5c10657d2 100644 --- a/dpgen/data/gen.py +++ b/dpgen/data/gen.py @@ -1071,7 +1071,7 @@ def coll_vasp_md(jdata): # convert outcars valid_outcars = [] for jj in scale: - for kk in range(pert_numb): + for kk in range(pert_numb + 1): path_work = os.path.join(f"scale-{jj:.3f}", "%06d" % kk) # noqa: UP031 outcar = os.path.join(path_work, "OUTCAR") # dlog.info("OUTCAR",outcar) From 716b9d251ea4ca7aeb71651c8f2e3f927de8f832 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 13 May 2025 17:41:11 +0800 Subject: [PATCH 12/27] [pre-commit.ci] pre-commit autoupdate (#1749) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.11.8 → v0.11.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.8...v0.11.9) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fa25b7305..2b2d3eb8d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: # Python - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.8 + rev: v0.11.9 hooks: - id: ruff args: ["--fix"] From e8ba3db85044087bccae6d158fe70bddf56787e6 Mon Sep 17 00:00:00 2001 From: Yong-Bin Zhuang <38876805+robinzyb@users.noreply.github.com> Date: Wed, 21 May 2025 19:16:57 +0800 Subject: [PATCH 13/27] Update param-ch4.json (#1752) fix the inconsistent lengths between `sys_batch_size` and `sys_configs` ## Summary by CodeRabbit - **Chores** - Cleaned up configuration by removing redundant entries from the batch size settings in the JSON file. Signed-off-by: Yong-Bin Zhuang <38876805+robinzyb@users.noreply.github.com> --- examples/run/dp2.x-lammps-cp2k/methane/param-ch4.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/run/dp2.x-lammps-cp2k/methane/param-ch4.json b/examples/run/dp2.x-lammps-cp2k/methane/param-ch4.json index 356dbb921..8e733f2d8 100644 --- a/examples/run/dp2.x-lammps-cp2k/methane/param-ch4.json +++ b/examples/run/dp2.x-lammps-cp2k/methane/param-ch4.json @@ -23,8 +23,6 @@ ] ], "sys_batch_size": [ - 8, - 8, 8, 8 ], From 86bfe1ba05d4d5afa5fb905dd70e384142262df6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 21 May 2025 19:17:12 +0800 Subject: [PATCH 14/27] [pre-commit.ci] pre-commit autoupdate (#1751) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.11.9 → v0.11.10](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.9...v0.11.10) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2b2d3eb8d..4b73f5dc1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: # Python - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.9 + rev: v0.11.10 hooks: - id: ruff args: ["--fix"] From 945a2a6137d4c76b7f95b44cf90bd00ee977fc6f Mon Sep 17 00:00:00 2001 From: Peng Xingliang <91927439+pxlxingliang@users.noreply.github.com> Date: Tue, 27 May 2025 21:12:54 +0800 Subject: [PATCH 15/27] abacus: fix bug in make_abacus_scf_stru (#1755) ## Summary by CodeRabbit - **Bug Fixes** - Improved the selection of pseudopotential and orbital files to ensure only relevant files for the atoms present in the system are included. --------- Co-authored-by: root Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- dpgen/generator/lib/abacus_scf.py | 33 ++++++++++++++++++++++++++++-- tests/data/test_gen_bulk_abacus.py | 1 - 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/dpgen/generator/lib/abacus_scf.py b/dpgen/generator/lib/abacus_scf.py index f04dbdd96..21f1e1377 100644 --- a/dpgen/generator/lib/abacus_scf.py +++ b/dpgen/generator/lib/abacus_scf.py @@ -213,9 +213,38 @@ def make_abacus_scf_stru( ): sys_data_copy = copy.deepcopy(sys_data) # re-construct the path of files by pporb + file name - fp_pp_files = [os.path.join(pporb, i) for i in fp_pp_files] + # when element in sys_data is part of type_map/fp_pp_files + # we need to only pass the pp_file in sys_data, but not all pp_files + if type_map is None: + type_map = sys_data_copy["atom_names"] + + missing_atoms = set(sys_data_copy["atom_names"]) - set(type_map) + if len(missing_atoms) > 0: + raise ValueError( + f"Some atoms in sys_data are not in type_map: {missing_atoms}. " + "Please provide a valid type_map." + ) + + if len(fp_pp_files) != len(type_map): + raise ValueError( + "The length of fp_pp_files should be equal to the length of type_map." + ) + if fp_orb_files is not None and len(fp_orb_files) != len(type_map): + raise ValueError( + "The length of fp_orb_files should be equal to the length of type_map." + ) + + fp_pp_files = [ + os.path.join(pporb, fp_pp_files[type_map.index(atom_name)]) + for atom_name in sys_data_copy["atom_names"] + ] + if fp_orb_files is not None: - fp_orb_files = [os.path.join(pporb, i) for i in fp_orb_files] + fp_orb_files = [ + os.path.join(pporb, fp_orb_files[type_map.index(atom_name)]) + for atom_name in sys_data_copy["atom_names"] + ] + if fp_dpks_descriptor is not None: fp_dpks_descriptor = os.path.join(pporb, fp_dpks_descriptor) diff --git a/tests/data/test_gen_bulk_abacus.py b/tests/data/test_gen_bulk_abacus.py index 728a6964e..520589829 100644 --- a/tests/data/test_gen_bulk_abacus.py +++ b/tests/data/test_gen_bulk_abacus.py @@ -76,7 +76,6 @@ def test(self): def testSTRU(self): jdata = self.jdata jdata["from_poscar_path"] = "./Cu.STRU" - jdata["potcars"] = ["abacus.in/Cu_ONCV_PBE-1.0.upf"] make_super_cell_STRU(jdata) make_abacus_relax(jdata, {"fp_resources": {}}) make_scale_ABACUS(jdata) From ec737090f6727a077481667a44168c6ff68782ba Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 10 Jun 2025 10:41:28 +0800 Subject: [PATCH 16/27] fix: remove duplicated reading model deviation files (#1762) The line I removed seems to be unused. xref: 1c18b1cecf241e1d74702e5c116a2f7a82b89bb4 ## Summary by CodeRabbit - **Refactor** - Improved consistency in reading model deviation data by using a unified helper function for file processing. Signed-off-by: Jinzhe Zeng --- dpgen/generator/run.py | 1 - 1 file changed, 1 deletion(-) diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index 0f6953721..768e91957 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -2477,7 +2477,6 @@ def _select_by_model_devi_adaptive_trust_low( for tt in modd_system_task: with warnings.catch_warnings(): warnings.simplefilter("ignore") - model_devi = np.loadtxt(os.path.join(tt, "model_devi.out")) model_devi = _read_model_devi_file( tt, model_devi_f_avg_relative, model_devi_merge_traj ) From 4ecd9708e5e9d50e278f0d0cc08c51d8d4c0775f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 10 Jun 2025 14:09:03 +0800 Subject: [PATCH 17/27] [pre-commit.ci] pre-commit autoupdate (#1758) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.11.10 → v0.11.13](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.10...v0.11.13) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4b73f5dc1..271ba50fa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: # Python - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.10 + rev: v0.11.13 hooks: - id: ruff args: ["--fix"] From 55098f9d9efbbbc0fe2ec6b1a2b459264d41a34b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 24 Jun 2025 09:17:21 +0800 Subject: [PATCH 18/27] [pre-commit.ci] pre-commit autoupdate (#1770) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.11.13 → v0.12.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.13...v0.12.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 271ba50fa..16734a225 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: # Python - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.13 + rev: v0.12.0 hooks: - id: ruff args: ["--fix"] From 28a47552cd7eff9b67596c5e32bbbd3eff751647 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 3 Jul 2025 08:08:01 +0800 Subject: [PATCH 19/27] [pre-commit.ci] pre-commit autoupdate (#1772) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.12.0 → v0.12.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.0...v0.12.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 16734a225..06676abdd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: # Python - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.12.0 + rev: v0.12.1 hooks: - id: ruff args: ["--fix"] From 35ea30320241759d7c49a75e123206d63ab27b4d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 8 Jul 2025 08:25:14 +0800 Subject: [PATCH 20/27] [pre-commit.ci] pre-commit autoupdate (#1776) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.12.1 → v0.12.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.1...v0.12.2) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 06676abdd..e86720d0c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: # Python - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.12.1 + rev: v0.12.2 hooks: - id: ruff args: ["--fix"] From 28d701431d7b164e255aadbb268cc1f3bdf765a4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 16 Jul 2025 09:09:54 +0800 Subject: [PATCH 21/27] [pre-commit.ci] pre-commit autoupdate (#1779) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.12.2 → v0.12.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.2...v0.12.3) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e86720d0c..26f070008 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: # Python - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.12.2 + rev: v0.12.3 hooks: - id: ruff args: ["--fix"] From 55af49e7f5000b9fe7c545421caa1e092bdc07f0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 25 Jul 2025 20:33:25 +0800 Subject: [PATCH 22/27] [pre-commit.ci] pre-commit autoupdate (#1783) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.12.3 → v0.12.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.3...v0.12.4) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 26f070008..8dc9b5616 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: # Python - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.12.3 + rev: v0.12.4 hooks: - id: ruff args: ["--fix"] From 16dd7a88a3e5af71f7749826e30ff6b5656a772a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 1 Aug 2025 17:43:00 +0800 Subject: [PATCH 23/27] [pre-commit.ci] pre-commit autoupdate (#1784) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.12.4 → v0.12.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.4...v0.12.5) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8dc9b5616..950b4f475 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: # Python - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.12.4 + rev: v0.12.5 hooks: - id: ruff args: ["--fix"] From ed971ae527b3bb1beca9fcdb8bedeb9e512ac6c8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 5 Aug 2025 08:42:49 +0800 Subject: [PATCH 24/27] [pre-commit.ci] pre-commit autoupdate (#1788) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.12.5 → v0.12.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.5...v0.12.7) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 950b4f475..c82eec2f8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: # Python - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.12.5 + rev: v0.12.7 hooks: - id: ruff args: ["--fix"] From 1b7bb62562ecd38bea9832612014784035c2f1ec Mon Sep 17 00:00:00 2001 From: Ming-Yu Guo Date: Tue, 5 Aug 2025 11:18:28 +0800 Subject: [PATCH 25/27] feat: add support for flexible multiplicity in CP2K inputs (#1785) --- dpgen/generator/lib/cp2k.py | 175 ++++++++++++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) diff --git a/dpgen/generator/lib/cp2k.py b/dpgen/generator/lib/cp2k.py index a73a94d7a..af151cc50 100644 --- a/dpgen/generator/lib/cp2k.py +++ b/dpgen/generator/lib/cp2k.py @@ -1,5 +1,127 @@ import numpy as np +atomic_numbers = { + "H": 1, + "He": 2, + "Li": 3, + "Be": 4, + "B": 5, + "C": 6, + "N": 7, + "O": 8, + "F": 9, + "Ne": 10, + "Na": 11, + "Mg": 12, + "Al": 13, + "Si": 14, + "P": 15, + "S": 16, + "Cl": 17, + "Ar": 18, + "K": 19, + "Ca": 20, + "Sc": 21, + "Ti": 22, + "V": 23, + "Cr": 24, + "Mn": 25, + "Fe": 26, + "Co": 27, + "Ni": 28, + "Cu": 29, + "Zn": 30, + "Ga": 31, + "Ge": 32, + "As": 33, + "Se": 34, + "Br": 35, + "Kr": 36, + "Rb": 37, + "Sr": 38, + "Y": 39, + "Zr": 40, + "Nb": 41, + "Mo": 42, + "Tc": 43, + "Ru": 44, + "Rh": 45, + "Pd": 46, + "Ag": 47, + "Cd": 48, + "In": 49, + "Sn": 50, + "Sb": 51, + "Te": 52, + "I": 53, + "Xe": 54, + "Cs": 55, + "Ba": 56, + "La": 57, + "Ce": 58, + "Pr": 59, + "Nd": 60, + "Pm": 61, + "Sm": 62, + "Eu": 63, + "Gd": 64, + "Tb": 65, + "Dy": 66, + "Ho": 67, + "Er": 68, + "Tm": 69, + "Yb": 70, + "Lu": 71, + "Hf": 72, + "Ta": 73, + "W": 74, + "Re": 75, + "Os": 76, + "Ir": 77, + "Pt": 78, + "Au": 79, + "Hg": 80, + "Tl": 81, + "Pb": 82, + "Bi": 83, + "Po": 84, + "At": 85, + "Rn": 86, + "Fr": 87, + "Ra": 88, + "Ac": 89, + "Th": 90, + "Pa": 91, + "U": 92, + "Np": 93, + "Pu": 94, + "Am": 95, + "Cm": 96, + "Bk": 97, + "Cf": 98, + "Es": 99, + "Fm": 100, + "Md": 101, + "No": 102, + "Lr": 103, + "Rf": 104, + "Db": 105, + "Sg": 106, + "Bh": 107, + "Hs": 108, + "Mt": 109, + "Ds": 110, + "Rg": 111, + "Cn": 112, + "Nh": 113, + "Fl": 114, + "Mc": 115, + "Lv": 116, + "Ts": 117, + "Og": 118, +} + + default_config = { "GLOBAL": {"PROJECT": "DPGEN"}, "FORCE_EVAL": { @@ -121,6 +243,46 @@ def iterdict(d, out_list, flag=None, indent=0): out_list.insert(index, " " * indent + k + " " + v) +def calculate_multiplicity(atom_names, atom_types, charge=0): + """ + Calculate the multiplicity based on atom species, quantities, and system charge. + + This function provides a basic heuristic for determining multiplicity: + - Even number of electrons -> singlet (multiplicity = 1) + - Odd number of electrons -> doublet (multiplicity = 2) + + Note: This approach assumes that an odd electron count always results in a doublet state. + It does not account for systems with multiple unpaired electrons, which can have higher + multiplicities (e.g., triplet, quartet, etc.). Users should be aware of this limitation + and use the function accordingly. + + :param atom_names: List of element symbols. + :param atom_types: List of atom type indices. + :param charge: System charge (default: 0). + :return: Multiplicity. + """ + # Calculate the total number of electrons + total_electrons = 0 + for idx in atom_types: + element = atom_names[idx] + try: + total_electrons += atomic_numbers[element] + except KeyError: + raise ValueError(f"Unknown element '{element}' encountered in atom_names.") + + # Subtract/add electrons based on system charge + # Positive charge means we remove electrons, negative charge means we add electrons + total_electrons -= charge + + # Determine multiplicity based on the total number of electrons + # Even number of electrons -> singlet (multiplicity = 1) + # Odd number of electrons -> doublet (multiplicity = 2) + if total_electrons % 2 == 0: + return 1 + else: + return 2 + + def make_cp2k_input(sys_data, fp_params): # covert cell to cell string cell = sys_data["cells"][0] @@ -132,14 +294,27 @@ def make_cp2k_input(sys_data, fp_params): cell_c = np.array2string(cell[2, :]) cell_c = cell_c[1:-1] + atom_names = sys_data["atom_names"] + atom_types = sys_data["atom_types"] + # Get system charge if provided, default to 0 + charge = sys_data.get("charge", 0) + dft_params = fp_params.get("FORCE_EVAL", {}).get("DFT", {}) + if "MULTIPLICITY" in dft_params: + multiplicity = dft_params["MULTIPLICITY"] + else: + multiplicity = calculate_multiplicity(atom_names, atom_types, charge) + # get update from user user_config = fp_params # get update from cell cell_config = { "FORCE_EVAL": {"SUBSYS": {"CELL": {"A": cell_a, "B": cell_b, "C": cell_c}}} } + # get update for multiplicity + multiplicity_config = {"FORCE_EVAL": {"DFT": {"MULTIPLICITY": multiplicity}}} update_dict(default_config, user_config) update_dict(default_config, cell_config) + update_dict(default_config, multiplicity_config) # output list input_str = [] iterdict(default_config, input_str) From efa1cad0df8e87e1f9346c288ce2e0fe0137b975 Mon Sep 17 00:00:00 2001 From: Ming-Yu Guo Date: Tue, 5 Aug 2025 11:19:37 +0800 Subject: [PATCH 26/27] feat: enhanced _sys check when adding to all_sys (#1787) --- dpgen/generator/run.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index 768e91957..70ac6845d 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -4523,8 +4523,9 @@ def post_fp_cp2k(iter_index, jdata, rfailed=None): _sys = dpdata.LabeledSystem( oo, fmt="cp2kdata/e_f", type_map=jdata["type_map"] ) - all_sys.append(_sys) - icount += 1 + if len(_sys) > 0: + all_sys.append(_sys) + icount += 1 if (all_sys is not None) and (len(all_sys) > 0): sys_data_path = os.path.join(work_path, f"data.{ss}") From 41402ad7ec8506ff5d3e99edda0143d9f9b21e64 Mon Sep 17 00:00:00 2001 From: ztzkz <95387041+ztzkz@users.noreply.github.com> Date: Thu, 7 Aug 2025 00:19:46 -0700 Subject: [PATCH 27/27] Update shuffle_poscar feature in run.py (#1730) numpy.random.Generator.shuffle() performs the intended operation of shuffling the order of atoms. numpy.random.Generator.permuted() permutes the elements along the given axis, which mixes the coordinates of all atoms shuffle ![shuffle](https://github.com/user-attachments/assets/ef814c7a-72b3-4d13-b6cc-1612a1fe6fc6) permuted ![permuted](https://github.com/user-attachments/assets/ea6e9be0-74e7-4e43-a008-0d65ec0839ee) ## Summary by CodeRabbit - **Refactor** - Improved the process that randomizes system coordinates when a specific option is enabled, enhancing internal data handling and consistency. --------- Signed-off-by: ztzkz <95387041+ztzkz@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- dpgen/generator/run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index 70ac6845d..600e5d827 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -1305,7 +1305,7 @@ def make_model_devi(iter_index, jdata, mdata): type_map=jdata["type_map"], ) if shuffle_poscar: - system.data["coords"] = rng.permuted(system.data["coords"], axis=1) + rng.shuffle(system.data["coords"], axis=1) if jdata.get("model_devi_nopbc", False): system.remove_pbc() system.to_lammps_lmp(os.path.join(conf_path, lmp_name))