dpdata 1.0.0__tar.gz → 1.0.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.
- {dpdata-1.0.0 → dpdata-1.0.2}/.github/dependabot.yml +0 -1
- {dpdata-1.0.0 → dpdata-1.0.2}/.github/workflows/benchmark.yml +1 -1
- {dpdata-1.0.0 → dpdata-1.0.2}/.github/workflows/pub-pypi.yml +2 -2
- {dpdata-1.0.0 → dpdata-1.0.2}/.github/workflows/pyright.yml +2 -2
- {dpdata-1.0.0 → dpdata-1.0.2}/.github/workflows/test.yml +10 -6
- {dpdata-1.0.0 → dpdata-1.0.2}/.github/workflows/test_import.yml +2 -2
- {dpdata-1.0.0 → dpdata-1.0.2}/.gitignore +4 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/.pre-commit-config.yaml +15 -7
- {dpdata-1.0.0 → dpdata-1.0.2}/AGENTS.md +19 -2
- dpdata-1.0.2/PKG-INFO +105 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/README.md +1 -1
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/__init__.py +2 -3
- dpdata-1.0.2/dpdata/_version.py +24 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/bond_order_system.py +6 -6
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/driver.py +3 -1
- dpdata-1.0.2/dpdata/formats/__init__.py +1 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/abacus/md.py +1 -1
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/abacus/relax.py +61 -10
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/abacus/scf.py +1 -1
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/abacus/stru.py +1 -1
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/amber/md.py +67 -11
- dpdata-1.0.2/dpdata/formats/cp2k/__init__.py +5 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/cp2k/output.py +2 -2
- dpdata-1.0.2/dpdata/formats/deepmd/mixed.py +299 -0
- {dpdata-1.0.0/dpdata/dftbplus → dpdata-1.0.2/dpdata/formats/fhi_aims}/__init__.py +0 -0
- dpdata-1.0.2/dpdata/formats/gaussian/__init__.py +5 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/gaussian/fchk.py +2 -2
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/gaussian/log.py +2 -2
- {dpdata-1.0.0/dpdata/fhi_aims → dpdata-1.0.2/dpdata/formats/gromacs}/__init__.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/gromacs/gro.py +1 -1
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/lammps/lmp.py +53 -0
- dpdata-1.0.2/dpdata/formats/lmdb/__init__.py +5 -0
- dpdata-1.0.2/dpdata/formats/lmdb/format.py +286 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/openmx/omx.py +21 -46
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/pwmat/atomconfig.py +1 -1
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/pwmat/movement.py +1 -1
- dpdata-1.0.2/dpdata/formats/qe/__init__.py +5 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/qe/traj.py +1 -1
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/rdkit/sanitize.py +9 -2
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/3dmol.py +1 -1
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/__init__.py +1 -5
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/abacus.py +7 -7
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/amber.py +7 -7
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/ase.py +3 -1
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/cp2k.py +3 -3
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/deepmd.py +45 -19
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/dftbplus.py +1 -1
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/fhi_aims.py +5 -3
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/gaussian.py +9 -9
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/gromacs.py +6 -4
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/lammps.py +9 -7
- dpdata-1.0.2/dpdata/plugins/lmdb.py +6 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/openmx.py +4 -4
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/orca.py +1 -1
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/psi4.py +2 -2
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/pwmat.py +5 -5
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/pymatgen.py +4 -4
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/qe.py +6 -6
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/rdkit.py +2 -2
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/siesta.py +6 -6
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/vasp.py +7 -7
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/xyz.py +2 -2
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/system.py +11 -2
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/utils.py +56 -22
- dpdata-1.0.2/dpdata.egg-info/PKG-INFO +105 -0
- dpdata-1.0.2/dpdata.egg-info/SOURCES.txt +145 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata.egg-info/requires.txt +2 -9
- {dpdata-1.0.0 → dpdata-1.0.2}/pyproject.toml +9 -10
- dpdata-1.0.2/skills/dpdata-cli/README.md +71 -0
- dpdata-1.0.2/skills/dpdata-cli/SKILL.md +188 -0
- dpdata-1.0.2/skills/dpdata-driver/SKILL.md +154 -0
- dpdata-1.0.2/skills/dpdata-minimizer/SKILL.md +86 -0
- dpdata-1.0.2/skills/dpdata-plugin/SKILL.md +119 -0
- dpdata-1.0.0/PKG-INFO +0 -272
- dpdata-1.0.0/dpdata/_version.py +0 -34
- dpdata-1.0.0/dpdata/deepmd/mixed.py +0 -157
- dpdata-1.0.0/dpdata/siesta/__init__.py +0 -0
- dpdata-1.0.0/dpdata/vasp/__init__.py +0 -0
- dpdata-1.0.0/dpdata/xyz/__init__.py +0 -0
- dpdata-1.0.0/dpdata.egg-info/PKG-INFO +0 -272
- dpdata-1.0.0/dpdata.egg-info/SOURCES.txt +0 -136
- {dpdata-1.0.0 → dpdata-1.0.2}/.git-blame-ignore-revs +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/.git_archival.txt +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/.gitattributes +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/.github/ISSUE_TEMPLATE/generic-issue.yml +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/.github/workflows/mirror_gitee.yml +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/.readthedocs.yaml +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/LICENSE +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/MANIFEST.in +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/benchmark/__init__.py +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/benchmark/test_import.py +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/__about__.py +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/__main__.py +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/ase_calculator.py +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/cli.py +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/data_type.py +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/format.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/abacus/__init__.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/amber/__init__.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/amber/mask.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/amber/sqm.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/cp2k/cell.py +0 -0
- {dpdata-1.0.0/dpdata/cp2k → dpdata-1.0.2/dpdata/formats/deepmd}/__init__.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/deepmd/comp.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/deepmd/hdf5.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/deepmd/raw.py +0 -0
- {dpdata-1.0.0/dpdata/deepmd → dpdata-1.0.2/dpdata/formats/dftbplus}/__init__.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/dftbplus/output.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/fhi_aims/output.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/gaussian/gjf.py +0 -0
- {dpdata-1.0.0/dpdata/gaussian → dpdata-1.0.2/dpdata/formats/lammps}/__init__.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/lammps/dump.py +0 -0
- {dpdata-1.0.0/dpdata/gromacs → dpdata-1.0.2/dpdata/formats/openmx}/__init__.py +0 -0
- {dpdata-1.0.0/dpdata/lammps → dpdata-1.0.2/dpdata/formats/orca}/__init__.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/orca/output.py +0 -0
- {dpdata-1.0.0/dpdata/md → dpdata-1.0.2/dpdata/formats/psi4}/__init__.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/psi4/input.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/psi4/output.py +0 -0
- {dpdata-1.0.0/dpdata/openmx → dpdata-1.0.2/dpdata/formats/pwmat}/__init__.py +0 -0
- {dpdata-1.0.0/dpdata/orca → dpdata-1.0.2/dpdata/formats/pymatgen}/__init__.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/pymatgen/molecule.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/pymatgen/structure.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/qe/scf.py +0 -0
- {dpdata-1.0.0/dpdata/psi4 → dpdata-1.0.2/dpdata/formats/rdkit}/__init__.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/rdkit/utils.py +0 -0
- {dpdata-1.0.0/dpdata/pwmat → dpdata-1.0.2/dpdata/formats/siesta}/__init__.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/siesta/aiMD_output.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/siesta/output.py +0 -0
- {dpdata-1.0.0/dpdata/pymatgen → dpdata-1.0.2/dpdata/formats/vasp}/__init__.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/vasp/outcar.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/vasp/poscar.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/vasp/xml.py +0 -0
- {dpdata-1.0.0/dpdata/qe → dpdata-1.0.2/dpdata/formats/xyz}/__init__.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/xyz/quip_gap_xyz.py +0 -0
- {dpdata-1.0.0/dpdata → dpdata-1.0.2/dpdata/formats}/xyz/xyz.py +0 -0
- {dpdata-1.0.0/dpdata/rdkit → dpdata-1.0.2/dpdata/md}/__init__.py +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/md/msd.py +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/md/pbc.py +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/md/rdf.py +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/md/water.py +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/periodic_table.json +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/periodic_table.py +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugin.py +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/list.py +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/plugins/n2p2.py +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/py.typed +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/stat.py +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata/unit.py +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata.egg-info/dependency_links.txt +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata.egg-info/entry_points.txt +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/dpdata.egg-info/top_level.txt +0 -0
- {dpdata-1.0.0 → dpdata-1.0.2}/setup.cfg +0 -0
|
@@ -10,10 +10,10 @@ jobs:
|
|
|
10
10
|
steps:
|
|
11
11
|
- uses: actions/checkout@master
|
|
12
12
|
|
|
13
|
-
- name: Set up Python 3.
|
|
13
|
+
- name: Set up Python 3.10
|
|
14
14
|
uses: actions/setup-python@master
|
|
15
15
|
with:
|
|
16
|
-
python-version: 3.
|
|
16
|
+
python-version: "3.10"
|
|
17
17
|
|
|
18
18
|
- name: Install pypa/build
|
|
19
19
|
run: >-
|
|
@@ -13,7 +13,7 @@ jobs:
|
|
|
13
13
|
with:
|
|
14
14
|
python-version: '3.12'
|
|
15
15
|
- run: pip install uv
|
|
16
|
-
- run: uv pip install --system -e .[amber,ase,pymatgen]
|
|
17
|
-
- uses: jakebailey/pyright-action@
|
|
16
|
+
- run: uv pip install --system -e .[amber,ase,pymatgen] rdkit openbabel-wheel
|
|
17
|
+
- uses: jakebailey/pyright-action@v3
|
|
18
18
|
with:
|
|
19
19
|
version: 1.1.363
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
name: Python package
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
- push
|
|
5
|
+
- pull_request
|
|
6
6
|
|
|
7
7
|
jobs:
|
|
8
8
|
build:
|
|
9
9
|
runs-on: ubuntu-22.04
|
|
10
10
|
strategy:
|
|
11
11
|
matrix:
|
|
12
|
-
python-version: ["3.
|
|
12
|
+
python-version: ["3.10", "3.13"]
|
|
13
13
|
|
|
14
14
|
steps:
|
|
15
|
-
- uses: actions/checkout@
|
|
15
|
+
- uses: actions/checkout@v6
|
|
16
16
|
# set up conda
|
|
17
17
|
- name: Set up Python ${{ matrix.python-version }}
|
|
18
18
|
uses: actions/setup-python@v6
|
|
@@ -26,13 +26,15 @@ jobs:
|
|
|
26
26
|
**/pyproject.toml
|
|
27
27
|
cache-suffix: "py${{ matrix.python-version }}"
|
|
28
28
|
- name: Install dependencies
|
|
29
|
-
run: uv pip install --system .[test,amber,ase,pymatgen] coverage ./tests/plugin
|
|
29
|
+
run: uv pip install --system .[test,amber,ase,pymatgen] coverage ./tests/plugin rdkit openbabel-wheel
|
|
30
30
|
- name: Test
|
|
31
31
|
run: cd tests && coverage run --source=../dpdata -m unittest && cd .. && coverage combine tests/.coverage && coverage report
|
|
32
32
|
- name: Run codecov
|
|
33
|
-
uses: codecov/codecov-action@
|
|
33
|
+
uses: codecov/codecov-action@v6
|
|
34
34
|
env:
|
|
35
35
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
36
|
+
with:
|
|
37
|
+
use_oidc: true
|
|
36
38
|
pass:
|
|
37
39
|
needs: [build]
|
|
38
40
|
runs-on: ubuntu-latest
|
|
@@ -42,3 +44,5 @@ jobs:
|
|
|
42
44
|
uses: re-actors/alls-green@release/v1
|
|
43
45
|
with:
|
|
44
46
|
jobs: ${{ toJSON(needs) }}
|
|
47
|
+
permissions:
|
|
48
|
+
id-token: write
|
|
@@ -8,10 +8,10 @@ jobs:
|
|
|
8
8
|
build:
|
|
9
9
|
runs-on: ubuntu-latest
|
|
10
10
|
steps:
|
|
11
|
-
- uses: actions/checkout@
|
|
11
|
+
- uses: actions/checkout@v6
|
|
12
12
|
- uses: actions/setup-python@v6
|
|
13
13
|
with:
|
|
14
|
-
python-version: '3.
|
|
14
|
+
python-version: '3.10'
|
|
15
15
|
architecture: 'x64'
|
|
16
16
|
- run: python -m pip install uv
|
|
17
17
|
- run: python -m uv pip install --system .
|
|
@@ -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.
|
|
24
|
+
rev: v0.15.12
|
|
25
25
|
hooks:
|
|
26
26
|
- id: ruff
|
|
27
27
|
args: ["--fix"]
|
|
@@ -34,10 +34,18 @@ repos:
|
|
|
34
34
|
hooks:
|
|
35
35
|
- id: velin
|
|
36
36
|
args: ["--write"]
|
|
37
|
-
#
|
|
38
|
-
- repo: https://github.com/
|
|
39
|
-
rev: 1.
|
|
37
|
+
# markdown
|
|
38
|
+
- repo: https://github.com/hukkin/mdformat
|
|
39
|
+
rev: 1.0.0
|
|
40
40
|
hooks:
|
|
41
|
-
- id:
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
- id: mdformat
|
|
42
|
+
exclude: "^tests/.*$"
|
|
43
|
+
additional_dependencies:
|
|
44
|
+
# - mdformat-myst==0.3.0
|
|
45
|
+
# See https://github.com/executablebooks/mdformat-myst/issues/13
|
|
46
|
+
- "git+https://github.com/njzjz-bothub/mdformat-myst@d9c414e#egg=mdformat-myst"
|
|
47
|
+
- mdformat-ruff==0.1.3
|
|
48
|
+
- mdformat-web==0.2.0
|
|
49
|
+
- mdformat-config==0.2.1
|
|
50
|
+
- mdformat-beautysh==1.0.0
|
|
51
|
+
- mdformat-gfm-alerts==2.0.0
|
|
@@ -7,22 +7,26 @@ Always reference these instructions first and fallback to search or bash command
|
|
|
7
7
|
## Working Effectively
|
|
8
8
|
|
|
9
9
|
- **Bootstrap and install the repository:**
|
|
10
|
+
|
|
10
11
|
- `cd /home/runner/work/dpdata/dpdata` (or wherever the repo is cloned)
|
|
11
12
|
- `uv pip install -e .` -- installs dpdata in development mode with core dependencies (numpy, scipy, h5py, monty, wcmatch)
|
|
12
13
|
- Test installation: `dpdata --version` -- should show version like "dpdata v0.1.dev2+..."
|
|
13
14
|
|
|
14
15
|
- **Run tests:**
|
|
16
|
+
|
|
15
17
|
- `cd tests && python -m unittest discover` -- runs all 1826 tests in ~10 seconds. NEVER CANCEL.
|
|
16
18
|
- `cd tests && python -m unittest test_<module>.py` -- run specific test modules (individual modules take ~0.5 seconds)
|
|
17
19
|
- `cd tests && coverage run --source=../dpdata -m unittest discover && coverage report` -- run tests with coverage
|
|
18
20
|
|
|
19
21
|
- **Linting and formatting:**
|
|
22
|
+
|
|
20
23
|
- Install ruff: `uv pip install ruff`
|
|
21
24
|
- `ruff check dpdata/` -- lint the main package (takes ~1 second)
|
|
22
25
|
- `ruff format dpdata/` -- format code according to project style
|
|
23
26
|
- `ruff check --fix dpdata/` -- auto-fix linting issues where possible
|
|
24
27
|
|
|
25
28
|
- **Pre-commit hooks:**
|
|
29
|
+
|
|
26
30
|
- Install: `uv pip install pre-commit`
|
|
27
31
|
- `pre-commit run --all-files` -- run all hooks on all files
|
|
28
32
|
- Hooks include: ruff linting/formatting, trailing whitespace, end-of-file-fixer, yaml/json/toml checks
|
|
@@ -30,15 +34,18 @@ Always reference these instructions first and fallback to search or bash command
|
|
|
30
34
|
## Validation
|
|
31
35
|
|
|
32
36
|
- **Always test CLI functionality after making changes:**
|
|
37
|
+
|
|
33
38
|
- `dpdata --help` -- ensure CLI still works
|
|
34
39
|
- `dpdata --version` -- verify version is correct
|
|
35
40
|
- Test a basic conversion if sample data is available
|
|
36
41
|
|
|
37
42
|
- **Always run linting before committing:**
|
|
43
|
+
|
|
38
44
|
- `ruff check dpdata/` -- ensure no new linting errors
|
|
39
45
|
- `ruff format dpdata/` -- ensure code is properly formatted
|
|
40
46
|
|
|
41
47
|
- **Run relevant tests for your changes:**
|
|
48
|
+
|
|
42
49
|
- For format-specific changes: `cd tests && python -m unittest test_<format>*.py`
|
|
43
50
|
- For core system changes: `cd tests && python -m unittest test_system*.py test_multisystems.py`
|
|
44
51
|
- For CLI changes: `cd tests && python -m unittest test_cli.py` (if exists)
|
|
@@ -46,12 +53,14 @@ Always reference these instructions first and fallback to search or bash command
|
|
|
46
53
|
## Build and Documentation
|
|
47
54
|
|
|
48
55
|
- **Documentation:**
|
|
56
|
+
|
|
49
57
|
- `cd docs && make help` -- see all available build targets
|
|
50
58
|
- `cd docs && make html` -- build HTML documentation (requires additional dependencies)
|
|
51
59
|
- Documentation source is in `docs/` directory using Sphinx
|
|
52
60
|
- **NOTE:** Full docs build requires additional dependencies like `deepmodeling-sphinx` that may not be readily available
|
|
53
61
|
|
|
54
62
|
- **Package building:**
|
|
63
|
+
|
|
55
64
|
- Uses setuptools with pyproject.toml configuration
|
|
56
65
|
- `uv pip install build && python -m build` -- create source and wheel distributions
|
|
57
66
|
- Version is managed by setuptools_scm from git tags
|
|
@@ -61,6 +70,7 @@ Always reference these instructions first and fallback to search or bash command
|
|
|
61
70
|
The following are outputs from frequently run commands. Reference them instead of re-running to save time.
|
|
62
71
|
|
|
63
72
|
### Repository structure
|
|
73
|
+
|
|
64
74
|
```
|
|
65
75
|
/home/runner/work/dpdata/dpdata/
|
|
66
76
|
├── dpdata/ # Main package code
|
|
@@ -82,6 +92,7 @@ The following are outputs from frequently run commands. Reference them instead o
|
|
|
82
92
|
```
|
|
83
93
|
|
|
84
94
|
### Key dependencies
|
|
95
|
+
|
|
85
96
|
- Core: numpy>=1.14.3, scipy, h5py, monty, wcmatch
|
|
86
97
|
- Optional: ase (ASE integration), parmed (AMBER), pymatgen (Materials Project), rdkit (molecular analysis)
|
|
87
98
|
- Testing: unittest (built-in), coverage
|
|
@@ -89,25 +100,30 @@ The following are outputs from frequently run commands. Reference them instead o
|
|
|
89
100
|
- Docs: sphinx with various extensions
|
|
90
101
|
|
|
91
102
|
### Test timing expectations
|
|
103
|
+
|
|
92
104
|
- Full test suite: ~10 seconds (1826 tests). NEVER CANCEL.
|
|
93
105
|
- Individual test modules: ~0.5 seconds
|
|
94
106
|
- Linting with ruff: ~1 second
|
|
95
107
|
- Documentation build: ~30 seconds
|
|
96
108
|
|
|
97
109
|
### Common workflows
|
|
110
|
+
|
|
98
111
|
1. **Adding a new format:**
|
|
112
|
+
|
|
99
113
|
- Create module in `dpdata/<format>/`
|
|
100
114
|
- Implement format classes inheriting from appropriate base classes
|
|
101
115
|
- Add tests in `tests/test_<format>*.py`
|
|
102
116
|
- Register format in the plugin system
|
|
103
117
|
|
|
104
|
-
|
|
118
|
+
1. **Fixing bugs:**
|
|
119
|
+
|
|
105
120
|
- Write test that reproduces the bug first
|
|
106
121
|
- Make minimal fix to pass the test
|
|
107
122
|
- Run full test suite to ensure no regressions
|
|
108
123
|
- Run linting to ensure code style compliance
|
|
109
124
|
|
|
110
|
-
|
|
125
|
+
1. **CLI changes:**
|
|
126
|
+
|
|
111
127
|
- Modify `dpdata/cli.py`
|
|
112
128
|
- Test with `dpdata --help` and specific commands
|
|
113
129
|
- Add/update tests if needed
|
|
@@ -115,6 +131,7 @@ The following are outputs from frequently run commands. Reference them instead o
|
|
|
115
131
|
## Troubleshooting
|
|
116
132
|
|
|
117
133
|
- **Installation timeouts:** Network timeouts during `uv pip install` are common. If this occurs, try:
|
|
134
|
+
|
|
118
135
|
- Individual package installation: `uv pip install numpy scipy h5py monty wcmatch`
|
|
119
136
|
- Use `--timeout` option: `uv pip install --timeout 300 -e .`
|
|
120
137
|
- Verify existing installation works: `dpdata --version` should work even if reinstall fails
|
dpdata-1.0.2/PKG-INFO
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dpdata
|
|
3
|
+
Version: 1.0.2
|
|
4
|
+
Summary: Manipulating data formats of DeePMD-kit, VASP, QE, PWmat, and LAMMPS, etc.
|
|
5
|
+
Author: DeepModeling
|
|
6
|
+
Author-email: Han Wang <wang_han@iapcm.ac.cn>
|
|
7
|
+
License-Expression: LGPL-3.0-or-later
|
|
8
|
+
Project-URL: Homepage, https://github.com/deepmodeling/dpdata
|
|
9
|
+
Project-URL: documentation, https://docs.deepmodeling.com/projects/dpdata
|
|
10
|
+
Project-URL: repository, https://github.com/deepmodeling/dpdata
|
|
11
|
+
Keywords: lammps,vasp,deepmd-kit
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: numpy>=1.14.3
|
|
20
|
+
Requires-Dist: monty
|
|
21
|
+
Requires-Dist: scipy
|
|
22
|
+
Requires-Dist: h5py
|
|
23
|
+
Requires-Dist: wcmatch
|
|
24
|
+
Requires-Dist: lmdb
|
|
25
|
+
Requires-Dist: msgpack-numpy
|
|
26
|
+
Provides-Extra: test
|
|
27
|
+
Provides-Extra: ase
|
|
28
|
+
Requires-Dist: ase; extra == "ase"
|
|
29
|
+
Provides-Extra: amber
|
|
30
|
+
Requires-Dist: parmed; extra == "amber"
|
|
31
|
+
Provides-Extra: pymatgen
|
|
32
|
+
Requires-Dist: pymatgen; extra == "pymatgen"
|
|
33
|
+
Provides-Extra: docs
|
|
34
|
+
Requires-Dist: sphinx; extra == "docs"
|
|
35
|
+
Requires-Dist: recommonmark; extra == "docs"
|
|
36
|
+
Requires-Dist: sphinx-book-theme; extra == "docs"
|
|
37
|
+
Requires-Dist: numpydoc; extra == "docs"
|
|
38
|
+
Requires-Dist: myst-parser; extra == "docs"
|
|
39
|
+
Requires-Dist: deepmodeling-sphinx>=0.3.0; extra == "docs"
|
|
40
|
+
Requires-Dist: sphinx-argparse<0.5.0; extra == "docs"
|
|
41
|
+
Requires-Dist: rdkit; extra == "docs"
|
|
42
|
+
Requires-Dist: jupyterlite-sphinx; extra == "docs"
|
|
43
|
+
Requires-Dist: jupyterlite-xeus; extra == "docs"
|
|
44
|
+
Provides-Extra: benchmark
|
|
45
|
+
Requires-Dist: pytest; extra == "benchmark"
|
|
46
|
+
Requires-Dist: pytest-codspeed; extra == "benchmark"
|
|
47
|
+
Dynamic: license-file
|
|
48
|
+
|
|
49
|
+
# dpdata
|
|
50
|
+
|
|
51
|
+
[](https://doi.org/10.1021/acs.jcim.5c01767)
|
|
52
|
+
[](https://anaconda.org/conda-forge/dpdata)
|
|
53
|
+
[](https://pypi.org/project/dpdata)
|
|
54
|
+
[](https://dpdata.readthedocs.io/)
|
|
55
|
+
|
|
56
|
+
**dpdata** is a Python package for manipulating atomistic data of software in computational science.
|
|
57
|
+
|
|
58
|
+
## Credits
|
|
59
|
+
|
|
60
|
+
If you use this software, please cite the following paper:
|
|
61
|
+
|
|
62
|
+
- 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). [](https://badge.dimensions.ai/details/doi/10.1021/acs.jcim.5c01767)
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
dpdata only supports Python 3.10 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:
|
|
67
|
+
|
|
68
|
+
- Install via pip: `pip install dpdata`
|
|
69
|
+
- Install via conda: `conda install -c conda-forge dpdata`
|
|
70
|
+
- Install from source code: `git clone https://github.com/deepmodeling/dpdata && pip install ./dpdata`
|
|
71
|
+
|
|
72
|
+
To test if the installation is successful, you may execute
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
dpdata --version
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Supported packages
|
|
79
|
+
|
|
80
|
+
`dpdata` is aimmed to support different kinds of atomistic packages:
|
|
81
|
+
|
|
82
|
+
- Atomistic machine learning packages, such as [DeePMD-kit](https://github.com/deepmodeling/deepmd-kit);
|
|
83
|
+
- Molecular dynamics packages, such as [LAMMPS](https://github.com/lammps/lammps) and [GROMACS](https://gitlab.com/gromacs/gromacs);
|
|
84
|
+
- Quantum chemistry packages, such as [VASP](https://www.vasp.at/), [Gaussian](https://gaussian.com), and [ABACUS](https://github.com/deepmodeling/abacus-develop);
|
|
85
|
+
- Atomistic visualization packages, such as [3Dmol.js](https://3dmol.csb.pitt.edu/).
|
|
86
|
+
- Other atomistic tools, such as [ASE](https://gitlab.com/ase/ase).
|
|
87
|
+
- Common formats such as `xyz`.
|
|
88
|
+
|
|
89
|
+
All supported formats are listed [here](https://docs.deepmodeling.com/projects/dpdata/en/master/formats.html).
|
|
90
|
+
|
|
91
|
+
## Quick start
|
|
92
|
+
|
|
93
|
+
The quickest way to convert a simple file from one format to another one is to use the [command line](https://docs.deepmodeling.com/projects/dpdata/en/master/cli.html).
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
dpdata OUTCAR -i vasp/outcar -o deepmd/npy -O deepmd_data
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
For advanced usage with Python APIs, [read dpdata documentation](https://docs.deepmodeling.com/projects/dpdata/).
|
|
100
|
+
|
|
101
|
+
## Plugins
|
|
102
|
+
|
|
103
|
+
- [cp2kdata](https://github.com/robinzyb/cp2kdata) adds the latest CP2K support for dpdata.
|
|
104
|
+
|
|
105
|
+
For how to create your own plugin packages, [read dpdata documentation](https://docs.deepmodeling.com/projects/dpdata/).
|
|
@@ -15,7 +15,7 @@ If you use this software, please cite the following paper:
|
|
|
15
15
|
|
|
16
16
|
## Installation
|
|
17
17
|
|
|
18
|
-
dpdata only supports Python 3.
|
|
18
|
+
dpdata only supports Python 3.10 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:
|
|
19
19
|
|
|
20
20
|
- Install via pip: `pip install dpdata`
|
|
21
21
|
- Install via conda: `conda install -c conda-forge dpdata`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from . import
|
|
3
|
+
from . import md
|
|
4
4
|
from .bond_order_system import BondOrderSystem
|
|
5
5
|
from .system import LabeledSystem, MultiSystems, System
|
|
6
6
|
|
|
@@ -9,11 +9,10 @@ try:
|
|
|
9
9
|
except ImportError:
|
|
10
10
|
from .__about__ import __version__
|
|
11
11
|
|
|
12
|
+
|
|
12
13
|
__all__ = [
|
|
13
14
|
"__version__",
|
|
14
|
-
"lammps",
|
|
15
15
|
"md",
|
|
16
|
-
"vasp",
|
|
17
16
|
"System",
|
|
18
17
|
"LabeledSystem",
|
|
19
18
|
"MultiSystems",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# file generated by vcs-versioning
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"__version__",
|
|
7
|
+
"__version_tuple__",
|
|
8
|
+
"version",
|
|
9
|
+
"version_tuple",
|
|
10
|
+
"__commit_id__",
|
|
11
|
+
"commit_id",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
version: str
|
|
15
|
+
__version__: str
|
|
16
|
+
__version_tuple__: tuple[int | str, ...]
|
|
17
|
+
version_tuple: tuple[int | str, ...]
|
|
18
|
+
commit_id: str | None
|
|
19
|
+
__commit_id__: str | None
|
|
20
|
+
|
|
21
|
+
__version__ = version = '1.0.2'
|
|
22
|
+
__version_tuple__ = version_tuple = (1, 0, 2)
|
|
23
|
+
|
|
24
|
+
__commit_id__ = commit_id = 'gbc617b720'
|
|
@@ -6,11 +6,11 @@ from copy import deepcopy
|
|
|
6
6
|
|
|
7
7
|
import numpy as np
|
|
8
8
|
|
|
9
|
-
import dpdata.rdkit.utils
|
|
10
|
-
from dpdata.rdkit.sanitize import Sanitizer
|
|
9
|
+
import dpdata.formats.rdkit.utils
|
|
10
|
+
from dpdata.formats.rdkit.sanitize import Sanitizer
|
|
11
11
|
from dpdata.system import Axis, DataType, System
|
|
12
12
|
|
|
13
|
-
# import dpdata.rdkit.mol2
|
|
13
|
+
# import dpdata.formats.rdkit.mol2
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class BondOrderSystem(System):
|
|
@@ -79,7 +79,7 @@ class BondOrderSystem(System):
|
|
|
79
79
|
self.sanitizer = Sanitizer(sanitize_level, raise_errors, verbose)
|
|
80
80
|
|
|
81
81
|
if data:
|
|
82
|
-
mol = dpdata.rdkit.utils.system_data_to_mol(data)
|
|
82
|
+
mol = dpdata.formats.rdkit.utils.system_data_to_mol(data)
|
|
83
83
|
self.from_rdkit_mol(mol)
|
|
84
84
|
if file_name:
|
|
85
85
|
self.from_fmt(
|
|
@@ -161,7 +161,7 @@ class BondOrderSystem(System):
|
|
|
161
161
|
# magic method "+" operation
|
|
162
162
|
# '''
|
|
163
163
|
# if isinstance(other, BondOrderSystem):
|
|
164
|
-
# if dpdata.rdkit.utils.check_same_molecule(self.rdkit_mol, other.rdkit_mol):
|
|
164
|
+
# if dpdata.formats.rdkit.utils.check_same_molecule(self.rdkit_mol, other.rdkit_mol):
|
|
165
165
|
# self.__class__(self, data=other.data)
|
|
166
166
|
# else:
|
|
167
167
|
# raise RuntimeError("The two systems are not of the same topology.")
|
|
@@ -171,7 +171,7 @@ class BondOrderSystem(System):
|
|
|
171
171
|
def from_rdkit_mol(self, rdkit_mol):
|
|
172
172
|
"""Initialize from a rdkit.Chem.rdchem.Mol object."""
|
|
173
173
|
rdkit_mol = self.sanitizer.sanitize(rdkit_mol)
|
|
174
|
-
self.data = dpdata.rdkit.utils.mol_to_system_data(rdkit_mol)
|
|
174
|
+
self.data = dpdata.formats.rdkit.utils.mol_to_system_data(rdkit_mol)
|
|
175
175
|
self.data["bond_dict"] = dict(
|
|
176
176
|
[(f"{int(bond[0])}-{int(bond[1])}", bond[2]) for bond in self.data["bonds"]]
|
|
177
177
|
)
|
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from abc import ABC, abstractmethod
|
|
6
|
-
from typing import TYPE_CHECKING
|
|
6
|
+
from typing import TYPE_CHECKING
|
|
7
7
|
|
|
8
8
|
from .plugin import Plugin
|
|
9
9
|
|
|
10
10
|
if TYPE_CHECKING:
|
|
11
|
+
from collections.abc import Callable
|
|
12
|
+
|
|
11
13
|
import ase.calculators.calculator
|
|
12
14
|
|
|
13
15
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Format modules for dpdata
|
|
@@ -135,7 +135,7 @@ def get_energy(outlines, ndump, dump_freq):
|
|
|
135
135
|
energy = []
|
|
136
136
|
nenergy = 0
|
|
137
137
|
for line_idx, line in enumerate(outlines):
|
|
138
|
-
if "final etot is" in line:
|
|
138
|
+
if "final etot is" in line or "#TOTAL ENERGY#" in line:
|
|
139
139
|
if nenergy % dump_freq == 0:
|
|
140
140
|
energy.append(float(line.split()[-2]))
|
|
141
141
|
nenergy += 1
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import glob
|
|
3
4
|
import os
|
|
4
5
|
|
|
5
6
|
import numpy as np
|
|
@@ -31,7 +32,22 @@ def get_log_file(fname, inlines):
|
|
|
31
32
|
return logf
|
|
32
33
|
|
|
33
34
|
|
|
34
|
-
def
|
|
35
|
+
def get_relax_stru_files(output_dir):
|
|
36
|
+
"""Find the STRU files in the output directory.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
output_dir (str): output directory
|
|
40
|
+
|
|
41
|
+
Returns
|
|
42
|
+
-------
|
|
43
|
+
strus: list of STRU files
|
|
44
|
+
example:
|
|
45
|
+
["STRU_ION1_D", "STRU_ION2_D"]
|
|
46
|
+
"""
|
|
47
|
+
return glob.glob(os.path.join(output_dir, "STRU_ION*_D"))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def get_coords_from_log(loglines, natoms, stru_files=None):
|
|
35
51
|
"""NOTICE: unit of coords and cells is Angstrom
|
|
36
52
|
order:
|
|
37
53
|
coordinate
|
|
@@ -72,7 +88,12 @@ def get_coords_from_log(loglines, natoms):
|
|
|
72
88
|
coord_direct.append(False)
|
|
73
89
|
for k in range(2, 2 + natoms):
|
|
74
90
|
coords[-1].append(
|
|
75
|
-
list(
|
|
91
|
+
list(
|
|
92
|
+
map(
|
|
93
|
+
lambda x: float(x) * a0 * bohr2ang,
|
|
94
|
+
loglines[i + k].split()[1:4],
|
|
95
|
+
)
|
|
96
|
+
)
|
|
76
97
|
)
|
|
77
98
|
else:
|
|
78
99
|
assert False, "Unrecongnized coordinate type, %s, line:%d" % ( # noqa: UP031
|
|
@@ -91,16 +112,42 @@ def get_coords_from_log(loglines, natoms):
|
|
|
91
112
|
cells.append([])
|
|
92
113
|
for k in range(1, 4):
|
|
93
114
|
cells[-1].append(
|
|
94
|
-
list(
|
|
115
|
+
list(
|
|
116
|
+
map(
|
|
117
|
+
lambda x: float(x) * a0 * bohr2ang,
|
|
118
|
+
loglines[i + k].split()[0:3],
|
|
119
|
+
)
|
|
120
|
+
)
|
|
95
121
|
)
|
|
96
122
|
|
|
97
|
-
elif line[1:14] == "final etot is":
|
|
123
|
+
elif line[1:14] == "final etot is" or "#TOTAL ENERGY#" in line:
|
|
98
124
|
# add the energy for previous structures whose SCF is not converged
|
|
99
125
|
while len(energy) < len(coords) - 1:
|
|
100
126
|
energy.append(np.nan)
|
|
101
127
|
# get the energy of current structure
|
|
102
128
|
energy.append(float(line.split()[-2]))
|
|
103
129
|
|
|
130
|
+
# in some relax method (like: bfgs_trad), the coordinate is not outputed in running_relax.log
|
|
131
|
+
# but if out_stru is true, then STRU_ION*_D will be outputed in OUT.ABACUS
|
|
132
|
+
# we should read cell and coord from STRU_ION*_D files
|
|
133
|
+
if len(energy) > 1 and len(coords) == 1:
|
|
134
|
+
# the energies of all structrues are collected, but coords have only the first structure
|
|
135
|
+
if (
|
|
136
|
+
stru_files is not None and len(stru_files) > 1
|
|
137
|
+
): # if stru_files are not only STRU_ION_D
|
|
138
|
+
stru_file_name = [os.path.basename(i) for i in stru_files]
|
|
139
|
+
coords = coords[:1] + [np.nan for i in range(len(energy) - 1)]
|
|
140
|
+
coord_direct = coord_direct[:1] + [False for i in range(len(energy) - 1)]
|
|
141
|
+
cells = cells[:1] + [np.nan for i in range(len(energy) - 1)]
|
|
142
|
+
for iframe in range(1, len(energy)):
|
|
143
|
+
if f"STRU_ION{iframe}_D" in stru_file_name:
|
|
144
|
+
# read the structure from STRU_ION*_D
|
|
145
|
+
stru_data = get_frame_from_stru(
|
|
146
|
+
stru_files[stru_file_name.index(f"STRU_ION{iframe}_D")]
|
|
147
|
+
)
|
|
148
|
+
coords[iframe] = stru_data["coords"][0]
|
|
149
|
+
cells[iframe] = stru_data["cells"][0]
|
|
150
|
+
|
|
104
151
|
force = collect_force(loglines)
|
|
105
152
|
stress = collect_stress(loglines)
|
|
106
153
|
|
|
@@ -133,7 +180,11 @@ def get_coords_from_log(loglines, natoms):
|
|
|
133
180
|
|
|
134
181
|
# delete structures whose energy is np.nan
|
|
135
182
|
for i in range(minl):
|
|
136
|
-
if
|
|
183
|
+
if (
|
|
184
|
+
np.isnan(energy[i - minl])
|
|
185
|
+
or np.any(np.isnan(coords[i - minl]))
|
|
186
|
+
or np.any(np.isnan(cells[i - minl]))
|
|
187
|
+
):
|
|
137
188
|
del energy[i - minl]
|
|
138
189
|
del coords[i - minl]
|
|
139
190
|
del cells[i - minl]
|
|
@@ -154,10 +205,6 @@ def get_coords_from_log(loglines, natoms):
|
|
|
154
205
|
if coord_direct[i]:
|
|
155
206
|
coords[i] = coords[i].dot(cells[i])
|
|
156
207
|
|
|
157
|
-
# transfer bohrium to angstrom
|
|
158
|
-
cells *= bohr2ang
|
|
159
|
-
coords *= bohr2ang
|
|
160
|
-
|
|
161
208
|
if len(stress) > 0:
|
|
162
209
|
virial = np.zeros([len(cells), 3, 3])
|
|
163
210
|
for i in range(len(cells)):
|
|
@@ -191,7 +238,11 @@ def get_frame(fname):
|
|
|
191
238
|
with open_file(logf) as f1:
|
|
192
239
|
lines = f1.readlines()
|
|
193
240
|
|
|
194
|
-
|
|
241
|
+
relax_stru_files = get_relax_stru_files(os.path.dirname(logf))
|
|
242
|
+
|
|
243
|
+
energy, cells, coords, force, stress, virial = get_coords_from_log(
|
|
244
|
+
lines, natoms, stru_files=relax_stru_files
|
|
245
|
+
)
|
|
195
246
|
|
|
196
247
|
magmom, magforce = get_mag_force(lines)
|
|
197
248
|
|
|
@@ -8,7 +8,7 @@ import numpy as np
|
|
|
8
8
|
|
|
9
9
|
from dpdata.utils import open_file
|
|
10
10
|
|
|
11
|
-
from
|
|
11
|
+
from ...unit import LengthConversion, PressureConversion
|
|
12
12
|
from .stru import get_frame_from_stru
|
|
13
13
|
|
|
14
14
|
bohr2ang = LengthConversion("bohr", "angstrom").value()
|