Skip to content

feat: Implement XAS (X-ray Absorption Spectroscopy) model, fitting, l…#5337

Draft
anyangml wants to merge 9 commits intodeepmodeling:masterfrom
anyangml:feat/support-xas-spectrum
Draft

feat: Implement XAS (X-ray Absorption Spectroscopy) model, fitting, l…#5337
anyangml wants to merge 9 commits intodeepmodeling:masterfrom
anyangml:feat/support-xas-spectrum

Conversation

@anyangml
Copy link
Collaborator

…oss, and testing infrastructure.

Copilot AI review requested due to automatic review settings March 24, 2026 05:29
@anyangml anyangml marked this pull request as draft March 24, 2026 05:29
@dosubot dosubot bot added the new feature label Mar 24, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 24, 2026

Caution

Review failed

The head commit changed during the review from 85fe716 to 9e9c6a3.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Adds end-to-end support for an XAS (X-ray Absorption Spectroscopy) fitting/model/loss pipeline, including configuration schema updates and new PyTorch + “dpmodel” implementations.

Changes:

  • Register new xas fitting-net arguments and XAS loss arguments in argcheck.
  • Introduce XAS fitting/task, atomic model, and model wrappers for both PyTorch and dpmodel.
  • Add an XASLoss and wire it into the PyTorch training loss factory.

Reviewed changes

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

Show a summary per file
File Description
deepmd/utils/argcheck.py Adds xas fitting and loss arg schemas; introduces absorbing_type model arg.
deepmd/pt/train/training.py Wires XASLoss and makes fully_shard import optional.
deepmd/pt/model/task/xas.py Adds PyTorch XAS fitting net implementation and (de)serialization.
deepmd/pt/model/task/init.py Exposes XASFittingNet.
deepmd/pt/model/model/xas_model.py Adds PyTorch XASModel wrapper with translated outputs.
deepmd/pt/model/model/init.py Routes fitting_net_type=="xas" to XASModel and passes absorbing_type.
deepmd/pt/model/atomic_model/xas_atomic_model.py Adds PyTorch atomic model to exclude non-absorbing types automatically.
deepmd/pt/model/atomic_model/init.py Exposes DPXASAtomicModel (PyTorch).
deepmd/pt/loss/xas.py Introduces XASLoss with optional CDF auxiliary term.
deepmd/pt/loss/init.py Exposes XASLoss.
deepmd/dpmodel/model/xas_model.py Adds dpmodel XASModel wrapper with translated outputs.
deepmd/dpmodel/model/model.py Routes fitting_net_type=="xas" to dpmodel XASModel and passes absorbing_type.
deepmd/dpmodel/fitting/xas_fitting.py Adds dpmodel XAS fitting net implementation.
deepmd/dpmodel/fitting/init.py Exposes XASFittingNet (dpmodel).
deepmd/dpmodel/atomic_model/xas_atomic_model.py Adds dpmodel atomic model with absorbing-type masking + (de)serialization.
deepmd/dpmodel/atomic_model/init.py Exposes DPXASAtomicModel (dpmodel).
deepmd/about.py Adds a dev stub __version__.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Mar 24, 2026

Codecov Report

❌ Patch coverage is 27.37430% with 130 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.16%. Comparing base (034e613) to head (250168b).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
deepmd/pt/loss/xas.py 15.38% 88 Missing ⚠️
deepmd/entrypoints/test.py 20.00% 24 Missing ⚠️
deepmd/pt/train/training.py 25.00% 9 Missing ⚠️
...pmd/pt/model/atomic_model/property_atomic_model.py 25.00% 6 Missing ⚠️
deepmd/pt/model/model/xas_model.py 80.00% 2 Missing ⚠️
deepmd/__about__.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5337      +/-   ##
==========================================
- Coverage   82.42%   82.16%   -0.27%     
==========================================
  Files         784      800      +16     
  Lines       79125    82274    +3149     
  Branches     3676     4004     +328     
==========================================
+ Hits        65220    67599    +2379     
- Misses      12732    13467     +735     
- Partials     1173     1208      +35     

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

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