pymdkit 1.2.0__tar.gz → 1.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. {pymdkit-1.2.0/src/pymdkit.egg-info → pymdkit-1.2.2}/PKG-INFO +3 -7
  2. {pymdkit-1.2.0 → pymdkit-1.2.2}/README.md +1 -2
  3. {pymdkit-1.2.0 → pymdkit-1.2.2}/pyproject.toml +4 -7
  4. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/__init__.py +1 -1
  5. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/commands/compute_msd_all_groups.py +4 -3
  6. pymdkit-1.2.2/src/pymdkit/commands/stable_entry.py +102 -0
  7. {pymdkit-1.2.0 → pymdkit-1.2.2/src/pymdkit.egg-info}/PKG-INFO +3 -7
  8. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit.egg-info/requires.txt +1 -4
  9. pymdkit-1.2.0/src/pymdkit/commands/stable_entry.py +0 -56
  10. {pymdkit-1.2.0 → pymdkit-1.2.2}/LICENSE +0 -0
  11. {pymdkit-1.2.0 → pymdkit-1.2.2}/setup.cfg +0 -0
  12. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/commands/__init__.py +0 -0
  13. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/commands/_fileio.py +0 -0
  14. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/commands/_vasp_output.py +0 -0
  15. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/commands/_vaspset.py +0 -0
  16. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/commands/add_groups.py +0 -0
  17. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/commands/compute_ehull.py +0 -0
  18. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/commands/compute_rmsd.py +0 -0
  19. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/commands/electrostatic_energy.py +0 -0
  20. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/commands/final_energy.py +0 -0
  21. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/commands/gather_contcar.py +0 -0
  22. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/commands/nep_rmse.py +0 -0
  23. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/commands/perturb.py +0 -0
  24. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/commands/stru2xyz.py +0 -0
  25. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/commands/submit_vasp.py +0 -0
  26. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/commands/substitute.py +0 -0
  27. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/commands/supercell.py +0 -0
  28. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/commands/symmetrize.py +0 -0
  29. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/commands/vasp2xyz.py +0 -0
  30. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/commands/vasp_relax.py +0 -0
  31. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/commands/vasp_static.py +0 -0
  32. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit/pymdkit_main.py +0 -0
  33. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit.egg-info/SOURCES.txt +0 -0
  34. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit.egg-info/dependency_links.txt +0 -0
  35. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit.egg-info/entry_points.txt +0 -0
  36. {pymdkit-1.2.0 → pymdkit-1.2.2}/src/pymdkit.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pymdkit
3
- Version: 1.2.0
3
+ Version: 1.2.2
4
4
  Summary: A unified command-line toolkit for atomistic / MD structure workflows.
5
5
  Author-email: Yueda Wang <ydwang0608@ustc.edu.cn>
6
6
  License-Expression: GPL-3.0-or-later
@@ -14,13 +14,10 @@ Requires-Python: >=3.9
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE
16
16
  Requires-Dist: numpy
17
- Requires-Dist: scipy
18
17
  Requires-Dist: ase
19
18
  Requires-Dist: pymatgen
20
- Requires-Dist: mp_api
19
+ Requires-Dist: mp-api
21
20
  Requires-Dist: pyxtal
22
- Requires-Dist: gemmi
23
- Requires-Dist: tqdm
24
21
  Requires-Dist: dpdata
25
22
  Dynamic: license-file
26
23
 
@@ -45,8 +42,7 @@ pip install pymdkit
45
42
  ```
46
43
 
47
44
  This installs the `pymdkit` command into the active conda environment, together
48
- with its dependencies (numpy, scipy, ase, pymatgen, pyxtal, mp_api, gemmi,
49
- tqdm).
45
+ with its direct dependencies (numpy, ase, pymatgen, mp-api, pyxtal, dpdata). Some of these packages may install their own transitive dependencies.
50
46
 
51
47
  Verify:
52
48
 
@@ -19,8 +19,7 @@ pip install pymdkit
19
19
  ```
20
20
 
21
21
  This installs the `pymdkit` command into the active conda environment, together
22
- with its dependencies (numpy, scipy, ase, pymatgen, pyxtal, mp_api, gemmi,
23
- tqdm).
22
+ with its direct dependencies (numpy, ase, pymatgen, mp-api, pyxtal, dpdata). Some of these packages may install their own transitive dependencies.
24
23
 
25
24
  Verify:
26
25
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pymdkit"
7
- version = "1.2.0"
7
+ version = "1.2.2"
8
8
  description = "A unified command-line toolkit for atomistic / MD structure workflows."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -25,13 +25,10 @@ classifiers = [
25
25
  # individual commands, so the dispatcher and `pymdkit -help` stay fast.
26
26
  dependencies = [
27
27
  "numpy",
28
- "scipy",
29
28
  "ase",
30
- "pymatgen",
31
- "mp_api",
32
- "pyxtal",
33
- "gemmi",
34
- "tqdm",
29
+ "pymatgen",
30
+ "mp-api",
31
+ "pyxtal",
35
32
  "dpdata",
36
33
  ]
37
34
 
@@ -1,3 +1,3 @@
1
1
  """pymdkit -- a unified CLI for atomistic / MD structure workflows."""
2
2
 
3
- __version__ = "1.2.0"
3
+ __version__ = "1.2.2"
@@ -25,7 +25,6 @@ from pathlib import Path
25
25
  from typing import Dict, Tuple
26
26
 
27
27
  import numpy as np
28
- import scipy.constants as consts
29
28
 
30
29
  try:
31
30
  from . import _fileio
@@ -37,6 +36,8 @@ HELP = "Diffusivity & conductivity from GPUMD MSD jobs (auto-scans <structure>/<
37
36
 
38
37
  JOB_FILES = ("msd.out", "thermo.out", "model.xyz", "run.in")
39
38
  SUMMARY_FILE = "msd_summary.txt"
39
+ ELEMENTARY_CHARGE_C = 1.602176634e-19
40
+ BOLTZMANN_J_PER_K = 1.380649e-23
40
41
 
41
42
 
42
43
  class MDAnalyzer:
@@ -176,8 +177,8 @@ class MDAnalyzer:
176
177
  def calculate_conductivity(self, diffusivities, num_ions, charge) -> np.ndarray:
177
178
  """Nernst-Einstein conductivity in mS/cm."""
178
179
  vol_cm3 = self.volume * 1e-24
179
- factor = (num_ions * charge ** 2 * consts.e ** 2
180
- / (vol_cm3 * consts.k * self.temperature))
180
+ factor = (num_ions * charge ** 2 * ELEMENTARY_CHARGE_C ** 2
181
+ / (vol_cm3 * BOLTZMANN_J_PER_K * self.temperature))
181
182
  return diffusivities * factor * 1000 # S/cm -> mS/cm
182
183
 
183
184
  def _format_summary(self, element, group_id, num_ions, temp, D, sigma=None) -> str:
@@ -0,0 +1,102 @@
1
+ """Download stable Materials Project structures for a chemical system."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import re
7
+ from dataclasses import dataclass
8
+ from pathlib import Path
9
+
10
+ COMMAND = "stable-entry"
11
+ HELP = "Download stable Materials Project structures for a chemical system."
12
+
13
+
14
+ @dataclass
15
+ class StableStructure:
16
+ material_id: str
17
+ formula: str
18
+ structure: object
19
+
20
+
21
+ def safe_formula(formula):
22
+ return re.sub(r"[^A-Za-z0-9_.-]+", "", str(formula))
23
+
24
+
25
+ def doc_get(doc, name, default=None):
26
+ if isinstance(doc, dict):
27
+ return doc.get(name, default)
28
+ return getattr(doc, name, default)
29
+
30
+
31
+ def normalize_doc(doc):
32
+ material_id = str(doc_get(doc, "material_id", "unknown"))
33
+ formula = doc_get(doc, "formula_pretty") or doc_get(doc, "formula")
34
+ structure = doc_get(doc, "structure")
35
+ if formula is None and structure is not None:
36
+ formula = structure.composition.reduced_formula
37
+ if structure is None:
38
+ raise ValueError(f"MP document {material_id} has no structure field")
39
+ return StableStructure(material_id=material_id, formula=str(formula), structure=structure)
40
+
41
+
42
+ def entry_sort_key(entry):
43
+ return (len(entry.structure.composition.elements), entry.formula, entry.material_id)
44
+
45
+
46
+ def add_arguments(parser: argparse.ArgumentParser) -> None:
47
+ parser.add_argument("-s", nargs="+", required=True,
48
+ help="Chemical system elements, e.g. -s Li La Ta Cl.")
49
+ parser.add_argument("-mp-api-key", default=None,
50
+ help="Materials Project API key.")
51
+
52
+
53
+ def fetch_stable_structures(elements, api_key=None):
54
+ from mp_api.client import MPRester
55
+
56
+ chemsys = "-".join(elements)
57
+ fields = ["material_id", "formula_pretty", "structure"]
58
+ with MPRester(api_key) as mpr:
59
+ docs = mpr.materials.summary.search(
60
+ chemsys=chemsys,
61
+ is_stable=True,
62
+ fields=fields,
63
+ )
64
+ return [normalize_doc(doc) for doc in docs]
65
+
66
+
67
+ def run(args) -> int:
68
+ from pymatgen.io.cif import CifWriter
69
+
70
+ elements = list(dict.fromkeys(args.s))
71
+ label = "-".join(elements)
72
+ out_dir = Path(f"{label}-stable-entries")
73
+ out_dir.mkdir(parents=True, exist_ok=True)
74
+
75
+ try:
76
+ entries = fetch_stable_structures(elements, args.mp_api_key)
77
+ except ModuleNotFoundError as exc:
78
+ if exc.name == "mp_api":
79
+ raise SystemExit(
80
+ "Error: stable-entry requires mp-api. Reinstall pymdkit 1.2.2+ "
81
+ "or run `pip install mp-api`."
82
+ ) from exc
83
+ raise
84
+
85
+ entries = sorted(entries, key=entry_sort_key)
86
+ written = 0
87
+ for entry in entries:
88
+ mpid = safe_formula(entry.material_id)
89
+ formula = safe_formula(entry.formula)
90
+ path = out_dir / f"{mpid}-{formula}.cif"
91
+ CifWriter(entry.structure).write_file(str(path))
92
+ print(f"{mpid}\t{entry.formula}\t-> {path}")
93
+ written += 1
94
+
95
+ print(f"Wrote {written} stable entr{'y' if written == 1 else 'ies'} to {out_dir}")
96
+ return 0 if written else 1
97
+
98
+
99
+ if __name__ == "__main__":
100
+ _parser = argparse.ArgumentParser(description=__doc__)
101
+ add_arguments(_parser)
102
+ raise SystemExit(run(_parser.parse_args()))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pymdkit
3
- Version: 1.2.0
3
+ Version: 1.2.2
4
4
  Summary: A unified command-line toolkit for atomistic / MD structure workflows.
5
5
  Author-email: Yueda Wang <ydwang0608@ustc.edu.cn>
6
6
  License-Expression: GPL-3.0-or-later
@@ -14,13 +14,10 @@ Requires-Python: >=3.9
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE
16
16
  Requires-Dist: numpy
17
- Requires-Dist: scipy
18
17
  Requires-Dist: ase
19
18
  Requires-Dist: pymatgen
20
- Requires-Dist: mp_api
19
+ Requires-Dist: mp-api
21
20
  Requires-Dist: pyxtal
22
- Requires-Dist: gemmi
23
- Requires-Dist: tqdm
24
21
  Requires-Dist: dpdata
25
22
  Dynamic: license-file
26
23
 
@@ -45,8 +42,7 @@ pip install pymdkit
45
42
  ```
46
43
 
47
44
  This installs the `pymdkit` command into the active conda environment, together
48
- with its dependencies (numpy, scipy, ase, pymatgen, pyxtal, mp_api, gemmi,
49
- tqdm).
45
+ with its direct dependencies (numpy, ase, pymatgen, mp-api, pyxtal, dpdata). Some of these packages may install their own transitive dependencies.
50
46
 
51
47
  Verify:
52
48
 
@@ -1,9 +1,6 @@
1
1
  numpy
2
- scipy
3
2
  ase
4
3
  pymatgen
5
- mp_api
4
+ mp-api
6
5
  pyxtal
7
- gemmi
8
- tqdm
9
6
  dpdata
@@ -1,56 +0,0 @@
1
- """Download stable Materials Project entries for a chemical system."""
2
-
3
- from __future__ import annotations
4
-
5
- import argparse
6
- import re
7
- from pathlib import Path
8
-
9
- COMMAND = "stable-entry"
10
- HELP = "Download stable Materials Project structures for a chemical system."
11
-
12
-
13
- def safe_formula(formula):
14
- return re.sub(r"[^A-Za-z0-9_.-]+", "", formula)
15
-
16
-
17
- def add_arguments(parser: argparse.ArgumentParser) -> None:
18
- parser.add_argument("-s", nargs="+", required=True,
19
- help="Chemical system elements, e.g. -s Li La Ta Cl.")
20
- parser.add_argument("-mp-api-key", default=None,
21
- help="Materials Project API key.")
22
-
23
-
24
- def run(args) -> int:
25
- from pymatgen.ext.matproj import MPRester
26
- from pymatgen.io.cif import CifWriter
27
-
28
- elements = list(dict.fromkeys(args.s))
29
- label = "-".join(elements)
30
- out_dir = Path(f"{label}-stable-entries")
31
- out_dir.mkdir(parents=True, exist_ok=True)
32
-
33
- with MPRester(args.mp_api_key) as mpr:
34
- entries = mpr.get_entries_in_chemsys(
35
- elements, inc_structure=True,
36
- additional_criteria={"thermo_types": ["GGA_GGA+U"], "is_stable": True},
37
- )
38
-
39
- entries = sorted(entries, key=lambda e: (len(e.composition.elements), e.composition.reduced_formula, e.entry_id))
40
- written = 0
41
- for entry in entries:
42
- mpid = str(entry.entry_id).split(" ")[0]
43
- formula = safe_formula(entry.composition.reduced_formula)
44
- path = out_dir / f"{mpid}-{formula}.cif"
45
- CifWriter(entry.structure).write_file(str(path))
46
- print(f"{mpid}\t{entry.composition.reduced_formula}\t-> {path}")
47
- written += 1
48
-
49
- print(f"Wrote {written} stable entr{'y' if written == 1 else 'ies'} to {out_dir}")
50
- return 0 if written else 1
51
-
52
-
53
- if __name__ == "__main__":
54
- _parser = argparse.ArgumentParser(description=__doc__)
55
- add_arguments(_parser)
56
- raise SystemExit(run(_parser.parse_args()))
File without changes
File without changes