deepmodeling / deepmodeling/fpop

[Code scan] Parse ABACUS DeepKS flags before deciding required files

Open
#32 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
3
Forks
13
PR merge metrics
No merged PRs in 30d

Description

This issue is a result of a Codex global code scan of `deepmodeling/fpop` at commit `b05b337590c31a5237b2dcbd9c0833b841c08cd4`.

Relevant code:
https://github.com/deepmodeling/fpop/blob/b05b337590c31a5237b2dcbd9c0833b841c08cd4/fpop/abacus.py#L399-L424
https://github.com/deepmodeling/fpop/blob/b05b337590c31a5237b2dcbd9c0833b841c08cd4/fpop/abacus.py#L466-L493

Problem:
`AbacusInputs.read_inputf()` stores all INPUT values as strings. `AbacusInputs.write_deepks()` then checks those values directly in boolean conditions:

```python
if self._input.get("deepks_out_labels", False):
need_descriptor = True
if self._input.get("deepks_scf", False):
need_descriptor = True
need_model = True
```

Strings such as `"0"`, `"false"`, and `"False"` are truthy in Python, so an INPUT file that explicitly disables DeepKS can still force descriptor/model files and fail with an assertion.

Minimal reproduction:
```text
INPUT_PARAMETERS
deepks_scf 0
deepks_out_labels 0
```

Constructing `AbacusInputs(INPUT, {"H": "H.upf"})` and calling `write_deepks()` raises `AssertionError` because `"0"` is treated as enabled.

Expected behavior:
DeepKS switches should be parsed with ABACUS-compatible boolean semantics before `write_deepks()` decides whether descriptor or model files are required.

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.