deepmodeling / deepmodeling/dpti

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

Open
#126 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
42
Forks
27
PR merge metrics
No merged PRs in 30d

Description

Source: Codex global repository scan of deepmodeling/dpti at commit b719828e7eeb571bd26411430197cd74ea78e38c.
Project: https://github.com/orgs/deepmodeling/projects/27

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
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/dpti/hti_water.py#L544
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/dpti/hti_water.py#L555
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/dpti/hti_water.py#L558

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.