dpdata 0.2.25__tar.gz → 1.0.0__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 (140) hide show
  1. {dpdata-0.2.25 → dpdata-1.0.0}/.github/workflows/benchmark.yml +6 -4
  2. {dpdata-0.2.25 → dpdata-1.0.0}/.github/workflows/pyright.yml +1 -1
  3. {dpdata-0.2.25 → dpdata-1.0.0}/.github/workflows/test.yml +3 -3
  4. {dpdata-0.2.25 → dpdata-1.0.0}/.github/workflows/test_import.yml +2 -2
  5. {dpdata-0.2.25 → dpdata-1.0.0}/.gitignore +5 -0
  6. {dpdata-0.2.25 → dpdata-1.0.0}/.pre-commit-config.yaml +3 -3
  7. dpdata-1.0.0/AGENTS.md +148 -0
  8. {dpdata-0.2.25 → dpdata-1.0.0}/PKG-INFO +8 -1
  9. {dpdata-0.2.25 → dpdata-1.0.0}/README.md +7 -0
  10. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/_version.py +16 -3
  11. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/abacus/scf.py +8 -3
  12. dpdata-1.0.0/dpdata/gaussian/fchk.py +175 -0
  13. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/lammps/dump.py +56 -0
  14. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/lammps/lmp.py +277 -16
  15. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugins/gaussian.py +31 -0
  16. dpdata-1.0.0/dpdata/plugins/lammps.py +193 -0
  17. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugins/vasp.py +8 -2
  18. dpdata-1.0.0/dpdata/plugins/xyz.py +116 -0
  19. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/qe/traj.py +27 -1
  20. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/unit.py +28 -0
  21. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/vasp/outcar.py +19 -2
  22. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/vasp/xml.py +57 -7
  23. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/xyz/quip_gap_xyz.py +65 -0
  24. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata.egg-info/PKG-INFO +8 -1
  25. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata.egg-info/SOURCES.txt +2 -0
  26. dpdata-0.2.25/dpdata/plugins/lammps.py +0 -101
  27. dpdata-0.2.25/dpdata/plugins/xyz.py +0 -58
  28. {dpdata-0.2.25 → dpdata-1.0.0}/.git-blame-ignore-revs +0 -0
  29. {dpdata-0.2.25 → dpdata-1.0.0}/.git_archival.txt +0 -0
  30. {dpdata-0.2.25 → dpdata-1.0.0}/.gitattributes +0 -0
  31. {dpdata-0.2.25 → dpdata-1.0.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  32. {dpdata-0.2.25 → dpdata-1.0.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  33. {dpdata-0.2.25 → dpdata-1.0.0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  34. {dpdata-0.2.25 → dpdata-1.0.0}/.github/ISSUE_TEMPLATE/generic-issue.yml +0 -0
  35. {dpdata-0.2.25 → dpdata-1.0.0}/.github/dependabot.yml +0 -0
  36. {dpdata-0.2.25 → dpdata-1.0.0}/.github/workflows/mirror_gitee.yml +0 -0
  37. {dpdata-0.2.25 → dpdata-1.0.0}/.github/workflows/pub-pypi.yml +0 -0
  38. {dpdata-0.2.25 → dpdata-1.0.0}/.readthedocs.yaml +0 -0
  39. {dpdata-0.2.25 → dpdata-1.0.0}/LICENSE +0 -0
  40. {dpdata-0.2.25 → dpdata-1.0.0}/MANIFEST.in +0 -0
  41. {dpdata-0.2.25 → dpdata-1.0.0}/benchmark/__init__.py +0 -0
  42. {dpdata-0.2.25 → dpdata-1.0.0}/benchmark/test_import.py +0 -0
  43. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/__about__.py +0 -0
  44. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/__init__.py +0 -0
  45. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/__main__.py +0 -0
  46. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/abacus/__init__.py +0 -0
  47. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/abacus/md.py +0 -0
  48. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/abacus/relax.py +0 -0
  49. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/abacus/stru.py +0 -0
  50. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/amber/__init__.py +0 -0
  51. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/amber/mask.py +0 -0
  52. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/amber/md.py +0 -0
  53. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/amber/sqm.py +0 -0
  54. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/ase_calculator.py +0 -0
  55. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/bond_order_system.py +0 -0
  56. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/cli.py +0 -0
  57. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/cp2k/__init__.py +0 -0
  58. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/cp2k/cell.py +0 -0
  59. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/cp2k/output.py +0 -0
  60. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/data_type.py +0 -0
  61. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/deepmd/__init__.py +0 -0
  62. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/deepmd/comp.py +0 -0
  63. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/deepmd/hdf5.py +0 -0
  64. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/deepmd/mixed.py +0 -0
  65. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/deepmd/raw.py +0 -0
  66. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/dftbplus/__init__.py +0 -0
  67. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/dftbplus/output.py +0 -0
  68. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/driver.py +0 -0
  69. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/fhi_aims/__init__.py +0 -0
  70. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/fhi_aims/output.py +0 -0
  71. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/format.py +0 -0
  72. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/gaussian/__init__.py +0 -0
  73. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/gaussian/gjf.py +0 -0
  74. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/gaussian/log.py +0 -0
  75. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/gromacs/__init__.py +0 -0
  76. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/gromacs/gro.py +0 -0
  77. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/lammps/__init__.py +0 -0
  78. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/md/__init__.py +0 -0
  79. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/md/msd.py +0 -0
  80. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/md/pbc.py +0 -0
  81. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/md/rdf.py +0 -0
  82. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/md/water.py +0 -0
  83. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/openmx/__init__.py +0 -0
  84. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/openmx/omx.py +0 -0
  85. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/orca/__init__.py +0 -0
  86. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/orca/output.py +0 -0
  87. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/periodic_table.json +0 -0
  88. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/periodic_table.py +0 -0
  89. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugin.py +0 -0
  90. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugins/3dmol.py +0 -0
  91. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugins/__init__.py +0 -0
  92. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugins/abacus.py +0 -0
  93. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugins/amber.py +0 -0
  94. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugins/ase.py +0 -0
  95. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugins/cp2k.py +0 -0
  96. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugins/deepmd.py +0 -0
  97. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugins/dftbplus.py +0 -0
  98. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugins/fhi_aims.py +0 -0
  99. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugins/gromacs.py +0 -0
  100. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugins/list.py +0 -0
  101. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugins/n2p2.py +0 -0
  102. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugins/openmx.py +0 -0
  103. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugins/orca.py +0 -0
  104. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugins/psi4.py +0 -0
  105. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugins/pwmat.py +0 -0
  106. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugins/pymatgen.py +0 -0
  107. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugins/qe.py +0 -0
  108. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugins/rdkit.py +0 -0
  109. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/plugins/siesta.py +0 -0
  110. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/psi4/__init__.py +0 -0
  111. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/psi4/input.py +0 -0
  112. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/psi4/output.py +0 -0
  113. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/pwmat/__init__.py +0 -0
  114. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/pwmat/atomconfig.py +0 -0
  115. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/pwmat/movement.py +0 -0
  116. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/py.typed +0 -0
  117. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/pymatgen/__init__.py +0 -0
  118. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/pymatgen/molecule.py +0 -0
  119. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/pymatgen/structure.py +0 -0
  120. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/qe/__init__.py +0 -0
  121. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/qe/scf.py +0 -0
  122. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/rdkit/__init__.py +0 -0
  123. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/rdkit/sanitize.py +0 -0
  124. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/rdkit/utils.py +0 -0
  125. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/siesta/__init__.py +0 -0
  126. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/siesta/aiMD_output.py +0 -0
  127. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/siesta/output.py +0 -0
  128. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/stat.py +0 -0
  129. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/system.py +0 -0
  130. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/utils.py +0 -0
  131. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/vasp/__init__.py +0 -0
  132. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/vasp/poscar.py +0 -0
  133. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/xyz/__init__.py +0 -0
  134. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata/xyz/xyz.py +0 -0
  135. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata.egg-info/dependency_links.txt +0 -0
  136. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata.egg-info/entry_points.txt +0 -0
  137. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata.egg-info/requires.txt +0 -0
  138. {dpdata-0.2.25 → dpdata-1.0.0}/dpdata.egg-info/top_level.txt +0 -0
  139. {dpdata-0.2.25 → dpdata-1.0.0}/pyproject.toml +0 -0
  140. {dpdata-0.2.25 → dpdata-1.0.0}/setup.cfg +0 -0
@@ -6,14 +6,15 @@ on:
6
6
 
7
7
  jobs:
8
8
  benchmark:
9
+ if: ${{ github.repository_owner == 'deepmodeling' }}
9
10
  runs-on: ubuntu-latest
10
11
  steps:
11
- - uses: actions/checkout@v4
12
+ - uses: actions/checkout@v5
12
13
  - name: Set up Python
13
- uses: actions/setup-python@v5
14
+ uses: actions/setup-python@v6
14
15
  with:
15
16
  python-version: 3.12
16
- - uses: astral-sh/setup-uv@v6
17
+ - uses: astral-sh/setup-uv@v7
17
18
  with:
18
19
  enable-cache: true
19
20
  cache-dependency-glob: |
@@ -22,7 +23,8 @@ jobs:
22
23
  - name: Install dependencies
23
24
  run: uv pip install --system .[test,amber,ase,pymatgen,benchmark] rdkit openbabel-wheel
24
25
  - name: Run benchmarks
25
- uses: CodSpeedHQ/action@v3
26
+ uses: CodSpeedHQ/action@v4
26
27
  with:
27
28
  token: ${{ secrets.CODSPEED_TOKEN }}
29
+ mode: walltime
28
30
  run: pytest benchmark/ --codspeed
@@ -9,7 +9,7 @@ jobs:
9
9
  runs-on: ubuntu-latest
10
10
  steps:
11
11
  - uses: actions/checkout@master
12
- - uses: actions/setup-python@v5
12
+ - uses: actions/setup-python@v6
13
13
  with:
14
14
  python-version: '3.12'
15
15
  - run: pip install uv
@@ -12,13 +12,13 @@ jobs:
12
12
  python-version: ["3.8", "3.12"]
13
13
 
14
14
  steps:
15
- - uses: actions/checkout@v4
15
+ - uses: actions/checkout@v5
16
16
  # set up conda
17
17
  - name: Set up Python ${{ matrix.python-version }}
18
- uses: actions/setup-python@v5
18
+ uses: actions/setup-python@v6
19
19
  with:
20
20
  python-version: ${{ matrix.python-version }}
21
- - uses: astral-sh/setup-uv@v6
21
+ - uses: astral-sh/setup-uv@v7
22
22
  with:
23
23
  enable-cache: true
24
24
  cache-dependency-glob: |
@@ -8,8 +8,8 @@ jobs:
8
8
  build:
9
9
  runs-on: ubuntu-latest
10
10
  steps:
11
- - uses: actions/checkout@v4
12
- - uses: actions/setup-python@v5
11
+ - uses: actions/checkout@v5
12
+ - uses: actions/setup-python@v6
13
13
  with:
14
14
  python-version: '3.9'
15
15
  architecture: 'x64'
@@ -29,3 +29,8 @@ docs/minimizers.csv
29
29
  docs/api/
30
30
  docs/formats/
31
31
  .DS_Store
32
+ # Test artifacts
33
+ tests/data_*.h5
34
+ tests/data_*/
35
+ tests/tmp.*
36
+ tests/.coverage
@@ -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: v5.0.0
5
+ rev: v6.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.12.5
24
+ rev: v0.14.1
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.19.1
39
+ rev: 1.20.0
40
40
  hooks:
41
41
  - id: blacken-docs
42
42
  ci:
dpdata-1.0.0/AGENTS.md ADDED
@@ -0,0 +1,148 @@
1
+ # dpdata - Atomistic Data Format Manipulation
2
+
3
+ dpdata is a Python package for manipulating atomistic data from computational science software. It supports format conversion between various atomistic simulation packages including VASP, DeePMD-kit, LAMMPS, GROMACS, Gaussian, ABACUS, and many others.
4
+
5
+ Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.
6
+
7
+ ## Working Effectively
8
+
9
+ - **Bootstrap and install the repository:**
10
+ - `cd /home/runner/work/dpdata/dpdata` (or wherever the repo is cloned)
11
+ - `uv pip install -e .` -- installs dpdata in development mode with core dependencies (numpy, scipy, h5py, monty, wcmatch)
12
+ - Test installation: `dpdata --version` -- should show version like "dpdata v0.1.dev2+..."
13
+
14
+ - **Run tests:**
15
+ - `cd tests && python -m unittest discover` -- runs all 1826 tests in ~10 seconds. NEVER CANCEL.
16
+ - `cd tests && python -m unittest test_<module>.py` -- run specific test modules (individual modules take ~0.5 seconds)
17
+ - `cd tests && coverage run --source=../dpdata -m unittest discover && coverage report` -- run tests with coverage
18
+
19
+ - **Linting and formatting:**
20
+ - Install ruff: `uv pip install ruff`
21
+ - `ruff check dpdata/` -- lint the main package (takes ~1 second)
22
+ - `ruff format dpdata/` -- format code according to project style
23
+ - `ruff check --fix dpdata/` -- auto-fix linting issues where possible
24
+
25
+ - **Pre-commit hooks:**
26
+ - Install: `uv pip install pre-commit`
27
+ - `pre-commit run --all-files` -- run all hooks on all files
28
+ - Hooks include: ruff linting/formatting, trailing whitespace, end-of-file-fixer, yaml/json/toml checks
29
+
30
+ ## Validation
31
+
32
+ - **Always test CLI functionality after making changes:**
33
+ - `dpdata --help` -- ensure CLI still works
34
+ - `dpdata --version` -- verify version is correct
35
+ - Test a basic conversion if sample data is available
36
+
37
+ - **Always run linting before committing:**
38
+ - `ruff check dpdata/` -- ensure no new linting errors
39
+ - `ruff format dpdata/` -- ensure code is properly formatted
40
+
41
+ - **Run relevant tests for your changes:**
42
+ - For format-specific changes: `cd tests && python -m unittest test_<format>*.py`
43
+ - For core system changes: `cd tests && python -m unittest test_system*.py test_multisystems.py`
44
+ - For CLI changes: `cd tests && python -m unittest test_cli.py` (if exists)
45
+
46
+ ## Build and Documentation
47
+
48
+ - **Documentation:**
49
+ - `cd docs && make help` -- see all available build targets
50
+ - `cd docs && make html` -- build HTML documentation (requires additional dependencies)
51
+ - Documentation source is in `docs/` directory using Sphinx
52
+ - **NOTE:** Full docs build requires additional dependencies like `deepmodeling-sphinx` that may not be readily available
53
+
54
+ - **Package building:**
55
+ - Uses setuptools with pyproject.toml configuration
56
+ - `uv pip install build && python -m build` -- create source and wheel distributions
57
+ - Version is managed by setuptools_scm from git tags
58
+
59
+ ## Common Tasks
60
+
61
+ The following are outputs from frequently run commands. Reference them instead of re-running to save time.
62
+
63
+ ### Repository structure
64
+ ```
65
+ /home/runner/work/dpdata/dpdata/
66
+ ├── dpdata/ # Main package code
67
+ │ ├── __init__.py
68
+ │ ├── cli.py # Command-line interface
69
+ │ ├── system.py # Core System classes
70
+ │ ├── format.py # Format registry
71
+ │ ├── abacus/ # ABACUS format support
72
+ │ ├── amber/ # AMBER format support
73
+ │ ├── deepmd/ # DeePMD format support
74
+ │ ├── vasp/ # VASP format support
75
+ │ ├── xyz/ # XYZ format support
76
+ │ └── ... # Other format modules
77
+ ├── tests/ # Test suite (91 test files)
78
+ ├── docs/ # Sphinx documentation
79
+ ├── plugin_example/ # Example plugin
80
+ ├── pyproject.toml # Project configuration
81
+ └── README.md
82
+ ```
83
+
84
+ ### Key dependencies
85
+ - Core: numpy>=1.14.3, scipy, h5py, monty, wcmatch
86
+ - Optional: ase (ASE integration), parmed (AMBER), pymatgen (Materials Project), rdkit (molecular analysis)
87
+ - Testing: unittest (built-in), coverage
88
+ - Linting: ruff
89
+ - Docs: sphinx with various extensions
90
+
91
+ ### Test timing expectations
92
+ - Full test suite: ~10 seconds (1826 tests). NEVER CANCEL.
93
+ - Individual test modules: ~0.5 seconds
94
+ - Linting with ruff: ~1 second
95
+ - Documentation build: ~30 seconds
96
+
97
+ ### Common workflows
98
+ 1. **Adding a new format:**
99
+ - Create module in `dpdata/<format>/`
100
+ - Implement format classes inheriting from appropriate base classes
101
+ - Add tests in `tests/test_<format>*.py`
102
+ - Register format in the plugin system
103
+
104
+ 2. **Fixing bugs:**
105
+ - Write test that reproduces the bug first
106
+ - Make minimal fix to pass the test
107
+ - Run full test suite to ensure no regressions
108
+ - Run linting to ensure code style compliance
109
+
110
+ 3. **CLI changes:**
111
+ - Modify `dpdata/cli.py`
112
+ - Test with `dpdata --help` and specific commands
113
+ - Add/update tests if needed
114
+
115
+ ## Troubleshooting
116
+
117
+ - **Installation timeouts:** Network timeouts during `uv pip install` are common. If this occurs, try:
118
+ - Individual package installation: `uv pip install numpy scipy h5py monty wcmatch`
119
+ - Use `--timeout` option: `uv pip install --timeout 300 -e .`
120
+ - Verify existing installation works: `dpdata --version` should work even if reinstall fails
121
+
122
+ - **Optional dependency errors:** Many tests will skip or fail if optional dependencies (ase, parmed, pymatgen, rdkit) are not installed. This is expected. Core functionality will work with just the basic dependencies.
123
+
124
+ - **Documentation build failures:** The docs build requires specific dependencies like `deepmodeling-sphinx` that may not be readily available. Use `make help` to see available targets, but expect build failures without full doc dependencies.
125
+
126
+ - **Test artifacts:** The test suite generates temporary files (`tests/data_*`, `tests/tmp.*`, `tests/.coverage`). These are excluded by `.gitignore` and should not be committed.
127
+
128
+ - **Import errors:** If you see import errors for specific modules, check if the corresponding optional dependency is installed. For example, ASE functionality requires `uv pip install ase`.
129
+
130
+ ## Critical Notes
131
+
132
+ - **NEVER CANCEL** test runs or builds - they complete quickly (10 seconds for tests, 30 seconds for docs)
133
+ - Always run `ruff check` and `ruff format` before committing
134
+ - Test artifacts in `tests/` directory are excluded by `.gitignore` - don't commit them
135
+ - Optional dependencies are required for some formats but core functionality works without them
136
+ - The CLI tool `dpdata` is the main user interface for format conversion
137
+
138
+ ## Commit and PR Guidelines
139
+
140
+ - **Use semantic commit messages** for all commits and PR titles following the format: `type(scope): description`
141
+ - **Types:** `feat` (new feature), `fix` (bug fix), `docs` (documentation), `style` (formatting), `refactor` (code restructuring), `test` (testing), `chore` (maintenance)
142
+ - **Examples:**
143
+ - `feat(vasp): add support for POSCAR format`
144
+ - `fix(cli): resolve parsing error for multi-frame files`
145
+ - `docs: update installation instructions`
146
+ - `test(amber): add tests for trajectory parsing`
147
+ - **PR titles** must follow semantic commit format
148
+ - **Commit messages** should be concise but descriptive of the actual changes made
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dpdata
3
- Version: 0.2.25
3
+ Version: 1.0.0
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>
@@ -215,12 +215,19 @@ Dynamic: license-file
215
215
 
216
216
  # dpdata
217
217
 
218
+ [![DOI:10.1021/acs.jcim.5c01767](https://img.shields.io/badge/DOI-10.1021%2Facs.jcim.5c01767-blue)](https://doi.org/10.1021/acs.jcim.5c01767)
218
219
  [![conda-forge](https://img.shields.io/conda/dn/conda-forge/dpdata?color=red&label=conda-forge&logo=conda-forge)](https://anaconda.org/conda-forge/dpdata)
219
220
  [![pip install](https://img.shields.io/pypi/dm/dpdata?label=pip%20install&logo=pypi)](https://pypi.org/project/dpdata)
220
221
  [![Documentation Status](https://readthedocs.org/projects/dpdata/badge/)](https://dpdata.readthedocs.io/)
221
222
 
222
223
  **dpdata** is a Python package for manipulating atomistic data of software in computational science.
223
224
 
225
+ ## Credits
226
+
227
+ If you use this software, please cite the following paper:
228
+
229
+ - Jinzhe Zeng, Xingliang Peng, Yong-Bin Zhuang, Haidi Wang, Fengbo Yuan, Duo Zhang, Renxi Liu, Yingze Wang, Ping Tuo, Yuzhi Zhang, Yixiao Chen, Yifan Li, Cao Thang Nguyen, Jiameng Huang, Anyang Peng, Marián Rynik, Wei-Hong Xu, Zezhong Zhang, Xu-Yuan Zhou, Tao Chen, Jiahao Fan, Wanrun Jiang, Bowen Li, Denan Li, Haoxi Li, Wenshuo Liang, Ruihao Liao, Liping Liu, Chenxing Luo, Logan Ward, Kaiwei Wan, Junjie Wang, Pan Xiang, Chengqian Zhang, Jinchao Zhang, Rui Zhou, Jia-Xin Zhu, Linfeng Zhang, Han Wang, dpdata: A Scalable Python Toolkit for Atomistic Machine Learning Data Sets, *J. Chem. Inf. Model.*, 2025, DOI: [10.1021/acs.jcim.5c01767](https://doi.org/10.1021/acs.jcim.5c01767). [![Citations](https://citations.njzjz.win/10.1021/acs.jcim.5c01767)](https://badge.dimensions.ai/details/doi/10.1021/acs.jcim.5c01767)
230
+
224
231
  ## Installation
225
232
 
226
233
  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:
@@ -1,11 +1,18 @@
1
1
  # dpdata
2
2
 
3
+ [![DOI:10.1021/acs.jcim.5c01767](https://img.shields.io/badge/DOI-10.1021%2Facs.jcim.5c01767-blue)](https://doi.org/10.1021/acs.jcim.5c01767)
3
4
  [![conda-forge](https://img.shields.io/conda/dn/conda-forge/dpdata?color=red&label=conda-forge&logo=conda-forge)](https://anaconda.org/conda-forge/dpdata)
4
5
  [![pip install](https://img.shields.io/pypi/dm/dpdata?label=pip%20install&logo=pypi)](https://pypi.org/project/dpdata)
5
6
  [![Documentation Status](https://readthedocs.org/projects/dpdata/badge/)](https://dpdata.readthedocs.io/)
6
7
 
7
8
  **dpdata** is a Python package for manipulating atomistic data of software in computational science.
8
9
 
10
+ ## Credits
11
+
12
+ If you use this software, please cite the following paper:
13
+
14
+ - Jinzhe Zeng, Xingliang Peng, Yong-Bin Zhuang, Haidi Wang, Fengbo Yuan, Duo Zhang, Renxi Liu, Yingze Wang, Ping Tuo, Yuzhi Zhang, Yixiao Chen, Yifan Li, Cao Thang Nguyen, Jiameng Huang, Anyang Peng, Marián Rynik, Wei-Hong Xu, Zezhong Zhang, Xu-Yuan Zhou, Tao Chen, Jiahao Fan, Wanrun Jiang, Bowen Li, Denan Li, Haoxi Li, Wenshuo Liang, Ruihao Liao, Liping Liu, Chenxing Luo, Logan Ward, Kaiwei Wan, Junjie Wang, Pan Xiang, Chengqian Zhang, Jinchao Zhang, Rui Zhou, Jia-Xin Zhu, Linfeng Zhang, Han Wang, dpdata: A Scalable Python Toolkit for Atomistic Machine Learning Data Sets, *J. Chem. Inf. Model.*, 2025, DOI: [10.1021/acs.jcim.5c01767](https://doi.org/10.1021/acs.jcim.5c01767). [![Citations](https://citations.njzjz.win/10.1021/acs.jcim.5c01767)](https://badge.dimensions.ai/details/doi/10.1021/acs.jcim.5c01767)
15
+
9
16
  ## Installation
10
17
 
11
18
  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:
@@ -1,7 +1,14 @@
1
1
  # file generated by setuptools-scm
2
2
  # don't change, don't track in version control
3
3
 
4
- __all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
4
+ __all__ = [
5
+ "__version__",
6
+ "__version_tuple__",
7
+ "version",
8
+ "version_tuple",
9
+ "__commit_id__",
10
+ "commit_id",
11
+ ]
5
12
 
6
13
  TYPE_CHECKING = False
7
14
  if TYPE_CHECKING:
@@ -9,13 +16,19 @@ if TYPE_CHECKING:
9
16
  from typing import Union
10
17
 
11
18
  VERSION_TUPLE = Tuple[Union[int, str], ...]
19
+ COMMIT_ID = Union[str, None]
12
20
  else:
13
21
  VERSION_TUPLE = object
22
+ COMMIT_ID = object
14
23
 
15
24
  version: str
16
25
  __version__: str
17
26
  __version_tuple__: VERSION_TUPLE
18
27
  version_tuple: VERSION_TUPLE
28
+ commit_id: COMMIT_ID
29
+ __commit_id__: COMMIT_ID
19
30
 
20
- __version__ = version = '0.2.25'
21
- __version_tuple__ = version_tuple = (0, 2, 25)
31
+ __version__ = version = '1.0.0'
32
+ __version_tuple__ = version_tuple = (1, 0, 0)
33
+
34
+ __commit_id__ = commit_id = 'g8b6a0a7ab'
@@ -45,7 +45,10 @@ def get_path_out(fname, inlines):
45
45
  def get_energy(outlines):
46
46
  Etot = None
47
47
  for line in reversed(outlines):
48
- if "final etot is" in line:
48
+ if "final etot is" in line: # for LTS
49
+ Etot = float(line.split()[-2]) # in eV
50
+ return Etot, True
51
+ elif "TOTAL ENERGY" in line: # for develop
49
52
  Etot = float(line.split()[-2]) # in eV
50
53
  return Etot, True
51
54
  elif "convergence has NOT been achieved!" in line:
@@ -59,7 +62,8 @@ def get_energy(outlines):
59
62
  def collect_force(outlines):
60
63
  force = []
61
64
  for i, line in enumerate(outlines):
62
- if "TOTAL-FORCE (eV/Angstrom)" in line:
65
+ # if "TOTAL-FORCE (eV/Angstrom)" in line:
66
+ if "TOTAL-FORCE" in line:
63
67
  value_pattern = re.compile(
64
68
  r"^\s*[A-Z][a-z]?[1-9][0-9]*\s+[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\s+[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\s+[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\s*$"
65
69
  )
@@ -95,7 +99,8 @@ def get_force(outlines, natoms):
95
99
  def collect_stress(outlines):
96
100
  stress = []
97
101
  for i, line in enumerate(outlines):
98
- if "TOTAL-STRESS (KBAR)" in line:
102
+ # if "TOTAL-STRESS (KBAR)" in line:
103
+ if "TOTAL-STRESS" in line:
99
104
  value_pattern = re.compile(
100
105
  r"^\s*[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\s+[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\s+[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\s*$"
101
106
  )
@@ -0,0 +1,175 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ import numpy as np
6
+
7
+ from dpdata.utils import open_file
8
+
9
+ if TYPE_CHECKING:
10
+ from dpdata.utils import FileType
11
+
12
+ from ..periodic_table import ELEMENTS
13
+ from ..unit import (
14
+ EnergyConversion,
15
+ ForceConversion,
16
+ HessianConversion,
17
+ LengthConversion,
18
+ )
19
+
20
+ length_convert = LengthConversion("bohr", "angstrom").value()
21
+ energy_convert = EnergyConversion("hartree", "eV").value()
22
+ force_convert = ForceConversion("hartree/bohr", "eV/angstrom").value()
23
+ hessian_convert = HessianConversion("hartree/bohr^2", "eV/angstrom^2").value()
24
+
25
+
26
+ def create_full_hessian(hessian_raw: list | np.ndarray, natoms: int) -> np.ndarray:
27
+ """
28
+ Reconstructs the full, symmetric Hessian matrix from a 1D array
29
+ containing its lower triangular elements.
30
+
31
+ Args:
32
+ hessian_raw (list | np.ndarray): A 1D list or NumPy array containing the
33
+ lower triangular elements (including the
34
+ diagonal) of the Hessian matrix.
35
+ natoms (int): The number of atoms in the system.
36
+
37
+ Returns
38
+ -------
39
+ np.ndarray: A full, symmetric (3*natoms, 3*natoms) Hessian matrix.
40
+
41
+ Raises
42
+ ------
43
+ ValueError: If the number of elements in `hessian_raw` does not match
44
+ the expected number for the lower triangle of a
45
+ (3*natoms, 3*natoms) matrix.
46
+ """
47
+ # Convert input to a NumPy array in case it's a list
48
+ hessian_block = np.array(hessian_raw)
49
+
50
+ # Calculate the dimension of the final matrix
51
+ dim = 3 * natoms
52
+
53
+ # Validate that the input data has the correct length
54
+ # A lower triangle of an n x n matrix has n*(n+1)/2 elements
55
+ expected_length = dim * (dim + 1) // 2
56
+ if hessian_block.size != expected_length:
57
+ raise ValueError(
58
+ f"Input length {hessian_block.size} != expected {expected_length}"
59
+ )
60
+
61
+ # Create a zero matrix, then fill the lower triangle
62
+ hessian_full = np.zeros((dim, dim), dtype=hessian_block.dtype)
63
+ lower_triangle_indices = np.tril_indices(dim)
64
+ hessian_full[lower_triangle_indices] = hessian_block
65
+
66
+ # This is done by copying the lower triangle to the upper triangle
67
+ # M_full = M_lower + M_lower.T - diag(M_lower)
68
+ hessian_full = hessian_full + hessian_full.T - np.diag(np.diag(hessian_full))
69
+
70
+ return hessian_full
71
+
72
+
73
+ def to_system_data(file_name: FileType, has_forces=True, has_hessian=True):
74
+ """Read Gaussian fchk file.
75
+
76
+ Parameters
77
+ ----------
78
+ file_name : str
79
+ file name
80
+ has_forces : bool, default True
81
+ whether to read force
82
+ Note: Cartesian Gradient in fchk file is converted to forces by taking negative sign
83
+ has_hessian : bool, default True
84
+ whether to read hessian
85
+
86
+ Returns
87
+ -------
88
+ data : dict
89
+ system data, including hessian if has_hessian is True
90
+ """
91
+ data = {}
92
+ natoms = 0
93
+ atom_numbers = []
94
+ coords_t = []
95
+ energy_t = []
96
+ forces_t = []
97
+ hessian_t = []
98
+ # Read fchk file
99
+ with open_file(file_name) as fp:
100
+ for line in fp:
101
+ if isinstance(line, bytes):
102
+ line = line.decode(errors="ignore")
103
+ if "Number of atoms" in line:
104
+ natoms = int(line.split()[-1])
105
+ elif "Atomic numbers" in line and "I" in line:
106
+ n = int(line.split()[-1])
107
+ atom_numbers = []
108
+ while len(atom_numbers) < n:
109
+ next_line = next(fp)
110
+ if isinstance(next_line, bytes):
111
+ next_line = next_line.decode(errors="ignore")
112
+ atom_numbers += [int(x) for x in next_line.split()]
113
+ elif "Current cartesian coordinates" in line and "R" in line:
114
+ n = int(line.split()[-1])
115
+ coords_raw = []
116
+ while len(coords_raw) < n:
117
+ next_line = next(fp)
118
+ if isinstance(next_line, bytes):
119
+ next_line = next_line.decode(errors="ignore")
120
+ coords_raw += [float(x) for x in next_line.split()]
121
+ coords = np.array(coords_raw).reshape(-1, 3) * length_convert
122
+ coords_t.append(coords)
123
+ elif "Total Energy" in line:
124
+ energy = float(line.split()[-1]) * energy_convert
125
+ energy_t.append(energy)
126
+ elif "Cartesian Gradient" in line:
127
+ n = int(line.split()[-1])
128
+ forces_raw = []
129
+ while len(forces_raw) < n:
130
+ next_line = next(fp)
131
+ if isinstance(next_line, bytes):
132
+ next_line = next_line.decode(errors="ignore")
133
+ forces_raw += [float(x) for x in next_line.split()]
134
+ # Cartesian Gradient is the negative of forces: F = -∇E
135
+ forces = -np.array(forces_raw).reshape(-1, 3) * force_convert
136
+ forces_t.append(forces)
137
+ elif "Cartesian Force Constants" in line and "R" in line:
138
+ n = int(line.split()[-1])
139
+ hessian_raw = []
140
+ while len(hessian_raw) < n:
141
+ next_line = next(fp)
142
+ if isinstance(next_line, bytes):
143
+ next_line = next_line.decode(errors="ignore")
144
+ hessian_raw += [float(x) for x in next_line.split()]
145
+ hessian_full = (
146
+ create_full_hessian(hessian_raw, natoms) * hessian_convert
147
+ )
148
+ # store as (natoms, 3, natoms, 3) to align with registered shape
149
+ hessian_t.append(hessian_full.reshape(natoms, 3, natoms, 3))
150
+ # Assert key data
151
+ assert coords_t, "cannot find coords"
152
+ assert energy_t, "cannot find energy"
153
+ if has_forces:
154
+ assert forces_t, "cannot find forces"
155
+ if has_hessian:
156
+ assert hessian_t, "cannot find hessian"
157
+ # Assemble data
158
+ atom_symbols = [ELEMENTS[z - 1] for z in atom_numbers]
159
+ atom_names, atom_types, atom_numbs = np.unique(
160
+ atom_symbols, return_inverse=True, return_counts=True
161
+ )
162
+ data["atom_names"] = list(atom_names)
163
+ data["atom_numbs"] = list(atom_numbs)
164
+ data["atom_types"] = atom_types
165
+ data["coords"] = np.array(coords_t).reshape(-1, natoms, 3)
166
+ data["orig"] = np.zeros(3)
167
+ data["cells"] = np.array([np.eye(3) * 100])
168
+ data["nopbc"] = True
169
+ if energy_t:
170
+ data["energies"] = np.array(energy_t)
171
+ if has_forces and forces_t:
172
+ data["forces"] = np.array(forces_t)
173
+ if has_hessian and hessian_t:
174
+ data["hessian"] = np.array(hessian_t)
175
+ return data
@@ -355,6 +355,62 @@ def split_traj(dump_lines):
355
355
  return None
356
356
 
357
357
 
358
+ def from_system_data(system, f_idx=0, timestep=0):
359
+ """Convert system data to LAMMPS dump format string.
360
+
361
+ Parameters
362
+ ----------
363
+ system : dict
364
+ System data dictionary containing atoms, coordinates, cell, etc.
365
+ f_idx : int, optional
366
+ Frame index to dump (default: 0)
367
+ timestep : int, optional
368
+ Timestep number for the dump (default: 0)
369
+
370
+ Returns
371
+ -------
372
+ str
373
+ LAMMPS dump format string
374
+ """
375
+ ret = ""
376
+
377
+ # Get basic system info
378
+ natoms = sum(system["atom_numbs"])
379
+ coords = system["coords"][f_idx]
380
+ cell = system["cells"][f_idx]
381
+ atom_types = system["atom_types"]
382
+ orig = system.get("orig", np.zeros(3))
383
+
384
+ # Convert cell to dump format (bounds and tilt)
385
+ bounds, tilt = box2dumpbox(orig, cell)
386
+
387
+ # Write timestep
388
+ ret += "ITEM: TIMESTEP\n"
389
+ ret += f"{timestep}\n"
390
+
391
+ # Write number of atoms
392
+ ret += "ITEM: NUMBER OF ATOMS\n"
393
+ ret += f"{natoms}\n"
394
+
395
+ # Write box bounds
396
+ ret += "ITEM: BOX BOUNDS xy xz yz pp pp pp\n"
397
+ ret += f"{bounds[0][0]:.10f} {bounds[0][1]:.10f} {tilt[0]:.10f}\n"
398
+ ret += f"{bounds[1][0]:.10f} {bounds[1][1]:.10f} {tilt[1]:.10f}\n"
399
+ ret += f"{bounds[2][0]:.10f} {bounds[2][1]:.10f} {tilt[2]:.10f}\n"
400
+
401
+ # Write atoms header
402
+ ret += "ITEM: ATOMS id type x y z\n"
403
+
404
+ # Write atom data
405
+ for ii in range(natoms):
406
+ atom_id = ii + 1 # LAMMPS uses 1-based indexing
407
+ atom_type = atom_types[ii] + 1 # LAMMPS uses 1-based type indexing
408
+ x, y, z = coords[ii]
409
+ ret += f"{atom_id} {atom_type} {x:.10f} {y:.10f} {z:.10f}\n"
410
+
411
+ return ret
412
+
413
+
358
414
  if __name__ == "__main__":
359
415
  # fname = 'dump.hti'
360
416
  # lines = open(fname).read().split('\n')