Skip to content

Commit

Permalink
fix: fix nopbc in dpdata driver (#4027)
Browse files Browse the repository at this point in the history
Sometimes dpdata data may contain `"nopbc": False` (from ase or n2p2).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved handling of the "nopbc" key in the data processing logic,
enhancing the accuracy of cell variable assignments.


<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz authored Jul 27, 2024
1 parent 7f61048 commit 0e0fc1a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion deepmd/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ def label(self, data: dict) -> dict:
atype = sorted_data["atom_types"]

coord = data["coords"].reshape((nframes, natoms * 3))
if "nopbc" not in data:
# sometimes data["nopbc"] may be False
if not data.get("nopbc", False):
cell = data["cells"].reshape((nframes, 9))
else:
cell = None
Expand Down

0 comments on commit 0e0fc1a

Please sign in to comment.