Skip to content

Commit 0e0fc1a

Browse files
authored
fix: fix nopbc in dpdata driver (#4027)
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 <jinzhe.zeng@rutgers.edu>
1 parent 7f61048 commit 0e0fc1a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

deepmd/driver.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ def label(self, data: dict) -> dict:
6262
atype = sorted_data["atom_types"]
6363

6464
coord = data["coords"].reshape((nframes, natoms * 3))
65-
if "nopbc" not in data:
65+
# sometimes data["nopbc"] may be False
66+
if not data.get("nopbc", False):
6667
cell = data["cells"].reshape((nframes, 9))
6768
else:
6869
cell = None

0 commit comments

Comments
 (0)