Skip to content

Commit

Permalink
fix: don't distinguish nlist types in high model interfaces (#4386)
Browse files Browse the repository at this point in the history
It will be distinguished in the low interfaces anyway.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Enhanced handling of atomic types in model predictions, simplifying
neighbor list processing.
- Updated logic for neighbor list construction, improving clarity and
consistency.

- **Bug Fixes**
- Adjusted logic for distinguishing atomic types, potentially improving
model performance.

- **Documentation**
- Improved docstrings for methods to clarify expected input shapes and
parameters.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
  • Loading branch information
njzjz authored Nov 21, 2024
1 parent e7925f3 commit 6febc71
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion deepmd/dpmodel/model/make_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ def model_call_from_call_lower(
nloc,
rcut,
sel,
distinguish_types=not mixed_types,
# types will be distinguished in the lower interface,
# so it doesn't need to be distinguished here
distinguish_types=False,
)
extended_coord = extended_coord.reshape(nframes, -1, 3)
model_predict_lower = call_lower(
Expand Down
4 changes: 3 additions & 1 deletion deepmd/jax/jax2tf/make_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ def model_call_from_call_lower(
nloc,
rcut,
sel,
distinguish_types=not mixed_types,
# types will be distinguished in the lower interface,
# so it doesn't need to be distinguished here
distinguish_types=False,
)
extended_coord = extended_coord.reshape(nframes, -1, 3)
model_predict_lower = call_lower(
Expand Down
4 changes: 3 additions & 1 deletion deepmd/pt/model/model/make_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ def forward_common(
atype,
self.get_rcut(),
self.get_sel(),
mixed_types=self.mixed_types(),
# types will be distinguished in the lower interface,
# so it doesn't need to be distinguished here
mixed_types=True,
box=bb,
)
model_predict_lower = self.forward_common_lower(
Expand Down

0 comments on commit 6febc71

Please sign in to comment.