File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -325,17 +325,20 @@ void UnitCell::setup_cell(const std::string& fn, std::ofstream& log) {
325325 // Firstly, latvec must be read in.
326326 // ========================================================
327327 assert (lat0 > 0.0 );
328- this ->omega = std::abs (latvec.Det ()) * this ->lat0 * lat0 * lat0;
329- if (this ->omega <= 0 ) {
330- std::cout << " The volume is negative: " << this ->omega << std::endl;
331- ModuleBase::WARNING_QUIT (" setup_cell" , " omega <= 0 ." );
332- } else {
328+ this ->omega = latvec.Det () * this ->lat0 * lat0 * lat0;
329+ if (this ->omega < 0 )
330+ {
331+ ModuleBase::WARNING_QUIT (" setup_cell" , " The lattice vector is left-handed, please change it to right-handed." );
332+ }
333+ else if (this ->omega == 0 )
334+ {
335+ ModuleBase::WARNING_QUIT (" setup_cell" , " The volume is zero." );
336+ }
337+ else
338+ {
333339 log << std::endl;
334340 ModuleBase::GlobalFunc::OUT (log, " Volume (Bohr^3)" , this ->omega );
335- ModuleBase::GlobalFunc::OUT (log,
336- " Volume (A^3)" ,
337- this ->omega
338- * pow (ModuleBase::BOHR_TO_A, 3 ));
341+ ModuleBase::GlobalFunc::OUT (log, " Volume (A^3)" , this ->omega * pow (ModuleBase::BOHR_TO_A, 3 ));
339342 }
340343
341344 // ==========================================================
You can’t perform that action at this time.
0 commit comments