Skip to content

Conversation

@anyangml
Copy link
Collaborator

This PR refactors the logic of calculator instantiation. We anticipate more LAMs to be trained with OMol25, MPTjr, and Omat24 together in the near future. As a consequence, it makes more sense to use domain-match modality for some generalizability tests. In an upcoming PR, we will introduce three OOD-FF test sets with two different DFT settings matching OMol25 and MPtrj, respectively.

@anyangml anyangml requested review from caic99 and Copilot October 29, 2025 06:59
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 refactors model instantiation to support multi-domain models (molecules vs. materials) by deferring model creation until the task domain is known. The key changes enable models like those trained on OMol25 to use different calculator heads based on whether they're processing molecular or materials tasks.

  • Splits model gathering into parameter collection (gather_model_params) and late model instantiation (gather_model)
  • Adds model_domain and supports_omol fields to support domain-specific calculator initialization
  • Changes calc from a cached property to a regular property with setter support for testing

Reviewed Changes

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

Show a summary per file
File Description
lambench/workflow/entrypoint.py Refactors model gathering to defer instantiation; adds domain-based model creation
lambench/models/basemodel.py Adds supports_omol and model_domain attributes for multi-domain support
lambench/models/ase_models.py Changes calc to property with setter; adds domain-aware calculator initialization
lambench/metrics/utils.py Updates to use new gather_model_params and gather_model functions
tests/workflow/test_entrypoint.py Updates test fixture to return dict instead of DPModel instance
tests/tasks/calculator/test_nve_md.py Simplifies test fixtures by leveraging default EMT calculator fallback

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

import pytest
from ase import Atoms
from ase.calculators.emt import EMT
from lambench.models.ase_models import ASEModel
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

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

Import of 'Calculator' is not used.

Suggested change
from lambench.models.ase_models import ASEModel

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

❌ Patch coverage is 66.66667% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.96%. Comparing base (063ad5e) to head (e1f3d26).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
lambench/workflow/entrypoint.py 59.09% 5 Missing and 4 partials ⚠️
lambench/models/ase_models.py 61.11% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #372      +/-   ##
==========================================
+ Coverage   65.89%   65.96%   +0.06%     
==========================================
  Files          35       35              
  Lines        1589     1604      +15     
  Branches      189      192       +3     
==========================================
+ Hits         1047     1058      +11     
- Misses        500      502       +2     
- Partials       42       44       +2     

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

@anyangml anyangml requested a review from Copilot October 29, 2025 07:06
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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.


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

@anyangml anyangml requested a review from Copilot October 29, 2025 07:21
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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

lambench/models/ase_models.py:1

  • The property getter doesn't check if self._calc is already initialized before recreating the calculator. This means every access to calc will reinitialize the calculator, which is inefficient and may cause issues. Add a check: if self._calc is not None: return self._calc at the beginning of the property getter.
from __future__ import annotations

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

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