deepmodeling / deepmodeling/dpti
[Code scan] water.add_bonds fails assigning molecule IDs to hydrogens
- 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
`water.add_bonds()` assigns molecule IDs to hydrogen atoms with `mole_idx[ii] = mole_idx[bonds[ii]]`. For a normal hydrogen, `bonds[ii]` is a one-element list, so NumPy returns a one-element array. Assigning that array into a scalar slot raises `ValueError` with current NumPy.
Code references
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/dpti/lib/water.py#L68
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/dpti/lib/water.py#L158
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/dpti/lib/water.py#L165
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/dpti/lib/water.py#L166
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/dpti/hti_water.py#L242
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/dpti/hti_water.py#L243
Reproduction
The CI-style test path currently reaches this through HTI water task generation:
```bash
cd tests
python -m unittest test_hti_water_gen_lammps_input.TestHtiWaterGenLammpsInput.test_hti_water_gen_old_json_gen_tasks
```
Observed result includes `ValueError: setting an array element with a sequence`.
Expected result
For H atoms, the code should use the bonded oxygen index, for example `bonds[ii][0]`, after validating that exactly one O-H owner was found.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.