Skip to content

Add BAM-MP-core model submission#381

Open
Godorina wants to merge 1 commit into
janosh:mainfrom
Godorina:bam-mp-core-resubmit
Open

Add BAM-MP-core model submission#381
Godorina wants to merge 1 commit into
janosh:mainfrom
Godorina:bam-mp-core-resubmit

Conversation

@Godorina

@Godorina Godorina commented Jul 16, 2026

Copy link
Copy Markdown

Description

This PR adds the BAM-MP-core model submission.

Validation performed locally:

  • tests/models/: 200 passed
  • prek run --files .pre-commit-config.yaml matbench_discovery/calculators.py matbench_discovery/enums.py models/bam/bam-mp-core.yml: passed
  • parity asset guard fails as expected until maintainer ingestion:
    models never ingested: ['bam-mp-core']

Could a maintainer please apply the ingest-model label for bam-mp-core? The branch is based on current main and keeps the resubmission to one clean commit.

Checklist

Please open PRs as draft and only mark as ready to review after checking off the following items:

  • I created a new folder and YAML metadata file models/<arch_name>/<model_variant>.yml for my submission. arch_name is the name of the architecture and model_variant.yml includes things like author details, training set names and important hyperparameters.
  • I uploaded all applicable prediction files to Figshare or another cloud storage service:
    • WBM energy/force/stress predictions (<yyyy-mm-dd>-<model_variant>-preds.csv.gz).
    • Model-relaxed structures in JSON Lines format (<yyyy-mm-dd>-wbm-IS2RE-FIRE.jsonl.gz).
    • Normalized 103-material phonon predictions (<yyyy-mm-dd>-phonondb-kappa-103.json.gz), with any force sets in a separate artifact.
    • Molecular-dynamics predictions (<yyyy-mm-dd>-<model_name>-md-metrics.csv.gz) — not included in this submission.
    • Diatomic predictions (<yyyy-mm-dd>-diatomics.json.gz) — not included in this submission.
  • I included the urls to the Figshare files in the YAML metadata file (models/<arch_name>/<model_variant>.yml). If not using Figshare I have included the urls to the cloud storage service in the description of the PR.
  • I followed the shared-runner requirements for calculator registration, kappa settings, and smoke tests.
  • I have run uv run --with-editable . scripts/ingest_model.py <model_variant> as described in the contributing guide to check metadata and generate the plots needed for submission. Maintainer ingestion via ingest-model label is requested above.
  • I have installed/run the pre-commit hooks (prek install or uvx prek) and ensured all checks are passing.

Marking your PR as ready to review will trigger an automated code review, please address any issues raised by the automated review. For the maintainers minimizing the final human review process enables us to merge your submissions much faster!

Additional Information (Optional)

  • I included a training script (train_<arch_name>.py) if I trained a model specifically for this benchmark.
  • I included a readme.md with additional details about my model.

Summary by CodeRabbit

  • New Features
    • Added support for the BAM-MP-core materials model.
    • The model now provides energy, free-energy, and stress predictions for compatible periodic structures.
    • Added model configuration, checkpoint details, usage requirements, licensing information, and reference links.
    • Included benchmark results for materials discovery, geometry optimization, and phonon/thermal-conductivity evaluation.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Godorina, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 31 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c0d8f43e-6c7a-43ed-96e0-cab49b392a25

📥 Commits

Reviewing files that changed from the base of the PR and between 2883231 and 217c89a.

📒 Files selected for processing (7)
  • matbench_discovery/calculators.py
  • models/bam/bam-mp-core.yml
  • site/scripts/fetch-mlip-repos-github-activity.ts
  • site/src/lib/model/ModelCard.svelte
  • site/src/lib/table/TableControls.svelte
  • site/tests/lib/MetricsTable.test.svelte.ts
  • site/tests/lib/models.test.svelte.ts
📝 Walkthrough

Walkthrough

BAM-MP-core metadata is added, and a new BAM calculator integrates checkpoint loading, periodic-graph stress defaults, and free_energy output mapping. The calculator is registered as bam_mp_core.

Changes

BAM-MP-core integration

Layer / File(s) Summary
Model metadata and benchmark configuration
models/bam/bam-mp-core.yml
Adds BAM-MP-core lifecycle, attribution, links, environment constraints, architecture settings, evaluation parameters, and benchmark metrics.
BAM calculator integration
matbench_discovery/calculators.py
Adds the BAM calculator factory, typing support, checkpoint loading, periodic stress defaults, free_energy handling, registry wiring, and formatting-only changes to _matris.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CALCULATORS
  participant download_checkpoint
  participant BAMCalculator
  participant batch_graphs
  CALCULATORS->>download_checkpoint: download .pkl checkpoint when absent
  download_checkpoint-->>CALCULATORS: return checkpoint path
  CALCULATORS->>BAMCalculator: construct calculator
  BAMCalculator->>batch_graphs: add default periodic stress
  BAMCalculator->>BAMCalculator: copy energy to free_energy
Loading

Possibly related PRs

Suggested labels: pkg, ci

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly names the main change: adding the BAM-MP-core model submission.
Description check ✅ Passed The PR description follows the template with a description, checklist, and validation notes, including the omitted artifacts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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.

@Godorina
Godorina force-pushed the bam-mp-core-resubmit branch from 2752318 to 5642a86 Compare July 16, 2026 13:52
@Godorina

Copy link
Copy Markdown
Author

Pushed a cleanup update based on current main.

Fixes included:

  • added the newly required phonon diagnostics (κ_SRD, κ_failure_rate, imaginary_mode_rate, spectrum_w1)
  • allowed discovery prediction files with model-suffixed energy columns like e_form_per_atom_bam-mp-core to load as e_form_per_atom
  • kept the PR to one clean commit on top of current main

Local validation after the update:

  • tests/models/: 200 passed
  • targeted prek hooks for touched files: passed
  • BAM discovery prediction load smoke test: passed
  • parity manifest still fails as expected until upstream ingestion: models never ingested: ['bam-mp-core']

Could a maintainer please apply ingest-model for bam-mp-core? The PR may also need payloads-unchanged before ingestion because adding the generated Model enum entry touches payload-generator inputs.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
matbench_discovery/data.py (1)

472-477: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Avoid misleading error message when id_col is missing.

If df_preds is missing id_col (e.g., material_id), set_index(id_col) will raise a KeyError, but the except block will erroneously report that the energy column was not found.

Consider explicitly checking for both columns to avoid developer confusion.

💡 Proposed fix
-            try:
-                df_out[model.label] = df_preds.set_index(id_col)[energy_col]
-            except KeyError as exc:
-                raise ValueError(
-                    f"e_form_per_atom column not found in {pred_path}"
-                ) from exc
+            if id_col not in df_preds:
+                raise ValueError(f"'{id_col}' column not found in {pred_path}")
+            if energy_col not in df_preds:
+                raise ValueError(f"'{energy_col}' column not found in {pred_path}")
+            df_out[model.label] = df_preds.set_index(id_col)[energy_col]
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@matbench_discovery/data.py` around lines 472 - 477, Update the assignment
around df_out[model.label] to validate id_col and energy_col in df_preds
separately before calling set_index. Raise a clear ValueError identifying the
missing identifier column when id_col is absent, and retain the
energy-column-specific error for a missing energy_col.
🧹 Nitpick comments (1)
matbench_discovery/data.py (1)

468-471: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Prefer using the centralized constant for the canonical prediction column.

The value "e_form_per_atom" is defined as DISCOVERY_PRED_COL in matbench_discovery.discovery. Consider importing and using that constant instead of a hardcoded string to ensure consistency across the codebase.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@matbench_discovery/data.py` around lines 468 - 471, Replace the hardcoded
"e_form_per_atom" assignment in the prediction-column handling with the
centralized DISCOVERY_PRED_COL constant imported from
matbench_discovery.discovery. Keep the existing model-specific rename logic and
column checks unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@matbench_discovery/data.py`:
- Around line 502-508: The cached load_discovery_predictions function
incorrectly keys only on an empty argument set and exposes mutable cached
DataFrames. Pass the selected models as an explicit hashable tuple, use that
tuple for load_df_wbm_with_preds instead of reading complete_models() inside the
cached function, and return copies of the resulting DataFrames so caller
mutations cannot alter cached state.

---

Outside diff comments:
In `@matbench_discovery/data.py`:
- Around line 472-477: Update the assignment around df_out[model.label] to
validate id_col and energy_col in df_preds separately before calling set_index.
Raise a clear ValueError identifying the missing identifier column when id_col
is absent, and retain the energy-column-specific error for a missing energy_col.

---

Nitpick comments:
In `@matbench_discovery/data.py`:
- Around line 468-471: Replace the hardcoded "e_form_per_atom" assignment in the
prediction-column handling with the centralized DISCOVERY_PRED_COL constant
imported from matbench_discovery.discovery. Keep the existing model-specific
rename logic and column checks unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4f7fc588-3c1b-42b0-af36-0197bac14a66

📥 Commits

Reviewing files that changed from the base of the PR and between 2752318 and 5642a86.

📒 Files selected for processing (5)
  • .pre-commit-config.yaml
  • matbench_discovery/calculators.py
  • matbench_discovery/data.py
  • matbench_discovery/enums.py
  • models/bam/bam-mp-core.yml
🚧 Files skipped from review as they are similar to previous changes (4)
  • matbench_discovery/enums.py
  • models/bam/bam-mp-core.yml
  • .pre-commit-config.yaml
  • matbench_discovery/calculators.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
matbench_discovery/data.py (1)

472-477: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Avoid misleading error message when id_col is missing.

If df_preds is missing id_col (e.g., material_id), set_index(id_col) will raise a KeyError, but the except block will erroneously report that the energy column was not found.

Consider explicitly checking for both columns to avoid developer confusion.

💡 Proposed fix
-            try:
-                df_out[model.label] = df_preds.set_index(id_col)[energy_col]
-            except KeyError as exc:
-                raise ValueError(
-                    f"e_form_per_atom column not found in {pred_path}"
-                ) from exc
+            if id_col not in df_preds:
+                raise ValueError(f"'{id_col}' column not found in {pred_path}")
+            if energy_col not in df_preds:
+                raise ValueError(f"'{energy_col}' column not found in {pred_path}")
+            df_out[model.label] = df_preds.set_index(id_col)[energy_col]
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@matbench_discovery/data.py` around lines 472 - 477, Update the assignment
around df_out[model.label] to validate id_col and energy_col in df_preds
separately before calling set_index. Raise a clear ValueError identifying the
missing identifier column when id_col is absent, and retain the
energy-column-specific error for a missing energy_col.
🧹 Nitpick comments (1)
matbench_discovery/data.py (1)

468-471: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Prefer using the centralized constant for the canonical prediction column.

The value "e_form_per_atom" is defined as DISCOVERY_PRED_COL in matbench_discovery.discovery. Consider importing and using that constant instead of a hardcoded string to ensure consistency across the codebase.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@matbench_discovery/data.py` around lines 468 - 471, Replace the hardcoded
"e_form_per_atom" assignment in the prediction-column handling with the
centralized DISCOVERY_PRED_COL constant imported from
matbench_discovery.discovery. Keep the existing model-specific rename logic and
column checks unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@matbench_discovery/data.py`:
- Around line 502-508: The cached load_discovery_predictions function
incorrectly keys only on an empty argument set and exposes mutable cached
DataFrames. Pass the selected models as an explicit hashable tuple, use that
tuple for load_df_wbm_with_preds instead of reading complete_models() inside the
cached function, and return copies of the resulting DataFrames so caller
mutations cannot alter cached state.

---

Outside diff comments:
In `@matbench_discovery/data.py`:
- Around line 472-477: Update the assignment around df_out[model.label] to
validate id_col and energy_col in df_preds separately before calling set_index.
Raise a clear ValueError identifying the missing identifier column when id_col
is absent, and retain the energy-column-specific error for a missing energy_col.

---

Nitpick comments:
In `@matbench_discovery/data.py`:
- Around line 468-471: Replace the hardcoded "e_form_per_atom" assignment in the
prediction-column handling with the centralized DISCOVERY_PRED_COL constant
imported from matbench_discovery.discovery. Keep the existing model-specific
rename logic and column checks unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4f7fc588-3c1b-42b0-af36-0197bac14a66

📥 Commits

Reviewing files that changed from the base of the PR and between 2752318 and 5642a86.

📒 Files selected for processing (5)
  • .pre-commit-config.yaml
  • matbench_discovery/calculators.py
  • matbench_discovery/data.py
  • matbench_discovery/enums.py
  • models/bam/bam-mp-core.yml
🚧 Files skipped from review as they are similar to previous changes (4)
  • matbench_discovery/enums.py
  • models/bam/bam-mp-core.yml
  • .pre-commit-config.yaml
  • matbench_discovery/calculators.py
🛑 Comments failed to post (1)
matbench_discovery/data.py (1)

502-508: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Risk of stale cache and mutable state leakage.

Using @cache on a function that depends on global state (complete_models()) and returns mutable pd.DataFrame instances introduces two major risks:

  1. Stale Data: The cache key is always empty (). If cli_args changes (e.g., across different tests mocking different models), this function will continue to return stale data from its first invocation.
  2. State Leakage: Pandas DataFrames are mutable. If any caller modifies the returned DataFrames in place, the cached state is corrupted for all subsequent callers.

Consider accepting a hashable tuple of models as an explicit argument so the cache correctly tracks inputs, and either returning copies of the DataFrames (.copy()) or removing @cache entirely.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@matbench_discovery/data.py` around lines 502 - 508, The cached
load_discovery_predictions function incorrectly keys only on an empty argument
set and exposes mutable cached DataFrames. Pass the selected models as an
explicit hashable tuple, use that tuple for load_df_wbm_with_preds instead of
reading complete_models() inside the cached function, and return copies of the
resulting DataFrames so caller mutations cannot alter cached state.

@Godorina
Godorina force-pushed the bam-mp-core-resubmit branch from 5642a86 to 129738d Compare July 16, 2026 14:06
@Godorina

Godorina commented Jul 19, 2026

Copy link
Copy Markdown
Author

Quick ping on this PR: the branch is still current with main (0 behind, 1 ahead), and the remaining failures are the expected payload/ingest gates for the newly added bam-mp-core model. Could a maintainer apply the ingest-model label (and payloads-unchanged if appropriate) so CI can complete?

@Godorina
Godorina force-pushed the bam-mp-core-resubmit branch 5 times, most recently from aeb941b to e00d7b1 Compare July 19, 2026 14:42
@Godorina
Godorina force-pushed the bam-mp-core-resubmit branch from e00d7b1 to 217c89a Compare July 19, 2026 14:45
@Godorina

Copy link
Copy Markdown
Author

Updated the PR to match the current ingestion rules: removed the manual enum/data-loader changes, kept only the BAM calculator integration plus model YAML, and switched discovery/geo-opt URLs to canonical artifacts with e_form_per_atom and structure columns. CI now has prek/scripts/vitest passing; the remaining model-pr-guard/pytest failures are the expected pre-ingestion registry/parity failures until a maintainer applies the ingest-model label.

@janosh

janosh commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Thanks for the submission! Currently hiking the alps but either me or @CompRhys will review and merge next week. Don't worry about reopening the PR, we'll handle merge conflicts

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.

2 participants