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
2 changes: 0 additions & 2 deletions source/driver_run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
void Driver::driver_run()
{
ModuleBase::TITLE("Driver", "driver_line");
ModuleBase::timer::tick("Driver", "driver_line");

//! 1: setup cell and atom information
// this warning should not be here, mohan 2024-05-22
Expand Down Expand Up @@ -93,6 +92,5 @@ void Driver::driver_run()

//! 6: output the json file
Json::create_Json(&ucell, PARAM);
ModuleBase::timer::tick("Driver", "driver_line");
return;
}
38 changes: 24 additions & 14 deletions source/module_basis/module_pw/pw_gatherscatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace ModulePW
template <typename T>
void PW_Basis::gatherp_scatters(std::complex<T>* in, std::complex<T>* out) const
{
ModuleBase::timer::tick(this->classname, "gatherp_scatters");
//ModuleBase::timer::tick(this->classname, "gatherp_scatters");

if(this->poolnproc == 1) //In this case nst=nstot, nz = nplane,
{
Expand All @@ -32,7 +32,7 @@ void PW_Basis::gatherp_scatters(std::complex<T>* in, std::complex<T>* out) const
outp[iz] = inp[iz];
}
}
ModuleBase::timer::tick(this->classname, "gatherp_scatters");
//ModuleBase::timer::tick(this->classname, "gatherp_scatters");
return;
}
#ifdef __MPI
Expand All @@ -55,10 +55,15 @@ void PW_Basis::gatherp_scatters(std::complex<T>* in, std::complex<T>* out) const

//exchange data
//(nplane,nstot) to (numz[ip],ns, poolnproc)
if(typeid(T) == typeid(double))
MPI_Alltoallv(out, numr, startr, MPI_DOUBLE_COMPLEX, in, numg, startg, MPI_DOUBLE_COMPLEX, this->pool_world);
else if(typeid(T) == typeid(float))
MPI_Alltoallv(out, numr, startr, MPI_COMPLEX, in, numg, startg, MPI_COMPLEX, this->pool_world);
if(typeid(T) == typeid(double))
{
MPI_Alltoallv(out, numr, startr, MPI_DOUBLE_COMPLEX, in, numg, startg, MPI_DOUBLE_COMPLEX, this->pool_world);
}
else if(typeid(T) == typeid(float))
{
MPI_Alltoallv(out, numr, startr, MPI_COMPLEX, in, numg, startg, MPI_COMPLEX, this->pool_world);
}

// change (nz,ns) to (numz[ip],ns, poolnproc)
#ifdef _OPENMP
#pragma omp parallel for collapse(2)
Expand All @@ -80,7 +85,7 @@ void PW_Basis::gatherp_scatters(std::complex<T>* in, std::complex<T>* out) const
}

#endif
ModuleBase::timer::tick(this->classname, "gatherp_scatters");
//ModuleBase::timer::tick(this->classname, "gatherp_scatters");
return;
}

Expand All @@ -94,7 +99,7 @@ void PW_Basis::gatherp_scatters(std::complex<T>* in, std::complex<T>* out) const
template <typename T>
void PW_Basis::gathers_scatterp(std::complex<T>* in, std::complex<T>* out) const
{
ModuleBase::timer::tick(this->classname, "gathers_scatterp");
//ModuleBase::timer::tick(this->classname, "gathers_scatterp");

if(this->poolnproc == 1) //In this case nrxx=fftnx*fftny*nz, nst = nstot,
{
Expand Down Expand Up @@ -147,10 +152,15 @@ void PW_Basis::gathers_scatterp(std::complex<T>* in, std::complex<T>* out) const

//exchange data
//(numz[ip],ns, poolnproc) to (nplane,nstot)
if(typeid(T) == typeid(double))
MPI_Alltoallv(out, numg, startg, MPI_DOUBLE_COMPLEX, in, numr, startr, MPI_DOUBLE_COMPLEX, this->pool_world);
else if(typeid(T) == typeid(float))
MPI_Alltoallv(out, numg, startg, MPI_COMPLEX, in, numr, startr, MPI_COMPLEX, this->pool_world);
if(typeid(T) == typeid(double))
{
MPI_Alltoallv(out, numg, startg, MPI_DOUBLE_COMPLEX, in, numr, startr, MPI_DOUBLE_COMPLEX, this->pool_world);
}
else if(typeid(T) == typeid(float))
{
MPI_Alltoallv(out, numg, startg, MPI_COMPLEX, in, numr, startr, MPI_COMPLEX, this->pool_world);
}

#ifdef _OPENMP
#pragma omp parallel for schedule(static, 4096/sizeof(T))
#endif
Expand All @@ -175,10 +185,10 @@ void PW_Basis::gathers_scatterp(std::complex<T>* in, std::complex<T>* out) const
}

#endif
ModuleBase::timer::tick(this->classname, "gathers_scatterp");
//ModuleBase::timer::tick(this->classname, "gathers_scatterp");
return;
}



}
}
4 changes: 2 additions & 2 deletions source/module_cell/klist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void K_Vectors::set(const UnitCell& ucell,
{
ModuleBase::TITLE("K_Vectors", "set");

ofs << "\n\n\n\n";
ofs << "\n\n";
ofs << " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << std::endl;
ofs << " | |" << std::endl;
ofs << " | Setup K-points |" << std::endl;
Expand All @@ -61,7 +61,7 @@ void K_Vectors::set(const UnitCell& ucell,
ofs << " | We treat the spin as another set of k-points. |" << std::endl;
ofs << " | |" << std::endl;
ofs << " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << std::endl;
ofs << "\n\n\n\n";
ofs << "\n\n";

ofs << "\n SETUP K-POINTS" << std::endl;

Expand Down
9 changes: 3 additions & 6 deletions source/module_cell/print_cell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,16 @@ namespace unitcell
bool direct = (Coordinate == "Direct");
std::string table;
table += direct? "DIRECT COORDINATES\n": FmtCore::format("CARTESIAN COORDINATES ( UNIT = %20.12f Bohr ).\n", lat0);
const std::string redundant_header = direct? "taud_": "tauc_";
table += FmtCore::format("%8s%20s%20s%20s%8s%20s%20s%20s\n", "atom", "x", "y", "z", "mag", "vx", "vy", "vz");
table += FmtCore::format("%8s%10s%10s%10s%8s%8s%8s%8s\n", "atom", "x", "y", "z", "mag", "vx", "vy", "vz");
for(int it = 0; it < ntype; it++)
{
for (int ia = 0; ia < atoms[it].na; ia++)
{
const double& x = direct? atoms[it].taud[ia].x: atoms[it].tau[ia].x;
const double& y = direct? atoms[it].taud[ia].y: atoms[it].tau[ia].y;
const double& z = direct? atoms[it].taud[ia].z: atoms[it].tau[ia].z;
table += FmtCore::format("%5s%-s%-5d%20.10f%20.10f%20.10f%8.4f%20.10f%20.10f%20.10f\n", // I dont know why there must be a redundant "tau[c|d]_" in the output. So ugly, it should be removed!
redundant_header,
table += FmtCore::format("%8s%10.3f%10.3f%10.3f%8.3f%8.3f%8.3f%8.3f\n",
atoms[it].label,
ia+1,
x,
y,
z,
Expand Down Expand Up @@ -140,4 +137,4 @@ namespace unitcell
ofs.close();
return;
}
}
}
6 changes: 4 additions & 2 deletions source/module_cell/test/unitcell_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,8 @@ TEST_F(UcellTest, PrintTauDirect)
ifs.open("print_tau_direct");
std::string str((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
EXPECT_THAT(str, testing::HasSubstr("DIRECT COORDINATES"));
EXPECT_THAT(str, testing::HasSubstr("taud_C1 0.1000000000 0.1000000000 0.1000000000"));
EXPECT_THAT(str, testing::HasSubstr(" C 0.100 0.100 0.100 0.000 0.100 0.100 0.100"));
EXPECT_THAT(str, testing::HasSubstr(" H 0.150 0.150 0.150 0.000 0.100 0.100 0.100"));
ifs.close();
remove("print_tau_direct");
}
Expand All @@ -1036,7 +1037,8 @@ TEST_F(UcellTest, PrintTauCartesian)
ifs.open("print_tau_Cartesian");
std::string str((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
EXPECT_THAT(str, testing::HasSubstr("CARTESIAN COORDINATES"));
EXPECT_THAT(str, testing::HasSubstr("tauc_C1 1.0000000000 1.0000000000 1.0000000000"));
EXPECT_THAT(str, testing::HasSubstr(" C 1.000 1.000 1.000 0.000 0.000 0.000 0.000"));
EXPECT_THAT(str, testing::HasSubstr(" H 1.500 1.500 1.500 0.000 0.000 0.000 0.000"));
ifs.close();
remove("print_tau_Cartesian");
}
Expand Down
6 changes: 3 additions & 3 deletions source/module_cell/unitcell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ void UnitCell::setup_cell(const std::string& fn, std::ofstream& log) {

if (ok)
{
log << "\n\n\n\n";
log << "\n\n";
log << " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
">>>>>>>>>>>>"
<< std::endl;
Expand Down Expand Up @@ -254,7 +254,7 @@ void UnitCell::setup_cell(const std::string& fn, std::ofstream& log) {
log << " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
"<<<<<<<<<<<<"
<< std::endl;
log << "\n\n\n\n";
log << "\n\n";

log << " READING UNITCELL INFORMATION" << std::endl;
//========================
Expand Down Expand Up @@ -560,4 +560,4 @@ void UnitCell::compare_atom_labels(std::string label1, std::string label2) {
}
}
}
}
}
24 changes: 13 additions & 11 deletions source/module_elecstate/module_charge/charge_mixing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,24 @@ void Charge_Mixing::set_mixing(const std::string& mixing_mode_in,
}

// print into running.log
GlobalV::ofs_running<<"\n----------- Double Check Mixing Parameters Begin ------------"<<std::endl;
GlobalV::ofs_running<<"mixing_type: "<< this->mixing_mode <<std::endl;
GlobalV::ofs_running<<"mixing_beta: "<< this->mixing_beta <<std::endl;
GlobalV::ofs_running<<"mixing_gg0: "<< this->mixing_gg0 <<std::endl;
GlobalV::ofs_running<<"mixing_gg0_min: "<< PARAM.inp.mixing_gg0_min <<std::endl;
GlobalV::ofs_running<<"\n ----------- Charge Mixing Parameters ------------"<<std::endl;

ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "mixing_type", this->mixing_mode);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "mixing_beta", this->mixing_beta);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "mixing_gg0", this->mixing_gg0);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "mixing_gg0_min", PARAM.inp.mixing_gg0_min);

if (PARAM.inp.nspin==2 || PARAM.inp.nspin==4)
{
GlobalV::ofs_running<<"mixing_beta_mag: "<< this->mixing_beta_mag <<std::endl;
GlobalV::ofs_running<<"mixing_gg0_mag: "<< PARAM.inp.mixing_gg0_mag <<std::endl;
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "mixing_beta_mag", this->mixing_beta_mag);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "mixing_gg0_mag", PARAM.inp.mixing_gg0_mag);
}
if (PARAM.inp.mixing_angle > 0)
{
GlobalV::ofs_running<<"mixing_angle: "<< PARAM.inp.mixing_angle <<std::endl;
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "mixing_angle", PARAM.inp.mixing_angle);
}
GlobalV::ofs_running<<"mixing_ndim: "<< this->mixing_ndim <<std::endl;
GlobalV::ofs_running<<"----------- Double Check Mixing Parameters End ------------"<<std::endl;

ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "mixing_ndim", this->mixing_ndim);

return;
}
Expand Down Expand Up @@ -240,4 +242,4 @@ bool Charge_Mixing::if_scf_oscillate(const int iteration, const double drho, con
}

return false;
}
}
8 changes: 4 additions & 4 deletions source/module_elecstate/potentials/pot_xc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ namespace elecstate

void PotXC::cal_v_eff(const Charge*const chg, const UnitCell*const ucell, ModuleBase::matrix& v_eff)
{
ModuleBase::TITLE("PotXC", "cal_v_eff");
ModuleBase::timer::tick("PotXC", "cal_v_eff");
ModuleBase::TITLE("PotXC", "cal_veff");
ModuleBase::timer::tick("PotXC", "cal_veff");
const int nrxx_current = chg->nrxx;

//----------------------------------------------------------
Expand Down Expand Up @@ -41,7 +41,7 @@ void PotXC::cal_v_eff(const Charge*const chg, const UnitCell*const ucell, Module
*(this->vtxc_) = std::get<1>(etxc_vtxc_v);
v_eff += std::get<2>(etxc_vtxc_v);
}
ModuleBase::timer::tick("PotXC", "cal_v_eff");
ModuleBase::timer::tick("PotXC", "cal_veff");
}

} // namespace elecstate
} // namespace elecstate
15 changes: 8 additions & 7 deletions source/module_elecstate/potentials/potential_new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ void Potential::allocate()
void Potential::update_from_charge(const Charge*const chg, const UnitCell*const ucell)
{
ModuleBase::TITLE("Potential", "update_from_charge");
ModuleBase::timer::tick("Potential", "update_from_charge");
//ModuleBase::timer::tick("Potential", "update_from_charge");

if (!this->fixed_done)
{
this->cal_fixed_v(this->v_effective_fixed.data());
Expand Down Expand Up @@ -216,13 +217,14 @@ void Potential::update_from_charge(const Charge*const chg, const UnitCell*const
}
#endif

ModuleBase::timer::tick("Potential", "update_from_charge");
//ModuleBase::timer::tick("Potential", "update_from_charge");
}

void Potential::cal_fixed_v(double* vl_pseudo)
{
ModuleBase::TITLE("Potential", "cal_fixed_v");
ModuleBase::timer::tick("Potential", "cal_fixed_v");

this->v_effective_fixed.assign(this->v_effective_fixed.size(), 0.0);
for (size_t i = 0; i < this->components.size(); i++)
{
Expand All @@ -237,10 +239,11 @@ void Potential::cal_fixed_v(double* vl_pseudo)

void Potential::cal_v_eff(const Charge*const chg, const UnitCell*const ucell, ModuleBase::matrix& v_eff)
{
ModuleBase::TITLE("Potential", "cal_v_eff");
ModuleBase::TITLE("Potential", "cal_veff");
ModuleBase::timer::tick("Potential", "cal_veff");

const int nspin_current = this->v_effective.nr;
const int nrxx = this->v_effective.nc;
ModuleBase::timer::tick("Potential", "cal_v_eff");
// first of all, set v_effective to zero.
this->v_effective.zero_out();

Expand All @@ -264,7 +267,7 @@ void Potential::cal_v_eff(const Charge*const chg, const UnitCell*const ucell, Mo
}
}

ModuleBase::timer::tick("Potential", "cal_v_eff");
ModuleBase::timer::tick("Potential", "cal_veff");
}

void Potential::init_pot(int istep, const Charge*const chg)
Expand All @@ -278,8 +281,6 @@ void Potential::init_pot(int istep, const Charge*const chg)

this->update_from_charge(chg, this->ucell_);

// plots
// figure::picture(this->vr_eff1,GlobalC::rhopw->nx,GlobalC::rhopw->ny,GlobalC::rhopw->nz);
ModuleBase::timer::tick("Potential", "init_pot");
return;
}
Expand Down
6 changes: 3 additions & 3 deletions source/module_elecstate/read_pseudo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace elecstate {
void read_pseudo(std::ofstream& ofs, UnitCell& ucell) {
// read in non-local pseudopotential and ouput the projectors.
ofs << "\n\n\n\n";
ofs << "\n\n";
ofs << " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
">>>>"
<< std::endl;
Expand Down Expand Up @@ -54,7 +54,7 @@ void read_pseudo(std::ofstream& ofs, UnitCell& ucell) {
ofs << " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
"<<<<"
<< std::endl;
ofs << "\n\n\n\n";
ofs << "\n\n";

read_cell_pseudopots(PARAM.inp.pseudo_dir, ofs, ucell);

Expand Down Expand Up @@ -368,4 +368,4 @@ void print_unitcell_pseudo(const std::string& fn, UnitCell& ucell)
return;
}

}
}
2 changes: 1 addition & 1 deletion source/module_esolver/esolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ std::string determine_type()
ModuleBase::WARNING_QUIT("ESolver", "No such esolver_type combined with basis_type");
}

GlobalV::ofs_running << " The esolver type has been set to : " << esolver_type << std::endl;
GlobalV::ofs_running << "\n The esolver type: " << esolver_type << std::endl;

auto device_info = PARAM.inp.device;

Expand Down
2 changes: 1 addition & 1 deletion source/module_esolver/esolver_fp.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class ESolver_FP: public ESolver
//! Something to do after SCF iterations when SCF is converged or comes to the max iter step.
virtual void after_scf(UnitCell& ucell, const int istep, const bool conv_esolver);

//! Something to do after hamilt2density function in each iter loop.
//! Something to do after hamilt2rho function in each iter loop.
virtual void iter_finish(UnitCell& ucell, const int istep, int& iter, bool &conv_esolver);

//! ------------------------------------------------------------------------------
Expand Down
Loading