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 pseudopotential with dense grid #3678

Merged
merged 8 commits into from
Mar 8, 2024
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
2 changes: 1 addition & 1 deletion source/module_cell/pseudo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void pseudo::set_pseudo_h(const Pseudopot_upf &upf)

// mohan update 2021-02-22
// max number of points in the atomic radial mesh
int ndmx = 2000;
int ndmx = 200000;
if (this->mesh > ndmx)
{
std::cout << "\n set_pseudo_h, too many grid points,";
Expand Down
12 changes: 12 additions & 0 deletions source/module_cell/read_pp_blps.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include "read_pp.h"
#include "module_base/atom_in.h"
#include "module_base/element_name.h"

int Pseudopot_upf::read_pseudo_blps(std::ifstream &ifs)
{
Expand Down Expand Up @@ -37,6 +39,16 @@ int Pseudopot_upf::read_pseudo_blps(std::ifstream &ifs)
this->zp = static_cast<int>(zion);
ifs.ignore(300, '\n');

atom_in ai;
for (auto each_type: ModuleBase::element_name)
{
if (zatom == ai.atom_Z[each_type])
{
this->psd = each_type;
break;
}
}

int pspcod, pspxc, lloc, r2well;
ifs >> pspcod >> pspxc >> this->lmax >> lloc >> this->mesh >> r2well;

Expand Down
2 changes: 1 addition & 1 deletion source/module_cell/test/read_pp_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ TEST_F(ReadPPTest, BLPS)
EXPECT_FALSE(upf->tvanp);
EXPECT_FALSE(upf->has_so);
EXPECT_EQ(upf->nbeta,0);
EXPECT_EQ(upf->psd,"Silicon");
EXPECT_EQ(upf->psd,"Si");
EXPECT_EQ(upf->zp,4);
EXPECT_EQ(upf->lmax,0);
EXPECT_EQ(upf->mesh,1601);
Expand Down
12 changes: 9 additions & 3 deletions source/module_elecstate/module_charge/charge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,15 @@ void Charge::atomic_rho(const int spin_number_need,
rhoatm[ir] = atom->ncpp.rho_at[ir] / ModuleBase::FOUR_PI / r2;
}
rhoatm[0]
= pow((rhoatm[2] / rhoatm[1]), 1. / (atom->ncpp.r[2] - atom->ncpp.r[1])); // zws add
rhoatm[0] = pow(rhoatm[0], atom->ncpp.r[1]);
rhoatm[0] = rhoatm[1] / rhoatm[0];
= pow((rhoatm[2] / rhoatm[1]), atom->ncpp.r[1] / (atom->ncpp.r[2] - atom->ncpp.r[1])); // zws add, sunliang updated 2024-03-04
if (rhoatm[0] < 1e-12)
{
rhoatm[0] = rhoatm[1];
}
else
{
rhoatm[0] = rhoatm[1] / rhoatm[0];
}

double charge = 0.0;
ModuleBase::Integral::Simpson_Integral(atom->ncpp.msh,
Expand Down
Loading