Skip to content

Commit dd6af44

Browse files
committed
Refactor: Issue a warning but not terminating the program, turn the volume to positive and continue, similar to QE's approach.
1 parent ecb4f2e commit dd6af44

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

source/module_cell/unitcell.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,13 @@ void UnitCell::setup_cell(const std::string& fn, std::ofstream& log) {
328328
this->omega = latvec.Det() * this->lat0 * lat0 * lat0;
329329
if (this->omega < 0)
330330
{
331-
ModuleBase::WARNING_QUIT("setup_cell", "The lattice vector is left-handed, please change it to right-handed.");
331+
std::cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << std::endl;
332+
std::cout << " Warning: The lattice vector is left-handed; a right-handed vector is prefered." << std::endl;
333+
std::cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << std::endl;
334+
GlobalV::ofs_warning << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << std::endl;
335+
GlobalV::ofs_warning << " Warning: The lattice vector is left-handed; a right-handed vector is prefered." << std::endl;
336+
GlobalV::ofs_warning << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << std::endl;
337+
this->omega = std::abs(this->omega);
332338
}
333339
else if (this->omega == 0)
334340
{

0 commit comments

Comments
 (0)