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.13.1 #1721

Merged
merged 13 commits into from
Feb 21, 2025
Merged

Conversation

njzjz
Copy link
Member

@njzjz njzjz commented Feb 21, 2025

Summary by CodeRabbit

  • Chores / Style Enhancements

    • Improved internal code quality by standardizing style and suppressing routine linting warnings.
  • Dependency Update

    • Upgraded a key dependency to ensure better performance and future compatibility.
  • Compatibility Improvements

    • Expanded support for newer external toolkit versions, enhancing overall stability.
  • Test & Documentation Refinements

    • Made minor adjustments in tests and documentation strings to improve clarity without affecting functionality.

njzjz and others added 13 commits November 23, 2024 06:20
<!--pre-commit.ci start-->
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.8.1 →
v0.8.2](astral-sh/ruff-pre-commit@v0.8.1...v0.8.2)
<!--pre-commit.ci end-->

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
<!--pre-commit.ci start-->
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.8.2 →
v0.8.3](astral-sh/ruff-pre-commit@v0.8.2...v0.8.3)
<!--pre-commit.ci end-->

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Fix deepmodeling#1688. Though I am not sure whether we should have an upper version.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
	- Enhanced support for `deepmd` library versions 1.x to 3.x.
- Improved handling of model deviation tasks with refined logic for
training conditions.
- Updated file management for better input/output file linking across
tasks.

- **Bug Fixes**
	- Clarified error messages for unsupported library versions.

- **Documentation**
- Updated documentation strings for argument compatibility and function
behavior.

- **Refactor**
- Adjusted function signatures to accommodate new parameters and
improved logic.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
<!--pre-commit.ci start-->
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.8.3 →
v0.8.4](astral-sh/ruff-pre-commit@v0.8.3...v0.8.4)
<!--pre-commit.ci end-->

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
xref:
materialsproject/pymatgen#4243 (comment)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Chores**
- Updated GitHub Actions workflow configuration with a minor environment
variable adjustment to support testing processes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Reverts deepmodeling#1704

See
materialsproject/pymatgen#4243 (comment)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Chores**
	- Updated GitHub Actions workflow configuration for testing.
	- Simplified test execution process in the CI pipeline.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
<!--pre-commit.ci start-->
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.8.4 →
v0.9.1](astral-sh/ruff-pre-commit@v0.8.4...v0.9.1)
<!--pre-commit.ci end-->

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
<!--pre-commit.ci start-->
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.1 →
v0.9.2](astral-sh/ruff-pre-commit@v0.9.1...v0.9.2)
<!--pre-commit.ci end-->

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Fix the bug induced by the update of dpdata.
Now the reading and writing of ABACUS STRU is by a more general
dpdata/abacus interface, and remove some redundant codes.

This commit is based on dpdata commit
deepmodeling/dpdata#793, and it is valid after
that commit is merged.

related issue:
deepmodeling#1711

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Refactor**
- Streamlined the workflow for generating atomic structure data by
removing redundant parameters and centralizing functionality.
- Improved handling of atomic data structures for more efficient
processing and organization.
- **Tests**
- Enhanced the precision of validations by refining comparisons to focus
on key attributes, ensuring more robust result accuracy.
	- Corrected the method name for improved clarity in the test suite.
- Added a new key to the test data structure for enhanced functionality
in subsequent tests.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: root <pxlxingliang>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Chores**
- Updated the minimum required version for a key dependency to ensure
access to the latest enhancements and fixes.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: root <pxlxingliang>
<!--pre-commit.ci start-->
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.2 →
v0.9.6](astral-sh/ruff-pre-commit@v0.9.2...v0.9.6)
<!--pre-commit.ci end-->

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
@njzjz njzjz merged commit 9b5fab4 into deepmodeling:master Feb 21, 2025
12 of 13 checks passed
@njzjz njzjz deleted the devel-0.13.1 branch February 21, 2025 06:05
Copy link
Contributor

coderabbitai bot commented Feb 21, 2025

📝 Walkthrough

Walkthrough

This PR updates dependency versions and enhances code style consistency by adding lint-suppression comments throughout the codebase. The pre-commit configuration is updated to use a newer version of the ruff hook, and the dpdata dependency version in the project configuration is bumped up. In addition, several functions across various modules and tests have been reformatted—for example, assertions and logging statements are condensed or renamed—to improve readability. Importantly, none of these changes alter the functional behavior of the code.

Changes

File(s) Change Summary
.pre-commit-config.yaml Updated ruff-pre-commit version from v0.7.4 to v0.9.6.
pyproject.toml Updated dependency constraint for dpdata from >=0.2.17 to >=0.2.23.
dpgen/generator/run.py Modified DeepMD-kit version check logic (upper limit changed from 3 to 4) and updated error messages; added lint comments.
dpgen/generator/lib/abacus_scf.py Revised get_abacus_STRU signature (removed extra parameters) and restructured structure parsing logic; improved assertion formatting.
Multiple files in dpgen/auto_test, dpgen/data, dpgen/generator, dpgen/tools, and tests directories Added # noqa: UP031 comments to numerous lines (e.g., import statements, print statements, string formatting, and assertions) to suppress lint warnings; included minor test renaming and improved dictionary comparisons.

Sequence Diagram(s)

sequenceDiagram
    participant Generator as DPGen Generator
    participant VersionCheck as Version Check Block
    Generator->>VersionCheck: Retrieve deepmd_version
    VersionCheck-->>Generator: Return deepmd_version
    alt Version Supported (>=1.x and <4)
       Generator->>Generator: Proceed with file generation
    else Version Unsupported
       Generator->>Generator: Raise error message for unsupported DeepMD-kit version
    end
Loading

Possibly related PRs

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (24)
dpgen/auto_test/lib/utils.py (1)

23-23: LGTM! Consider modernizing string formatting in future.

The linter suppression is consistent with the PR's objectives of improving code style consistency. While the current change is appropriate for this release, consider updating to f-strings in a future PR for better readability:

-            bk_dirname = dirname + ".bk%03d" % counter  # noqa: UP031
+            bk_dirname = f"{dirname}.bk{counter:03d}"
dpgen/generator/run.py (23)

205-205: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-            "graph.%03d%s" % (ii, suffix),  # noqa: UP031
+            f"graph.{ii:03d}{suffix}",

652-652: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-                "training_iter0_model should be provided, and the number of models should be equal to %d"  # noqa: UP031
-                % numb_models
+                f"training_iter0_model should be provided, and the number of models should be equal to {numb_models}"

1070-1070: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-        raise RuntimeError("found %d keywords %s" % (len(found), key))  # noqa: UP031
+        raise RuntimeError(f"found {len(found)} keywords {key}")

1082-1083: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-        lmp_lines[idx] = "pair_style      deepmd %s %d model_devi.out\n" % (  # noqa: UP031
-            graph_list,
-            trj_freq,
+        lmp_lines[idx] = f"pair_style      deepmd {graph_list} {trj_freq} model_devi.out\n"

-                "pair_style      deepmd %s out_freq %d out_file model_devi.out\n"  # noqa: UP031
-                % (
-                    graph_list,
-                    trj_freq,
+                f"pair_style      deepmd {graph_list} out_freq {trj_freq} out_file model_devi.out\n"

-                "pair_style      deepmd %s out_freq %d out_file model_devi.out fparam ${ELE_TEMP}\n"  # noqa: UP031
-                % (
-                    graph_list,
-                    trj_freq,
+                f"pair_style      deepmd {graph_list} out_freq {trj_freq} out_file model_devi.out fparam ${{ELE_TEMP}}\n"

Also applies to: 1089-1090, 1097-1098


1110-1111: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-            "dump            dpgen_dump all custom %d    all.lammpstrj id type x y z\n"  # noqa: UP031
-            % trj_freq
+            f"dump            dpgen_dump all custom {trj_freq}    all.lammpstrj id type x y z\n"

-            "dump            dpgen_dump all custom %d traj/*.lammpstrj id type x y z\n"  # noqa: UP031
-            % trj_freq
+            f"dump            dpgen_dump all custom {trj_freq} traj/*.lammpstrj id type x y z\n"

Also applies to: 1115-1116


1239-1239: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-                        "%s.%03d" % (_calypso_run_opt_path, temp_idx)  # noqa: UP031
+                        f"{_calypso_run_opt_path}.{temp_idx:03d}"

-                calypso_run_opt_path.append("%s.%03d" % (_calypso_run_opt_path, 0))  # noqa: UP031
+                calypso_run_opt_path.append(f"{_calypso_run_opt_path}.{0:03d}")

-                    "%s.%03d" % (_calypso_run_opt_path, temp_idx)  # noqa: UP031
+                    f"{_calypso_run_opt_path}.{temp_idx:03d}"

Also applies to: 1242-1242, 1254-1254


1408-1409: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-                "ase opt traj %s frame %d with f devi %f does not belong to either accurate, candidiate and failed "  # noqa: UP031
-                % (tt, ii, all_conf[ii][4])
+                f"ase opt traj {tt} frame {ii} with f devi {all_conf[ii][4]} does not belong to either accurate, candidiate and failed"

-                "md traj %s frame %d with f devi %f does not belong to either accurate, candidiate and failed, it should not happen"  # noqa: UP031
-                % (tt, ii, all_conf[ii][4])
+                f"md traj {tt} frame {ii} with f devi {all_conf[ii][4]} does not belong to either accurate, candidiate and failed, it should not happen"

Also applies to: 1413-1414


1435-1435: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-        "nframes (%d) in data sys %s is too small, skip" % (nframes, jj)  # noqa: UP031
+        f"nframes ({nframes}) in data sys {jj} is too small, skip"

1762-1762: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-        with open("low_level%d.mdin" % ii, "w") as f:  # noqa: UP031
+        with open(f"low_level{ii}.mdin", "w") as f:

-            open(os.path.join(work_path, "init%d.mdin" % ii), "w") as fw,  # noqa: UP031
+            open(os.path.join(work_path, f"init{ii}.mdin"), "w") as fw,

-                mdin_str = mdin_str.replace("@GRAPH_FILE%d@" % jj, mm)  # noqa: UP031
+                mdin_str = mdin_str.replace(f"@GRAPH_FILE{jj}@", mm)

Also applies to: 1902-1902, 1922-1922


1978-1979: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-                "rr should not be iterable! sys: %d rr: %s r: %s"  # noqa: UP031
-                % (sys_idx[sys_counter], str(rr), str(r))
+                f"rr should not be iterable! sys: {sys_idx[sys_counter]} rr: {str(rr)} r: {str(r)}"

2119-2119: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-            ("TASK=$(basename $(pwd)) && SYS1=${TASK:5:3} && SYS=$((10#$SYS1)) && ")
+            f"TASK=$(basename $(pwd)) && SYS1=${{TASK:5:3}} && SYS=$((10#$SYS1)) && "

2263-2264: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-            r"Not all beads generated the same number of lines in the model_devi${ibead}.out file. Check your pimd task carefully."
+            f"Not all beads generated the same number of lines in the model_devi{ibead}.out file. Check your pimd task carefully."

-                "Not all beads generated the same number of frames. Check your pimd task carefully."
+                f"Not all beads generated the same number of frames. Check your pimd task carefully."

Also applies to: 2304-2305


2314-2314: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-                        f"{frame_number + ibead * (int(last_step) + 1):d}.lammpstrj",
+                        f"{frame_number + ibead * (int(last_step) + 1)}.lammpstrj",

3083-3083: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-                fp.write("IN.PSP%d = %s\n" % (idx + 1, ii))  # noqa: UP031
+                fp.write(f"IN.PSP{idx + 1} = {ii}\n")

3250-3252: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-    assert len(fp_pp_files) == len(type_map), (
-        "size of fp_pp_files should be the same as the size of type_map"
-    )
+    assert len(fp_pp_files) == len(type_map), f"size of fp_pp_files ({len(fp_pp_files)}) should be the same as the size of type_map ({len(type_map)})"

3309-3311: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-            assert os.path.isfile(model_file), (
-                f"Can not find the deepks model file {model_file}, which is defined in {ii}/INPUT"
-            )
+            assert os.path.isfile(model_file), f"Can not find the deepks model file {model_file}, which is defined in {ii}/INPUT"

3326-3328: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-            assert "fp_dpks_descriptor" in jdata, (
-                "need to define fp_dpks_descriptor in jdata"
-            )
+            assert "fp_dpks_descriptor" in jdata, "need to define fp_dpks_descriptor in jdata"

3338-3340: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-                assert os.path.isfile(src_file), (
-                    f"Can not find the pseudopotential file {src_file}"
-                )
+                assert os.path.isfile(src_file), f"Can not find the pseudopotential file {src_file}"

-                assert os.path.isfile(src_file), (
-                    f"Can not find the orbital file {src_file}"
-                )
+                assert os.path.isfile(src_file), f"Can not find the orbital file {src_file}"

-            assert os.path.isfile(src_file), (
-                f"Can not find the descriptor file {src_file}"
-            )
+            assert os.path.isfile(src_file), f"Can not find the descriptor file {src_file}"

Also applies to: 3344-3346, 3350-3352


3777-3777: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-        os.symlink(pp, "qmmm%d.parm7" % ii)  # noqa: UP031
+        os.symlink(pp, f"qmmm{ii}.parm7")

-        os.symlink(os.path.join(rst7_prefix, ss[0]), "init%d.rst7" % ii)  # noqa: UP031
+        os.symlink(os.path.join(rst7_prefix, ss[0]), f"init{ii}.rst7")

Also applies to: 3781-3781


3831-3831: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-            raise RuntimeError("unknown task %d, something wrong" % jj)  # noqa: UP031
+            raise RuntimeError(f"unknown task {jj}, something wrong")

4206-4206: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-    dlog.info("failed tasks: %6d in %6d  %6.2f %% " % (nfail, ntask, rfail * 100.0))  # noqa: UP031
+    dlog.info(f"failed tasks: {nfail:6d} in {ntask:6d}  {rfail * 100.0:6.2f} % ")

-        dlog.info("failed frame: %6d in %6d " % (icount, tcount))  # noqa: UP031
+        dlog.info(f"failed frame: {icount:6d} in {tcount:6d} ")

-            "failed frame: %6d in %6d  %6.2f %% " % (icount, tcount, rfail * 100.0)  # noqa: UP031
+            f"failed frame: {icount:6d} in {tcount:6d}  {rfail * 100.0:6.2f} % "

Also applies to: 4298-4298, 4302-4302


4537-4537: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-        dlog.info("failed frame: %6d in %6d " % (tcount - icount, tcount))  # noqa: UP031
+        dlog.info(f"failed frame: {tcount - icount:6d} in {tcount:6d} ")

-            "failed frame: %6d in %6d  %6.2f %% "  # noqa: UP031
-            % (tcount - icount, tcount, rfail * 100.0)
+            f"failed frame: {tcount - icount:6d} in {tcount:6d}  {rfail * 100.0:6.2f} % "

Also applies to: 4541-4542


4785-4785: Use f-strings instead of %-formatting.

The string formatting uses the older %-style formatting. For better readability and maintainability, use f-strings which are the preferred way in modern Python.

-        dlog.info("continue from iter %03d task %02d" % (iter_rec[0], iter_rec[1]))  # noqa: UP031
+        dlog.info(f"continue from iter {iter_rec[0]:03d} task {iter_rec[1]:02d}")

-            task_name = "task %02d" % jj  # noqa: UP031
+            task_name = f"task {jj:02d}"

Also applies to: 4798-4798

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e02e6a2 and bc70e21.

📒 Files selected for processing (62)
  • .pre-commit-config.yaml (1 hunks)
  • doc/conf.py (1 hunks)
  • dpgen/__init__.py (1 hunks)
  • dpgen/auto_test/EOS.py (1 hunks)
  • dpgen/auto_test/Elastic.py (1 hunks)
  • dpgen/auto_test/Gamma.py (3 hunks)
  • dpgen/auto_test/Interstitial.py (9 hunks)
  • dpgen/auto_test/Surface.py (3 hunks)
  • dpgen/auto_test/VASP.py (2 hunks)
  • dpgen/auto_test/Vacancy.py (1 hunks)
  • dpgen/auto_test/common_prop.py (2 hunks)
  • dpgen/auto_test/lib/abacus.py (3 hunks)
  • dpgen/auto_test/lib/lammps.py (8 hunks)
  • dpgen/auto_test/lib/lmp.py (3 hunks)
  • dpgen/auto_test/lib/mfp_eosfit.py (14 hunks)
  • dpgen/auto_test/lib/pwscf.py (3 hunks)
  • dpgen/auto_test/lib/siesta.py (4 hunks)
  • dpgen/auto_test/lib/utils.py (1 hunks)
  • dpgen/auto_test/lib/vasp.py (5 hunks)
  • dpgen/auto_test/refine.py (2 hunks)
  • dpgen/auto_test/reproduce.py (3 hunks)
  • dpgen/collect/collect.py (2 hunks)
  • dpgen/data/gen.py (18 hunks)
  • dpgen/data/reaction.py (1 hunks)
  • dpgen/data/surf.py (7 hunks)
  • dpgen/data/tools/bcc.py (1 hunks)
  • dpgen/data/tools/cessp2force_lin.py (2 hunks)
  • dpgen/data/tools/create_random_disturb.py (4 hunks)
  • dpgen/data/tools/diamond.py (1 hunks)
  • dpgen/data/tools/fcc.py (1 hunks)
  • dpgen/data/tools/hcp.py (1 hunks)
  • dpgen/data/tools/io_lammps.py (3 hunks)
  • dpgen/data/tools/sc.py (1 hunks)
  • dpgen/generator/arginfo.py (2 hunks)
  • dpgen/generator/lib/abacus_scf.py (9 hunks)
  • dpgen/generator/lib/calypso_check_outcar.py (1 hunks)
  • dpgen/generator/lib/calypso_run_model_devi.py (2 hunks)
  • dpgen/generator/lib/calypso_run_opt.py (2 hunks)
  • dpgen/generator/lib/gaussian.py (2 hunks)
  • dpgen/generator/lib/lammps.py (5 hunks)
  • dpgen/generator/lib/make_calypso.py (6 hunks)
  • dpgen/generator/lib/pwmat.py (1 hunks)
  • dpgen/generator/lib/pwscf.py (3 hunks)
  • dpgen/generator/lib/run_calypso.py (8 hunks)
  • dpgen/generator/lib/siesta.py (4 hunks)
  • dpgen/generator/lib/utils.py (3 hunks)
  • dpgen/generator/run.py (43 hunks)
  • dpgen/simplify/simplify.py (4 hunks)
  • dpgen/tools/collect_data.py (2 hunks)
  • dpgen/tools/relabel.py (4 hunks)
  • dpgen/tools/stat_sys.py (2 hunks)
  • pyproject.toml (1 hunks)
  • tests/auto_test/data.vasp.kp.gf/make_kp_test.py (1 hunks)
  • tests/auto_test/test_abacus.py (2 hunks)
  • tests/data/test_coll_abacus.py (1 hunks)
  • tests/data/test_gen_bulk_abacus.py (1 hunks)
  • tests/generator/comp_sys.py (7 hunks)
  • tests/generator/gromacs/model_devi_case/model_devi.py (1 hunks)
  • tests/generator/test_make_fp.py (26 hunks)
  • tests/generator/test_make_md.py (11 hunks)
  • tests/generator/test_make_train.py (10 hunks)
  • tests/generator/test_post_fp.py (8 hunks)
✅ Files skipped from review due to trivial changes (49)
  • dpgen/data/tools/bcc.py
  • dpgen/data/tools/fcc.py
  • dpgen/data/tools/hcp.py
  • dpgen/data/tools/diamond.py
  • doc/conf.py
  • tests/generator/gromacs/model_devi_case/model_devi.py
  • dpgen/init.py
  • dpgen/collect/collect.py
  • dpgen/auto_test/Vacancy.py
  • dpgen/generator/lib/utils.py
  • dpgen/auto_test/EOS.py
  • dpgen/data/reaction.py
  • tests/auto_test/data.vasp.kp.gf/make_kp_test.py
  • dpgen/tools/collect_data.py
  • dpgen/data/tools/cessp2force_lin.py
  • dpgen/auto_test/refine.py
  • dpgen/auto_test/Elastic.py
  • dpgen/data/tools/sc.py
  • dpgen/auto_test/lib/siesta.py
  • dpgen/data/tools/io_lammps.py
  • dpgen/auto_test/common_prop.py
  • dpgen/auto_test/lib/lmp.py
  • dpgen/generator/lib/siesta.py
  • dpgen/generator/lib/gaussian.py
  • dpgen/auto_test/lib/pwscf.py
  • dpgen/generator/lib/calypso_run_opt.py
  • dpgen/generator/lib/pwmat.py
  • tests/generator/comp_sys.py
  • dpgen/generator/lib/lammps.py
  • dpgen/auto_test/VASP.py
  • dpgen/generator/lib/calypso_run_model_devi.py
  • dpgen/tools/relabel.py
  • dpgen/auto_test/Surface.py
  • dpgen/generator/lib/pwscf.py
  • dpgen/generator/lib/make_calypso.py
  • dpgen/auto_test/lib/lammps.py
  • dpgen/auto_test/lib/vasp.py
  • dpgen/auto_test/reproduce.py
  • tests/generator/test_make_md.py
  • dpgen/auto_test/Gamma.py
  • dpgen/data/surf.py
  • dpgen/auto_test/lib/mfp_eosfit.py
  • tests/generator/test_make_train.py
  • dpgen/generator/lib/run_calypso.py
  • tests/generator/test_post_fp.py
  • tests/generator/test_make_fp.py
  • dpgen/simplify/simplify.py
  • dpgen/auto_test/Interstitial.py
  • dpgen/data/gen.py
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build (3.12)
🔇 Additional comments (17)
dpgen/tools/stat_sys.py (2)

42-42: LGTM!

The addition of the # noqa: UP031 comment is consistent with the codebase-wide effort to suppress linting warnings for string formatting.


75-75: LGTM!

The addition of the # noqa: UP031 comment is consistent with the codebase-wide effort to suppress linting warnings for string formatting.

tests/data/test_coll_abacus.py (1)

25-27: LGTM!

The assertion statement has been reformatted for better readability while maintaining the same functionality.

dpgen/data/tools/create_random_disturb.py (2)

77-77: LGTM!

The # noqa: UP031 comments have been added to suppress linting warnings for string formatting, which is acceptable as the code functionality remains unchanged.

Also applies to: 139-139, 211-211


195-195: LGTM!

The code correctly assigns atom masses to the masses key to maintain compatibility with dpdata's expected structure.

dpgen/auto_test/lib/abacus.py (3)

164-166: LGTM!

The assertion statements have been reformatted for better readability while maintaining the same functionality.

Also applies to: 172-174, 180-182


336-336: LGTM!

The # noqa: UP031 comment has been added to suppress a linting warning for string formatting, which is acceptable as the code functionality remains unchanged.


7-7:

✅ Verification successful

Verify the updated import path.

The import path for make_unlabeled_stru has been updated from dpdata.abacus.scf to dpdata.abacus.stru. Please ensure this change is compatible with the latest version of dpdata.


🌐 Web query:

What is the latest version of dpdata and where is make_unlabeled_stru located in it?

💡 Result:

The latest version of dpdata available via conda-forge is v0.2.23[10].

The make_unlabeled_stru function is located in the dpdata.abacus.stru module[3][5]. This module handles parsing and generating structural data for ABACUS (Atomic-orbital Based Ab-initio Computation at UStc), a software package for electronic structure calculations.

For example:

from dpdata.abacus.stru import make_unlabeled_stru

This function assists in creating unlabeled structural data for compatibility with workflows requiring atomic configurations without energy/force labels[3][5].

Citations:


Import Path Verified: The updated import statement is correct.

After reviewing the latest dpdata documentation, we can confirm that make_unlabeled_stru is now located in the dpdata.abacus.stru module as of dpdata v0.2.23. The change from dpdata.abacus.scf to dpdata.abacus.stru is valid and compatible with the latest version.

  • File: dpgen/auto_test/lib/abacus.py, Line 7
  • Change Verified: from dpdata.abacus.stru import make_unlabeled_stru is correct.
tests/auto_test/test_abacus.py (1)

219-264: LGTM! Improved test precision with selective key comparison.

The changes enhance the test by:

  1. Fixing the typo in the function name.
  2. Adding selective comparison of essential structure attributes.
dpgen/generator/lib/abacus_scf.py (4)

6-6: LGTM! Improved code readability and organization.

The changes enhance the code by:

  1. Using the correct module for imports.
  2. Reformatting assertions for better readability.
  3. Adding consistent lint suppressions.

Also applies to: 48-53, 80-83, 95-97, 102-105, 108-111, 121-130, 133-143, 147-149, 154-157, 161-164, 180-183, 187-190


214-240: LGTM! Enhanced data validation and format consistency.

The changes improve robustness by:

  1. Adding shape validation for cells and coords.
  2. Ensuring consistent 3D format.
  3. Improving file path construction.

256-287: LGTM! Enhanced function documentation and error handling.

The changes improve the function by:

  1. Adding comprehensive docstring.
  2. Simplifying the function signature.
  3. Adding robust error handling and sensible defaults.

300-314: LGTM! Improved array handling and attribute support.

The changes enhance the code by:

  1. Using numpy arrays for atom types.
  2. Adding support for move and spins attributes.
dpgen/generator/lib/calypso_check_outcar.py (1)

53-53: LGTM! The linter suppression is justified.

The use of %-formatting here is intentional as it needs to match VASP's OUTCAR format requirements. The noqa: UP031 comment appropriately suppresses the warning while maintaining compatibility with VASP parsers.

.pre-commit-config.yaml (1)

31-31:

❓ Verification inconclusive

Verify compatibility with the updated ruff version.

Please ensure that v0.9.6 is the intended version and check for any breaking changes or new rules that might affect the codebase.


🌐 Web query:

What are the breaking changes in ruff v0.9.6 compared to v0.7.4?

💡 Result:

The key breaking changes between Ruff v0.7.4 and v0.9.6 include updates across formatter styles, configuration defaults, and diagnostic behaviors based on provided sources[1][2][3]. Here are the significant updates:

Formatter Style Changes

  • Ruff2025 style guide adoption: Starting with v***.*_*****_*****._______._______.__.__.__.__.__.__._***_., code formatting aligns with stricter rules under "Ruff2025", potentially altering existing code layouts[1][2].

Configuration & Behavior Updates

Target Python Version

  • Default Python target version: Changed from Python _.8 (prior) ****to ******._9 (post-v*******_). Projects without explicit target_version configurations may see new linting errors[1][2].

Diagnostic Locations

  • pydoclint diagnostics: Now point ****to ****the first line ****of ****the docstring instead ****of arbitrary positions[1][2].

Installer Paths

  • Standalone installer directory: Changed ****from ~/.cargo/bin ****to XDG-compliant paths (~/.local/bin)[1][2].

Line Width Calculations

  • Unicode character handling: Line widths ****now use an updated Unicode library (unicode-width) affecting E501 checks[1][2].

Rule Updates

Renamed/Moved Rules

  • TRY302 (useless-try-except) renamed ****to TRY203 for consistency with external linters[1][2].

Removed Settings

  • lintallow-unused-imports: Deprecated ****in favor ****of lint.pyflakesallow-unused-imports[1][2].

These updates require reviewing configurations (target_version, exclude paths), adjusting suppression comments (noqa placement), and rechecking formatted code against new style rules[1][2].

Citations:


Ruff v0.9.6 Compatibility Verification

Please ensure that using rev: v0.9.6 is intentional. Note that compared to v0.7.4, Ruff v0.9.6 introduces several breaking changes that may impact your codebase:

  • Formatter Style Update: Adoption of the Ruff2025 style guide could alter existing code formatting.
  • Target Python Version Change: The default target Python version may have shifted (e.g., from Python 3.8 to 3.9), which might result in new linting errors if not explicitly set.
  • Diagnostic Adjustments: Diagnostics from tools like pydoclint now point to the docstring’s first line, potentially affecting error locations.
  • Installer Path Modification: The standalone installer now uses XDG-compliant paths, differing from previous defaults.
  • Rule Updates: Some rule names have changed (e.g., TRY302 renamed to TRY203), and certain settings (like lintallow-unused-imports) have been deprecated.

Review your configuration and any suppression comments to ensure they align with these updates.

dpgen/generator/arginfo.py (1)

300-301: LGTM! Documentation update improves version requirement clarity.

The documentation changes accurately clarify that the virial trust bounds can be used with any DeePMD-kit version 2 or above, rather than limiting it to specific v2.x versions.

Also applies to: 354-355

pyproject.toml (1)

22-22: Dependency Version Update: dpdata>=0.2.23

The dpdata dependency has been updated from a previous constraint (>=0.2.17) to require version 0.2.23 or higher. This aligns with the PR’s objective of updating dependencies and ensures that any newer features or fixes in dpdata are available to the project. Please verify that this change is compatible with all modules that depend on dpdata (for example, any version-related checks or feature usage in dpgen/generator/run.py).

@@ -76,6 +76,7 @@ def test(self):
def testSTRU(self):
jdata = self.jdata
jdata["from_poscar_path"] = "./Cu.STRU"
jdata["potcars"] = ["abacus.in/Cu_ONCV_PBE-1.0.upf"]
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify the UPF file path.

Please ensure that the UPF file exists at the specified path.

Run the following script to verify the file exists:


🏁 Script executed:

#!/bin/bash
# Description: Verify the UPF file exists.

# Test: Check if the file exists.
if [ -f "abacus.in/Cu_ONCV_PBE-1.0.upf" ]; then
  echo "UPF file exists."
else
  echo "UPF file not found."
fi

Length of output: 91


Action Required: UPF File Missing

The file referenced in the "potcars" array in tests/data/test_gen_bulk_abacus.py (line 79) is not found on disk. Please ensure that either:

  • The file abacus.in/Cu_ONCV_PBE-1.0.upf is added to the repository in the correct location, or
  • The UPF file path is updated in the code to reference a valid, existing file.

Please address this to avoid issues during runtime.

Comment on lines +477 to 478
) < Version("4"):
# 2.x
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Update version check to support DeePMD-kit 4.x.

The version check limits DeePMD-kit version to 3.x, but according to the AI summary, the upper limit should be updated to 4.x.

-    ) < Version("4"):
+    ) < Version("5"):

Also applies to: 525-525

@@ -818,7 +818,7 @@ def run_train_dp(iter_index, jdata, mdata):
commands.append(f"{train_command} compress")
else:
raise RuntimeError(
"DP-GEN currently only supports for DeePMD-kit 1.x or 2.x version!"
"DP-GEN currently only supports for DeePMD-kit 1.x to 3.x version!"
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Update version check to support DeePMD-kit 4.x.

The version check limits DeePMD-kit version to 3.x, but according to the AI summary, the upper limit should be updated to 4.x.

-            "DP-GEN currently only supports for DeePMD-kit 1.x to 3.x version!"
+            "DP-GEN currently only supports for DeePMD-kit 1.x to 4.x version!"
📝 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
"DP-GEN currently only supports for DeePMD-kit 1.x to 3.x version!"
"DP-GEN currently only supports for DeePMD-kit 1.x to 4.x version!"

@@ -1695,7 +1695,7 @@ def _make_model_devi_native_gromacs(iter_index, jdata, mdata, conf_systems):
# only support for deepmd v2.0
if Version(mdata["deepmd_version"]) < Version("2.0"):
raise RuntimeError(
"Only support deepmd-kit 2.x for model_devi_engine='gromacs'"
"Only support deepmd-kit v2 or above for model_devi_engine='gromacs'"
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Update version check to support DeePMD-kit 4.x.

The version check limits DeePMD-kit version to 3.x, but according to the AI summary, the upper limit should be updated to 4.x.

-            "Only support deepmd-kit v2 or above for model_devi_engine='gromacs'"
+            "Only support deepmd-kit v2 or above for model_devi_engine='gromacs'. Currently supports up to v4.x"
📝 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
"Only support deepmd-kit v2 or above for model_devi_engine='gromacs'"
"Only support deepmd-kit v2 or above for model_devi_engine='gromacs'. Currently supports up to v4.x"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants