dpdata 0.2.20__tar.gz → 0.2.22__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 (137) hide show
  1. {dpdata-0.2.20 → dpdata-0.2.22}/.github/workflows/benchmark.yml +6 -1
  2. {dpdata-0.2.20 → dpdata-0.2.22}/.github/workflows/test.yml +10 -4
  3. {dpdata-0.2.20 → dpdata-0.2.22}/.pre-commit-config.yaml +3 -3
  4. {dpdata-0.2.20 → dpdata-0.2.22}/.readthedocs.yaml +1 -1
  5. {dpdata-0.2.20 → dpdata-0.2.22}/PKG-INFO +6 -8
  6. {dpdata-0.2.20 → dpdata-0.2.22}/README.md +1 -1
  7. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/_version.py +2 -2
  8. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/abacus/md.py +18 -8
  9. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/abacus/relax.py +13 -3
  10. dpdata-0.2.22/dpdata/abacus/scf.py +923 -0
  11. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/ase_calculator.py +2 -1
  12. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/data_type.py +5 -1
  13. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/deepmd/comp.py +7 -59
  14. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/deepmd/hdf5.py +9 -56
  15. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/deepmd/mixed.py +3 -3
  16. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/deepmd/raw.py +5 -42
  17. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/driver.py +2 -1
  18. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/gaussian/gjf.py +4 -4
  19. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/lammps/dump.py +104 -2
  20. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/lammps/lmp.py +74 -15
  21. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/abacus.py +56 -20
  22. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/amber.py +2 -2
  23. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/ase.py +20 -4
  24. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/deepmd.py +30 -0
  25. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/gaussian.py +2 -2
  26. dpdata-0.2.22/dpdata/plugins/lammps.py +101 -0
  27. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/n2p2.py +9 -9
  28. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/pwmat.py +3 -1
  29. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/pymatgen.py +4 -5
  30. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/vasp.py +19 -1
  31. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/pwmat/atomconfig.py +2 -2
  32. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/pymatgen/structure.py +10 -1
  33. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/qe/scf.py +27 -6
  34. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/qe/traj.py +2 -2
  35. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/rdkit/sanitize.py +2 -2
  36. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/stat.py +19 -18
  37. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/system.py +45 -19
  38. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/unit.py +24 -6
  39. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/utils.py +1 -6
  40. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/vasp/outcar.py +3 -3
  41. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/vasp/poscar.py +52 -7
  42. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/vasp/xml.py +5 -5
  43. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/xyz/quip_gap_xyz.py +5 -5
  44. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata.egg-info/PKG-INFO +6 -8
  45. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata.egg-info/requires.txt +2 -3
  46. {dpdata-0.2.20 → dpdata-0.2.22}/pyproject.toml +4 -8
  47. dpdata-0.2.20/dpdata/abacus/scf.py +0 -430
  48. dpdata-0.2.20/dpdata/plugins/lammps.py +0 -51
  49. {dpdata-0.2.20 → dpdata-0.2.22}/.git-blame-ignore-revs +0 -0
  50. {dpdata-0.2.20 → dpdata-0.2.22}/.git_archival.txt +0 -0
  51. {dpdata-0.2.20 → dpdata-0.2.22}/.gitattributes +0 -0
  52. {dpdata-0.2.20 → dpdata-0.2.22}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  53. {dpdata-0.2.20 → dpdata-0.2.22}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  54. {dpdata-0.2.20 → dpdata-0.2.22}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  55. {dpdata-0.2.20 → dpdata-0.2.22}/.github/ISSUE_TEMPLATE/generic-issue.yml +0 -0
  56. {dpdata-0.2.20 → dpdata-0.2.22}/.github/dependabot.yml +0 -0
  57. {dpdata-0.2.20 → dpdata-0.2.22}/.github/workflows/mirror_gitee.yml +0 -0
  58. {dpdata-0.2.20 → dpdata-0.2.22}/.github/workflows/pub-pypi.yml +0 -0
  59. {dpdata-0.2.20 → dpdata-0.2.22}/.github/workflows/pyright.yml +0 -0
  60. {dpdata-0.2.20 → dpdata-0.2.22}/.github/workflows/test_import.yml +0 -0
  61. {dpdata-0.2.20 → dpdata-0.2.22}/.gitignore +0 -0
  62. {dpdata-0.2.20 → dpdata-0.2.22}/LICENSE +0 -0
  63. {dpdata-0.2.20 → dpdata-0.2.22}/MANIFEST.in +0 -0
  64. {dpdata-0.2.20 → dpdata-0.2.22}/benchmark/__init__.py +0 -0
  65. {dpdata-0.2.20 → dpdata-0.2.22}/benchmark/test_import.py +0 -0
  66. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/__about__.py +0 -0
  67. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/__init__.py +0 -0
  68. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/__main__.py +0 -0
  69. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/abacus/__init__.py +0 -0
  70. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/amber/__init__.py +0 -0
  71. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/amber/mask.py +0 -0
  72. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/amber/md.py +0 -0
  73. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/amber/sqm.py +0 -0
  74. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/bond_order_system.py +0 -0
  75. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/cli.py +0 -0
  76. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/cp2k/__init__.py +0 -0
  77. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/cp2k/cell.py +0 -0
  78. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/cp2k/output.py +0 -0
  79. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/deepmd/__init__.py +0 -0
  80. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/dftbplus/__init__.py +0 -0
  81. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/dftbplus/output.py +0 -0
  82. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/fhi_aims/__init__.py +0 -0
  83. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/fhi_aims/output.py +0 -0
  84. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/format.py +0 -0
  85. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/gaussian/__init__.py +0 -0
  86. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/gaussian/log.py +0 -0
  87. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/gromacs/__init__.py +0 -0
  88. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/gromacs/gro.py +0 -0
  89. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/lammps/__init__.py +0 -0
  90. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/md/__init__.py +0 -0
  91. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/md/msd.py +0 -0
  92. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/md/pbc.py +0 -0
  93. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/md/rdf.py +0 -0
  94. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/md/water.py +0 -0
  95. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/openmx/__init__.py +0 -0
  96. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/openmx/omx.py +0 -0
  97. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/orca/__init__.py +0 -0
  98. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/orca/output.py +0 -0
  99. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/periodic_table.json +0 -0
  100. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/periodic_table.py +0 -0
  101. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugin.py +0 -0
  102. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/3dmol.py +0 -0
  103. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/__init__.py +0 -0
  104. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/cp2k.py +0 -0
  105. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/dftbplus.py +0 -0
  106. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/fhi_aims.py +0 -0
  107. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/gromacs.py +0 -0
  108. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/list.py +0 -0
  109. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/openmx.py +0 -0
  110. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/orca.py +0 -0
  111. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/psi4.py +0 -0
  112. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/qe.py +0 -0
  113. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/rdkit.py +0 -0
  114. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/siesta.py +0 -0
  115. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/plugins/xyz.py +0 -0
  116. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/psi4/__init__.py +0 -0
  117. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/psi4/input.py +0 -0
  118. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/psi4/output.py +0 -0
  119. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/pwmat/__init__.py +0 -0
  120. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/pwmat/movement.py +0 -0
  121. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/py.typed +0 -0
  122. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/pymatgen/__init__.py +0 -0
  123. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/pymatgen/molecule.py +0 -0
  124. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/qe/__init__.py +0 -0
  125. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/rdkit/__init__.py +0 -0
  126. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/rdkit/utils.py +0 -0
  127. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/siesta/__init__.py +0 -0
  128. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/siesta/aiMD_output.py +0 -0
  129. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/siesta/output.py +0 -0
  130. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/vasp/__init__.py +0 -0
  131. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/xyz/__init__.py +0 -0
  132. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata/xyz/xyz.py +0 -0
  133. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata.egg-info/SOURCES.txt +0 -0
  134. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata.egg-info/dependency_links.txt +0 -0
  135. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata.egg-info/entry_points.txt +0 -0
  136. {dpdata-0.2.20 → dpdata-0.2.22}/dpdata.egg-info/top_level.txt +0 -0
  137. {dpdata-0.2.20 → dpdata-0.2.22}/setup.cfg +0 -0
@@ -13,7 +13,12 @@ jobs:
13
13
  uses: actions/setup-python@v5
14
14
  with:
15
15
  python-version: 3.12
16
- - run: curl -LsSf https://astral.sh/uv/install.sh | sh
16
+ - uses: astral-sh/setup-uv@v5
17
+ with:
18
+ enable-cache: true
19
+ cache-dependency-glob: |
20
+ **/requirements*.txt
21
+ **/pyproject.toml
17
22
  - name: Install dependencies
18
23
  run: uv pip install --system .[test,amber,ase,pymatgen,benchmark] rdkit openbabel-wheel
19
24
  - name: Run benchmarks
@@ -6,10 +6,10 @@ on:
6
6
 
7
7
  jobs:
8
8
  build:
9
- runs-on: ubuntu-latest
9
+ runs-on: ubuntu-22.04
10
10
  strategy:
11
11
  matrix:
12
- python-version: ["3.7", "3.8", "3.12"]
12
+ python-version: ["3.8", "3.12"]
13
13
 
14
14
  steps:
15
15
  - uses: actions/checkout@v4
@@ -18,13 +18,19 @@ jobs:
18
18
  uses: actions/setup-python@v5
19
19
  with:
20
20
  python-version: ${{ matrix.python-version }}
21
- - run: curl -LsSf https://astral.sh/uv/install.sh | sh
21
+ - uses: astral-sh/setup-uv@v5
22
+ with:
23
+ enable-cache: true
24
+ cache-dependency-glob: |
25
+ **/requirements*.txt
26
+ **/pyproject.toml
27
+ cache-suffix: "py${{ matrix.python-version }}"
22
28
  - name: Install dependencies
23
29
  run: uv pip install --system .[test,amber,ase,pymatgen] coverage ./tests/plugin rdkit openbabel-wheel
24
30
  - name: Test
25
31
  run: cd tests && coverage run --source=../dpdata -m unittest && cd .. && coverage combine tests/.coverage && coverage report
26
32
  - name: Run codecov
27
- uses: codecov/codecov-action@v4
33
+ uses: codecov/codecov-action@v5
28
34
  env:
29
35
  CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
30
36
  pass:
@@ -2,7 +2,7 @@
2
2
  # See https://pre-commit.com/hooks.html for more hooks
3
3
  repos:
4
4
  - repo: https://github.com/pre-commit/pre-commit-hooks
5
- rev: v4.6.0
5
+ rev: v5.0.0
6
6
  hooks:
7
7
  # there are many log files in tests
8
8
  # TODO: seperate py files and log files
@@ -21,7 +21,7 @@ repos:
21
21
  # Python
22
22
  - repo: https://github.com/astral-sh/ruff-pre-commit
23
23
  # Ruff version.
24
- rev: v0.6.3
24
+ rev: v0.9.2
25
25
  hooks:
26
26
  - id: ruff
27
27
  args: ["--fix"]
@@ -36,7 +36,7 @@ repos:
36
36
  args: ["--write"]
37
37
  # Python inside docs
38
38
  - repo: https://github.com/asottile/blacken-docs
39
- rev: 1.18.0
39
+ rev: 1.19.1
40
40
  hooks:
41
41
  - id: blacken-docs
42
42
  ci:
@@ -3,7 +3,7 @@ version: 2
3
3
  build:
4
4
  os: ubuntu-22.04
5
5
  tools:
6
- python: "mambaforge-22.9"
6
+ python: "mambaforge-23.11"
7
7
  conda:
8
8
  environment: docs/rtd_environment.yml
9
9
  sphinx:
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: dpdata
3
- Version: 0.2.20
3
+ Version: 0.2.22
4
4
  Summary: Manipulating data formats of DeePMD-kit, VASP, QE, PWmat, and LAMMPS, etc.
5
5
  Author: DeepModeling
6
6
  Author-email: Han Wang <wang_han@iapcm.ac.cn>
@@ -174,13 +174,12 @@ Project-URL: Homepage, https://github.com/deepmodeling/dpdata
174
174
  Project-URL: documentation, https://docs.deepmodeling.com/projects/dpdata
175
175
  Project-URL: repository, https://github.com/deepmodeling/dpdata
176
176
  Keywords: lammps,vasp,deepmd-kit
177
- Classifier: Programming Language :: Python :: 3.7
178
177
  Classifier: Programming Language :: Python :: 3.8
179
178
  Classifier: Programming Language :: Python :: 3.9
180
179
  Classifier: Programming Language :: Python :: 3.10
181
180
  Classifier: Programming Language :: Python :: 3.11
182
181
  Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
183
- Requires-Python: >=3.7
182
+ Requires-Python: >=3.8
184
183
  Description-Content-Type: text/markdown
185
184
  License-File: LICENSE
186
185
  Requires-Dist: numpy>=1.14.3
@@ -191,7 +190,6 @@ Requires-Dist: wcmatch
191
190
  Requires-Dist: importlib_metadata>=1.4; python_version < "3.8"
192
191
  Requires-Dist: typing_extensions; python_version < "3.8"
193
192
  Provides-Extra: test
194
- Requires-Dist: numpy<2; extra == "test"
195
193
  Provides-Extra: ase
196
194
  Requires-Dist: ase; extra == "ase"
197
195
  Provides-Extra: amber
@@ -202,10 +200,10 @@ Requires-Dist: pymatgen; extra == "pymatgen"
202
200
  Provides-Extra: docs
203
201
  Requires-Dist: sphinx; extra == "docs"
204
202
  Requires-Dist: recommonmark; extra == "docs"
205
- Requires-Dist: sphinx_rtd_theme>=1.0.0rc1; extra == "docs"
203
+ Requires-Dist: sphinx-book-theme; extra == "docs"
206
204
  Requires-Dist: numpydoc; extra == "docs"
207
205
  Requires-Dist: myst-parser; extra == "docs"
208
- Requires-Dist: deepmodeling-sphinx>=0.1.1; extra == "docs"
206
+ Requires-Dist: deepmodeling-sphinx>=0.3.0; extra == "docs"
209
207
  Requires-Dist: sphinx-argparse<0.5.0; extra == "docs"
210
208
  Requires-Dist: rdkit; extra == "docs"
211
209
  Requires-Dist: jupyterlite-sphinx; extra == "docs"
@@ -224,7 +222,7 @@ Requires-Dist: pytest-codspeed; extra == "benchmark"
224
222
 
225
223
  ## Installation
226
224
 
227
- DP-GEN only supports Python 3.7 and above. You can [setup a conda/pip environment](https://docs.deepmodeling.com/faq/conda.html), and then use one of the following methods to install DP-GEN:
225
+ dpdata only supports Python 3.8 and above. You can [setup a conda/pip environment](https://docs.deepmodeling.com/faq/conda.html), and then use one of the following methods to install dpdata:
228
226
 
229
227
  - Install via pip: `pip install dpdata`
230
228
  - Install via conda: `conda install -c conda-forge dpdata`
@@ -8,7 +8,7 @@
8
8
 
9
9
  ## Installation
10
10
 
11
- DP-GEN only supports Python 3.7 and above. You can [setup a conda/pip environment](https://docs.deepmodeling.com/faq/conda.html), and then use one of the following methods to install DP-GEN:
11
+ dpdata only supports Python 3.8 and above. You can [setup a conda/pip environment](https://docs.deepmodeling.com/faq/conda.html), and then use one of the following methods to install dpdata:
12
12
 
13
13
  - Install via pip: `pip install dpdata`
14
14
  - Install via conda: `conda install -c conda-forge dpdata`
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.2.20'
16
- __version_tuple__ = version_tuple = (0, 2, 20)
15
+ __version__ = version = '0.2.22'
16
+ __version_tuple__ = version_tuple = (0, 2, 22)
@@ -12,6 +12,7 @@ from .scf import (
12
12
  get_cell,
13
13
  get_coords,
14
14
  get_geometry_in,
15
+ get_mag_force,
15
16
  kbar2evperang3,
16
17
  )
17
18
 
@@ -55,9 +56,9 @@ def get_coords_from_dump(dumplines, natoms):
55
56
  if "VIRIAL" in dumplines[6]:
56
57
  calc_stress = True
57
58
  check_line = 10
58
- assert (
59
- "POSITION" in dumplines[check_line]
60
- ), "keywords 'POSITION' cannot be found in the 6th line. Please check."
59
+ assert "POSITION" in dumplines[check_line], (
60
+ "keywords 'POSITION' cannot be found in the 6th line. Please check."
61
+ )
61
62
  if "FORCE" in dumplines[check_line]:
62
63
  calc_force = True
63
64
 
@@ -67,7 +68,7 @@ def get_coords_from_dump(dumplines, natoms):
67
68
  else:
68
69
  nframes_dump = int(nlines / (total_natoms + 9))
69
70
  assert nframes_dump > 0, (
70
- "Number of lines in MD_dump file = %d. Number of atoms = %d. The MD_dump file is incomplete."
71
+ "Number of lines in MD_dump file = %d. Number of atoms = %d. The MD_dump file is incomplete." # noqa: UP031
71
72
  % (nlines, total_natoms)
72
73
  )
73
74
  cells = np.zeros([nframes_dump, 3, 3])
@@ -124,7 +125,7 @@ def get_coords_from_dump(dumplines, natoms):
124
125
  )
125
126
  iframe += 1
126
127
  assert iframe == nframes_dump, (
127
- "iframe=%d, nframe_dump=%d. Number of frames does not match number of lines in MD_dump."
128
+ "iframe=%d, nframe_dump=%d. Number of frames does not match number of lines in MD_dump." # noqa: UP031
128
129
  % (iframe, nframes_dump)
129
130
  )
130
131
  stresses *= kbar2evperang3
@@ -144,7 +145,7 @@ def get_energy(outlines, ndump, dump_freq):
144
145
  energy.append(np.nan)
145
146
  nenergy += 1
146
147
  assert ndump == len(energy), (
147
- "Number of total energies in running_md.log = %d. Number of frames in MD_dump = %d. Please check."
148
+ "Number of total energies in running_md.log = %d. Number of frames in MD_dump = %d. Please check." # noqa: UP031
148
149
  % (len(energy), ndump)
149
150
  )
150
151
  energy = np.array(energy)
@@ -166,7 +167,7 @@ def get_frame(fname):
166
167
  with open_file(geometry_path_in) as fp:
167
168
  geometry_inlines = fp.read().split("\n")
168
169
  celldm, cell = get_cell(geometry_inlines)
169
- atom_names, natoms, types, coords = get_coords(
170
+ atom_names, natoms, types, coords, move, magmom = get_coords(
170
171
  celldm, cell, geometry_inlines, inlines
171
172
  )
172
173
  # This coords is not to be used.
@@ -190,7 +191,7 @@ def get_frame(fname):
190
191
  force = np.delete(force, i - ndump, axis=0)
191
192
  stress = np.delete(stress, i - ndump, axis=0)
192
193
  energy = np.delete(energy, i - ndump, axis=0)
193
- unconv_stru += "%d " % i
194
+ unconv_stru += "%d " % i # noqa: UP031
194
195
  ndump = len(energy)
195
196
  if unconv_stru != "":
196
197
  warnings.warn(f"Structure {unconv_stru} are unconverged and not collected!")
@@ -199,6 +200,9 @@ def get_frame(fname):
199
200
  stress[iframe] *= np.linalg.det(cells[iframe, :, :].reshape([3, 3]))
200
201
  if np.sum(np.abs(stress[0])) < 1e-10:
201
202
  stress = None
203
+
204
+ magmom, magforce = get_mag_force(outlines)
205
+
202
206
  data = {}
203
207
  data["atom_names"] = atom_names
204
208
  data["atom_numbs"] = natoms
@@ -213,5 +217,11 @@ def get_frame(fname):
213
217
  if not isinstance(data["virials"], np.ndarray):
214
218
  del data["virials"]
215
219
  data["orig"] = np.zeros(3)
220
+ if len(magmom) > 0:
221
+ data["spins"] = magmom
222
+ if len(magforce) > 0:
223
+ data["force_mags"] = magforce
224
+ if len(move) > 0:
225
+ data["move"] = move
216
226
 
217
227
  return data
@@ -13,6 +13,7 @@ from .scf import (
13
13
  get_cell,
14
14
  get_coords,
15
15
  get_geometry_in,
16
+ get_mag_force,
16
17
  kbar2evperang3,
17
18
  )
18
19
 
@@ -46,7 +47,7 @@ def get_coords_from_log(loglines, natoms):
46
47
  natoms_log += int(line.split()[-1])
47
48
 
48
49
  assert natoms_log > 0 and natoms_log == natoms, (
49
- "ERROR: detected atom number in log file is %d" % natoms
50
+ "ERROR: detected atom number in log file is %d" % natoms # noqa: UP031
50
51
  )
51
52
 
52
53
  energy = []
@@ -75,7 +76,7 @@ def get_coords_from_log(loglines, natoms):
75
76
  list(map(lambda x: float(x) * a0, loglines[i + k].split()[1:4]))
76
77
  )
77
78
  else:
78
- assert False, "Unrecongnized coordinate type, %s, line:%d" % (
79
+ assert False, "Unrecongnized coordinate type, %s, line:%d" % ( # noqa: UP031
79
80
  loglines[i].split()[0],
80
81
  i,
81
82
  )
@@ -182,7 +183,7 @@ def get_frame(fname):
182
183
  with open_file(geometry_path_in) as fp:
183
184
  geometry_inlines = fp.read().split("\n")
184
185
  celldm, cell = get_cell(geometry_inlines)
185
- atom_names, natoms, types, coord_tmp = get_coords(
186
+ atom_names, natoms, types, coord_tmp, move, magmom = get_coords(
186
187
  celldm, cell, geometry_inlines, inlines
187
188
  )
188
189
 
@@ -198,6 +199,8 @@ def get_frame(fname):
198
199
  lines, atomnumber
199
200
  )
200
201
 
202
+ magmom, magforce = get_mag_force(lines)
203
+
201
204
  data = {}
202
205
  data["atom_names"] = atom_names
203
206
  data["atom_numbs"] = natoms
@@ -211,4 +214,11 @@ def get_frame(fname):
211
214
  data["stress"] = stress
212
215
  data["orig"] = np.zeros(3)
213
216
 
217
+ if len(magmom) > 0:
218
+ data["spins"] = magmom
219
+ if len(magforce) > 0:
220
+ data["force_mags"] = magforce
221
+ if len(move) > 0:
222
+ data["move"] = move
223
+
214
224
  return data