pymdkit 1.2.11__tar.gz → 1.2.12__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 (35) hide show
  1. {pymdkit-1.2.11/src/pymdkit.egg-info → pymdkit-1.2.12}/PKG-INFO +1 -1
  2. {pymdkit-1.2.11 → pymdkit-1.2.12}/pyproject.toml +1 -1
  3. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/__init__.py +1 -1
  4. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/commands/supercell.py +28 -8
  5. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/commands/vasp2xyz.py +21 -3
  6. {pymdkit-1.2.11 → pymdkit-1.2.12/src/pymdkit.egg-info}/PKG-INFO +1 -1
  7. {pymdkit-1.2.11 → pymdkit-1.2.12}/LICENSE +0 -0
  8. {pymdkit-1.2.11 → pymdkit-1.2.12}/README.md +0 -0
  9. {pymdkit-1.2.11 → pymdkit-1.2.12}/setup.cfg +0 -0
  10. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/commands/__init__.py +0 -0
  11. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/commands/_fileio.py +0 -0
  12. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/commands/_vasp_output.py +0 -0
  13. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/commands/_vaspset.py +0 -0
  14. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/commands/add_groups.py +0 -0
  15. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/commands/compute_ehull.py +0 -0
  16. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/commands/compute_msd_all_groups.py +0 -0
  17. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/commands/compute_rmsd.py +0 -0
  18. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/commands/electrostatic_energy.py +0 -0
  19. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/commands/final_energy.py +0 -0
  20. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/commands/gather_contcar.py +0 -0
  21. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/commands/nep_rmse.py +0 -0
  22. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/commands/perturb.py +0 -0
  23. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/commands/stable_entry.py +0 -0
  24. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/commands/stru2xyz.py +0 -0
  25. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/commands/submit_vasp.py +0 -0
  26. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/commands/substitute.py +0 -0
  27. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/commands/symmetrize.py +0 -0
  28. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/commands/vasp_relax.py +0 -0
  29. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/commands/vasp_static.py +0 -0
  30. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit/pymdkit_main.py +0 -0
  31. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit.egg-info/SOURCES.txt +0 -0
  32. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit.egg-info/dependency_links.txt +0 -0
  33. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit.egg-info/entry_points.txt +0 -0
  34. {pymdkit-1.2.11 → pymdkit-1.2.12}/src/pymdkit.egg-info/requires.txt +0 -0
  35. {pymdkit-1.2.11 → pymdkit-1.2.12}/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.11
3
+ Version: 1.2.12
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pymdkit"
7
- version = "1.2.11"
7
+ version = "1.2.12"
8
8
  description = "A unified command-line toolkit for atomistic / MD structure workflows."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -1,3 +1,3 @@
1
1
  """pymdkit -- a unified CLI for atomistic / MD structure workflows."""
2
2
 
3
- __version__ = "1.2.11"
3
+ __version__ = "1.2.12"
@@ -3,7 +3,8 @@ Build a supercell whose cell lengths stay within a maximum (-max-abc).
3
3
 
4
4
  For each lattice vector the structure is repeated as many times as possible
5
5
  without its length exceeding ``-max-abc`` (in Angstrom):
6
- ``n_i = max(1, floor(max_abc / |a_i|))``.
6
+ `
7
+ _i = max(1, floor(max_abc / |a_i|))``.
7
8
 
8
9
  Single file: supercell -i example.vasp -o out.vasp -max-abc 20
9
10
  Whole folder: supercell -if vasp-opted -of out -max-abc 20
@@ -15,20 +16,28 @@ GPUMD setup: supercell -if extxyz-vasp-opted -max-abc 24 -individual \\
15
16
  temperature, each seeded with model.xyz + the shared GPUMD
16
17
  input files (target_t in run.in replaced by the temperature).
17
18
  With -add-groups, model.xyz is tagged with a GPUMD group index
18
- by element order (Li->0, Y->1, Cl->2).
19
+ by element order (Li->0, Y->1, Cl->2).
20
+ Single GPUMD: supercell -i example.cif -max-abc 24 -temp 500 600
21
+ -> ./model.xyz plus ./500/ and ./600/ directly, without
22
+ creating a structure-name folder.
19
23
  """
20
24
 
21
25
  import argparse
22
26
  import shutil
23
27
  from pathlib import Path
24
28
 
25
- from ase.io import read, write
26
-
27
29
  try:
28
- from . import _fileio, add_groups as _add_groups
30
+ from . import _fileio
29
31
  except ImportError: # running as a standalone script
30
32
  import _fileio
31
- import add_groups as _add_groups
33
+
34
+
35
+ def tag_groups(path, elements):
36
+ try:
37
+ from . import add_groups as _add_groups
38
+ except ImportError: # running as a standalone script
39
+ import add_groups as _add_groups
40
+ _add_groups._tag_one(path, path, elements)
32
41
 
33
42
  COMMAND = "supercell"
34
43
  HELP = "Build a supercell with cell lengths capped at -max-abc Angstrom."
@@ -43,6 +52,8 @@ def repetitions_for(atoms, max_abc):
43
52
 
44
53
 
45
54
  def make_supercell(in_path, out_path, max_abc):
55
+ from ase.io import read, write
56
+
46
57
  atoms = read(str(in_path))
47
58
  reps = repetitions_for(atoms, max_abc)
48
59
  sc = atoms.repeat(reps)
@@ -111,9 +122,18 @@ def add_arguments(parser):
111
122
 
112
123
 
113
124
  def _run_gpumd(args):
114
- """GPUMD setup: ./<name>/model.xyz + per-temperature job folders."""
125
+ """GPUMD setup: model.xyz + per-temperature job folders."""
126
+ if args.input:
127
+ model = Path("model.xyz")
128
+ make_supercell(args.input, model, args.max_abc)
129
+ if args.add_groups:
130
+ tag_groups(model, args.add_groups)
131
+ setup_temp_folders(Path("."), args.temp, args.md_input_folder)
132
+ print(f"Done: set up single structure with temperatures {args.temp}.")
133
+ return 0
134
+
115
135
  if not args.input_folder:
116
- raise SystemExit("Error: -temp requires -if/-input-folder.")
136
+ raise SystemExit("Error: -temp requires -i/-input or -if/-input-folder.")
117
137
  count = 0
118
138
  for f in _fileio.structure_files(args.input_folder):
119
139
  folder = Path(_folder_name(f.stem))
@@ -22,7 +22,8 @@ except ImportError: # running as a standalone script
22
22
  import _vasp_output
23
23
 
24
24
  COMMAND = "vasp2xyz"
25
- HELP = "Collect SCF-converged VASP job folders into one extxyz file."
25
+ HELP = "Collect SCF-converged VASP job folders into one extxyz file."
26
+ KBAR_TO_EV_PER_A3 = 0.0006241509125883258
26
27
 
27
28
 
28
29
  def folder_sort_key(name):
@@ -79,6 +80,23 @@ def strip_calculation_results(atoms):
79
80
  atoms.arrays.pop(key, None)
80
81
 
81
82
 
83
+ def vasp_stress_to_ase(stress):
84
+ """Convert VASP stress in kB to ASE stress in eV/A^3."""
85
+ if stress is None:
86
+ return None
87
+ try:
88
+ import numpy as np
89
+ return -np.asarray(stress, dtype=float) * KBAR_TO_EV_PER_A3
90
+ except ImportError:
91
+ pass
92
+
93
+ def convert(value):
94
+ if isinstance(value, (list, tuple)):
95
+ return [convert(x) for x in value]
96
+ return -float(value) * KBAR_TO_EV_PER_A3
97
+
98
+ return convert(stress)
99
+
82
100
  def atoms_from_output(output):
83
101
  from ase.calculators.singlepoint import SinglePointCalculator
84
102
  from pymatgen.io.ase import AseAtomsAdaptor
@@ -92,9 +110,9 @@ def atoms_from_output(output):
92
110
  if "forces" in step:
93
111
  results["forces"] = step["forces"]
94
112
  if "stress" in step:
95
- results["stress"] = step["stress"]
113
+ results["stress"] = vasp_stress_to_ase(step["stress"])
96
114
  elif "stresses" in step:
97
- results["stress"] = step["stresses"]
115
+ results["stress"] = vasp_stress_to_ase(step["stresses"])
98
116
  atoms.calc = SinglePointCalculator(atoms, **results)
99
117
  return atoms
100
118
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pymdkit
3
- Version: 1.2.11
3
+ Version: 1.2.12
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
File without changes
File without changes
File without changes