Skip to content

[Code scan] Water HTI MBAR bond_angle_off uses the wrong branch #126

Open

Description

@njzjz

Source: Codex global repository scan of deepmodeling/dpti at commit b719828.
Project: DeepModeling Agent Code Scan

Problem
The MBAR path in hti_water._post_tasks_mbar() contains if step == 'angle_on' or 'deep_on':, which is always true because the string 'deep_on' is truthy. Therefore the bond_angle_off branch never uses the intended -de * (1-ll) reduced-potential construction, which can silently corrupt MBAR free energies for water HTI.

Code references

if step == 'angle_on' :

if step == 'angle_on' or 'deep_on':

block_u.append(-de * (1-ll))

Reproduction
Unit-test _post_tasks_mbar(..., step='bond_angle_off') with mocked thermo data and inspect the generated block_u. The current code always takes the angle/deep branch instead of the else branch.

Expected result
The condition should explicitly test both positive cases, for example if step in ('angle_on', 'deep_on'), so bond_angle_off uses the intended reduced-potential formula.

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