dpdata: RuntimeError: system has virials, but this does not #1851
Replies: 2 comments
|
The error happens because some of your systems have virials (stress tensor data) and others do not, and dpdata requires all systems in a MultiSystems object to have the same set of data fields. This usually occurs if some OUTCAR files are missing virial data, often due to VASP INCAR settings like To fix:
Best practice: always ensure all systems you append have the same set of data fields (virials, forces, energies, etc.) to avoid this and similar errors. To reply, just mention @dosu. Docs are dead. Just use Dosu. |
|
The main diagnosis in Dosu's answer is correct: systems being appended must consistently either contain virials or omit them. However, Check each parsed system directly: for name, system in systems:
print(name, "virials" in system.data, system.get_nframes())A missing virial commonly indicates an incomplete/unconverged/truncated OUTCAR, a differently generated calculation, or a parser issue. Regenerate or reparse those calculations so every frame has consistent energy, force, and virial labels if you intend to train stresses. If virials are intentionally not needed, remove the field consistently from all systems before appending: for system in systems:
system.data.pop("virials", None)Do not fill missing virials with zeros: that creates incorrect stress labels. It is also useful to load and append one OUTCAR at a time so the first failing filename is explicit, then inspect whether its ionic/electronic calculation completed normally. Coding agent: Codex |
Uh oh!
There was an error while loading. Please reload this page.
I used dpdata to prepare training_data and validation_data from a series OUTCAR of AIMD. However, the dpdata stopped due to the error:
RuntimeError Traceback (most recent call last)
Cell In[1], line 50
48 data.append(data_6ring1)
49 data.append(data_6ring2)
---> 50 data.append(data_10ring1_shxy01)
51 data.append(data_10ring1_shxz01)
52 data.append(data_10ring1_shyx01)
File /opt/deepmd-kit-3.1.0/lib/python3.12/site-packages/dpdata/system.py:1509, in MultiSystems.append(self, *systems)
1507 for system in systems:
1508 if isinstance(system, System):
-> 1509 self.__append(system)
1510 elif isinstance(system, MultiSystems):
1511 for sys in system:
File /opt/deepmd-kit-3.1.0/lib/python3.12/site-packages/dpdata/system.py:1524, in MultiSystems.__append(self, system)
1522 formula = system.formula
1523 if formula in self.systems:
-> 1524 self.systems[formula].append(system)
1525 else:
1526 self.systems[formula] = system.copy()
File /opt/deepmd-kit-3.1.0/lib/python3.12/site-packages/dpdata/system.py:507, in System.append(self, system)
505 if tt.shape is not None and Axis.NFRAMES in tt.shape:
506 if tt.name not in self.data and tt.name in system.data:
--> 507 raise RuntimeError(f"system has {tt.name}, but this does not")
508 elif tt.name in self.data and tt.name not in system.data:
509 raise RuntimeError(f"this has {tt.name}, but system does not")
RuntimeError: system has virials, but this does not
How to fix it?
All reactions