Skip to content

Commit 6ba9779

Browse files
author
Han Wang
committed
raise exception when det(cell) < 0
1 parent f209b4f commit 6ba9779

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

source/lib/include/SimulationRegion_Impl.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,9 @@ computeVolume()
500500
boxt[0*3+1] * (boxt[1*3+0]*boxt[2*3+2] - boxt[2*3+0]*boxt[1*3+2]) +
501501
boxt[0*3+2] * (boxt[1*3+0]*boxt[2*3+1] - boxt[2*3+0]*boxt[1*3+1]);
502502
volumei = static_cast<double>(1.)/volume;
503+
if (volume < 0) {
504+
throw std::runtime_error("Negative volume detected. Please make sure the simulation cell obeys the right-hand rule.");
505+
}
503506
}
504507

505508
template<typename VALUETYPE>

0 commit comments

Comments
 (0)