From cb13eee2673052f8c10f4a9dd8960a62e1fae360 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Sat, 13 Jul 2024 12:21:10 -0700 Subject: [PATCH 01/63] Update _m3gnet.py Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- src/maml/describers/_m3gnet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/maml/describers/_m3gnet.py b/src/maml/describers/_m3gnet.py index 466ba1ce..c1696df4 100644 --- a/src/maml/describers/_m3gnet.py +++ b/src/maml/describers/_m3gnet.py @@ -134,6 +134,6 @@ def transform_one(self, structure: Structure | Molecule): g = self.describer_model.graph_layers[i](g) atom_fea[f"gc_{i + 1}"] = g[Index.ATOMS] atom_fea_dict = {k: v for k, v in atom_fea.items() if k in self.output_layers} - if isinstance(self.return_type, dict): + if self.return_type == dict: return atom_fea_dict return pd.DataFrame(np.concatenate(list(atom_fea_dict.values()), axis=1)) From a1674413ee50b9db147d3b9f92780a99dbdf42ae Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Sat, 13 Jul 2024 12:40:27 -0700 Subject: [PATCH 02/63] Update _m3gnet.py Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- src/maml/describers/_m3gnet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/maml/describers/_m3gnet.py b/src/maml/describers/_m3gnet.py index c1696df4..b30aea6e 100644 --- a/src/maml/describers/_m3gnet.py +++ b/src/maml/describers/_m3gnet.py @@ -134,6 +134,6 @@ def transform_one(self, structure: Structure | Molecule): g = self.describer_model.graph_layers[i](g) atom_fea[f"gc_{i + 1}"] = g[Index.ATOMS] atom_fea_dict = {k: v for k, v in atom_fea.items() if k in self.output_layers} - if self.return_type == dict: + if self.return_type is dict: return atom_fea_dict return pd.DataFrame(np.concatenate(list(atom_fea_dict.values()), axis=1)) From 83c97ec5d7a029c7b10b93de133de1adfd3cce50 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Tue, 17 Sep 2024 09:16:55 -0700 Subject: [PATCH 03/63] Update pyproject.toml Solve GAP.json FileNotFoundError in pip install Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index c9701d6b..2e32e878 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,6 +67,7 @@ where = ["src"] "describers/data/*.json", "describers/data/megnet_models/*", "describers/data/m3gnet_models/matbench_mp_e_form/0/m3gnet/*", + "apps/pes/params/*.json", ] [tool.black] From 56fd83621654b01be291cc3bf4d2e3c7cee156ac Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 10:44:54 -0700 Subject: [PATCH 04/63] Update cgcnn_example.ipynb Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- notebooks/bowsr/cgcnn_example.ipynb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/notebooks/bowsr/cgcnn_example.ipynb b/notebooks/bowsr/cgcnn_example.ipynb index 49b4323d..9c883002 100644 --- a/notebooks/bowsr/cgcnn_example.ipynb +++ b/notebooks/bowsr/cgcnn_example.ipynb @@ -127,7 +127,8 @@ "radius = max(round(expected_radius(compressed_optimizer.structure) * 0.6, 2), 1.1)\n", "relaxed_from_compressed_cubic, _ = compressed_optimizer.get_optimized_structure_and_energy(radius=radius)\n", "print(\n", - " f\"CGCNN predicted formation energy of relaxed compressed cubic: {model.predict_energy(relaxed_from_compressed_cubic)} eV/atom\"\n", + " f\"CGCNN predicted formation energy of relaxed compressed cubic: \ +{model.predict_energy(relaxed_from_compressed_cubic)} eV/atom\"\n", ")" ] }, From fe4498b5349a8e874a77ad702c95659871ad992e Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 10:46:04 -0700 Subject: [PATCH 05/63] Update cgcnn_example.ipynb Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- notebooks/bowsr/cgcnn_example.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/bowsr/cgcnn_example.ipynb b/notebooks/bowsr/cgcnn_example.ipynb index 9c883002..8c7d548c 100644 --- a/notebooks/bowsr/cgcnn_example.ipynb +++ b/notebooks/bowsr/cgcnn_example.ipynb @@ -127,7 +127,7 @@ "radius = max(round(expected_radius(compressed_optimizer.structure) * 0.6, 2), 1.1)\n", "relaxed_from_compressed_cubic, _ = compressed_optimizer.get_optimized_structure_and_energy(radius=radius)\n", "print(\n", - " f\"CGCNN predicted formation energy of relaxed compressed cubic: \ + " f\"CGCNN predicted formation energy of relaxed compressed cubic: "\" {model.predict_energy(relaxed_from_compressed_cubic)} eV/atom\"\n", ")" ] From 660d438cce03004035c7b69e254a1759cdc3b1a1 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 10:46:45 -0700 Subject: [PATCH 06/63] Update cgcnn_example.ipynb Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- notebooks/bowsr/cgcnn_example.ipynb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/notebooks/bowsr/cgcnn_example.ipynb b/notebooks/bowsr/cgcnn_example.ipynb index 8c7d548c..65631dbb 100644 --- a/notebooks/bowsr/cgcnn_example.ipynb +++ b/notebooks/bowsr/cgcnn_example.ipynb @@ -127,8 +127,7 @@ "radius = max(round(expected_radius(compressed_optimizer.structure) * 0.6, 2), 1.1)\n", "relaxed_from_compressed_cubic, _ = compressed_optimizer.get_optimized_structure_and_energy(radius=radius)\n", "print(\n", - " f\"CGCNN predicted formation energy of relaxed compressed cubic: "\" -{model.predict_energy(relaxed_from_compressed_cubic)} eV/atom\"\n", + " f\"CGCNN predicted formation energy of relaxed compressed cubic: " {model.predict_energy(relaxed_from_compressed_cubic)} eV/atom\"\n", ")" ] }, From b39fc3a1c71ed9233de3a1a129db2978ba8028ae Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 10:47:20 -0700 Subject: [PATCH 07/63] Update cgcnn_example.ipynb Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- notebooks/bowsr/cgcnn_example.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/bowsr/cgcnn_example.ipynb b/notebooks/bowsr/cgcnn_example.ipynb index 65631dbb..49b4323d 100644 --- a/notebooks/bowsr/cgcnn_example.ipynb +++ b/notebooks/bowsr/cgcnn_example.ipynb @@ -127,7 +127,7 @@ "radius = max(round(expected_radius(compressed_optimizer.structure) * 0.6, 2), 1.1)\n", "relaxed_from_compressed_cubic, _ = compressed_optimizer.get_optimized_structure_and_energy(radius=radius)\n", "print(\n", - " f\"CGCNN predicted formation energy of relaxed compressed cubic: " {model.predict_energy(relaxed_from_compressed_cubic)} eV/atom\"\n", + " f\"CGCNN predicted formation energy of relaxed compressed cubic: {model.predict_energy(relaxed_from_compressed_cubic)} eV/atom\"\n", ")" ] }, From dd00bfb1d75f1ee442afb0677e7ef16d0e1b1333 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 10:49:10 -0700 Subject: [PATCH 08/63] Update pyproject.toml Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index bad5d4a8..5c7cdbbe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -76,7 +76,7 @@ line-length = 120 [tool.ruff] target-version = "py311" -line-length = 120 +line-length = 160 lint.select = [ "B", # flake8-bugbear "C4", # flake8-comprehensions From 14f1c0f2d049290f0000cf9f105c55722cc475b2 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 10:58:21 -0700 Subject: [PATCH 09/63] Update pyproject.toml Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 5c7cdbbe..62287fe4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -109,6 +109,7 @@ lint.select = [ "YTT", # flake8-2020 ] lint.ignore = [ + "D103", # docstring is missing "B023", # Function definition does not bind loop variable "B028", # No explicit stacklevel keyword argument found "B904", # Within an except clause, raise exceptions with ... From 695f862f15363310d263b3d8529e83cfbb2c9356 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 10:58:47 -0700 Subject: [PATCH 10/63] Update Example1_MPF2021.2.8.all.ipynb Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- notebooks/direct/Example1_MPF2021.2.8.all.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/direct/Example1_MPF2021.2.8.all.ipynb b/notebooks/direct/Example1_MPF2021.2.8.all.ipynb index 17ad542c..22fe35ec 100644 --- a/notebooks/direct/Example1_MPF2021.2.8.all.ipynb +++ b/notebooks/direct/Example1_MPF2021.2.8.all.ipynb @@ -205,7 +205,7 @@ "metadata": {}, "outputs": [], "source": [ - "manual_selection_index = [i for i, l in enumerate(MPF_2021_2_8_All_feature_data[\"relax_label\"]) if l]" + "manual_selection_index = [i for i, j in enumerate(MPF_2021_2_8_All_feature_data[\"relax_label\"]) if j]" ] }, { From c16573024e9a98941fec487e0a623e56c74d716e Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:03:52 -0700 Subject: [PATCH 11/63] Update pyproject.toml Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 62287fe4..69e497d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -109,6 +109,7 @@ lint.select = [ "YTT", # flake8-2020 ] lint.ignore = [ + "RET504", # assignment before `return` statement "D103", # docstring is missing "B023", # Function definition does not bind loop variable "B028", # No explicit stacklevel keyword argument found From 941ea873afeba53b743d9b64a6bbf7177b03c22a Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:18:46 -0700 Subject: [PATCH 12/63] Update Example2_Ti-H.ipynb Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- notebooks/direct/Example2_Ti-H.ipynb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/notebooks/direct/Example2_Ti-H.ipynb b/notebooks/direct/Example2_Ti-H.ipynb index 2b81217d..5ac09cf0 100644 --- a/notebooks/direct/Example2_Ti-H.ipynb +++ b/notebooks/direct/Example2_Ti-H.ipynb @@ -65,9 +65,7 @@ "\n", "\n", "def load_ase_MD_traj(filename: str):\n", - " \"\"\"\n", - " Load .traj to pymatgen structures\n", - " \"\"\"\n", + " \"\"\"Load .traj to pymatgen structures\"\"\"\n", " traj = Trajectory(filename)\n", " structures = [AseAtomsAdaptor.get_structure(tra) for tra in traj]\n", " return structures" From b0fb265b6992d60183c47a61ce3a150f635a13ec Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:20:13 -0700 Subject: [PATCH 13/63] Update Example2_Ti-H.ipynb Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- notebooks/direct/Example2_Ti-H.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/direct/Example2_Ti-H.ipynb b/notebooks/direct/Example2_Ti-H.ipynb index 5ac09cf0..0a5e5e36 100644 --- a/notebooks/direct/Example2_Ti-H.ipynb +++ b/notebooks/direct/Example2_Ti-H.ipynb @@ -65,7 +65,7 @@ "\n", "\n", "def load_ase_MD_traj(filename: str):\n", - " \"\"\"Load .traj to pymatgen structures\"\"\"\n", + " \"\"\"Load .traj to pymatgen structures.\"\"\"\n", " traj = Trajectory(filename)\n", " structures = [AseAtomsAdaptor.get_structure(tra) for tra in traj]\n", " return structures" From fa9bd7b263cd204012cb2a5cdd23a54c70028763 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:30:36 -0700 Subject: [PATCH 14/63] Update pyproject.toml Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- pyproject.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 69e497d1..23526915 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -109,12 +109,11 @@ lint.select = [ "YTT", # flake8-2020 ] lint.ignore = [ - "RET504", # assignment before `return` statement - "D103", # docstring is missing "B023", # Function definition does not bind loop variable "B028", # No explicit stacklevel keyword argument found "B904", # Within an except clause, raise exceptions with ... "C408", # unnecessary-collection-call + "D103", # docstring is missing "D105", # Missing docstring in magic method "D205", # 1 blank line required between summary line and description "D212", # Multi-line docstring summary should start at the first line @@ -124,8 +123,10 @@ lint.ignore = [ "PLR", # pylint refactor "PLW2901", # Outer for loop variable overwritten by inner assignment target "PT013", # pytest-incorrect-pytest-import + "RET504", # assignment before `return` statement "RUF012", # Disable checks for mutable class args. This is a non-problem. "SIM105", # Use contextlib.suppress(OSError) instead of try-except-pass + "SIM108", # Use ternary operator instead of `if`-`else`-block ] lint.pydocstyle.convention = "google" lint.isort.required-imports = ["from __future__ import annotations"] From f3d402301751c70f973cc5ccc9341848fb3b79e4 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:37:18 -0700 Subject: [PATCH 15/63] Update process_vasprun_to_mliap.ipynb Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- notebooks/pes/data/process_vasprun_to_mliap.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/pes/data/process_vasprun_to_mliap.ipynb b/notebooks/pes/data/process_vasprun_to_mliap.ipynb index b43aa738..bf759a5b 100644 --- a/notebooks/pes/data/process_vasprun_to_mliap.ipynb +++ b/notebooks/pes/data/process_vasprun_to_mliap.ipynb @@ -17,7 +17,7 @@ "\n", "def get_document(vrun) -> dict:\n", " \"\"\"\n", - " Parse the vasprun into a dictionary\n", + " Parse the vasprun into a dictionary.\n", "\n", " Args:\n", " vrun (Vasprun object): the vasprun object from pymatgen\n", From c5209d1bbbbffdcf06e7e4c0c8fcd5b91d8e165a Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:38:44 -0700 Subject: [PATCH 16/63] Update garnet_formation_energy.ipynb Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- notebooks/model/garnet_formation_energy.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/model/garnet_formation_energy.ipynb b/notebooks/model/garnet_formation_energy.ipynb index 45fb2153..e1e069e2 100644 --- a/notebooks/model/garnet_formation_energy.ipynb +++ b/notebooks/model/garnet_formation_energy.ipynb @@ -190,7 +190,7 @@ "\n", "structures = []\n", "targets = []\n", - "for i, j in df.iterrows():\n", + "for _i, j in df.iterrows():\n", " s = parent.copy()\n", " for k, indices in mapping.items():\n", " for index in indices:\n", From ab8ebf8ccf5f2202d9025705612e5690667cbb47 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:40:22 -0700 Subject: [PATCH 17/63] Update GB energy model.ipynb Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- notebooks/gbe/GB energy model.ipynb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/notebooks/gbe/GB energy model.ipynb b/notebooks/gbe/GB energy model.ipynb index 5ff89aef..b13f2a9f 100644 --- a/notebooks/gbe/GB energy model.ipynb +++ b/notebooks/gbe/GB energy model.ipynb @@ -148,13 +148,13 @@ } ], "source": [ + "\n", + "import sklearn\n", + "\n", "\"\"\"\n", "Make prediction\n", "The model is a sklearn(0.24.2) pipeline object\n", "\"\"\"\n", - "\n", - "import sklearn\n", - "\n", "if sklearn.__version__ == \"0.24.2\":\n", " features = [\"d_gb\", \"cos(theta)\", \"mean_delta_bl\", \"mean_bl\"]\n", " module_dir = os.path.dirname(gbe.__file__)\n", From 1b433f88c3ee320f3fb687dd9dc975cc48aa1519 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:41:25 -0700 Subject: [PATCH 18/63] Update GB energy model.ipynb Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- notebooks/gbe/GB energy model.ipynb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/notebooks/gbe/GB energy model.ipynb b/notebooks/gbe/GB energy model.ipynb index b13f2a9f..07ea6785 100644 --- a/notebooks/gbe/GB energy model.ipynb +++ b/notebooks/gbe/GB energy model.ipynb @@ -123,8 +123,7 @@ "source": [ "\"\"\"\n", "Generate features for db entries\n", - "The dataframe containing all features and labels for all 361 data \n", - "is located at maml/apps/gbe/data/features.pickle\n", + "The dataframe containing all features and labels for all 361 data is located at maml/apps/gbe/data/features.pickle\n", "\"\"\"\n", "\n", "describer = GBDescriber()\n", From 1669ac5924382ebf68805e54563b747792dd3ac4 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:25:55 -0700 Subject: [PATCH 19/63] Update _gap.py Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- src/maml/apps/pes/_gap.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/maml/apps/pes/_gap.py b/src/maml/apps/pes/_gap.py index 6a794b8f..b5152d3f 100644 --- a/src/maml/apps/pes/_gap.py +++ b/src/maml/apps/pes/_gap.py @@ -58,8 +58,7 @@ def _line_up(structure, energy, forces, virial_stress): virial_stress (list): stress should has 6 distinct elements arranged in order [xx, yy, zz, xy, yz, xz]. - Returns: - outputs: a proper format storing structure, energy, forces, virial_stress. + Returns: a proper format storing structure, energy, forces, virial_stress. """ full_virial_stress = [ virial_stress[0], From 206469e608d013771fa9be4e5880bb5d90258431 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:30:00 -0700 Subject: [PATCH 20/63] Update pca.py Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- src/maml/sampling/pca.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/maml/sampling/pca.py b/src/maml/sampling/pca.py index 39668471..76432d0c 100644 --- a/src/maml/sampling/pca.py +++ b/src/maml/sampling/pca.py @@ -1,5 +1,7 @@ -"""This file contains the PCA implementation.""" - +""" +This module implements PCA (Principal Component Analysis) sampling techniques +for the MAML framework. +""" from __future__ import annotations import logging From bee8e972ce7ae706d813c8c4867b964c4c0f784c Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:31:05 -0700 Subject: [PATCH 21/63] Update pyproject.toml Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 23526915..d147ad39 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -117,6 +117,7 @@ lint.ignore = [ "D105", # Missing docstring in magic method "D205", # 1 blank line required between summary line and description "D212", # Multi-line docstring summary should start at the first line + "D417", # Argument description in the docstring "PD901", # pandas-df-variable-name "PERF203", # try-except-in-loop "PERF401", # manual-list-comprehension (TODO fix these or wait for autofix) From 5068c43cd16e6af75ab23745485aef53c4a6561b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Sep 2024 21:32:56 +0000 Subject: [PATCH 22/63] pre-commit auto-fixes --- src/maml/sampling/pca.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/maml/sampling/pca.py b/src/maml/sampling/pca.py index 76432d0c..2ea17583 100644 --- a/src/maml/sampling/pca.py +++ b/src/maml/sampling/pca.py @@ -2,6 +2,7 @@ This module implements PCA (Principal Component Analysis) sampling techniques for the MAML framework. """ + from __future__ import annotations import logging From 8c5f5494b86e77a00829552e30b63998bd972a14 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:39:36 -0700 Subject: [PATCH 23/63] Update example.ipynb Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- notebooks/pes/qsnap/example.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/pes/qsnap/example.ipynb b/notebooks/pes/qsnap/example.ipynb index 42eb4812..ae5f57b3 100644 --- a/notebooks/pes/qsnap/example.ipynb +++ b/notebooks/pes/qsnap/example.ipynb @@ -78,7 +78,7 @@ "describer = BispectrumCoefficients(\n", " rcutfac=0.5, twojmax=6, element_profile=element_profile, quadratic=True, pot_fit=True\n", ")\n", - "model = ModelWithSklearn(describer=describer, model=LinearRegression())\n", + "model = SKLModel(describer=describer, model=LinearRegression())\n", "qsnap = SNAPotential(model=model)\n", "qsnap.train(train_structures, train_energies, train_forces, sample_weight=weights)" ] From 6d3b16d89a4146669e9b6da0528830fa97ada997 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:43:04 -0700 Subject: [PATCH 24/63] Update example.ipynb Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- notebooks/pes/qsnap/example.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/pes/qsnap/example.ipynb b/notebooks/pes/qsnap/example.ipynb index ae5f57b3..52060dbb 100644 --- a/notebooks/pes/qsnap/example.ipynb +++ b/notebooks/pes/qsnap/example.ipynb @@ -70,7 +70,7 @@ "outputs": [], "source": [ "from sklearn.linear_model import LinearRegression\n", - "\n", + "from maml.base import SKLModel\n", "from maml.apps.pes import SNAPotential\n", "from maml.describers import BispectrumCoefficients\n", "\n", From d953c673cc49a31128d4205e4bf491761b6eff0e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Sep 2024 21:43:43 +0000 Subject: [PATCH 25/63] pre-commit auto-fixes --- notebooks/pes/qsnap/example.ipynb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/notebooks/pes/qsnap/example.ipynb b/notebooks/pes/qsnap/example.ipynb index 52060dbb..1c073e56 100644 --- a/notebooks/pes/qsnap/example.ipynb +++ b/notebooks/pes/qsnap/example.ipynb @@ -70,8 +70,9 @@ "outputs": [], "source": [ "from sklearn.linear_model import LinearRegression\n", - "from maml.base import SKLModel\n", + "\n", "from maml.apps.pes import SNAPotential\n", + "from maml.base import SKLModel\n", "from maml.describers import BispectrumCoefficients\n", "\n", "element_profile = {\"Mo\": {\"r\": 5.0, \"w\": 1}, \"Ni\": {\"r\": 5.0, \"w\": 1}}\n", From 748cd9a7f08bb7413b51a303bfdfe68eaa851428 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:55:41 -0700 Subject: [PATCH 26/63] Update example.ipynb Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- notebooks/pes/qsnap/example.ipynb | 1 - 1 file changed, 1 deletion(-) diff --git a/notebooks/pes/qsnap/example.ipynb b/notebooks/pes/qsnap/example.ipynb index 1c073e56..1c4da72e 100644 --- a/notebooks/pes/qsnap/example.ipynb +++ b/notebooks/pes/qsnap/example.ipynb @@ -70,7 +70,6 @@ "outputs": [], "source": [ "from sklearn.linear_model import LinearRegression\n", - "\n", "from maml.apps.pes import SNAPotential\n", "from maml.base import SKLModel\n", "from maml.describers import BispectrumCoefficients\n", From 75cb1e758c986ecbadfcbb95c360612e48ef2ecb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Sep 2024 21:56:22 +0000 Subject: [PATCH 27/63] pre-commit auto-fixes --- notebooks/pes/qsnap/example.ipynb | 1 + 1 file changed, 1 insertion(+) diff --git a/notebooks/pes/qsnap/example.ipynb b/notebooks/pes/qsnap/example.ipynb index 1c4da72e..1c073e56 100644 --- a/notebooks/pes/qsnap/example.ipynb +++ b/notebooks/pes/qsnap/example.ipynb @@ -70,6 +70,7 @@ "outputs": [], "source": [ "from sklearn.linear_model import LinearRegression\n", + "\n", "from maml.apps.pes import SNAPotential\n", "from maml.base import SKLModel\n", "from maml.describers import BispectrumCoefficients\n", From fa4db5af7d85798f27d0474dfc894e84a37e5a71 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 15:52:11 -0700 Subject: [PATCH 28/63] Update conf.py Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- docs/conf.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 779e27c9..c819de28 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,8 +1,10 @@ -# Configuration file for the Sphinx documentation builder. -# -# This file only contains a selection of the most common options. For a full -# list see the documentation: -# https://www.sphinx-doc.org/en/master/usage/configuration.html +""" +Configuration file for the Sphinx documentation builder. + +This file only contains a selection of the most common options. For a full +list see the documentation: +https://www.sphinx-doc.org/en/master/usage/configuration.html +""" from __future__ import annotations # -- Path setup -------------------------------------------------------------- From e67fd4deb0eeb487fa2fd94385dc26eb171d9cff Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Wed, 18 Sep 2024 15:57:10 -0700 Subject: [PATCH 29/63] Add files via upload Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> From 291664a56ce84081c92907505abfb8d3f27e487d Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Thu, 19 Sep 2024 11:14:54 -0700 Subject: [PATCH 30/63] Add files via upload Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- src/maml/describers/__init__.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/maml/describers/__init__.py b/src/maml/describers/__init__.py index e392a5ff..2e423c6f 100644 --- a/src/maml/describers/__init__.py +++ b/src/maml/describers/__init__.py @@ -10,14 +10,11 @@ from ._matminer import wrap_matminer_describer from ._megnet import MEGNetSite, MEGNetStructure from ._rdf import RadialDistributionFunction -from ._site import BispectrumCoefficients, BPSymmetryFunctions, SiteElementProperty, SmoothOverlapAtomicPosition -from ._structure import ( - CoulombEigenSpectrum, - CoulombMatrix, - DistinctSiteProperty, - RandomizedCoulombMatrix, - SortedCoulombMatrix, -) +from ._site import (BispectrumCoefficients, BPSymmetryFunctions, + SiteElementProperty, SmoothOverlapAtomicPosition) +from ._structure import (CoulombEigenSpectrum, CoulombMatrix, + DistinctSiteProperty, RandomizedCoulombMatrix, + SortedCoulombMatrix) __all__ = [ "BispectrumCoefficients", From 7a7c6e812f70b9265fb92734ea3fd6ae29ed0241 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 18:16:12 +0000 Subject: [PATCH 31/63] pre-commit auto-fixes --- src/maml/describers/__init__.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/maml/describers/__init__.py b/src/maml/describers/__init__.py index 2e423c6f..e392a5ff 100644 --- a/src/maml/describers/__init__.py +++ b/src/maml/describers/__init__.py @@ -10,11 +10,14 @@ from ._matminer import wrap_matminer_describer from ._megnet import MEGNetSite, MEGNetStructure from ._rdf import RadialDistributionFunction -from ._site import (BispectrumCoefficients, BPSymmetryFunctions, - SiteElementProperty, SmoothOverlapAtomicPosition) -from ._structure import (CoulombEigenSpectrum, CoulombMatrix, - DistinctSiteProperty, RandomizedCoulombMatrix, - SortedCoulombMatrix) +from ._site import BispectrumCoefficients, BPSymmetryFunctions, SiteElementProperty, SmoothOverlapAtomicPosition +from ._structure import ( + CoulombEigenSpectrum, + CoulombMatrix, + DistinctSiteProperty, + RandomizedCoulombMatrix, + SortedCoulombMatrix, +) __all__ = [ "BispectrumCoefficients", From be3ddfb20d59d248c1cb5d780c2088051d51948e Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Thu, 19 Sep 2024 11:26:15 -0700 Subject: [PATCH 32/63] Update pyproject.toml Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index d147ad39..2682e0dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -118,6 +118,7 @@ lint.ignore = [ "D205", # 1 blank line required between summary line and description "D212", # Multi-line docstring summary should start at the first line "D417", # Argument description in the docstring + "I001", # import block sort "PD901", # pandas-df-variable-name "PERF203", # try-except-in-loop "PERF401", # manual-list-comprehension (TODO fix these or wait for autofix) From 9dbe9e5144f0fca0cd58c6b3d764f7db4a02efcd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 18:27:56 +0000 Subject: [PATCH 33/63] pre-commit auto-fixes --- src/maml/describers/_composition.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/maml/describers/_composition.py b/src/maml/describers/_composition.py index 0ac38280..9f5463c9 100644 --- a/src/maml/describers/_composition.py +++ b/src/maml/describers/_composition.py @@ -28,7 +28,7 @@ try: - from matminer.featurizers.composition import ( # noqa + from matminer.featurizers.composition import ( ElementProperty as MatminerElementProperty, ) From 1a50d871ec75f5a7b72efe4b5fc17ed950c0b68f Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Thu, 19 Sep 2024 11:36:22 -0700 Subject: [PATCH 34/63] Update requirements.txt Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 135f3b67..90712d9f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -pymatgen==2024.9.17.1 +pymatgen==2023.10.11 scikit-learn==1.5.2 h5py==3.11.0 joblib==1.4.2 From 983c63fd419430e1b007f425633a476b64cb4596 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Thu, 19 Sep 2024 11:42:33 -0700 Subject: [PATCH 35/63] Update requirements-ci.txt Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- requirements-ci.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-ci.txt b/requirements-ci.txt index 4c69ac53..b6a449c4 100644 --- a/requirements-ci.txt +++ b/requirements-ci.txt @@ -1,7 +1,7 @@ pytest pytest-cov coveralls -mypy +mypy==1.10.1 pydocstyle black ruff From 15aca59a56eda1184911db088cf729a9ce2260a3 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Thu, 19 Sep 2024 11:50:43 -0700 Subject: [PATCH 36/63] Update requirements-dl.txt Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- requirements-dl.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dl.txt b/requirements-dl.txt index 39ec24c4..6fd14f13 100644 --- a/requirements-dl.txt +++ b/requirements-dl.txt @@ -1,2 +1,2 @@ -tensorflow==2.14.0 +tensorflow==2.9.1 torch==2.3.1 From 0dcb22167845d654181471faa0059cdad55fd82c Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Thu, 19 Sep 2024 11:59:08 -0700 Subject: [PATCH 37/63] Update pyproject.toml Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2682e0dd..b5f95af4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ authors = [ ] description = "MAterials Machine Learning (maml) is a machine learning library for materials science." readme = "README.md" -requires-python = ">=3.10" +requires-python = ">=3.9" keywords = [ "materials", "interatomic potential", From 9bf4f51e2983cc6775e00f48288b34ef6e8c2105 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Thu, 19 Sep 2024 12:03:10 -0700 Subject: [PATCH 38/63] Update testing.yml Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- .github/workflows/testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 3e7a3e36..10c667ce 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -22,7 +22,7 @@ jobs: max-parallel: 20 matrix: os: [ubuntu-latest] - python-version: ["3.10", "3.11"] + python-version: ["3.10", "3.9"] runs-on: ${{ matrix.os }} env: From 39e1ce857e6cc2ae985cad0ca48dfcbb7706899a Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Thu, 19 Sep 2024 12:18:56 -0700 Subject: [PATCH 39/63] Update _material.py Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- src/maml/utils/_material.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/maml/utils/_material.py b/src/maml/utils/_material.py index 4e208d65..4a3b0013 100644 --- a/src/maml/utils/_material.py +++ b/src/maml/utils/_material.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import Union from pymatgen.core import Composition, Molecule, Structure @@ -17,6 +18,6 @@ def to_composition(obj: Composition | Molecule | Structure | str) -> Composition """ if isinstance(obj, str): return Composition(obj) - if isinstance(obj, Structure | Molecule): + if isinstance(obj, Union[Structure, Molecule]): return obj.composition return obj From d29a7fcd2b7a88d8aa3495e96e7a662a7b4edaf8 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Thu, 19 Sep 2024 12:22:55 -0700 Subject: [PATCH 40/63] Update pyproject.toml Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index b5f95af4..9123866c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,6 +129,7 @@ lint.ignore = [ "RUF012", # Disable checks for mutable class args. This is a non-problem. "SIM105", # Use contextlib.suppress(OSError) instead of try-except-pass "SIM108", # Use ternary operator instead of `if`-`else`-block + "UP007", # X | Y ] lint.pydocstyle.convention = "google" lint.isort.required-imports = ["from __future__ import annotations"] From 2da756a72c1853999d1a0a1f430f3309147d4bdf Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Sat, 21 Sep 2024 09:40:12 -0700 Subject: [PATCH 41/63] Update _material.py Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- src/maml/utils/_material.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/maml/utils/_material.py b/src/maml/utils/_material.py index 4a3b0013..d6fc915f 100644 --- a/src/maml/utils/_material.py +++ b/src/maml/utils/_material.py @@ -2,7 +2,6 @@ from __future__ import annotations -from typing import Union from pymatgen.core import Composition, Molecule, Structure @@ -18,6 +17,6 @@ def to_composition(obj: Composition | Molecule | Structure | str) -> Composition """ if isinstance(obj, str): return Composition(obj) - if isinstance(obj, Union[Structure, Molecule]): + if isinstance(obj,(Structure, Molecule)): return obj.composition return obj From 872de13116b36c9aec5fbab9bb0b76e01cb94610 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 21 Sep 2024 16:42:06 +0000 Subject: [PATCH 42/63] pre-commit auto-fixes --- src/maml/utils/_material.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/maml/utils/_material.py b/src/maml/utils/_material.py index d6fc915f..e541646e 100644 --- a/src/maml/utils/_material.py +++ b/src/maml/utils/_material.py @@ -17,6 +17,6 @@ def to_composition(obj: Composition | Molecule | Structure | str) -> Composition """ if isinstance(obj, str): return Composition(obj) - if isinstance(obj,(Structure, Molecule)): + if isinstance(obj, (Structure, Molecule)): return obj.composition return obj From fc17348bd3a9bd38d123f6d6126f7e694214f0ad Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Sat, 21 Sep 2024 10:01:58 -0700 Subject: [PATCH 43/63] Update _composition.py Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- src/maml/describers/_composition.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/maml/describers/_composition.py b/src/maml/describers/_composition.py index 9f5463c9..baadc93d 100644 --- a/src/maml/describers/_composition.py +++ b/src/maml/describers/_composition.py @@ -142,7 +142,7 @@ def transform_one(self, obj: Structure | str | Composition) -> pd.DataFrame: data.append(self.element_properties[i]) weights.append(j) - data = list(zip(*data, strict=False)) + data = list(zip(*data)) features = [] for stat in self.stats_func: for d in data: From db0878358265d6eabb765c755ceca9fff797b808 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 21 Sep 2024 17:02:35 +0000 Subject: [PATCH 44/63] pre-commit auto-fixes --- src/maml/describers/_composition.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/maml/describers/_composition.py b/src/maml/describers/_composition.py index baadc93d..9f5463c9 100644 --- a/src/maml/describers/_composition.py +++ b/src/maml/describers/_composition.py @@ -142,7 +142,7 @@ def transform_one(self, obj: Structure | str | Composition) -> pd.DataFrame: data.append(self.element_properties[i]) weights.append(j) - data = list(zip(*data)) + data = list(zip(*data, strict=False)) features = [] for stat in self.stats_func: for d in data: From df7368bda32af55292d38342e917df471963ab5a Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Sat, 21 Sep 2024 10:07:04 -0700 Subject: [PATCH 45/63] Update requirements-ci.txt Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- requirements-ci.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-ci.txt b/requirements-ci.txt index b6a449c4..31e2b19b 100644 --- a/requirements-ci.txt +++ b/requirements-ci.txt @@ -4,6 +4,6 @@ coveralls mypy==1.10.1 pydocstyle black -ruff +ruff==0.5.1 megnet m3gnet From 18b6cbd3d4ef18d000f8d5890a33b93bb6e23d91 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Sat, 21 Sep 2024 10:16:09 -0700 Subject: [PATCH 46/63] Update linting.yml Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- .github/workflows/linting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 7c494535..e691c553 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -8,7 +8,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: [3.11] + python-version: [3.9] steps: - uses: actions/checkout@v2 From 4a44b6784ccf7b7ff4b71d4e82108843fec99851 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Sat, 21 Sep 2024 10:21:54 -0700 Subject: [PATCH 47/63] Update _composition.py Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- src/maml/describers/_composition.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/maml/describers/_composition.py b/src/maml/describers/_composition.py index 9f5463c9..baadc93d 100644 --- a/src/maml/describers/_composition.py +++ b/src/maml/describers/_composition.py @@ -142,7 +142,7 @@ def transform_one(self, obj: Structure | str | Composition) -> pd.DataFrame: data.append(self.element_properties[i]) weights.append(j) - data = list(zip(*data, strict=False)) + data = list(zip(*data)) features = [] for stat in self.stats_func: for d in data: From 40e2f763fcddd8b419093e7f1abd2081bec46449 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 21 Sep 2024 17:22:31 +0000 Subject: [PATCH 48/63] pre-commit auto-fixes --- src/maml/describers/_composition.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/maml/describers/_composition.py b/src/maml/describers/_composition.py index baadc93d..9f5463c9 100644 --- a/src/maml/describers/_composition.py +++ b/src/maml/describers/_composition.py @@ -142,7 +142,7 @@ def transform_one(self, obj: Structure | str | Composition) -> pd.DataFrame: data.append(self.element_properties[i]) weights.append(j) - data = list(zip(*data)) + data = list(zip(*data, strict=False)) features = [] for stat in self.stats_func: for d in data: From 5d4bd17947d145b5aca65b8f7fae270ad650d39e Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Sat, 21 Sep 2024 10:29:02 -0700 Subject: [PATCH 49/63] Update pyproject.toml Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9123866c..b4b3628b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,7 +75,7 @@ where = ["src"] line-length = 120 [tool.ruff] -target-version = "py311" +target-version = "3.9" line-length = 160 lint.select = [ "B", # flake8-bugbear From 558d8bffcc9f8f4a8233522b04b7ea62368ffc0f Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Sat, 21 Sep 2024 10:33:33 -0700 Subject: [PATCH 50/63] Update pyproject.toml Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b4b3628b..2055db10 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,7 +75,7 @@ where = ["src"] line-length = 120 [tool.ruff] -target-version = "3.9" +target-version = "py39" line-length = 160 lint.select = [ "B", # flake8-bugbear From b105c39d9e386306b5325e82f597ebc11e06aa31 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Sat, 21 Sep 2024 10:41:35 -0700 Subject: [PATCH 51/63] Update _composition.py Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- src/maml/describers/_composition.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/maml/describers/_composition.py b/src/maml/describers/_composition.py index 9f5463c9..b3146ca7 100644 --- a/src/maml/describers/_composition.py +++ b/src/maml/describers/_composition.py @@ -142,7 +142,7 @@ def transform_one(self, obj: Structure | str | Composition) -> pd.DataFrame: data.append(self.element_properties[i]) weights.append(j) - data = list(zip(*data, strict=False)) + data = list(zip(*data)) features = [] for stat in self.stats_func: for d in data: @@ -273,7 +273,7 @@ def _reduce_dimension( transformed_values = m.fit_transform(value_np_array) - for key, value_list in zip(p_keys, transformed_values, strict=False): + for key, value_list in zip(p_keys, transformed_values): element_properties[key] = value_list.tolist() return element_properties, property_names From 37adfc3e17d401a6c279a46ae54d07477535c571 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Sat, 21 Sep 2024 10:47:36 -0700 Subject: [PATCH 52/63] Update _stats.py Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- src/maml/utils/_stats.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/maml/utils/_stats.py b/src/maml/utils/_stats.py index 2c631a40..8a1cd047 100644 --- a/src/maml/utils/_stats.py +++ b/src/maml/utils/_stats.py @@ -309,9 +309,9 @@ def power_mean(data: list[float], weights: list[float] | None = None, p: int = 1 assert abs(sum(weights) - 1) < 1e-3 if p == 0: - return np.prod([i**j for i, j in zip(data, weights, strict=False)]).item() + return np.prod([i**j for i, j in zip(data, weights)]).item() - s = np.sum([j * i**p for i, j in zip(data, weights, strict=False)]) + s = np.sum([j * i**p for i, j in zip(data, weights)]) return s ** (1.0 / p) @staticmethod From 936e4a4b7f04693430bb762f90976bc387029ddc Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Sat, 21 Sep 2024 10:48:41 -0700 Subject: [PATCH 53/63] Update _mixin.py Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- src/maml/base/_mixin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/maml/base/_mixin.py b/src/maml/base/_mixin.py index da1693f5..13bdfade 100644 --- a/src/maml/base/_mixin.py +++ b/src/maml/base/_mixin.py @@ -52,10 +52,10 @@ def train( return super().train(objs, targets, val_objs, val_targets, **kwargs) # type: ignore num_atoms = [len(i) for i in objs] - targets = [self.target_scaler.transform(i, j) for i, j in zip(targets, num_atoms, strict=False)] + targets = [self.target_scaler.transform(i, j) for i, j in zip(targets, num_atoms)] if val_objs is not None and val_targets is not None: num_val_atoms = [len(i) for i in val_objs] - val_targets = [self.target_scaler.transform(i, j) for i, j in zip(val_targets, num_val_atoms, strict=False)] + val_targets = [self.target_scaler.transform(i, j) for i, j in zip(val_targets, num_val_atoms)] super().train(objs, targets, val_objs, val_targets, **kwargs) # type: ignore return self # type: ignore @@ -66,4 +66,4 @@ def predict_objs(self, objs: list | np.ndarray) -> np.ndarray: """ preds = super().predict_objs(objs) # type: ignore ns = [len(i) for i in objs] - return np.array([self.target_scaler.inverse_transform(i, j) for i, j in zip(preds, ns, strict=False)]) + return np.array([self.target_scaler.inverse_transform(i, j) for i, j in zip(preds, ns)]) From ec39f5612dfacc028f4eb7973e4710b3d33c8a79 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Sat, 21 Sep 2024 10:49:16 -0700 Subject: [PATCH 54/63] Update _stats.py Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- src/maml/utils/_stats.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/maml/utils/_stats.py b/src/maml/utils/_stats.py index 8a1cd047..224d54c2 100644 --- a/src/maml/utils/_stats.py +++ b/src/maml/utils/_stats.py @@ -367,7 +367,7 @@ def _root_moment(data, weights, order) -> float: if order > 1: mean = np.mean(data) - moment = sum((i - mean) ** order * j for i, j in zip(data, pmf, strict=False)) + moment = sum((i - mean) ** order * j for i, j in zip(data, pmf)) # when order is odd, moment can be negative sign = -1 if moment < 0 else 1 @@ -446,7 +446,7 @@ def get_full_stats_and_funcs(stats: list) -> tuple[list[str], list]: func = getattr(Stats, stat_name) args = splits[1:] arg_dict = {} - for name_dict, arg in zip(STATS_KWARGS[stat_name], args, strict=False): # type: ignore + for name_dict, arg in zip(STATS_KWARGS[stat_name], args): # type: ignore name = next(iter(name_dict.keys())) value_type = next(iter(name_dict.values())) try: From 7e6074d6b2c46ee253492640f6e5566a72aef279 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Sat, 21 Sep 2024 10:49:43 -0700 Subject: [PATCH 55/63] Update _matminer.py Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- src/maml/describers/_matminer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/maml/describers/_matminer.py b/src/maml/describers/_matminer.py index eaaae151..1692835d 100644 --- a/src/maml/describers/_matminer.py +++ b/src/maml/describers/_matminer.py @@ -57,7 +57,7 @@ def transform_one(self, obj: Any): obj = obj_conversion(obj) results = wrapped_class.featurize(self, obj) labels = wrapped_class.feature_labels(self) - return pd.DataFrame({i: [j] for i, j in zip(labels, results, strict=False)}) + return pd.DataFrame({i: [j] for i, j in zip(labels, results)}) @classmethod # type: ignore def from_preset(cls, name: str, **kwargs): # type: ignore From 4856415cffb29b40de464619afc58bee8a7f04f1 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Sat, 21 Sep 2024 10:50:11 -0700 Subject: [PATCH 56/63] Update clustering.py Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- src/maml/sampling/clustering.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/maml/sampling/clustering.py b/src/maml/sampling/clustering.py index d5f96716..6eaad932 100644 --- a/src/maml/sampling/clustering.py +++ b/src/maml/sampling/clustering.py @@ -76,7 +76,7 @@ def transform(self, PCAfeatures): f"BirchClustering with threshold_init={self.threshold_init} and n={self.n} " f"gives {len(set(model.subcluster_labels_))} clusters.", ) - label_centers = dict(zip(model.subcluster_labels_, model.subcluster_centers_, strict=False)) + label_centers = dict(zip(model.subcluster_labels_, model.subcluster_centers_)) return { "labels": labels, "label_centers": label_centers, From eb2d5b3c5ca9dcb084a24b7b54f0d5673550b9dc Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Sat, 21 Sep 2024 10:50:45 -0700 Subject: [PATCH 57/63] Update _lammps.py Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- src/maml/utils/_lammps.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/maml/utils/_lammps.py b/src/maml/utils/_lammps.py index ab0f2343..6a48dc34 100644 --- a/src/maml/utils/_lammps.py +++ b/src/maml/utils/_lammps.py @@ -246,7 +246,7 @@ def write_data_from_structure( ph = f"{{:.{significant_figures}f}}" - for bound, d in zip(bounds, "xyz", strict=False): + for bound, d in zip(bounds, "xyz"): line = " ".join([ph.format(i) for i in bound] + [f"{d}{i}" for i in ["lo", "hi"]]) lines.append(line) if tilt is not None: @@ -259,7 +259,7 @@ def write_data_from_structure( lines.append("\nAtoms\n") new_coords = symmop.operate_multi(structure.cart_coords) - for i, (site, coords) in enumerate(zip(structure.sites, new_coords, strict=False)): + for i, (site, coords) in enumerate(zip(structure.sites, new_coords)): charge = _get_charge(site.specie) line = "{} {} " + " ".join([ph] * 4) index = i + 1 From 228f256684c1f1739185f4fd2363338219f3a2d3 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Sat, 21 Sep 2024 10:51:37 -0700 Subject: [PATCH 58/63] Update optimizer.py Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- src/maml/apps/bowsr/optimizer.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/maml/apps/bowsr/optimizer.py b/src/maml/apps/bowsr/optimizer.py index ae5a798f..76bdf789 100644 --- a/src/maml/apps/bowsr/optimizer.py +++ b/src/maml/apps/bowsr/optimizer.py @@ -58,17 +58,17 @@ def struct2perturbation( wyckoffs = sd["wyckoffs"] symm_ops = [ SymmOp.from_rotation_and_translation(rotation, translation, tol=0.1) - for rotation, translation in zip(sd["rotations"], sd["translations"], strict=False) + for rotation, translation in zip(sd["rotations"], sd["translations"]) ] if use_symmetry: equivalent_atoms = sd["equivalent_atoms"] - mapping = dict(zip(range(structure.num_sites), equivalent_atoms, strict=False)) + mapping = dict(zip(range(structure.num_sites), equivalent_atoms)) symmetrically_distinct_indices = np.unique(equivalent_atoms) indices = symmetrically_distinct_indices.tolist() else: indices = list(range(structure.num_sites)) - mapping = dict(zip(indices, indices, strict=False)) + mapping = dict(zip(indices, indices)) wps = [] for i in indices: @@ -195,7 +195,7 @@ def get_derived_structure(self, x: np.ndarray) -> Structure: ] ) - for i, (idx, wp) in enumerate(zip(self.indices, self.wps, strict=False)): + for i, (idx, wp) in enumerate(zip(self.indices, self.wps)): p = wp.standardize(frac_coords[idx]) + x_wyckoff[i * 3 : (i + 1) * 3] orbit = wp.get_orbit(p) @@ -524,7 +524,7 @@ def gpr_from_dict(gpr_d): scaler = getattr(preprocessing, d["scaler"]["@class"])(**d["scaler"]["params"]) optimizer.scaler = scaler optimizer._space.scaler = scaler - for x, target in zip(space_params, space_target, strict=False): + for x, target in zip(space_params, space_target): optimizer._space._params = np.concatenate([optimizer._space._params, x.reshape(1, -1)]) optimizer._space._target = np.concatenate([optimizer._space._target, [target]]) optimizer._space._bounds = space_bounds From d9b9e1e06a1e0d439dd733f39d3791ef785bd1c1 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Sat, 21 Sep 2024 10:52:01 -0700 Subject: [PATCH 59/63] Update _describer.py Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- src/maml/base/_describer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/maml/base/_describer.py b/src/maml/base/_describer.py index 6fbd1717..e8f02c7c 100644 --- a/src/maml/base/_describer.py +++ b/src/maml/base/_describer.py @@ -124,7 +124,7 @@ def transform(self, objs: list[Any]) -> Any: multi_output = self._is_multi_output() if not multi_output: features = [features] - batched_features = [self.feature_batch(i) for i in list(*zip(features, strict=False))] # type: ignore + batched_features = [self.feature_batch(i) for i in list(*zip(features))] # type: ignore return batched_features if multi_output else batched_features[0] def _is_multi_output(self) -> bool: From c6bcb9a683c3e4663074f325bdaa71de2cd9b431 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Sat, 21 Sep 2024 10:52:24 -0700 Subject: [PATCH 60/63] Update _data_conversion.py Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- src/maml/utils/_data_conversion.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/maml/utils/_data_conversion.py b/src/maml/utils/_data_conversion.py index 359486da..13356241 100644 --- a/src/maml/utils/_data_conversion.py +++ b/src/maml/utils/_data_conversion.py @@ -54,7 +54,7 @@ def pool_from(structures, energies=None, forces=None, stresses=None): stresses = stresses if stresses is not None else [None] * len(structures) return [ doc_from(structure, energy, force, stress) - for structure, energy, force, stress in zip(structures, energies, forces, stresses, strict=False) + for structure, energy, force, stress in zip(structures, energies, forces, stresses) ] From 4c4f9990f0329781bf33235ce3768d7eafd8710c Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Sat, 21 Sep 2024 10:52:51 -0700 Subject: [PATCH 61/63] Update _preprocessing.py Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- src/maml/utils/_preprocessing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/maml/utils/_preprocessing.py b/src/maml/utils/_preprocessing.py index b2618ec9..642d37cf 100644 --- a/src/maml/utils/_preprocessing.py +++ b/src/maml/utils/_preprocessing.py @@ -107,7 +107,7 @@ def from_training_data( is_intensive (bool): whether the target is intensive Returns: new instance. """ - new_targets = targets if is_intensive else [(i / len(j)) for i, j in zip(targets, structures, strict=False)] + new_targets = targets if is_intensive else [(i / len(j)) for i, j in zip(targets, structures)] mean = np.mean(new_targets).item() std = np.std(new_targets).item() return cls(mean, std, is_intensive) From 84fa811b5b818e780eddb713c5adc583c6af46d1 Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Sat, 21 Sep 2024 10:53:15 -0700 Subject: [PATCH 62/63] Update _snap.py Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- src/maml/apps/pes/_snap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/maml/apps/pes/_snap.py b/src/maml/apps/pes/_snap.py index f9e8cf40..37af3b71 100644 --- a/src/maml/apps/pes/_snap.py +++ b/src/maml/apps/pes/_snap.py @@ -146,7 +146,7 @@ def write_param(self): coeff_lines = [] coeff_lines.append(f"{ne} {nbc + 1}") - for element, coeff in zip(self.elements, np.split(model.model.coef_, ne), strict=False): + for element, coeff in zip(self.elements, np.split(model.model.coef_, ne)): coeff_lines.append(f"{element} {profile[element]['r']} {profile[element]['w']}") coeff_lines.extend([str(c) for c in coeff]) with open(coeff_file, "w") as f: From db84cb2a5f218b94f4a367102b67ac51e808fc1a Mon Sep 17 00:00:00 2001 From: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> Date: Sat, 21 Sep 2024 10:53:39 -0700 Subject: [PATCH 63/63] Update _rdf.py Signed-off-by: Zishen Wang <64644075+zz11ss11zz@users.noreply.github.com> --- src/maml/describers/_rdf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/maml/describers/_rdf.py b/src/maml/describers/_rdf.py index bb3e0bbf..154a1623 100644 --- a/src/maml/describers/_rdf.py +++ b/src/maml/describers/_rdf.py @@ -233,7 +233,7 @@ def get_pair_distances(structure: Structure, r_max: float = 8.0) -> list[dict]: species = np.array([str(i.specie) for i in structure.sites]) res = [{"specie": i, "neighbors": {}} for i in species] neighbor_species = species[index2] - tuples = np.array(list(zip(index1, neighbor_species, strict=False)), dtype=[("index", "i4"), ("specie", "