Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions source/module_cell/read_pp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,4 +478,13 @@ void Pseudopot_upf::setqfnew(const int& nqf,
}
rho[ir] *= pow(r[ir], l + n);
}
}

void Pseudopot_upf::skip_number(std::ifstream& ifs, bool mesh_changed)
{
if (mesh_changed)
{
double temp = 0.;
ifs >> temp;
}
}
1 change: 1 addition & 0 deletions source/module_cell/read_pp.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class Pseudopot_upf

private:
bool mesh_changed = false; // if the mesh is even, it will be changed to odd
void skip_number(std::ifstream& ifs, bool mesh_changed); // skip the last number if the mesh is even

int set_pseudo_type(const std::string& fn, std::string& type);
std::string& trim(std::string& in_str);
Expand Down
13 changes: 7 additions & 6 deletions source/module_cell/read_pp_upf100.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ void Pseudopot_upf::read_pseudo_mesh(std::ifstream &ifs, Atom_pseudo& pp)
{
ifs >> pp.r[ir];
}
this->skip_number(ifs, this->mesh_changed);
ModuleBase::GlobalFunc::SCAN_END(ifs, "</PP_R>");
}

Expand All @@ -245,6 +246,7 @@ void Pseudopot_upf::read_pseudo_mesh(std::ifstream &ifs, Atom_pseudo& pp)
{
ifs >> pp.rab[ir];
}
this->skip_number(ifs, this->mesh_changed);
ModuleBase::GlobalFunc::SCAN_END(ifs, "</PP_RAB>");
}
return;
Expand All @@ -258,6 +260,7 @@ void Pseudopot_upf::read_pseudo_nlcc(std::ifstream &ifs, Atom_pseudo& pp)
{
ifs >> pp.rho_atc[ir];
}
this->skip_number(ifs, this->mesh_changed);
return;
}

Expand All @@ -270,7 +273,7 @@ void Pseudopot_upf::read_pseudo_local(std::ifstream &ifs, Atom_pseudo& pp)
{
ifs >> pp.vloc_at[ir];
}
this->skip_number(ifs, this->mesh_changed);
return;
}

Expand Down Expand Up @@ -406,6 +409,7 @@ void Pseudopot_upf::read_pseudo_nl(std::ifstream &ifs, Atom_pseudo& pp)
ifs >> qfunc(nmb, ir);
}
}
this->skip_number(ifs, this->mesh_changed);

if (this->nqf > 0)
{
Expand Down Expand Up @@ -445,11 +449,7 @@ void Pseudopot_upf::read_pseudo_pswfc(std::ifstream &ifs, Atom_pseudo& pp)
{
ifs >> pp.chi(i, ir);
}
if (this->mesh_changed)
{
double temp = 0.0;
ifs >> temp;
}
this->skip_number(ifs, this->mesh_changed);
}
return;
}
Expand All @@ -461,6 +461,7 @@ void Pseudopot_upf::read_pseudo_rhoatom(std::ifstream &ifs, Atom_pseudo& pp)
{
ifs >> pp.rho_at[ir];
}
this->skip_number(ifs, this->mesh_changed);
return;
}

Expand Down
9 changes: 9 additions & 0 deletions source/module_cell/read_pp_upf201.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ int Pseudopot_upf::read_pseudo_upf201(std::ifstream &ifs, Atom_pseudo& pp)
{
ifs >> pp.rho_atc[ir];
}
this->skip_number(ifs, this->mesh_changed);
ModuleBase::GlobalFunc::SCAN_END(ifs, "</PP_NLCC>");
}

Expand All @@ -53,6 +54,7 @@ int Pseudopot_upf::read_pseudo_upf201(std::ifstream &ifs, Atom_pseudo& pp)
{
ifs >> pp.vloc_at[ir];
}
this->skip_number(ifs, this->mesh_changed);
ModuleBase::GlobalFunc::SCAN_END(ifs, "</PP_LOCAL>");
}

Expand Down Expand Up @@ -90,6 +92,7 @@ int Pseudopot_upf::read_pseudo_upf201(std::ifstream &ifs, Atom_pseudo& pp)
{
ifs >> pp.rho_at[ir];
}
this->skip_number(ifs, this->mesh_changed);
ModuleBase::GlobalFunc::SCAN_END(ifs, "</PP_RHOATOM>");

//--------------------------------------
Expand Down Expand Up @@ -406,6 +409,7 @@ void Pseudopot_upf::read_pseudo_upf201_mesh(std::ifstream& ifs, Atom_pseudo& pp)
{
ifs >> pp.r[ir];
}
this->skip_number(ifs, this->mesh_changed);
ModuleBase::GlobalFunc::SCAN_END(ifs, "</PP_R>");

if (ModuleBase::GlobalFunc::SCAN_BEGIN(ifs, "<PP_RAB", true, false))
Expand All @@ -420,6 +424,7 @@ void Pseudopot_upf::read_pseudo_upf201_mesh(std::ifstream& ifs, Atom_pseudo& pp)
{
ifs >> pp.rab[ir];
}
this->skip_number(ifs, this->mesh_changed);
ModuleBase::GlobalFunc::SCAN_END(ifs, "</PP_RAB>");
ModuleBase::GlobalFunc::SCAN_END(ifs, "</PP_MESH>");
}
Expand Down Expand Up @@ -497,6 +502,7 @@ void Pseudopot_upf::read_pseudo_upf201_nonlocal(std::ifstream& ifs, Atom_pseudo&
{
ifs >> pp.betar(ib, ir);
}
this->skip_number(ifs, this->mesh_changed);
word = "</PP_BETA." + std::to_string(ib + 1) + ">";
ModuleBase::GlobalFunc::SCAN_END(ifs, word);
}
Expand Down Expand Up @@ -639,6 +645,7 @@ void Pseudopot_upf::read_pseudo_upf201_nonlocal(std::ifstream& ifs, Atom_pseudo&
{
ifs >> pp.qfuncl(l, nmb, ir);
}
this->skip_number(ifs, this->mesh_changed);
word = "</PP_QIJL." + std::to_string(nb + 1) + "." + std::to_string(mb + 1) + "."
+ std::to_string(l) + ">";
ModuleBase::GlobalFunc::SCAN_END(ifs, word);
Expand All @@ -653,6 +660,7 @@ void Pseudopot_upf::read_pseudo_upf201_nonlocal(std::ifstream& ifs, Atom_pseudo&
{
ifs >> this->qfunc(nmb, ir);
}
this->skip_number(ifs, this->mesh_changed);
word = "</PP_QIJ." + std::to_string(nb + 1) + "." + std::to_string(mb + 1) + ">";
ModuleBase::GlobalFunc::SCAN_END(ifs, word);
}
Expand Down Expand Up @@ -757,6 +765,7 @@ void Pseudopot_upf::read_pseudo_upf201_pswfc(std::ifstream& ifs, Atom_pseudo& pp
{
assert(pp.chi.c[iw * pp.mesh + ir] == pp.chi(iw, ir));
}
this->skip_number(ifs, this->mesh_changed);
word = "</PP_CHI." + std::to_string(iw + 1) + ">";
ModuleBase::GlobalFunc::SCAN_END(ifs, word);
}
Expand Down
Loading