Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge devel to master to release v0.2.22 #786

Merged
merged 37 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
395328a
merge master to devel (v0.2.21) (#730)
njzjz Sep 20, 2024
b797acb
[pre-commit.ci] pre-commit autoupdate (#731)
pre-commit-ci[bot] Sep 24, 2024
a6ced9f
abacus: add checks on pp and orb in construction of STRU (#737)
pxlxingliang Oct 15, 2024
373e0d7
fix(rtd): pin python to `<3.13` and mamba to `<2` (#735)
njzjz Oct 15, 2024
dccab68
chore(ci): use astral-sh/setup-uv action (#734)
njzjz-bot Oct 15, 2024
74bfccc
[pre-commit.ci] pre-commit autoupdate (#733)
pre-commit-ci[bot] Oct 17, 2024
d1f1b98
[pre-commit.ci] pre-commit autoupdate (#741)
pre-commit-ci[bot] Oct 22, 2024
cdbbe1b
fix: change `project.entry-points.console_scripts` to `project.script…
njzjz Oct 23, 2024
7853b7b
add spin for lammps (#738)
pxlxingliang Oct 23, 2024
b908c2b
docs: replace sphinx-rtd-theme with sphinx-book-theme (#745)
njzjz-bot Oct 29, 2024
fba50f1
[pre-commit.ci] pre-commit autoupdate (#746)
pre-commit-ci[bot] Oct 29, 2024
d0a7868
Add support for converting move flags between Abacus and VASP (#744)
Angel-Jia Oct 29, 2024
b9b0778
ci: test against numpy v2 (#695)
njzjz Oct 31, 2024
01a03b3
[pre-commit.ci] pre-commit autoupdate (#749)
pre-commit-ci[bot] Nov 5, 2024
32f832b
support spin for deepmd format (#750)
pxlxingliang Nov 6, 2024
7c9be86
add spin for abacus/stru (#751)
pxlxingliang Nov 7, 2024
6a05f3b
Adjust pp_file as an unnessary parameter in save to abacus/stru (#752)
pxlxingliang Nov 8, 2024
e5e9414
[pre-commit.ci] pre-commit autoupdate (#753)
pre-commit-ci[bot] Nov 13, 2024
7aa3bae
[pre-commit.ci] pre-commit autoupdate (#754)
pre-commit-ci[bot] Nov 19, 2024
5916b4f
chore(deps): bump codecov/codecov-action from 4 to 5 (#755)
dependabot[bot] Nov 20, 2024
5cb41f8
abacus: fix bug in reading nspin2 results (#758)
pxlxingliang Nov 26, 2024
467ffbd
chore(deps): bump astral-sh/setup-uv from 3 to 4 (#760)
dependabot[bot] Nov 26, 2024
5423efe
Fix: ignore UP031 (#762)
wanghan-iapcm Dec 4, 2024
a496b6f
Fix: pyright error: Type "floating[Any]" is not assignable to return …
wanghan-iapcm Dec 23, 2024
7f5f030
chore(deps): bump astral-sh/setup-uv from 4 to 5 (#767)
dependabot[bot] Dec 23, 2024
25e7e4b
[pre-commit.ci] pre-commit autoupdate (#759)
pre-commit-ci[bot] Dec 24, 2024
799044b
fix: pin scipy constants to version 2018 (#775)
wanghan-iapcm Jan 12, 2025
18ba98d
fix: doc dpgen->dpdata (#776)
wanghan-iapcm Jan 12, 2025
07c688e
[pre-commit.ci] pre-commit autoupdate (#770)
pre-commit-ci[bot] Jan 13, 2025
2905792
breaking: change internal prec of quip/gap/xyz to float64 (#777)
wanghan-iapcm Jan 13, 2025
46251a7
Feat: set force label optional (#772)
anyangml Jan 13, 2025
b826633
[pre-commit.ci] pre-commit autoupdate (#779)
pre-commit-ci[bot] Jan 14, 2025
4e5ab18
fix: add optional force check (#780)
anyangml Jan 16, 2025
961b591
breaking: drop python 3.7 (#783)
wanghan-iapcm Jan 17, 2025
5ebe959
fix: 781 pymatgen structure bug (#782)
wanghan-iapcm Jan 17, 2025
50da1c9
[pre-commit.ci] pre-commit autoupdate (#784)
pre-commit-ci[bot] Jan 21, 2025
8ef2646
docs: bump minimal dpdata version to 3.8 in README (#785)
njzjz Jan 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: 3.12
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: |
**/requirements*.txt
**/pyproject.toml
- name: Install dependencies
run: uv pip install --system .[test,amber,ase,pymatgen,benchmark] rdkit openbabel-wheel
- name: Run benchmarks
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ["3.7", "3.8", "3.12"]
python-version: ["3.8", "3.12"]

steps:
- uses: actions/checkout@v4
Expand All @@ -18,13 +18,19 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: |
**/requirements*.txt
**/pyproject.toml
cache-suffix: "py${{ matrix.python-version }}"
- name: Install dependencies
run: uv pip install --system .[test,amber,ase,pymatgen] coverage ./tests/plugin rdkit openbabel-wheel
- name: Test
run: cd tests && coverage run --source=../dpdata -m unittest && cd .. && coverage combine tests/.coverage && coverage report
- name: Run codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
pass:
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
# there are many log files in tests
# TODO: seperate py files and log files
Expand All @@ -21,7 +21,7 @@ repos:
# Python
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.6.5
rev: v0.9.2
hooks:
- id: ruff
args: ["--fix"]
Expand All @@ -36,7 +36,7 @@ repos:
args: ["--write"]
# Python inside docs
- repo: https://github.com/asottile/blacken-docs
rev: 1.18.0
rev: 1.19.1
hooks:
- id: blacken-docs
ci:
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "mambaforge-22.9"
python: "mambaforge-23.11"
conda:
environment: docs/rtd_environment.yml
sphinx:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

## Installation

DP-GEN only supports Python 3.7 and above. You can [setup a conda/pip environment](https://docs.deepmodeling.com/faq/conda.html), and then use one of the following methods to install DP-GEN:
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:

- Install via pip: `pip install dpdata`
- Install via conda: `conda install -c conda-forge dpdata`
Expand Down
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# -- Project information -----------------------------------------------------

project = "dpdata"
copyright = "2019-%d, DeepModeling " % date.today().year
copyright = "2019-%d, DeepModeling " % date.today().year # noqa: UP031
author = "Han Wang"

# The short X.Y version
Expand All @@ -44,7 +44,7 @@
# ones.
extensions = [
"deepmodeling_sphinx",
"sphinx_rtd_theme",
"sphinx_book_theme",
"sphinx.ext.mathjax",
"sphinx.ext.viewcode",
"sphinx.ext.intersphinx",
Expand Down Expand Up @@ -87,7 +87,7 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
html_theme = "sphinx_book_theme"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Installation

DP-GEN only supports Python 3.7 and above. You can [setup a conda/pip environment](https://docs.deepmodeling.com/faq/conda.html), and then use one of the following methods to install DP-GEN:
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:

- Install via pip: `pip install dpdata`
- Install via conda: `conda install -c conda-forge dpdata`
Expand Down
7 changes: 1 addition & 6 deletions docs/make_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@

import csv
import os
import sys
from collections import defaultdict
from inspect import Parameter, Signature, cleandoc, signature

if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from typing import Literal

from numpydoc.docscrape import Parameter as numpydoc_Parameter
from numpydoc.docscrape_sphinx import SphinxDocString
Expand Down
3 changes: 2 additions & 1 deletion docs/rtd_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: dpdata
channels:
- conda-forge
dependencies:
- mamba
- python <3.13
- mamba <2
Comment on lines +5 to +6
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Consider updating mamba version constraint

The current constraint mamba <2 is too restrictive as Mamba 2.x is now stable and widely available. Consider using mamba <3 or mamba >=1.5.0,<3 to ensure access to the latest stable features and fixes.

🔗 Analysis chain

LGTM! Version constraints look appropriate.

The version constraints are well-chosen:

  • Python <3.13 prevents future compatibility issues
  • mamba <2 prevents potential breaking changes in the documentation build

Run this script to verify the mamba version compatibility:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check mamba version compatibility
# Verify if mamba <2 is available in conda-forge

curl -s https://api.anaconda.org/package/conda-forge/mamba | jq -r '.versions[]' | sort -V

Length of output: 1102

- pip:
- ..[docs]
20 changes: 11 additions & 9 deletions dpdata/abacus/md.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ def get_coords_from_dump(dumplines, natoms):
if "VIRIAL" in dumplines[6]:
calc_stress = True
check_line = 10
assert (
"POSITION" in dumplines[check_line]
), "keywords 'POSITION' cannot be found in the 6th line. Please check."
assert "POSITION" in dumplines[check_line], (
"keywords 'POSITION' cannot be found in the 6th line. Please check."
)
if "FORCE" in dumplines[check_line]:
calc_force = True

Expand All @@ -68,7 +68,7 @@ def get_coords_from_dump(dumplines, natoms):
else:
nframes_dump = int(nlines / (total_natoms + 9))
assert nframes_dump > 0, (
"Number of lines in MD_dump file = %d. Number of atoms = %d. The MD_dump file is incomplete."
"Number of lines in MD_dump file = %d. Number of atoms = %d. The MD_dump file is incomplete." # noqa: UP031
% (nlines, total_natoms)
)
cells = np.zeros([nframes_dump, 3, 3])
Expand Down Expand Up @@ -125,7 +125,7 @@ def get_coords_from_dump(dumplines, natoms):
)
iframe += 1
assert iframe == nframes_dump, (
"iframe=%d, nframe_dump=%d. Number of frames does not match number of lines in MD_dump."
"iframe=%d, nframe_dump=%d. Number of frames does not match number of lines in MD_dump." # noqa: UP031
% (iframe, nframes_dump)
)
stresses *= kbar2evperang3
Expand All @@ -145,7 +145,7 @@ def get_energy(outlines, ndump, dump_freq):
energy.append(np.nan)
nenergy += 1
assert ndump == len(energy), (
"Number of total energies in running_md.log = %d. Number of frames in MD_dump = %d. Please check."
"Number of total energies in running_md.log = %d. Number of frames in MD_dump = %d. Please check." # noqa: UP031
% (len(energy), ndump)
)
energy = np.array(energy)
Expand All @@ -167,7 +167,7 @@ def get_frame(fname):
with open_file(geometry_path_in) as fp:
geometry_inlines = fp.read().split("\n")
celldm, cell = get_cell(geometry_inlines)
atom_names, natoms, types, coords = get_coords(
atom_names, natoms, types, coords, move, magmom = get_coords(
celldm, cell, geometry_inlines, inlines
)
# This coords is not to be used.
Expand All @@ -191,7 +191,7 @@ def get_frame(fname):
force = np.delete(force, i - ndump, axis=0)
stress = np.delete(stress, i - ndump, axis=0)
energy = np.delete(energy, i - ndump, axis=0)
unconv_stru += "%d " % i
unconv_stru += "%d " % i # noqa: UP031
ndump = len(energy)
if unconv_stru != "":
warnings.warn(f"Structure {unconv_stru} are unconverged and not collected!")
Expand Down Expand Up @@ -220,6 +220,8 @@ def get_frame(fname):
if len(magmom) > 0:
data["spins"] = magmom
if len(magforce) > 0:
data["mag_forces"] = magforce
data["force_mags"] = magforce
if len(move) > 0:
data["move"] = move

return data
10 changes: 6 additions & 4 deletions dpdata/abacus/relax.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get_coords_from_log(loglines, natoms):
natoms_log += int(line.split()[-1])

assert natoms_log > 0 and natoms_log == natoms, (
"ERROR: detected atom number in log file is %d" % natoms
"ERROR: detected atom number in log file is %d" % natoms # noqa: UP031
)

energy = []
Expand Down Expand Up @@ -76,7 +76,7 @@ def get_coords_from_log(loglines, natoms):
list(map(lambda x: float(x) * a0, loglines[i + k].split()[1:4]))
)
else:
assert False, "Unrecongnized coordinate type, %s, line:%d" % (
assert False, "Unrecongnized coordinate type, %s, line:%d" % ( # noqa: UP031
loglines[i].split()[0],
i,
)
Comment on lines +79 to 82
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Replace assert False with raise AssertionError.

The use of assert False is discouraged as assertions can be disabled with Python's -O flag. Replace with an explicit exception raise.

-                assert False, "Unrecongnized coordinate type, %s, line:%d" % (  # noqa: UP031
-                    loglines[i].split()[0],
-                    i,
-                )
+                raise AssertionError(
+                    "Unrecongnized coordinate type, %s, line:%d"
+                    % (loglines[i].split()[0], i)
+                )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
assert False, "Unrecongnized coordinate type, %s, line:%d" % ( # noqa: UP031
loglines[i].split()[0],
i,
)
raise AssertionError(
"Unrecongnized coordinate type, %s, line:%d"
% (loglines[i].split()[0], i)
)
🧰 Tools
🪛 Ruff (0.8.2)

79-79: Do not assert False (python -O removes these calls), raise AssertionError()

Replace assert False

(B011)

Expand Down Expand Up @@ -183,7 +183,7 @@ def get_frame(fname):
with open_file(geometry_path_in) as fp:
geometry_inlines = fp.read().split("\n")
celldm, cell = get_cell(geometry_inlines)
atom_names, natoms, types, coord_tmp = get_coords(
atom_names, natoms, types, coord_tmp, move, magmom = get_coords(
celldm, cell, geometry_inlines, inlines
)

Expand Down Expand Up @@ -217,6 +217,8 @@ def get_frame(fname):
if len(magmom) > 0:
data["spins"] = magmom
if len(magforce) > 0:
data["mag_forces"] = magforce
data["force_mags"] = magforce
if len(move) > 0:
data["move"] = move

return data
Loading
Loading