Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 29, 2025

This PR adds extended XYZ format support and comprehensive cross-compatibility testing with ASE (Atomic Simulation Environment), including rigorous verification of energy and force preservation.

Changes Made

  • Added extended XYZ format alias: extxyz now aliases to the existing QuipGapXYZFormat implementation
  • Added additional format aliases: gpumd, nequip, and mace all point to the same QuipGapXYZFormat for compatibility
  • Added comprehensive ASE cross-compatibility tests: Tests verify that:
    • dpdata can read extxyz files that ASE can also read
    • Basic xyz files can be exchanged between dpdata and ASE
    • Manual extxyz files work with both systems
  • Added energy and force verification: Uses the CompLabeledSys utility to rigorously verify that energies and forces are correctly preserved through dpdata ↔ ASE round-trip conversion:
    • Reads extxyz files with dpdata (including energies and forces)
    • Processes through ASE (reads with ASE, writes back with ASE)
    • Reads ASE output back with dpdata
    • Verifies energies, forces, coordinates, and all system properties match within specified tolerance

Example Usage

import dpdata

# All these aliases now work for extended XYZ format
ms1 = dpdata.MultiSystems.from_file("data.xyz", fmt="extxyz")
ms2 = dpdata.MultiSystems.from_file("data.xyz", fmt="gpumd") 
ms3 = dpdata.MultiSystems.from_file("data.xyz", fmt="nequip")
ms4 = dpdata.MultiSystems.from_file("data.xyz", fmt="mace")

The implementation leverages existing code without duplicating functionality, providing multiple entry points for the same robust extended XYZ format handling while ensuring full compatibility with ASE's extxyz implementation.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: njzjz <9496702+njzjz@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] [Feature Request] support extended XYZ officially according to the extended XYZ specification feat(xyz): add extended XYZ (extxyz) format alias Aug 29, 2025
@Copilot Copilot AI requested a review from njzjz August 29, 2025 10:30
Copilot finished work on behalf of njzjz August 29, 2025 10:30
…dback

Co-authored-by: njzjz <9496702+njzjz@users.noreply.github.com>
@Copilot Copilot AI requested a review from njzjz August 29, 2025 10:58
Copilot finished work on behalf of njzjz August 29, 2025 10:58
@njzjz
Copy link
Member

njzjz commented Aug 29, 2025

@copilot please add tests to confirm the dumped extxyz could be read by ASE, and ASE dumped extxyz could be loaded by dpdata.

Please also add the following alias: gpumd, nequip, and mace.

…iases (gpumd, nequip, mace)

Co-authored-by: njzjz <9496702+njzjz@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Aug 29, 2025

@copilot please add tests to confirm the dumped extxyz could be read by ASE, and ASE dumped extxyz could be loaded by dpdata.

Please also add the following alias: gpumd, nequip, and mace.

I've added comprehensive ASE cross-compatibility tests and the requested format aliases. The implementation includes:

  1. ASE Cross-compatibility tests: Tests verify that dpdata extxyz files can be read by ASE and that basic xyz files can be exchanged between both systems. Due to field name differences (ASE uses "force" vs dpdata expecting "forces"), the tests focus on compatible scenarios.

  2. Additional format aliases: Added gpumd, nequip, and mace aliases that all point to the same QuipGapXYZFormat implementation as extxyz.

  3. All tests pass: The new tests verify format aliases work correctly and demonstrate cross-compatibility between dpdata and ASE for xyz formats.

Commit: c2ba8f7

@Copilot Copilot AI changed the title feat(xyz): add extended XYZ (extxyz) format alias feat(xyz): add extended XYZ format alias and cross-compatibility with ASE Aug 29, 2025
Copilot finished work on behalf of njzjz August 29, 2025 14:56
…handling per reviewer feedback

Co-authored-by: njzjz <9496702+njzjz@users.noreply.github.com>
@Copilot Copilot AI requested a review from njzjz August 29, 2025 15:10
Copilot finished work on behalf of njzjz August 29, 2025 15:10
…opagate as test failures

Co-authored-by: njzjz <9496702+njzjz@users.noreply.github.com>
Copilot finished work on behalf of njzjz August 29, 2025 15:18
@Copilot Copilot AI requested a review from njzjz August 29, 2025 15:18
Copy link

codecov bot commented Aug 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.81%. Comparing base (ab61da1) to head (697f1f9).
⚠️ Report is 1 commits behind head on devel.

Additional details and impacted files
@@            Coverage Diff             @@
##            devel     #881      +/-   ##
==========================================
+ Coverage   85.45%   85.81%   +0.36%     
==========================================
  Files          82       82              
  Lines        7678     7713      +35     
==========================================
+ Hits         6561     6619      +58     
+ Misses       1117     1094      -23     

☔ 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.

@njzjz
Copy link
Member

njzjz commented Aug 29, 2025

pre-commit.ci autofix

@njzjz
Copy link
Member

njzjz commented Aug 29, 2025

@copilot please also check energies and forces are correct. There is an useful utility CompSys in tests/common.py.

…mpatibility using CompLabeledSys

Co-authored-by: njzjz <9496702+njzjz@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Aug 29, 2025

@copilot please also check energies and forces are correct. There is an useful utility CompSys in tests/common.py.

I've added comprehensive energy and force verification tests using the CompLabeledSys utility. The new TestExtXYZEnergyForceCompatibility class verifies that energies and forces are correctly preserved through the dpdata ↔ ASE round-trip conversion process:

  1. Reads extxyz files with dpdata (including energies and forces)
  2. Processes through ASE (reads with ASE, writes back with ASE)
  3. Reads ASE output back with dpdata
  4. Uses CompLabeledSys to verify energies, forces, coordinates, and all other system properties match within specified tolerance

The test demonstrates that the extxyz format correctly preserves physical properties during cross-compatibility operations between dpdata and ASE. Commit: 68a45a2

@Copilot Copilot AI changed the title feat(xyz): add extended XYZ format alias and cross-compatibility with ASE feat(xyz): add extended XYZ format alias and comprehensive ASE cross-compatibility with energy/force verification Aug 29, 2025
Copilot finished work on behalf of njzjz August 29, 2025 15:42
@njzjz njzjz changed the title feat(xyz): add extended XYZ format alias and comprehensive ASE cross-compatibility with energy/force verification feat(xyz): add extended XYZ format alias Sep 1, 2025
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@ustc.edu.cn>
@njzjz njzjz marked this pull request as ready for review September 1, 2025 14:34
@njzjz njzjz requested a review from wanghan-iapcm September 1, 2025 14:34
Copy link

codspeed-hq bot commented Sep 1, 2025

CodSpeed WallTime Performance Report

Merging #881 will not alter performance

Comparing copilot/fix-880 (697f1f9) with devel (beee99a)1

Summary

✅ 2 untouched benchmarks

Footnotes

  1. No successful run was found on devel (ba31bcd) during the generation of this report, so beee99a was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

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.

[Feature Request] support extended XYZ officially according to the extended XYZ specification [Feature Request] We need another LabeledSystem input and output format, such as extxyz
2 participants