Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: support lmax of orbital 8,9 #5528

Merged
merged 3 commits into from
Nov 20, 2024
Merged
Changes from all commits
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
36 changes: 24 additions & 12 deletions source/module_cell/read_atoms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1125,16 +1125,16 @@ void UnitCell::check_dtau() {

void UnitCell::read_orb_file(int it, std::string &orb_file, std::ofstream &ofs_running, Atom* atom)
{
// the maximum L is 7, according to the basissetexchange https://www.basissetexchange.org/
// there is no orbitals with L>7 presently
const std::string spectrum = "SPDFGHIK";
// the maximum L is 9 like cc-pV9Z, according to the basissetexchange https://www.basissetexchange.org/
// there is no orbitals with L>9 presently
const std::string spectrum = "SPDFGHIKLM";
std::ifstream ifs(orb_file.c_str(), std::ios::in); // pengfei 2014-10-13
// mohan add return 2021-04-26
if (!ifs)
{
std::cout << " Element index " << it+1 << std::endl;
std::cout << " orbital file: " << orb_file << std::endl;
ModuleBase::WARNING_QUIT("read_orb_file","ABACUS Cannot find the ORBITAL file (basis sets)");
ModuleBase::WARNING_QUIT("UnitCell::read_orb_file", "ABACUS Cannot find the ORBITAL file (basis sets)");
}
std::string word;
atom->nw = 0;
Expand All @@ -1156,21 +1156,33 @@ void UnitCell::read_orb_file(int it, std::string &orb_file, std::ofstream &ofs_r
{
ModuleBase::GlobalFunc::READ_VALUE(ifs, atom->Rcut);
}
for (int i = 0; i < spectrum.size(); i++)
if (FmtCore::endswith(word, "orbital-->"))
{
if (word == spectrum.substr(i, 1) + "orbital-->")
bool valid = false;
for (int i = 0; i < spectrum.size(); i++)
{
ModuleBase::GlobalFunc::READ_VALUE(ifs, atom->l_nchi[i]);
atom->nw += (2*i + 1) * atom->l_nchi[i];
std::stringstream ss;
ss << "L=" << i << ", number of zeta";
ModuleBase::GlobalFunc::OUT(ofs_running,ss.str(),atom->l_nchi[i]);
if (word == spectrum.substr(i, 1) + "orbital-->")
{
ModuleBase::GlobalFunc::READ_VALUE(ifs, atom->l_nchi[i]);
atom->nw += (2*i + 1) * atom->l_nchi[i];
std::stringstream ss;
ss << "L=" << i << ", number of zeta";
ModuleBase::GlobalFunc::OUT(ofs_running,ss.str(),atom->l_nchi[i]);
valid = true;
break;
}
}
if (!valid)
{
ModuleBase::WARNING_QUIT("UnitCell::read_orb_file",
"ABACUS does not support numerical atomic orbital with L > 9, "
"or an invalid orbital label is found in the ORBITAL file.");
}
}
}
ifs.close();
if(!atom->nw)
{
ModuleBase::WARNING_QUIT("read_orb_file","get nw = 0");
ModuleBase::WARNING_QUIT("UnitCell::read_orb_file","get nw = 0");
}
}
Loading