deepmodeling / deepmodeling/dpti
[Code scan] list-valued spring_k crashes einstein.free_energy
- 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
`einstein.free_energy()` supports scalar `spring_k` by constructing `m_spring_k`, but if `spring_k` is already a list, `m_spring_k` is never initialized and is immediately referenced. This makes list-valued spring constants unusable in the Vega Einstein free-energy path.
Code references
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/dpti/einstein.py#L70
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/dpti/einstein.py#L71
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/dpti/einstein.py#L76
Reproduction
Create a minimal job with `in.json` containing a list-valued `spring_k`, such as `"spring_k": [1.0]`, then run:
```python
from dpti.einstein import free_energy
free_energy('JOB')
```
Expected result
List-valued spring constants should be accepted directly or validated with a clear error. They should not raise `UnboundLocalError` from an uninitialized local variable.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.