Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

throw errros if rmin is no less than rmax #3393

Merged
merged 9 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions deepmd/dpmodel/utils/env_mat.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
rmax: float,
):
"""Compute smooth weight for descriptor elements."""
if rmin >= rmax:
raise ValueError("rmin should be less than rmax.")

Check warning on line 21 in deepmd/dpmodel/utils/env_mat.py

View check run for this annotation

Codecov / codecov/patch

deepmd/dpmodel/utils/env_mat.py#L20-L21

Added lines #L20 - L21 were not covered by tests
min_mask = distance <= rmin
max_mask = distance >= rmax
mid_mask = np.logical_not(np.logical_or(min_mask, max_mask))
Expand Down
2 changes: 2 additions & 0 deletions deepmd/pt/utils/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@

def compute_smooth_weight(distance, rmin: float, rmax: float):
"""Compute smooth weight for descriptor elements."""
if rmin >= rmax:
raise ValueError("rmin should be less than rmax.")

Check warning on line 232 in deepmd/pt/utils/preprocess.py

View check run for this annotation

Codecov / codecov/patch

deepmd/pt/utils/preprocess.py#L231-L232

Added lines #L231 - L232 were not covered by tests
min_mask = distance <= rmin
max_mask = distance >= rmax
mid_mask = torch.logical_not(torch.logical_or(min_mask, max_mask))
Expand Down
Loading