Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions source/source_io/module_parameter/read_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,32 +522,32 @@ void ReadInput::check_ntype(const std::string& fn, int& param_ntype)
{
break;
}
else if (isalpha(temp[0]))
else if (!temp.empty() && isalpha(temp[0]))
{
Comment thread
sunliang98 marked this conversation as resolved.
Outdated
ntype_stru += 1;
}
}
}

if (param_ntype == 0)
if (ntype_stru <= 0)
{
param_ntype = ntype_stru;
GlobalV::ofs_running << " 'ntype' is no longer required in INPUT, and "
"it will be ignored. "
<< std::endl;
ModuleBase::WARNING_QUIT("ReadInput",
"Failed to detect valid ntype from STRU: no valid ATOMIC_SPECIES entries were found.");
}

if (param_ntype < 0)
{
ModuleBase::WARNING_QUIT("ReadInput", "The ntype in INPUT should not be less than 0.");
}
Comment thread
sunliang98 marked this conversation as resolved.
Outdated
else if (param_ntype != ntype_stru)
else if (param_ntype != 0 && param_ntype != ntype_stru)
{
ModuleBase::WARNING_QUIT("ReadInput",
"The ntype in INPUT is not equal to the ntype "
"counted in STRU, check it.");
}
if (param_ntype <= 0)
{
ModuleBase::WARNING_QUIT("ReadInput", "ntype should be greater than 0.");
}
else
else if (param_ntype == 0)
{
param_ntype = ntype_stru;
GlobalV::ofs_running << " 'ntype' is automatically set to " << param_ntype << std::endl;
}
}
Expand Down
Loading