@@ -1125,16 +1125,16 @@ void UnitCell::check_dtau() {
11251125
11261126void UnitCell::read_orb_file (int it, std::string &orb_file, std::ofstream &ofs_running, Atom* atom)
11271127{
1128- // the maximum L is 7 , according to the basissetexchange https://www.basissetexchange.org/
1129- // there is no orbitals with L>7 presently
1130- const std::string spectrum = " SPDFGHIK " ;
1128+ // the maximum L is 9 like cc-pV9Z , according to the basissetexchange https://www.basissetexchange.org/
1129+ // there is no orbitals with L>9 presently
1130+ const std::string spectrum = " SPDFGHIKLM " ;
11311131 std::ifstream ifs (orb_file.c_str (), std::ios::in); // pengfei 2014-10-13
11321132 // mohan add return 2021-04-26
11331133 if (!ifs)
11341134 {
11351135 std::cout << " Element index " << it+1 << std::endl;
11361136 std::cout << " orbital file: " << orb_file << std::endl;
1137- ModuleBase::WARNING_QUIT (" read_orb_file" ," ABACUS Cannot find the ORBITAL file (basis sets)" );
1137+ ModuleBase::WARNING_QUIT (" UnitCell:: read_orb_file" , " ABACUS Cannot find the ORBITAL file (basis sets)" );
11381138 }
11391139 std::string word;
11401140 atom->nw = 0 ;
@@ -1156,21 +1156,33 @@ void UnitCell::read_orb_file(int it, std::string &orb_file, std::ofstream &ofs_r
11561156 {
11571157 ModuleBase::GlobalFunc::READ_VALUE (ifs, atom->Rcut );
11581158 }
1159- for ( int i = 0 ; i < spectrum. size (); i++ )
1159+ if ( FmtCore::endswith (word, " orbital--> " ) )
11601160 {
1161- if (word == spectrum.substr (i, 1 ) + " orbital-->" )
1161+ bool valid = false ;
1162+ for (int i = 0 ; i < spectrum.size (); i++)
11621163 {
1163- ModuleBase::GlobalFunc::READ_VALUE (ifs, atom->l_nchi [i]);
1164- atom->nw += (2 *i + 1 ) * atom->l_nchi [i];
1165- std::stringstream ss;
1166- ss << " L=" << i << " , number of zeta" ;
1167- ModuleBase::GlobalFunc::OUT (ofs_running,ss.str (),atom->l_nchi [i]);
1164+ if (word == spectrum.substr (i, 1 ) + " orbital-->" )
1165+ {
1166+ ModuleBase::GlobalFunc::READ_VALUE (ifs, atom->l_nchi [i]);
1167+ atom->nw += (2 *i + 1 ) * atom->l_nchi [i];
1168+ std::stringstream ss;
1169+ ss << " L=" << i << " , number of zeta" ;
1170+ ModuleBase::GlobalFunc::OUT (ofs_running,ss.str (),atom->l_nchi [i]);
1171+ valid = true ;
1172+ break ;
1173+ }
1174+ }
1175+ if (!valid)
1176+ {
1177+ ModuleBase::WARNING_QUIT (" UnitCell::read_orb_file" ,
1178+ " ABACUS does not support numerical atomic orbital with L > 9, "
1179+ " or an invalid orbital label is found in the ORBITAL file." );
11681180 }
11691181 }
11701182 }
11711183 ifs.close ();
11721184 if (!atom->nw )
11731185 {
1174- ModuleBase::WARNING_QUIT (" read_orb_file" ," get nw = 0" );
1186+ ModuleBase::WARNING_QUIT (" UnitCell:: read_orb_file" ," get nw = 0" );
11751187 }
11761188}
0 commit comments