deepmodeling / deepmodeling/dftio
[Code scan] Keep SIESTA density-matrix keys aligned with filtered blocks
- Dominant language
- Jupyter Notebook
- Stars
- 16
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
This issue comes from a Codex global repository scan.
## Problem
SIESTA density-matrix parsing filters keys with `block_mask`, but zips those filtered keys with the unfiltered `block` array:
https://github.com/deepmodeling/dftio/blob/c9d128f24a74ef2911e1a28f5640357488beb196/dftio/io/siesta/siesta_parser.py#L530-L535
If an earlier R block is below threshold, later retained keys receive the wrong matrix. This silently corrupts density-matrix blocks.
## Reproduction
With `block_mask = [False, True]`, the first retained key is zipped with `block[0]`, not `block[1]`.
## Suggested fix
Filter values with the same mask before zipping:
```python
DM_blocks_dict[block_index] = dict(zip(keys, block[block_mask]))
```
Contributor guide
Assessment
This issue has not been assessed yet.