dpdata 0.2.18__tar.gz → 0.2.19__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-0.2.19/.git_archival.txt +4 -0
- dpdata-0.2.19/.gitattributes +1 -0
- dpdata-0.2.19/.github/workflows/benchmark.yml +23 -0
- dpdata-0.2.19/.github/workflows/pyright.yml +19 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/.github/workflows/test.yml +4 -6
- {dpdata-0.2.18 → dpdata-0.2.19}/.github/workflows/test_import.yml +18 -17
- {dpdata-0.2.18 → dpdata-0.2.19}/.pre-commit-config.yaml +4 -2
- {dpdata-0.2.18 → dpdata-0.2.19}/PKG-INFO +6 -2
- dpdata-0.2.19/benchmark/test_import.py +20 -0
- dpdata-0.2.19/dpdata/__about__.py +3 -0
- dpdata-0.2.19/dpdata/__init__.py +21 -0
- dpdata-0.2.19/dpdata/__main__.py +6 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/_version.py +2 -2
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/abacus/md.py +4 -2
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/abacus/relax.py +3 -1
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/abacus/scf.py +12 -10
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/amber/mask.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/amber/md.py +4 -1
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/amber/sqm.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/ase_calculator.py +14 -9
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/bond_order_system.py +8 -4
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/cli.py +6 -7
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/cp2k/cell.py +1 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/cp2k/output.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/data_type.py +9 -6
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/deepmd/comp.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/deepmd/hdf5.py +8 -7
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/deepmd/mixed.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/deepmd/raw.py +2 -0
- {dpdata-0.2.18/dpdata/fhi_aims → dpdata-0.2.19/dpdata/dftbplus}/__init__.py +0 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/dftbplus/output.py +2 -2
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/driver.py +9 -6
- {dpdata-0.2.18/dpdata/gaussian → dpdata-0.2.19/dpdata/fhi_aims}/__init__.py +0 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/fhi_aims/output.py +8 -6
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/format.py +10 -8
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/gaussian/gjf.py +14 -19
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/gaussian/log.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/gromacs/gro.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/lammps/dump.py +1 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/lammps/lmp.py +1 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/md/msd.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/md/pbc.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/md/rdf.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/md/water.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/openmx/omx.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/orca/output.py +64 -64
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/periodic_table.py +23 -6
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugin.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/3dmol.py +2 -2
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/__init__.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/abacus.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/amber.py +3 -1
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/ase.py +74 -29
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/cp2k.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/deepmd.py +12 -4
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/dftbplus.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/fhi_aims.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/gaussian.py +3 -1
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/gromacs.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/lammps.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/list.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/n2p2.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/openmx.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/orca.py +53 -51
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/psi4.py +104 -102
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/pwmat.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/pymatgen.py +20 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/qe.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/rdkit.py +11 -7
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/siesta.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/vasp.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/plugins/xyz.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/psi4/input.py +6 -1
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/psi4/output.py +74 -74
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/pwmat/atomconfig.py +3 -1
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/pwmat/movement.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/pymatgen/molecule.py +5 -5
- dpdata-0.2.19/dpdata/pymatgen/structure.py +21 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/qe/scf.py +1 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/qe/traj.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/rdkit/sanitize.py +32 -16
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/rdkit/utils.py +6 -4
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/siesta/aiMD_output.py +1 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/siesta/output.py +1 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/stat.py +21 -9
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/system.py +211 -104
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/unit.py +3 -1
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/utils.py +26 -1
- dpdata-0.2.19/dpdata/vasp/__init__.py +0 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/vasp/outcar.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/vasp/poscar.py +3 -2
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/vasp/xml.py +1 -0
- dpdata-0.2.19/dpdata/xyz/__init__.py +0 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/xyz/quip_gap_xyz.py +2 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/xyz/xyz.py +2 -2
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata.egg-info/PKG-INFO +6 -2
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata.egg-info/SOURCES.txt +9 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata.egg-info/requires.txt +6 -1
- {dpdata-0.2.18 → dpdata-0.2.19}/pyproject.toml +31 -2
- dpdata-0.2.18/dpdata/__about__.py +0 -1
- dpdata-0.2.18/dpdata/__init__.py +0 -43
- {dpdata-0.2.18 → dpdata-0.2.19}/.git-blame-ignore-revs +0 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/.github/ISSUE_TEMPLATE/generic-issue.yml +0 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/.github/dependabot.yml +0 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/.github/workflows/mirror_gitee.yml +0 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/.github/workflows/pub-pypi.yml +0 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/.gitignore +0 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/.readthedocs.yaml +0 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/LICENSE +0 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/MANIFEST.in +0 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/README.md +0 -0
- {dpdata-0.2.18/dpdata/abacus → dpdata-0.2.19/benchmark}/__init__.py +0 -0
- {dpdata-0.2.18/dpdata/amber → dpdata-0.2.19/dpdata/abacus}/__init__.py +0 -0
- {dpdata-0.2.18/dpdata/cp2k → dpdata-0.2.19/dpdata/amber}/__init__.py +0 -0
- {dpdata-0.2.18/dpdata/deepmd → dpdata-0.2.19/dpdata/cp2k}/__init__.py +0 -0
- {dpdata-0.2.18/dpdata/dftbplus → dpdata-0.2.19/dpdata/deepmd}/__init__.py +0 -0
- {dpdata-0.2.18/dpdata/gromacs → dpdata-0.2.19/dpdata/gaussian}/__init__.py +0 -0
- {dpdata-0.2.18/dpdata/lammps → dpdata-0.2.19/dpdata/gromacs}/__init__.py +0 -0
- {dpdata-0.2.18/dpdata/md → dpdata-0.2.19/dpdata/lammps}/__init__.py +0 -0
- {dpdata-0.2.18/dpdata/openmx → dpdata-0.2.19/dpdata/md}/__init__.py +0 -0
- {dpdata-0.2.18/dpdata/orca → dpdata-0.2.19/dpdata/openmx}/__init__.py +0 -0
- {dpdata-0.2.18/dpdata/psi4 → dpdata-0.2.19/dpdata/orca}/__init__.py +0 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata/periodic_table.json +0 -0
- {dpdata-0.2.18/dpdata/pwmat → dpdata-0.2.19/dpdata/psi4}/__init__.py +0 -0
- {dpdata-0.2.18/dpdata/pymatgen → dpdata-0.2.19/dpdata/pwmat}/__init__.py +0 -0
- /dpdata-0.2.18/dpdata/qe/__init__.py → /dpdata-0.2.19/dpdata/py.typed +0 -0
- {dpdata-0.2.18/dpdata/rdkit → dpdata-0.2.19/dpdata/pymatgen}/__init__.py +0 -0
- {dpdata-0.2.18/dpdata/siesta → dpdata-0.2.19/dpdata/qe}/__init__.py +0 -0
- {dpdata-0.2.18/dpdata/vasp → dpdata-0.2.19/dpdata/rdkit}/__init__.py +0 -0
- {dpdata-0.2.18/dpdata/xyz → dpdata-0.2.19/dpdata/siesta}/__init__.py +0 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata.egg-info/dependency_links.txt +0 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata.egg-info/entry_points.txt +0 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/dpdata.egg-info/top_level.txt +0 -0
- {dpdata-0.2.18 → dpdata-0.2.19}/setup.cfg +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.git_archival.txt export-subst
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: Python package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
- push
|
|
5
|
+
- pull_request
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
- name: Set up Python
|
|
13
|
+
uses: actions/setup-python@v5
|
|
14
|
+
with:
|
|
15
|
+
python-version: 3.12
|
|
16
|
+
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
17
|
+
- name: Install dependencies
|
|
18
|
+
run: uv pip install --system .[amber,ase,pymatgen,benchmark] rdkit openbabel-wheel
|
|
19
|
+
- name: Run benchmarks
|
|
20
|
+
uses: CodSpeedHQ/action@v2
|
|
21
|
+
with:
|
|
22
|
+
token: ${{ secrets.CODSPEED_TOKEN }}
|
|
23
|
+
run: pytest benchmark/ --codspeed
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
on:
|
|
2
|
+
- push
|
|
3
|
+
- pull_request
|
|
4
|
+
|
|
5
|
+
name: Type checker
|
|
6
|
+
jobs:
|
|
7
|
+
pyright:
|
|
8
|
+
name: pyright
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@master
|
|
12
|
+
- uses: actions/setup-python@v5
|
|
13
|
+
with:
|
|
14
|
+
python-version: '3.12'
|
|
15
|
+
- run: pip install uv
|
|
16
|
+
- run: uv pip install --system -e .[amber,ase,pymatgen] rdkit openbabel-wheel
|
|
17
|
+
- uses: jakebailey/pyright-action@v2
|
|
18
|
+
with:
|
|
19
|
+
version: 1.1.363
|
|
@@ -12,17 +12,15 @@ jobs:
|
|
|
12
12
|
python-version: ["3.7", "3.8", "3.12"]
|
|
13
13
|
|
|
14
14
|
steps:
|
|
15
|
-
- uses: actions/checkout@
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
16
|
# set up conda
|
|
17
17
|
- name: Set up Python ${{ matrix.python-version }}
|
|
18
|
-
uses: actions/setup-python@
|
|
18
|
+
uses: actions/setup-python@v5
|
|
19
19
|
with:
|
|
20
20
|
python-version: ${{ matrix.python-version }}
|
|
21
|
-
|
|
22
|
-
- name: Install rdkit
|
|
23
|
-
run: python -m pip install rdkit openbabel-wheel
|
|
21
|
+
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
24
22
|
- name: Install dependencies
|
|
25
|
-
run:
|
|
23
|
+
run: uv pip install --system .[amber,ase,pymatgen] coverage ./tests/plugin rdkit openbabel-wheel
|
|
26
24
|
- name: Test
|
|
27
25
|
run: cd tests && coverage run --source=../dpdata -m unittest && cd .. && coverage combine tests/.coverage && coverage report
|
|
28
26
|
- name: Run codecov
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
name: test Python import
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
- push
|
|
5
|
-
- pull_request
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
build:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
steps:
|
|
11
|
-
- uses: actions/checkout@
|
|
12
|
-
- uses: actions/setup-python@
|
|
13
|
-
with:
|
|
14
|
-
python-version: '3.9'
|
|
15
|
-
architecture: 'x64'
|
|
16
|
-
- run: python -m pip install
|
|
17
|
-
- run: python -
|
|
1
|
+
name: test Python import
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
- push
|
|
5
|
+
- pull_request
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
- uses: actions/setup-python@v5
|
|
13
|
+
with:
|
|
14
|
+
python-version: '3.9'
|
|
15
|
+
architecture: 'x64'
|
|
16
|
+
- run: python -m pip install uv
|
|
17
|
+
- run: python -m uv pip install --system .
|
|
18
|
+
- run: python -c 'import dpdata'
|
|
@@ -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.
|
|
5
|
+
rev: v4.6.0
|
|
6
6
|
hooks:
|
|
7
7
|
# there are many log files in tests
|
|
8
8
|
# TODO: seperate py files and log files
|
|
@@ -16,10 +16,12 @@ repos:
|
|
|
16
16
|
- id: check-merge-conflict
|
|
17
17
|
- id: check-symlinks
|
|
18
18
|
- id: check-toml
|
|
19
|
+
- id: mixed-line-ending
|
|
20
|
+
args: ["--fix=lf"]
|
|
19
21
|
# Python
|
|
20
22
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
21
23
|
# Ruff version.
|
|
22
|
-
rev: v0.
|
|
24
|
+
rev: v0.4.7
|
|
23
25
|
hooks:
|
|
24
26
|
- id: ruff
|
|
25
27
|
args: ["--fix"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dpdata
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.19
|
|
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>
|
|
@@ -189,6 +189,7 @@ Requires-Dist: scipy
|
|
|
189
189
|
Requires-Dist: h5py
|
|
190
190
|
Requires-Dist: wcmatch
|
|
191
191
|
Requires-Dist: importlib_metadata>=1.4; python_version < "3.8"
|
|
192
|
+
Requires-Dist: typing_extensions; python_version < "3.8"
|
|
192
193
|
Provides-Extra: ase
|
|
193
194
|
Requires-Dist: ase; extra == "ase"
|
|
194
195
|
Provides-Extra: amber
|
|
@@ -206,7 +207,10 @@ Requires-Dist: deepmodeling-sphinx>=0.1.1; extra == "docs"
|
|
|
206
207
|
Requires-Dist: sphinx-argparse; extra == "docs"
|
|
207
208
|
Requires-Dist: rdkit; extra == "docs"
|
|
208
209
|
Requires-Dist: jupyterlite-sphinx; extra == "docs"
|
|
209
|
-
Requires-Dist: jupyterlite-xeus
|
|
210
|
+
Requires-Dist: jupyterlite-xeus; extra == "docs"
|
|
211
|
+
Provides-Extra: benchmark
|
|
212
|
+
Requires-Dist: pytest; extra == "benchmark"
|
|
213
|
+
Requires-Dist: pytest-codspeed; extra == "benchmark"
|
|
210
214
|
|
|
211
215
|
# dpdata
|
|
212
216
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import subprocess
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
import pytest
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@pytest.mark.benchmark
|
|
10
|
+
def test_import():
|
|
11
|
+
"""Test import dpdata."""
|
|
12
|
+
subprocess.check_output(
|
|
13
|
+
[sys.executable, "-c", "'from dpdata import LabeledSystem'"]
|
|
14
|
+
).decode("ascii")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@pytest.mark.benchmark
|
|
18
|
+
def test_cli():
|
|
19
|
+
"""Test dpdata command."""
|
|
20
|
+
subprocess.check_output([sys.executable, "-m", "dpdata", "-h"]).decode("ascii")
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from . import lammps, md, vasp
|
|
4
|
+
from .bond_order_system import BondOrderSystem
|
|
5
|
+
from .system import LabeledSystem, MultiSystems, System
|
|
6
|
+
|
|
7
|
+
try:
|
|
8
|
+
from ._version import version as __version__
|
|
9
|
+
except ImportError:
|
|
10
|
+
from .__about__ import __version__
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"__version__",
|
|
14
|
+
"lammps",
|
|
15
|
+
"md",
|
|
16
|
+
"vasp",
|
|
17
|
+
"System",
|
|
18
|
+
"LabeledSystem",
|
|
19
|
+
"MultiSystems",
|
|
20
|
+
"BondOrderSystem",
|
|
21
|
+
]
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
import os
|
|
2
4
|
import warnings
|
|
3
5
|
|
|
@@ -28,7 +30,7 @@ def get_path_out(fname, inlines):
|
|
|
28
30
|
for line in inlines:
|
|
29
31
|
if len(line) > 0 and "suffix" in line and "suffix" == line.split()[0]:
|
|
30
32
|
suffix = line.split()[1]
|
|
31
|
-
path_out = os.path.join(fname, "OUT
|
|
33
|
+
path_out = os.path.join(fname, f"OUT.{suffix}/")
|
|
32
34
|
break
|
|
33
35
|
return path_out
|
|
34
36
|
|
|
@@ -189,7 +191,7 @@ def get_frame(fname):
|
|
|
189
191
|
unconv_stru += "%d " % i
|
|
190
192
|
ndump = len(energy)
|
|
191
193
|
if unconv_stru != "":
|
|
192
|
-
warnings.warn("Structure
|
|
194
|
+
warnings.warn(f"Structure {unconv_stru} are unconverged and not collected!")
|
|
193
195
|
|
|
194
196
|
for iframe in range(ndump):
|
|
195
197
|
stress[iframe] *= np.linalg.det(cells[iframe, :, :].reshape([3, 3]))
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
import os
|
|
2
4
|
|
|
3
5
|
import numpy as np
|
|
@@ -183,7 +185,7 @@ def get_frame(fname):
|
|
|
183
185
|
)
|
|
184
186
|
|
|
185
187
|
logf = get_log_file(fname, inlines)
|
|
186
|
-
assert os.path.isfile(logf), "Error: can not find
|
|
188
|
+
assert os.path.isfile(logf), f"Error: can not find {logf}"
|
|
187
189
|
with open(logf) as f1:
|
|
188
190
|
lines = f1.readlines()
|
|
189
191
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
import os
|
|
2
4
|
import re
|
|
3
5
|
import warnings
|
|
@@ -23,7 +25,7 @@ ABACUS_STRU_KEYS = [
|
|
|
23
25
|
|
|
24
26
|
def CheckFile(ifile):
|
|
25
27
|
if not os.path.isfile(ifile):
|
|
26
|
-
print("Can not find file
|
|
28
|
+
print(f"Can not find file {ifile}")
|
|
27
29
|
return False
|
|
28
30
|
return True
|
|
29
31
|
|
|
@@ -38,10 +40,10 @@ def get_block(lines, keyword, skip=0, nlines=None):
|
|
|
38
40
|
found = True
|
|
39
41
|
blk_idx = idx + 1 + skip
|
|
40
42
|
line_idx = 0
|
|
41
|
-
while len(re.split("\s+", lines[blk_idx])) == 0:
|
|
43
|
+
while len(re.split(r"\s+", lines[blk_idx])) == 0:
|
|
42
44
|
blk_idx += 1
|
|
43
45
|
while line_idx < nlines and blk_idx != len(lines):
|
|
44
|
-
if len(re.split("\s+", lines[blk_idx])) == 0 or lines[blk_idx] == "":
|
|
46
|
+
if len(re.split(r"\s+", lines[blk_idx])) == 0 or lines[blk_idx] == "":
|
|
45
47
|
blk_idx += 1
|
|
46
48
|
continue
|
|
47
49
|
ret.append(lines[blk_idx])
|
|
@@ -91,7 +93,7 @@ def get_path_out(fname, inlines):
|
|
|
91
93
|
for line in inlines:
|
|
92
94
|
if "suffix" in line and "suffix" == line.split()[0]:
|
|
93
95
|
suffix = line.split()[1]
|
|
94
|
-
path_out = os.path.join(fname, "OUT
|
|
96
|
+
path_out = os.path.join(fname, f"OUT.{suffix}/running_scf.log")
|
|
95
97
|
break
|
|
96
98
|
return path_out
|
|
97
99
|
|
|
@@ -131,7 +133,7 @@ def get_coords(celldm, cell, geometry_inlines, inlines=None):
|
|
|
131
133
|
tmp = np.matmul(xyz, cell)
|
|
132
134
|
xyz = tmp
|
|
133
135
|
else:
|
|
134
|
-
print("coord_type =
|
|
136
|
+
print(f"coord_type = {coord_type}")
|
|
135
137
|
raise RuntimeError(
|
|
136
138
|
"Input coordination type is invalid.\n Only direct and cartesian are accepted."
|
|
137
139
|
)
|
|
@@ -329,7 +331,7 @@ def get_nele_from_stru(geometry_inlines):
|
|
|
329
331
|
for iline in range(
|
|
330
332
|
keyword_line_index[idx] + 1, keyword_line_index[idx + 1]
|
|
331
333
|
):
|
|
332
|
-
if len(re.split("\s+", geometry_inlines[iline])) >= 3:
|
|
334
|
+
if len(re.split(r"\s+", geometry_inlines[iline])) >= 3:
|
|
333
335
|
nele += 1
|
|
334
336
|
return nele
|
|
335
337
|
|
|
@@ -367,11 +369,11 @@ def make_unlabeled_stru(
|
|
|
367
369
|
for iele in range(len(data["atom_names"])):
|
|
368
370
|
out += data["atom_names"][iele] + " "
|
|
369
371
|
if mass is not None:
|
|
370
|
-
out += "
|
|
372
|
+
out += f"{mass[iele]:.3f} "
|
|
371
373
|
else:
|
|
372
374
|
out += "1 "
|
|
373
375
|
if pp_file is not None:
|
|
374
|
-
out += "
|
|
376
|
+
out += f"{pp_file[iele]}\n"
|
|
375
377
|
else:
|
|
376
378
|
out += "\n"
|
|
377
379
|
out += "\n"
|
|
@@ -380,12 +382,12 @@ def make_unlabeled_stru(
|
|
|
380
382
|
assert len(numerical_orbital) == len(data["atom_names"])
|
|
381
383
|
out += "NUMERICAL_ORBITAL\n"
|
|
382
384
|
for iele in range(len(numerical_orbital)):
|
|
383
|
-
out += "
|
|
385
|
+
out += f"{numerical_orbital[iele]}\n"
|
|
384
386
|
out += "\n"
|
|
385
387
|
|
|
386
388
|
if numerical_descriptor is not None:
|
|
387
389
|
assert isinstance(numerical_descriptor, str)
|
|
388
|
-
out += "NUMERICAL_DESCRIPTOR\n
|
|
390
|
+
out += f"NUMERICAL_DESCRIPTOR\n{numerical_descriptor}\n"
|
|
389
391
|
out += "\n"
|
|
390
392
|
|
|
391
393
|
out += "LATTICE_CONSTANT\n"
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
import os
|
|
2
4
|
import re
|
|
3
5
|
|
|
4
6
|
import numpy as np
|
|
5
|
-
from scipy.io import netcdf_file
|
|
6
7
|
|
|
7
8
|
from dpdata.amber.mask import pick_by_amber_mask
|
|
8
9
|
from dpdata.unit import EnergyConversion
|
|
@@ -44,6 +45,8 @@ def read_amber_traj(
|
|
|
44
45
|
labeled : bool
|
|
45
46
|
Whether to return labeled data
|
|
46
47
|
"""
|
|
48
|
+
from scipy.io import netcdf_file
|
|
49
|
+
|
|
47
50
|
flag_atom_type = False
|
|
48
51
|
flag_atom_numb = False
|
|
49
52
|
amber_types = []
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
from
|
|
1
|
+
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
|
|
5
|
+
from ase.calculators.calculator import ( # noqa: TID253
|
|
4
6
|
Calculator,
|
|
5
7
|
PropertyNotImplementedError,
|
|
6
8
|
all_changes,
|
|
@@ -23,7 +25,10 @@ class DPDataCalculator(Calculator):
|
|
|
23
25
|
dpdata driver
|
|
24
26
|
"""
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
@property
|
|
29
|
+
def name(self) -> str:
|
|
30
|
+
return "dpdata"
|
|
31
|
+
|
|
27
32
|
implemented_properties = ["energy", "free_energy", "forces", "virial", "stress"]
|
|
28
33
|
|
|
29
34
|
def __init__(self, driver: Driver, **kwargs) -> None:
|
|
@@ -32,9 +37,9 @@ class DPDataCalculator(Calculator):
|
|
|
32
37
|
|
|
33
38
|
def calculate(
|
|
34
39
|
self,
|
|
35
|
-
atoms:
|
|
36
|
-
properties:
|
|
37
|
-
system_changes:
|
|
40
|
+
atoms: Atoms | None = None,
|
|
41
|
+
properties: list[str] = ["energy", "forces"],
|
|
42
|
+
system_changes: list[str] = all_changes,
|
|
38
43
|
):
|
|
39
44
|
"""Run calculation with a driver.
|
|
40
45
|
|
|
@@ -48,10 +53,10 @@ class DPDataCalculator(Calculator):
|
|
|
48
53
|
system_changes : List[str], optional
|
|
49
54
|
unused, only for function signature compatibility, by default all_changes
|
|
50
55
|
"""
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
assert atoms is not None
|
|
57
|
+
atoms = atoms.copy()
|
|
53
58
|
|
|
54
|
-
system = dpdata.System(
|
|
59
|
+
system = dpdata.System(atoms, fmt="ase/structure")
|
|
55
60
|
data = system.predict(driver=self.driver).data
|
|
56
61
|
|
|
57
62
|
self.results["energy"] = data["energies"][0]
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# %%
|
|
2
2
|
# Bond Order System
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
3
5
|
from copy import deepcopy
|
|
4
6
|
|
|
5
7
|
import numpy as np
|
|
6
|
-
from rdkit.Chem import Conformer
|
|
7
8
|
|
|
8
9
|
import dpdata.rdkit.utils
|
|
9
10
|
from dpdata.rdkit.sanitize import Sanitizer
|
|
@@ -97,11 +98,14 @@ class BondOrderSystem(System):
|
|
|
97
98
|
mol = fmtobj.from_bond_order_system(file_name, **kwargs)
|
|
98
99
|
self.from_rdkit_mol(mol)
|
|
99
100
|
if hasattr(fmtobj.from_bond_order_system, "post_func"):
|
|
100
|
-
for post_f in fmtobj.from_bond_order_system.post_func:
|
|
101
|
+
for post_f in fmtobj.from_bond_order_system.post_func: # type: ignore
|
|
101
102
|
self.post_funcs.get_plugin(post_f)(self)
|
|
102
103
|
return self
|
|
103
104
|
|
|
104
105
|
def to_fmt_obj(self, fmtobj, *args, **kwargs):
|
|
106
|
+
from rdkit.Chem import Conformer
|
|
107
|
+
|
|
108
|
+
assert self.rdkit_mol is not None
|
|
105
109
|
self.rdkit_mol.RemoveAllConformers()
|
|
106
110
|
for ii in range(self.get_nframes()):
|
|
107
111
|
conf = Conformer()
|
|
@@ -144,9 +148,9 @@ class BondOrderSystem(System):
|
|
|
144
148
|
"""Return the formal charges on each atom."""
|
|
145
149
|
return self.data["formal_charges"]
|
|
146
150
|
|
|
147
|
-
def copy(self):
|
|
151
|
+
def copy(self): # type: ignore
|
|
148
152
|
new_mol = deepcopy(self.rdkit_mol)
|
|
149
|
-
self.__class__(data=deepcopy(self.data), rdkit_mol=new_mol)
|
|
153
|
+
return self.__class__(data=deepcopy(self.data), rdkit_mol=new_mol)
|
|
150
154
|
|
|
151
155
|
def __add__(self, other):
|
|
152
156
|
raise NotImplementedError(
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"""Command line interface for dpdata."""
|
|
2
2
|
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
3
5
|
import argparse
|
|
4
|
-
from typing import Optional
|
|
5
6
|
|
|
6
7
|
from . import __version__
|
|
7
8
|
from .system import LabeledSystem, MultiSystems, System
|
|
@@ -37,9 +38,7 @@ def dpdata_parser() -> argparse.ArgumentParser:
|
|
|
37
38
|
)
|
|
38
39
|
parser.add_argument("--type-map", "-t", type=str, nargs="+", help="type map")
|
|
39
40
|
|
|
40
|
-
parser.add_argument(
|
|
41
|
-
"--version", action="version", version="dpdata v%s" % __version__
|
|
42
|
-
)
|
|
41
|
+
parser.add_argument("--version", action="version", version=f"dpdata v{__version__}")
|
|
43
42
|
return parser
|
|
44
43
|
|
|
45
44
|
|
|
@@ -61,11 +60,11 @@ def convert(
|
|
|
61
60
|
*,
|
|
62
61
|
from_file: str,
|
|
63
62
|
from_format: str = "auto",
|
|
64
|
-
to_file:
|
|
65
|
-
to_format:
|
|
63
|
+
to_file: str | None = None,
|
|
64
|
+
to_format: str | None = None,
|
|
66
65
|
no_labeled: bool = False,
|
|
67
66
|
multi: bool = False,
|
|
68
|
-
type_map:
|
|
67
|
+
type_map: list | None = None,
|
|
69
68
|
**kwargs,
|
|
70
69
|
):
|
|
71
70
|
"""Convert files from one format to another one.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
from enum import Enum, unique
|
|
2
|
-
from typing import TYPE_CHECKING
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
3
5
|
|
|
4
6
|
import numpy as np
|
|
5
7
|
|
|
@@ -50,7 +52,7 @@ class DataType:
|
|
|
50
52
|
self,
|
|
51
53
|
name: str,
|
|
52
54
|
dtype: type,
|
|
53
|
-
shape:
|
|
55
|
+
shape: tuple[int | Axis, ...] | None = None,
|
|
54
56
|
required: bool = True,
|
|
55
57
|
) -> None:
|
|
56
58
|
self.name = name
|
|
@@ -58,8 +60,9 @@ class DataType:
|
|
|
58
60
|
self.shape = shape
|
|
59
61
|
self.required = required
|
|
60
62
|
|
|
61
|
-
def real_shape(self, system:
|
|
63
|
+
def real_shape(self, system: System) -> tuple[int]:
|
|
62
64
|
"""Returns expected real shape of a system."""
|
|
65
|
+
assert self.shape is not None
|
|
63
66
|
shape = []
|
|
64
67
|
for ii in self.shape:
|
|
65
68
|
if ii is Axis.NFRAMES:
|
|
@@ -70,7 +73,7 @@ class DataType:
|
|
|
70
73
|
shape.append(system.get_natoms())
|
|
71
74
|
elif ii is Axis.NBONDS:
|
|
72
75
|
# BondOrderSystem
|
|
73
|
-
shape.append(system.get_nbonds())
|
|
76
|
+
shape.append(system.get_nbonds()) # type: ignore
|
|
74
77
|
elif ii == -1:
|
|
75
78
|
shape.append(AnyInt(-1))
|
|
76
79
|
elif isinstance(ii, int):
|
|
@@ -79,7 +82,7 @@ class DataType:
|
|
|
79
82
|
raise RuntimeError("Shape is not an int!")
|
|
80
83
|
return tuple(shape)
|
|
81
84
|
|
|
82
|
-
def check(self, system:
|
|
85
|
+
def check(self, system: System):
|
|
83
86
|
"""Check if a system has correct data of this type.
|
|
84
87
|
|
|
85
88
|
Parameters
|
|
@@ -121,7 +124,7 @@ class DataType:
|
|
|
121
124
|
else:
|
|
122
125
|
raise RuntimeError("Unsupported type to check shape")
|
|
123
126
|
elif self.required:
|
|
124
|
-
raise DataError("
|
|
127
|
+
raise DataError(f"{self.name} not found in data")
|
|
125
128
|
|
|
126
129
|
|
|
127
130
|
__system_data_type_plugin = Plugin()
|
|
@@ -3,16 +3,15 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import warnings
|
|
6
|
+
from typing import TYPE_CHECKING
|
|
6
7
|
|
|
7
|
-
try:
|
|
8
|
-
import h5py
|
|
9
|
-
except ImportError:
|
|
10
|
-
pass
|
|
11
8
|
import numpy as np
|
|
12
|
-
from wcmatch.glob import globfilter
|
|
13
9
|
|
|
14
10
|
import dpdata
|
|
15
11
|
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
import h5py
|
|
14
|
+
|
|
16
15
|
__all__ = ["to_system_data", "dump"]
|
|
17
16
|
|
|
18
17
|
|
|
@@ -35,6 +34,8 @@ def to_system_data(
|
|
|
35
34
|
labels : bool
|
|
36
35
|
labels
|
|
37
36
|
"""
|
|
37
|
+
from wcmatch.glob import globfilter
|
|
38
|
+
|
|
38
39
|
g = f[folder] if folder else f
|
|
39
40
|
|
|
40
41
|
data = {}
|
|
@@ -139,7 +140,7 @@ def to_system_data(
|
|
|
139
140
|
|
|
140
141
|
for ii in sets:
|
|
141
142
|
set = g[ii]
|
|
142
|
-
fn = "
|
|
143
|
+
fn = "{}.npy".format(prop["fn"])
|
|
143
144
|
if fn in set.keys():
|
|
144
145
|
dd = set[fn][:]
|
|
145
146
|
nframes = dd.shape[0]
|
|
@@ -257,7 +258,7 @@ def dump(
|
|
|
257
258
|
for dt, prop in data_types.items():
|
|
258
259
|
if dt in reshaped_data:
|
|
259
260
|
set_folder.create_dataset(
|
|
260
|
-
"
|
|
261
|
+
"{}.npy".format(prop["fn"]), data=reshaped_data[dt][set_stt:set_end]
|
|
261
262
|
)
|
|
262
263
|
|
|
263
264
|
if nopbc:
|
|
File without changes
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
from
|
|
1
|
+
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
def read_dftb_plus(fn_1: str, fn_2: str) ->
|
|
6
|
+
def read_dftb_plus(fn_1: str, fn_2: str) -> tuple[str, np.ndarray, float, np.ndarray]:
|
|
7
7
|
"""Read from DFTB+ input and output.
|
|
8
8
|
|
|
9
9
|
Parameters
|