Skip to content

Conversation

@njzjz
Copy link
Member

@njzjz njzjz commented Aug 3, 2025

Summary by CodeRabbit

  • Chores
    • Updated all scripts, configuration files, and documentation to use the latest LAMMPS stable release version (stable_22Jul2025) for building and installing DeePMD-kit.
    • Adjusted dependency specifications and environment variables to reflect the new LAMMPS version.
    • Revised installation instructions to reference the updated LAMMPS source archive and directory names.
    • Replaced external LAMMPS version extraction with a custom implementation for improved version parsing.
    • Removed obsolete environment variable settings related to C++ ABI configuration.
    • Updated build dependencies to conditionally include the MPI package based on the build environment.
    • Enhanced environment setup to properly handle CUDA and MPI library paths across platforms during build and runtime.
    • Improved library loading to explicitly load MPI libraries when building with cibuildwheel.
    • Clarified installation documentation to indicate automatic MPICH installation without manual MPI setup.
    • Added conditional interface to manage LAMMPS OP library directory retrieval based on configuration.
  • Tests
    • Modified tests to restrict atom ID indexing to the subset of atoms matching coordinate array lengths for consistency in validation.

Copilot AI review requested due to automatic review settings August 3, 2025 16:06
@github-actions github-actions bot added the Docs label Aug 3, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the LAMMPS version from stable_29Aug2024_update1 to stable_22Jul2025 across the project's build scripts, documentation, and configuration files.

  • Updates LAMMPS version string in all build scripts and CMake configurations
  • Modifies Python package dependency to match the new LAMMPS version
  • Updates documentation examples to reference the new version

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
source/install/test_cc_local.sh Updates LAMMPS_VERSION cmake parameter
source/install/test_cc.sh Updates LAMMPS_VERSION in cmake command
source/install/build_lammps.sh Updates LAMMPS_VERSION variable
source/install/build_from_c.sh Updates LAMMPS_VERSION cmake parameter
source/install/build_cc.sh Updates LAMMPS_VERSION cmake parameter
pyproject.toml Updates lammps package version and build environment variables
doc/install/install-lammps.md Updates documentation examples with new version strings
.devcontainer/build_cxx.sh Updates LAMMPS_VERSION cmake parameter
Comments suppressed due to low confidence (1)

pyproject.toml:111

  • The LAMMPS version 2025.7.22.0.0 appears to be from a future date (July 22, 2025). This version likely does not exist yet and may cause dependency resolution failures.
    "lammps~=2025.7.22.0.0",

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 3, 2025

📝 Walkthrough

Walkthrough

All references to the LAMMPS version in build scripts, documentation, dependency specifications, and CMake plugin files were updated from stable_29Aug2024_update1 to stable_22Jul2025. Additionally, a custom CMake function was introduced to parse and set the LAMMPS version number from the version header, replacing the previous external utility call. Several test files were modified to restrict atom ID indexing to the first six atoms. The environment variable LMP_CXX11_ABI_0 was removed from CI workflows and devcontainer settings. The dependency on mpich was reorganized to be included conditionally during build wheels and added to test requirements, with explicit installs removed from build steps. The deepmd Python code was restructured to conditionally import and define environment setup based on the LAMMPS version configuration.

Changes

Cohort / File(s) Change Summary
Build Scripts: LAMMPS Version Update
.devcontainer/build_cxx.sh, source/install/build_cc.sh, source/install/build_from_c.sh, source/install/build_lammps.sh, source/install/test_cc.sh, source/install/test_cc_local.sh
Updated the LAMMPS version string from stable_29Aug2024_update1 to stable_22Jul2025 in all build and test scripts.
Documentation: LAMMPS Install Instructions
doc/install/install-lammps.md
Updated all references, commands, and directory names for the LAMMPS version to stable_22Jul2025.
Dependency and Environment Configuration
pyproject.toml
Changed the LAMMPS version in the optional dependencies and environment variables to stable_22Jul2025. Added mpich to test requirements and removed explicit pip installs of mpich in build steps.
CMake Plugin and Builtin Configuration
source/lmp/builtin.cmake, source/lmp/plugin/CMakeLists.txt
Replaced external get_lammps_version call with a custom _get_lammps_version function that parses version.h to produce a numeric version string in YYYYMMDD format. Simplified ABI macro check in plugin CMakeLists.txt.
Test Code: Atom ID Indexing Restriction
source/lmp/tests/test_deeptensor.py, source/lmp/tests/test_dplr.py, source/lmp/tests/test_lammps.py, source/lmp/tests/test_lammps_3types.py, source/lmp/tests/test_lammps_dpa_jax.py, source/lmp/tests/test_lammps_dpa_pt.py, source/lmp/tests/test_lammps_dpa_pt_nopbc.py, source/lmp/tests/test_lammps_dpa_sel_pt.py, source/lmp/tests/test_lammps_faparam.py, source/lmp/tests/test_lammps_jax.py, source/lmp/tests/test_lammps_pd.py, source/lmp/tests/test_lammps_pt.py, source/lmp/tests/test_lammps_spin.py, source/lmp/tests/test_lammps_spin_pt.py
Modified test functions to extract only the first six atom IDs before subtracting one for zero-based indexing, aligning index maps with expected data sizes.
Environment Variable Cleanup
.github/workflows/test_cc.yml, .github/workflows/test_cuda.yml, .devcontainer/devcontainer.json
Removed the environment variable LMP_CXX11_ABI_0 from CI workflows and devcontainer environment settings.
Backend Build Dependency Adjustment
backend/dp_backend.py
Added conditional inclusion of "mpich" as a build wheel requirement when building inside cibuildwheel environment.
Environment Variable Propagation in Build
backend/read_env.py
Added -DCIBUILDWHEEL CMake argument reflecting the CIBUILDWHEEL environment variable to propagate build context.
DeepMD Python Environment Setup Restructuring
deepmd/lmp.py, deepmd/lmp_check_build.py
Refactored to conditionally define imports and environment setup functions based on presence of LAMMPS_VERSION in global config, grouping platform-specific environment variable handling and CUDA library path setup. Added new module deepmd/lmp_check_build.py for conditional get_op_dir import or stub.
DeepMD PyTorch Operator MPI Environment Adjustment
deepmd/pt/cxx_op.py
Added logic to explicitly load the MPI shared library (libmpi.so or libmpi.dylib) using ctypes when building inside cibuildwheel environment on Linux or macOS to avoid lost MPI linkage after wheel repair.
Configuration File Updates
source/config/run_config.ini
Added new configuration keys LAMMPS_VERSION and CIBUILDWHEEL as placeholders for build-time substitution.
Documentation: MPICH Installation Clarification
doc/install/easy-install.md
Clarified that MPICH will be installed automatically and users do not need to manually install an MPI library.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • wanghan-iapcm

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a987430 and 20c3b27.

📒 Files selected for processing (1)
  • .github/workflows/test_cuda.yml (0 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/test_cuda.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (30)
  • GitHub Check: Build C++ (cuda120, cuda)
  • GitHub Check: Build C++ (clang, clang)
  • GitHub Check: Build C++ (cuda, cuda)
  • GitHub Check: Build C++ (cpu, cpu)
  • GitHub Check: Build C++ (rocm, rocm)
  • GitHub Check: Build wheels for cp310-manylinux_aarch64
  • GitHub Check: Build wheels for cp311-win_amd64
  • GitHub Check: Build wheels for cp311-macosx_arm64
  • GitHub Check: Build wheels for cp311-macosx_x86_64
  • GitHub Check: Build wheels for cp311-manylinux_x86_64
  • GitHub Check: Build wheels for cp311-manylinux_x86_64
  • GitHub Check: Test Python (6, 3.12)
  • GitHub Check: Build C library (2.14, >=2.5.0,<2.15, libdeepmd_c_cu11.tar.gz)
  • GitHub Check: Test Python (6, 3.9)
  • GitHub Check: Build C library (2.18, libdeepmd_c.tar.gz)
  • GitHub Check: Test Python (4, 3.9)
  • GitHub Check: Test Python (5, 3.12)
  • GitHub Check: Test Python (5, 3.9)
  • GitHub Check: Test Python (4, 3.12)
  • GitHub Check: Test Python (3, 3.12)
  • GitHub Check: Test Python (2, 3.12)
  • GitHub Check: Test Python (2, 3.9)
  • GitHub Check: Test Python (1, 3.9)
  • GitHub Check: Test Python (3, 3.9)
  • GitHub Check: Test Python (1, 3.12)
  • GitHub Check: Analyze (c-cpp)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (python)
  • GitHub Check: Test C++ (false)
  • GitHub Check: Test C++ (true)
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
  • 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 explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @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: 0

♻️ Duplicate comments (5)
source/install/build_from_c.sh (1)

16-17: Same hard-coded version string as in test_cc_local.sh

See earlier remark on centralising the value; the same refactor applies here.

source/install/build_cc.sh (1)

29-30: Same hard-coded version string as in test_cc_local.sh

See earlier remark on centralising the value; the same refactor applies here.

source/install/test_cc.sh (1)

20-21: Same hard-coded version string as in test_cc_local.sh

See earlier remark on centralising the value; the same refactor applies here.

.devcontainer/build_cxx.sh (1)

16-17: Same hard-coded version string as in test_cc_local.sh

See earlier remark on centralising the value; the same refactor applies here.

pyproject.toml (1)

284-286: As above – duplicated value

Same duplication comment applies here.

🧹 Nitpick comments (4)
source/install/test_cc_local.sh (1)

31-32: Centralize the LAMMPS version string to avoid future drift

stable_22Jul2025 is now hard-coded here as well as in several other scripts. The next version bump will require touching every occurrence again, which is error-prone.

Consider driving the value from a single source (e.g. an environment variable or a small version file read by all build/test scripts):

-	-D LAMMPS_VERSION=stable_22Jul2025 \
+	-D LAMMPS_VERSION=${LAMMPS_VERSION:-stable_22Jul2025} \

This keeps the default behaviour unchanged while allowing overrides and single-point updates.

source/install/build_lammps.sh (1)

16-18: Fix typo and consider centralising version definition

  1. Typo: # download LAMMMPS contains three “M”s.
  2. The hard-coded LAMMPS_VERSION=stable_22Jul2025 string is now duplicated across several build/test scripts. Using the already-exported DP_LAMMPS_VERSION environment variable (with a sane default fallback) would remove this duplication.
-# download LAMMMPS
-LAMMPS_VERSION=stable_22Jul2025
+# download LAMMPS
+LAMMPS_VERSION=${DP_LAMMPS_VERSION:-stable_22Jul2025}
pyproject.toml (1)

246-249: Avoid duplicating DP_LAMMPS_VERSION across platforms

DP_LAMMPS_VERSION is set for macOS and Linux but missing for Windows, and the value is repeated. A single top-level [tool.cibuildwheel.environment] block (or reuse of a default in the build scripts) would eliminate drift next time the version bumps.

doc/install/install-lammps.md (1)

18-25: Use a variable placeholder to simplify future version bumps

The version string now appears multiple times in the docs (stable_22Jul2025). Replacing it with something like ${LAMMPS_TAG} (explained once at the top) would make future updates less error-prone.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 813bbc8 and c0b71f0.

📒 Files selected for processing (8)
  • .devcontainer/build_cxx.sh (1 hunks)
  • doc/install/install-lammps.md (4 hunks)
  • pyproject.toml (3 hunks)
  • source/install/build_cc.sh (1 hunks)
  • source/install/build_from_c.sh (1 hunks)
  • source/install/build_lammps.sh (1 hunks)
  • source/install/test_cc.sh (1 hunks)
  • source/install/test_cc_local.sh (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (29)
  • GitHub Check: Test Python (4, 3.12)
  • GitHub Check: Test Python (6, 3.9)
  • GitHub Check: Test Python (5, 3.12)
  • GitHub Check: Test Python (4, 3.9)
  • GitHub Check: Test Python (5, 3.9)
  • GitHub Check: Test Python (3, 3.9)
  • GitHub Check: Test Python (6, 3.12)
  • GitHub Check: Analyze (python)
  • GitHub Check: Test Python (3, 3.12)
  • GitHub Check: Analyze (c-cpp)
  • GitHub Check: Test C++ (true)
  • GitHub Check: Test C++ (false)
  • GitHub Check: Test Python (2, 3.9)
  • GitHub Check: Test Python (1, 3.9)
  • GitHub Check: Test Python (2, 3.12)
  • GitHub Check: Test Python (1, 3.12)
  • GitHub Check: Build wheels for cp311-macosx_arm64
  • GitHub Check: Build wheels for cp311-win_amd64
  • GitHub Check: Build C library (2.18, libdeepmd_c.tar.gz)
  • GitHub Check: Build wheels for cp311-manylinux_x86_64
  • GitHub Check: Build wheels for cp310-manylinux_aarch64
  • GitHub Check: Build C library (2.14, >=2.5.0,<2.15, libdeepmd_c_cu11.tar.gz)
  • GitHub Check: Build wheels for cp311-manylinux_x86_64
  • GitHub Check: Build wheels for cp311-macosx_x86_64
  • GitHub Check: Build C++ (clang, clang)
  • GitHub Check: Build C++ (rocm, rocm)
  • GitHub Check: Build C++ (cuda120, cuda)
  • GitHub Check: Build C++ (cpu, cpu)
  • GitHub Check: Build C++ (cuda, cuda)
🔇 Additional comments (2)
source/install/build_lammps.sh (1)

17-21: Verify the new archive actually exists before failing the build

A silent 404 from GitHub will leave an empty tarball and an opaque CMake failure later. Consider a pre-flight check:

curl -I -f https://github.com/lammps/lammps/archive/refs/tags/${LAMMPS_VERSION}.tar.gz \
  || { echo "Unknown LAMMPS tag ${LAMMPS_VERSION}"; exit 1; }
pyproject.toml (1)

110-113: Verified PyPI wheels exist for lammps~=2025.7.22.0.0

File: pyproject.toml (lines 110–113)

Snippet:

lmp = [
    "lammps~=2025.7.22.0.0",
]
ipi = [

PyPI publishes wheels for version 2025.7.22.0.0 on all major platforms:

  • macOS: arm64, x86_64
  • Linux (manylinux2014): aarch64, x86_64
  • Windows: amd64

No further action required—installation with this specifier will succeed.

@github-actions github-actions bot added the LAMMPS label Aug 3, 2025
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: 1

♻️ Duplicate comments (1)
source/lmp/plugin/CMakeLists.txt (1)

74-82: Fix month length check logic (duplicate issue).

This has the same critical issue as in builtin.cmake. The month length check is performed on the numeric month value, but should check if the numeric value is less than 10.

- string(LENGTH ${month} month_length)
  if(day_length EQUAL 1)
    set(day "0${day}")
  endif()
- if(month_length EQUAL 1)
+ if(month LESS 10)
    set(month "0${month}")
  endif()
🧹 Nitpick comments (2)
source/lmp/builtin.cmake (1)

11-51: Consider adding error handling for malformed version strings.

The function assumes the version header follows the exact format #define LAMMPS_VERSION "day month year". Consider adding validation to handle cases where the format is unexpected or the month abbreviation is not found in the MONTHS list.

+ # Validate that we found the version line
+ if(NOT line)
+   message(FATAL_ERROR "Could not find LAMMPS_VERSION in ${version_header}")
+ endif()
+
  string(REGEX
         REPLACE "#define LAMMPS_VERSION \"([0-9]+) ([A-Za-z]+) ([0-9]+)\""
                 "\\3" year "${line}")
  string(STRIP ${day} day)
  string(STRIP ${month} month)
  string(STRIP ${year} year)
  list(FIND MONTHS "${month}" month)
+ if(month EQUAL -1)
+   message(FATAL_ERROR "Unknown month abbreviation: ${month}")
+ endif()
source/lmp/plugin/CMakeLists.txt (1)

46-86: Consider extracting the duplicated function to a shared module.

The _get_lammps_version function is duplicated between builtin.cmake and plugin/CMakeLists.txt. Consider extracting this function to a shared CMake module to avoid code duplication and maintain consistency.

Create a shared file like cmake/LAMMPSVersionUtils.cmake:

function(_get_lammps_version version_header variable)
  # Implementation here
endfunction()

Then include it in both files:

+ include(${CMAKE_CURRENT_LIST_DIR}/../../cmake/LAMMPSVersionUtils.cmake)
- function(_get_lammps_version version_header variable)
-   # ... entire function implementation
- endfunction()
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c0b71f0 and 3948184.

📒 Files selected for processing (2)
  • source/lmp/builtin.cmake (1 hunks)
  • source/lmp/plugin/CMakeLists.txt (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: Test Python (6, 3.12)
  • GitHub Check: Test Python (4, 3.9)
  • GitHub Check: Test Python (6, 3.9)
  • GitHub Check: Test Python (5, 3.9)
  • GitHub Check: Test Python (5, 3.12)
  • GitHub Check: Test Python (3, 3.9)
  • GitHub Check: Test Python (4, 3.12)
  • GitHub Check: Test Python (2, 3.9)
  • GitHub Check: Test Python (2, 3.12)
  • GitHub Check: Test Python (3, 3.12)
  • GitHub Check: Test Python (1, 3.9)
  • GitHub Check: Test Python (1, 3.12)
  • GitHub Check: Analyze (c-cpp)
  • GitHub Check: Test C++ (true)
  • GitHub Check: Test C++ (false)

njzjz added 14 commits August 4, 2025 01:05
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@ustc.edu.cn>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@ustc.edu.cn>
This reverts commit 6a68f9d.
This reverts commit db0048e.
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@ustc.edu.cn>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@ustc.edu.cn>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@ustc.edu.cn>
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: 2

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7cd3e7d and b649db6.

📒 Files selected for processing (16)
  • .github/workflows/test_cc.yml (0 hunks)
  • pyproject.toml (3 hunks)
  • source/lmp/tests/test_deeptensor.py (1 hunks)
  • source/lmp/tests/test_dplr.py (4 hunks)
  • source/lmp/tests/test_lammps.py (2 hunks)
  • source/lmp/tests/test_lammps_3types.py (2 hunks)
  • source/lmp/tests/test_lammps_dpa_jax.py (2 hunks)
  • source/lmp/tests/test_lammps_dpa_pt.py (2 hunks)
  • source/lmp/tests/test_lammps_dpa_pt_nopbc.py (2 hunks)
  • source/lmp/tests/test_lammps_dpa_sel_pt.py (2 hunks)
  • source/lmp/tests/test_lammps_faparam.py (1 hunks)
  • source/lmp/tests/test_lammps_jax.py (2 hunks)
  • source/lmp/tests/test_lammps_pd.py (2 hunks)
  • source/lmp/tests/test_lammps_pt.py (2 hunks)
  • source/lmp/tests/test_lammps_spin.py (1 hunks)
  • source/lmp/tests/test_lammps_spin_pt.py (1 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/test_cc.yml
✅ Files skipped from review due to trivial changes (2)
  • source/lmp/tests/test_dplr.py
  • source/lmp/tests/test_lammps.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • pyproject.toml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (29)
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (c-cpp)
  • GitHub Check: Build C library (2.14, >=2.5.0,<2.15, libdeepmd_c_cu11.tar.gz)
  • GitHub Check: Build C library (2.18, libdeepmd_c.tar.gz)
  • GitHub Check: Build wheels for cp311-manylinux_x86_64
  • GitHub Check: Build wheels for cp311-win_amd64
  • GitHub Check: Build wheels for cp311-macosx_x86_64
  • GitHub Check: Build wheels for cp310-manylinux_aarch64
  • GitHub Check: Build wheels for cp311-macosx_arm64
  • GitHub Check: Build wheels for cp311-manylinux_x86_64
  • GitHub Check: Test Python (4, 3.12)
  • GitHub Check: Test Python (6, 3.12)
  • GitHub Check: Test Python (4, 3.9)
  • GitHub Check: Test Python (3, 3.9)
  • GitHub Check: Test Python (5, 3.12)
  • GitHub Check: Build C++ (cuda120, cuda)
  • GitHub Check: Test Python (5, 3.9)
  • GitHub Check: Build C++ (clang, clang)
  • GitHub Check: Test Python (6, 3.9)
  • GitHub Check: Build C++ (cuda, cuda)
  • GitHub Check: Test Python (2, 3.12)
  • GitHub Check: Build C++ (cpu, cpu)
  • GitHub Check: Test Python (1, 3.12)
  • GitHub Check: Build C++ (rocm, rocm)
  • GitHub Check: Test Python (2, 3.9)
  • GitHub Check: Test Python (3, 3.12)
  • GitHub Check: Test Python (1, 3.9)
  • GitHub Check: Test C++ (true)
  • GitHub Check: Test C++ (false)
🔇 Additional comments (18)
source/lmp/tests/test_lammps_dpa_pt_nopbc.py (2)

331-331: LGTM - Consistent indexing with expected data arrays.

The change properly limits atom ID extraction to 6 atoms, which aligns with the expected data arrays (expected_ae, expected_f, expected_v) that are all sized for 6 atoms.


382-382: LGTM - Consistent indexing with expected data arrays.

The change properly limits atom ID extraction to 6 atoms, which aligns with the expected data arrays used in this test function.

source/lmp/tests/test_lammps_dpa_pt.py (2)

333-333: LGTM - Consistent indexing with expected data arrays.

The change properly limits atom ID extraction to 6 atoms, which aligns with the expected data arrays (expected_ae, expected_f, expected_v) that are all sized for 6 atoms.


384-384: LGTM - Consistent indexing with expected data arrays.

The change properly limits atom ID extraction to 6 atoms, maintaining consistency with the expected data arrays used in assertions.

source/lmp/tests/test_lammps_dpa_jax.py (2)

337-337: LGTM - Consistent indexing with expected data arrays.

The change properly limits atom ID extraction to 6 atoms, which aligns with the expected data arrays (expected_ae, expected_f, expected_v) that are all sized for 6 atoms.


388-388: LGTM - Consistent indexing with expected data arrays.

The change maintains consistency between the index map size and expected data arrays used in virial assertions.

source/lmp/tests/test_lammps_dpa_sel_pt.py (2)

336-336: Good improvement to test robustness.

Restricting the atom ID extraction to the first six atoms before zero-based indexing ensures consistent behavior with the expected virial data array which is shaped for 6 atoms. This prevents potential indexing errors if the simulation contains more atoms than expected.


387-387: Consistent improvement for virial testing.

Same beneficial change as in test_pair_deepmd_virial - limiting atom ID extraction to the first six atoms for consistent indexing with the expected data arrays.

source/lmp/tests/test_lammps_jax.py (2)

335-335: Consistent test improvement across files.

This change aligns with the same improvement made in other test files, restricting atom ID extraction to the first six atoms to match the expected virial data array dimensions.


386-386: Same beneficial indexing improvement.

Identical change to the one in test_pair_deepmd_virial, ensuring consistent atom indexing behavior across virial test functions.

source/lmp/tests/test_lammps_3types.py (2)

323-323: Intentional restriction to first six atoms.

This change limits virial testing to the first six atoms, even though this test setup has 7 atoms. This appears intentional, likely because the 7th atom in the expected arrays often contains zeros, suggesting it may have special properties or be a placeholder.


374-374: Consistent with previous change in this file.

Same intentional restriction to the first six atoms for virial calculations, maintaining consistency with the test_pair_deepmd_virial function in this file.

source/lmp/tests/test_lammps_pd.py (2)

336-336: Standard test robustness improvement.

Consistent with changes in other test files, this restricts atom ID extraction to the first six atoms to match the expected data array dimensions and prevent potential indexing issues.


387-387: Consistent virial test improvement.

Same beneficial change as in test_pair_deepmd_virial, ensuring uniform atom indexing behavior across all virial calculation tests.

source/lmp/tests/test_deeptensor.py (1)

145-145: Same indexing improvement for tensor calculations.

This change applies the same beneficial pattern to tensor calculations, restricting atom ID extraction to the first six atoms to match the expected tensor data array size and ensure robust test behavior.

source/lmp/tests/test_lammps_pt.py (2)

333-333: LGTM: Explicit atom indexing improves test reliability.

The addition of [:6] slice before zero-based indexing makes the test more explicit about using only the first 6 atoms, which aligns with the test data setup (6-atom coordinate array and expected arrays dimensioned for 6 atoms).


384-384: LGTM: Consistent atom indexing with other test functions.

This change mirrors the modification in test_pair_deepmd_virial (line 333), ensuring consistent indexing behavior across the test suite.

source/lmp/tests/test_lammps_faparam.py (1)

216-216: LGTM: Explicit atom indexing aligns with test expectations.

The [:6] slice ensures the test uses only the first 6 atoms for indexing, which matches the expected arrays that are dimensioned for exactly 6 atoms. This change is consistent with similar modifications across the test suite.

njzjz added 4 commits August 5, 2025 23:07
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@ustc.edu.cn>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@ustc.edu.cn>
@codecov
Copy link

codecov bot commented Aug 6, 2025

Codecov Report

❌ Patch coverage is 22.22222% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.70%. Comparing base (813bbc8) to head (20c3b27).
⚠️ Report is 80 commits behind head on devel.

Files with missing lines Patch % Lines
deepmd/pt/cxx_op.py 33.33% 8 Missing ⚠️
deepmd/lmp_check_build.py 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #4861      +/-   ##
==========================================
- Coverage   84.71%   84.70%   -0.02%     
==========================================
  Files         699      700       +1     
  Lines       68135    68145      +10     
  Branches     3542     3542              
==========================================
- Hits        57723    57722       -1     
- Misses       9279     9290      +11     
  Partials     1133     1133              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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: 0

🧹 Nitpick comments (1)
backend/find_pytorch.py (1)

127-131: Consider using a ternary operator for more concise code.

The conditional logic for adding MPI requirements is correct and aligns well with the coordinated MPI dependency handling across the build system. However, the code can be made more concise.

Apply this diff to use a ternary operator as suggested by the static analysis tool:

-    if os.environ.get("CIBUILDWHEEL", "0") == "1":
-        # PyTorch OP library is built against mpich
-        mpi_requirement = ["mpich"]
-    else:
-        mpi_requirement = []
+    # PyTorch OP library is built against mpich
+    mpi_requirement = ["mpich"] if os.environ.get("CIBUILDWHEEL", "0") == "1" else []
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4036f0a and aca113c.

📒 Files selected for processing (4)
  • backend/find_pytorch.py (2 hunks)
  • deepmd/pt/cxx_op.py (2 hunks)
  • doc/install/easy-install.md (1 hunks)
  • pyproject.toml (4 hunks)
✅ Files skipped from review due to trivial changes (1)
  • doc/install/easy-install.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • pyproject.toml
  • deepmd/pt/cxx_op.py
🧰 Additional context used
🪛 Ruff (0.12.2)
backend/find_pytorch.py

127-131: Use ternary operator mpi_requirement = ["mpich"] if os.environ.get("CIBUILDWHEEL", "0") == "1" else [] instead of if-else-block

(SIM108)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (29)
  • GitHub Check: Test Python (2, 3.12)
  • GitHub Check: Test Python (3, 3.9)
  • GitHub Check: Test Python (4, 3.9)
  • GitHub Check: Test Python (6, 3.12)
  • GitHub Check: Test Python (4, 3.12)
  • GitHub Check: Test Python (5, 3.12)
  • GitHub Check: Test Python (6, 3.9)
  • GitHub Check: Test Python (5, 3.9)
  • GitHub Check: Test Python (3, 3.12)
  • GitHub Check: Test Python (1, 3.9)
  • GitHub Check: Test Python (2, 3.9)
  • GitHub Check: Test Python (1, 3.12)
  • GitHub Check: Build C++ (cuda, cuda)
  • GitHub Check: Build C++ (rocm, rocm)
  • GitHub Check: Build C++ (cpu, cpu)
  • GitHub Check: Build C++ (clang, clang)
  • GitHub Check: Build C++ (cuda120, cuda)
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (c-cpp)
  • GitHub Check: Test C++ (false)
  • GitHub Check: Test C++ (true)
  • GitHub Check: Build C library (2.18, libdeepmd_c.tar.gz)
  • GitHub Check: Build C library (2.14, >=2.5.0,<2.15, libdeepmd_c_cu11.tar.gz)
  • GitHub Check: Build wheels for cp311-win_amd64
  • GitHub Check: Build wheels for cp311-manylinux_x86_64
  • GitHub Check: Build wheels for cp311-macosx_x86_64
  • GitHub Check: Build wheels for cp310-manylinux_aarch64
  • GitHub Check: Build wheels for cp311-macosx_arm64
  • GitHub Check: Build wheels for cp311-manylinux_x86_64
🔇 Additional comments (1)
backend/find_pytorch.py (1)

142-143: LGTM! Clean integration of conditional MPI requirement.

The use of the unpacking operator to conditionally include the MPI requirement in the torch requirements list is well-implemented. This approach maintains the existing requirement structure while seamlessly adding the MPI dependency when building wheels.

@njzjz njzjz requested a review from wanghan-iapcm August 6, 2025 08:30
@njzjz njzjz added the Test CUDA Trigger test CUDA workflow label Aug 6, 2025
@github-actions github-actions bot removed the Test CUDA Trigger test CUDA workflow label Aug 6, 2025
@njzjz njzjz added the Test CUDA Trigger test CUDA workflow label Aug 7, 2025
@github-actions github-actions bot removed the Test CUDA Trigger test CUDA workflow label Aug 7, 2025
@njzjz njzjz added the Test CUDA Trigger test CUDA workflow label Aug 7, 2025
@github-actions github-actions bot removed the Test CUDA Trigger test CUDA workflow label Aug 7, 2025
@njzjz njzjz enabled auto-merge August 7, 2025 10:04
@njzjz njzjz added the Test CUDA Trigger test CUDA workflow label Aug 7, 2025
@github-actions github-actions bot removed the Test CUDA Trigger test CUDA workflow label Aug 7, 2025
@njzjz njzjz added this pull request to the merge queue Aug 7, 2025
Merged via the queue into deepmodeling:devel with commit bcc267e Aug 7, 2025
65 of 69 checks passed
@njzjz njzjz deleted the lammps-stable_22Jul2025 branch August 7, 2025 23:25
ChiahsinChu pushed a commit to ChiahsinChu/deepmd-kit that referenced this pull request Dec 17, 2025
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Chores**
* Updated all scripts, configuration files, and documentation to use the
latest LAMMPS stable release version (stable_22Jul2025) for building and
installing DeePMD-kit.
* Adjusted dependency specifications and environment variables to
reflect the new LAMMPS version.
* Revised installation instructions to reference the updated LAMMPS
source archive and directory names.
* Replaced external LAMMPS version extraction with a custom
implementation for improved version parsing.
* Removed obsolete environment variable settings related to C++ ABI
configuration.
* Updated build dependencies to conditionally include the MPI package
based on the build environment.
* Enhanced environment setup to properly handle CUDA and MPI library
paths across platforms during build and runtime.
* Improved library loading to explicitly load MPI libraries when
building with cibuildwheel.
* Clarified installation documentation to indicate automatic MPICH
installation without manual MPI setup.
* Added conditional interface to manage LAMMPS OP library directory
retrieval based on configuration.
* **Tests**
* Modified tests to restrict atom ID indexing to the subset of atoms
matching coordinate array lengths for consistency in validation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@ustc.edu.cn>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants