Skip to content

Commit

Permalink
fix: wrong use of bessel_nao_rcut (deepmodeling#4792)
Browse files Browse the repository at this point in the history
* fix: wrong use of bessel_nao_rcut


---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Qianruipku and pre-commit-ci-lite[bot] authored Jul 26, 2024
1 parent 4372d33 commit 7a6fe6d
Showing 12 changed files with 111 additions and 1,938 deletions.
48 changes: 32 additions & 16 deletions source/module_cell/unitcell.cpp
Original file line number Diff line number Diff line change
@@ -28,8 +28,9 @@
#endif

UnitCell::UnitCell() {
if (GlobalV::test_unitcell)
if (GlobalV::test_unitcell) {
ModuleBase::TITLE("unitcell", "Constructor");
}
Coordinate = "Direct";
latName = "none";
lat0 = 0.0;
@@ -87,8 +88,9 @@ UnitCell::~UnitCell() {
#include "module_base/parallel_common.h"
#ifdef __MPI
void UnitCell::bcast_unitcell() {
if (GlobalV::test_unitcell)
if (GlobalV::test_unitcell) {
ModuleBase::TITLE("UnitCell", "bcast_unitcell");
}
Parallel_Common::bcast_string(Coordinate);
Parallel_Common::bcast_int(nat);

@@ -167,8 +169,9 @@ void UnitCell::bcast_unitcell2() {
#endif

void UnitCell::print_cell(std::ofstream& ofs) const {
if (GlobalV::test_unitcell)
if (GlobalV::test_unitcell) {
ModuleBase::TITLE("UnitCell", "print_cell");
}

ModuleBase::GlobalFunc::OUT(ofs, "print_unitcell()");

@@ -380,18 +383,24 @@ void UnitCell::periodic_boundary_adjustment() {
Atom* atom = &this->atoms[it];
for (int ia = 0; ia < atom->na; ia++) {
// mohan update 2011-03-21
if (atom->taud[ia].x < 0)
if (atom->taud[ia].x < 0) {
atom->taud[ia].x += 1.0;
if (atom->taud[ia].y < 0)
}
if (atom->taud[ia].y < 0) {
atom->taud[ia].y += 1.0;
if (atom->taud[ia].z < 0)
}
if (atom->taud[ia].z < 0) {
atom->taud[ia].z += 1.0;
if (atom->taud[ia].x >= 1.0)
}
if (atom->taud[ia].x >= 1.0) {
atom->taud[ia].x -= 1.0;
if (atom->taud[ia].y >= 1.0)
}
if (atom->taud[ia].y >= 1.0) {
atom->taud[ia].y -= 1.0;
if (atom->taud[ia].z >= 1.0)
}
if (atom->taud[ia].z >= 1.0) {
atom->taud[ia].z -= 1.0;
}

if (atom->taud[ia].x < 0 || atom->taud[ia].y < 0
|| atom->taud[ia].z < 0 || atom->taud[ia].x >= 1.0
@@ -445,8 +454,9 @@ void UnitCell::cal_ux() {
break;
}
}
if (magnet.lsign_)
if (magnet.lsign_) {
break;
}
}
// whether the initial magnetizations is parallel
for (int it = starting_it; it < ntype; it++) {
@@ -789,8 +799,9 @@ void UnitCell::read_pseudo(std::ofstream& ofs) {
break;
}
}
if (cut_mesh % 2 == 0)
if (cut_mesh % 2 == 0) {
++cut_mesh;
}

ofs << std::setw(10) << cut_mesh << "\t"
<< "the number of mesh points." << std::endl;
@@ -1084,8 +1095,9 @@ void UnitCell::set_iat2iwt(const int& npol_in) {
// Demand : atoms[].msh
//======================
void UnitCell::cal_meshx() {
if (GlobalV::test_pseudo_cell)
if (GlobalV::test_pseudo_cell) {
ModuleBase::TITLE("UnitCell", "cal_meshx");
}
this->meshx = 0;
for (int it = 0; it < this->ntype; it++) {
const int mesh = this->atoms[it].ncpp.msh;
@@ -1104,8 +1116,9 @@ void UnitCell::cal_meshx() {
// atoms[].na
//=========================
void UnitCell::cal_natomwfc(std::ofstream& log) {
if (GlobalV::test_pseudo_cell)
if (GlobalV::test_pseudo_cell) {
ModuleBase::TITLE("UnitCell", "cal_natomwfc");
}

this->natomwfc = 0;
for (int it = 0; it < ntype; it++) {
@@ -1120,13 +1133,15 @@ void UnitCell::cal_natomwfc(std::ofstream& log) {
tmp += 2 * atoms[it].ncpp.lchi[l];
if (fabs(atoms[it].ncpp.jchi[l] - atoms[it].ncpp.lchi[l]
- 0.5)
< 1e-6)
< 1e-6) {
tmp += 2;
}
} else {
tmp += 2 * (2 * atoms[it].ncpp.lchi[l] + 1);
}
} else
} else {
tmp += 2 * atoms[it].ncpp.lchi[l] + 1;
}
}
}
natomwfc += tmp * atoms[it].na;
@@ -1208,8 +1223,9 @@ bool UnitCell::if_atoms_can_move() const {
for (int it = 0; it < this->ntype; it++) {
Atom* atom = &atoms[it];
for (int ia = 0; ia < atom->na; ia++) {
if (atom->mbl[ia].x || atom->mbl[ia].y || atom->mbl[ia].z)
if (atom->mbl[ia].x || atom->mbl[ia].y || atom->mbl[ia].z) {
return true;
}
}
}
return false;
2 changes: 1 addition & 1 deletion source/module_esolver/esolver_ks_pw.cpp
Original file line number Diff line number Diff line change
@@ -1030,7 +1030,7 @@ void ESolver_KS_PW<T, Device>::after_all_runners() {
this->kv,
this->pw_wfc,
GlobalC::ucell,
PARAM.inp.bessel_nao_rcuts[i]);
i);
}
ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running,
"BASIS OVERLAP (Q and S) GENERATION.");
2 changes: 0 additions & 2 deletions source/module_io/bcast_globalv.cpp
Original file line number Diff line number Diff line change
@@ -5,8 +5,6 @@ namespace ModuleIO
void ReadInput::set_globalv_bcast()
{
add_bool_bcast(sys.two_fermi);
add_int_bcast(sys.nrcut);
add_double_bcast(sys.bessel_nao_rcut);
add_bool_bcast(sys.dos_setemin);
add_bool_bcast(sys.dos_setemax);
add_int_bcast(sys.ncx);
1 change: 0 additions & 1 deletion source/module_io/input.h
Original file line number Diff line number Diff line change
@@ -22,7 +22,6 @@ class Input
int cond_dtbatch;
int nche_sto;
double md_tfirst;
double bessel_nao_rcut; // radial cutoff for spherical bessel functions(a.u.)
MD_para mdp;
int* orbital_corr = nullptr; ///< which correlated orbitals need corrected ;
double* hubbard_u = nullptr; ///< Hubbard Coulomb interaction parameter U(ev)
1 change: 0 additions & 1 deletion source/module_io/input_conv_tmp.cpp
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@
void Input_Conv::tmp_convert()
{
INPUT.stru_file = PARAM.inp.stru_file;
INPUT.bessel_nao_rcut = PARAM.globalv.bessel_nao_rcut;
INPUT.cond_dtbatch = PARAM.inp.cond_dtbatch;
INPUT.nche_sto = PARAM.inp.nche_sto;
INPUT.mdp = PARAM.mdp;
Loading

0 comments on commit 7a6fe6d

Please sign in to comment.