Skip to content

[Code scan] Dict cutoff validation compares whole dataset dicts to scalar model cutoffs #354

Description

@njzjz

This issue is part of a Codex global repository scan.

Problem:
When model cutoffs are dictionaries, check_cutoffs() verifies that each key exists in the dataset cutoff dict, but then compares the whole dataset dict to a scalar value. The same pattern appears for r_max, er_max, and oer_max.

Code references:
https://github.com/deepmodeling/deeptb/blob/86c60c73996f0dd961c3138f2e88424382cb734e/dptb/data/build.py#L334-L340
https://github.com/deepmodeling/deeptb/blob/86c60c73996f0dd961c3138f2e88424382cb734e/dptb/data/build.py#L346-L353
https://github.com/deepmodeling/deeptb/blob/86c60c73996f0dd961c3138f2e88424382cb734e/dptb/data/build.py#L362-L369

Impact:
Valid dict-mode cutoff configurations raise TypeError instead of being validated, so model/dataset compatibility checks fail for per-type or per-bond cutoff settings.

Suggested fix:
Compare self.r_max[key], self.er_max[key], and self.oer_max[key] to the corresponding model cutoff values.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions