Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
5d8b0c7
update timer, add std
mohanchen Mar 27, 2024
b5bcc7f
update the format of esolver_fp.cpp
mohanchen Mar 27, 2024
3c69ace
add description in esolver_fp.h
mohanchen Mar 27, 2024
e1551cf
update a few esolver files
mohanchen Mar 27, 2024
f0a5c3b
update esolver description for LCAO
mohanchen Mar 27, 2024
1c8ed86
update some formats of esolver codes
mohanchen Mar 27, 2024
ea0e2c4
update esolver_ks_pw.cpp formats
mohanchen Mar 27, 2024
ae36b11
update formats of esolver_ks_pw.cpp and esolver_ks_pw.h
mohanchen Mar 27, 2024
16b0f76
update esolver_ks_lcao_tddft.cpp formats
mohanchen Mar 27, 2024
1768c88
update format of esolver_sdft_pw.cpp
mohanchen Mar 27, 2024
6a606ed
update the format of esolver_sdft_pw_tool.cpp
mohanchen Mar 27, 2024
cac11ea
keep formating esolver_ks_pw.cpp
mohanchen Mar 27, 2024
e191f6c
formating esolver_of_interface.cpp
mohanchen Mar 27, 2024
8eddd5a
change GlobalC::ucell to ucell in esolver_ks.cpp
mohanchen Mar 27, 2024
bcf4d54
remove some GlobalC::ucell in esolver_sdft_pw.cpp
mohanchen Mar 27, 2024
1ca6574
refactor the code before getting rid of RA in esolver_lcao
mohanchen Mar 28, 2024
7987684
refactor before getting rid of LOWF
mohanchen Mar 28, 2024
186609f
refactor before getting rid of LCAO_hamilt.h and LCAO_matrix.h
mohanchen Mar 28, 2024
fc02fb8
refactor wavefunc_in_pw
mohanchen Mar 28, 2024
7a8064f
refactor density matrix
mohanchen Mar 28, 2024
f95129d
refactor the format cal_dm_psi.cpp
mohanchen Mar 28, 2024
98234ae
format forces.cpp
mohanchen Mar 30, 2024
583214c
refactor esolver_of_tool.cpp
mohanchen Mar 30, 2024
2638dd3
resolve conflict
mohanchen Mar 30, 2024
9505a9f
change member function beforescf in Esolver to before_scf
mohanchen Mar 31, 2024
313893e
change afterscf to after_scf
mohanchen Mar 31, 2024
7317a47
change updatepot to update_pot
mohanchen Mar 31, 2024
730b460
change eachiterinit to iter_init, change eachiterfinish to iter_finish
mohanchen Mar 31, 2024
31760e8
refactor esolvers, change member function names of most esolvers
mohanchen Mar 31, 2024
cccbb14
reformat esolver.h
mohanchen Mar 31, 2024
270a39d
update tests for esolvers
mohanchen Mar 31, 2024
bfc8ac7
add TITLE in esolver_ks_lcao
mohanchen Mar 31, 2024
3e15388
update esolver_ks_lcao
mohanchen Mar 31, 2024
413e73f
update esolver_lcao
mohanchen Mar 31, 2024
3f2006a
update timer::tick in esolver_lcao
mohanchen Mar 31, 2024
78c08cf
try to delete LCAO_Matrix in LCAO_Hamilt, and try to delete Parallel_…
mohanchen Mar 31, 2024
76b23de
fix the compiling issue with LCAO_hamilt.hpp
mohanchen Mar 31, 2024
4018fa2
try to divide the FORCE_k.cpp into several small files
mohanchen Mar 31, 2024
eee4f97
fix conflicts
mohanchen Mar 31, 2024
34add55
divide FORCE_k into foverlap_k.cpp ftvnl_dphi_k.cpp fvl_dphi_k.cpp fv…
mohanchen Mar 31, 2024
0469d94
get rid of UHM in FORCE_k.cpp
mohanchen Mar 31, 2024
2eac633
cannot compile, but I have modified some files in order to get rid of…
mohanchen Mar 31, 2024
21d4637
keep updating, cannot run
mohanchen Mar 31, 2024
3e01810
update write_Vxc, cannot run yet
mohanchen Mar 31, 2024
be3b80a
keep updating gint_gamma and gint_k
mohanchen Apr 1, 2024
37066e5
update LCAO_matrix.cpp
mohanchen Apr 1, 2024
d128c11
divide force files, and update Makefile.Objects
mohanchen Apr 1, 2024
a2e25b3
update LCAO_hamilt.cpp
mohanchen Apr 1, 2024
d6e6492
Merge branch 'deepmodeling:develop' into develop
mohanchen Apr 1, 2024
e182760
Merge branch 'divide_force' into develop.
mohanchen Apr 1, 2024
d96852a
Merge branch 'deepmodeling:develop' into develop
mohanchen Apr 2, 2024
70420af
delete genH pointer in UHM
mohanchen Apr 2, 2024
9bc99e2
Merge branch 'develop' of https://github.com/mohanchen/abacus-mc into…
mohanchen Apr 2, 2024
28d0035
divide LCAO_hamilt.cpp into small codes, grid_init.cpp is the first one
mohanchen Apr 2, 2024
0b10d2c
update grid_init in esolver_ks_lcao
mohanchen Apr 2, 2024
bfb62a6
add a new namespace named sparse_format, most of the functions that o…
mohanchen Apr 2, 2024
0d5b0e1
update with the upstream
mohanchen Apr 3, 2024
2978fa5
cannot find the mismatch of DFTU
mohanchen Apr 3, 2024
c5ab404
fix the DFTU error
mohanchen Apr 3, 2024
a2f4374
update
mohanchen Apr 3, 2024
c8be288
avoid using UHM in esolver_ks_lcao, try to move some functions in LCA…
mohanchen Apr 3, 2024
2cb501c
Merge branch 'deepmodeling:develop' into develop
mohanchen Apr 4, 2024
ac4df7e
enable the test_memory function again by setting calcalculation param…
mohanchen Apr 5, 2024
33f46eb
update memory record functions
mohanchen Apr 5, 2024
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
15 changes: 3 additions & 12 deletions source/driver_run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,15 @@ void Driver::driver_run(void)
#endif
GlobalC::ucell.setup_cell(GlobalV::stru_file, GlobalV::ofs_running);

//! 3: for these two types of calculations
// nothing else need to be initialized
if(GlobalV::CALCULATION == "test_neighbour"
|| GlobalV::CALCULATION == "test_memory")
{
p_esolver->run(0, GlobalC::ucell);
ModuleBase::QUIT();
}

//! 4: initialize Esolver and fill json-structure
//! 3: initialize Esolver and fill json-structure
p_esolver->init(INPUT, GlobalC::ucell);


#ifdef __RAPIDJSON
Json::gen_stru_wrapper(&GlobalC::ucell);
#endif

//! 5: md or relax calculations
//! 4: md or relax calculations
if(GlobalV::CALCULATION == "md")
{
Run_MD::md_line(GlobalC::ucell, p_esolver, INPUT.mdp);
Expand All @@ -73,7 +64,7 @@ void Driver::driver_run(void)
}
}

//! 6: clean up esolver
//! 5: clean up esolver
p_esolver->post_process();
ModuleESolver::clean_esolver(p_esolver);

Expand Down
Empty file modified source/module_base/math_chebyshev_def.h
100755 → 100644
Empty file.
44 changes: 20 additions & 24 deletions source/module_base/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// AUTHOR : mohan
// DATE : 2008-11-18
//==========================================================
#include <cassert>
#include "memory.h"
#include "global_variable.h"
#include "module_base/parallel_reduce.h"
Expand Down Expand Up @@ -230,20 +231,26 @@ void Memory::finish(std::ofstream &ofs)

void Memory::print_all(std::ofstream &ofs)
{
// std::cout<<"\n init_flag="<<init_flag;
if(!init_flag) return;
if(!init_flag)
{
return;
}

const double small = 1.0;
const double small = 1.0; // unit is MB
#ifdef __MPI
Parallel_Reduce::reduce_all(Memory::total);
Parallel_Reduce::reduce_all(Memory::total);
#endif
ofs <<"\n NAME---------------|MEMORY(MB)--------" << std::endl;
// std::cout<<"\n"<<std::setw(41)<< " " <<std::setprecision(4)<<total;
ofs <<std::setw(20)<< "total" << std::setw(15) <<std::setprecision(4)<< Memory::total << std::endl;
ofs <<"\n NAME-------------------------|MEMORY(MB)--------" << std::endl;
ofs <<std::setw(30)<< "total" << std::setw(15) <<std::setprecision(4)<< Memory::total << std::endl;

assert(n_memory>0);

bool *print_flag = new bool[n_memory];
for(int i=0; i<n_memory; i++) print_flag[i] = false;


for(int i=0; i<n_memory; i++)
{
print_flag[i] = false;
}

for (int i=0; i<n_memory; i++)
{
Expand Down Expand Up @@ -285,32 +292,21 @@ void Memory::print_all(std::ofstream &ofs)
}
}
print_flag[k] = true;
if ( consume[k] < small ){
if ( consume[k] < small )
{
continue;
}
else
{
ofs << std::setw(20) << name[k]
ofs << std::setw(30) << name[k]
<< std::setw(15) << consume[k] << std::endl;
}

}
// if ( consume[k] < small )
// {
// continue;
// }
// else
// {
// ofs << std::setw(20) << name[k]
// << std::setw(15) << consume[k] << std::endl;

// std::cout << "\n "
// << std::setw(20) << class_name[k]
// << std::setw(20) << name[k]
// << std::setw(15) << consume[k];
//std::cout<<"\n ----------------------------------------------------------"<<std::endl;
ofs<<" ------------- < 1.0 MB has been ignored ----------------"<<std::endl;
ofs<<" ----------------------------------------------------------"<<std::endl;

delete[] print_flag; //mohan fix by valgrind at 2012-04-02
return;
}
Expand Down
Empty file modified source/module_base/module_mixing/broyden_mixing.h
100755 → 100644
Empty file.
6 changes: 6 additions & 0 deletions source/module_esolver/esolver_fp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ ESolver_FP::~ESolver_FP()

void ESolver_FP::init(Input& inp, UnitCell& cell)
{
ModuleBase::TITLE("ESolver_FP", "init");

if(!GlobalV::use_paw)
{
cell.read_pseudo(GlobalV::ofs_running);
Expand Down Expand Up @@ -96,6 +98,8 @@ void ESolver_FP::init(Input& inp, UnitCell& cell)
}

this->print_rhofft(inp, GlobalV::ofs_running);

return;
}


Expand Down Expand Up @@ -164,6 +168,8 @@ void ESolver_FP::init_after_vc(Input& inp, UnitCell& cell)

kv.set_after_vc(cell.symm, GlobalV::global_kpoint_card, GlobalV::NSPIN, cell.G, cell.latvec);
ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "INIT K-POINTS");

return;
}


Expand Down
11 changes: 4 additions & 7 deletions source/module_esolver/esolver_ks.cpp
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
#include "esolver_ks.h"

#include <time.h>
#ifdef __MPI
#include <mpi.h>
#else
#include <chrono>
#endif

#include <iostream>

#include "module_io/print_info.h"
#include "module_base/timer.h"
#include "module_io/input.h"
#include "module_io/json_output/init_info.h"


//--------------Temporary----------------
#include "module_base/global_variable.h"
#include "module_hamilt_pw/hamilt_pwdft/global.h"
//---------------------------------------

#ifdef USE_PAW
#include "module_cell/module_paw/paw_cell.h"
#include "module_base/parallel_common.h"
#endif

#include "module_io/json_output/output_info.h"

namespace ModuleESolver
Expand Down Expand Up @@ -75,6 +68,8 @@ ESolver_KS<T, Device>::~ESolver_KS()
template<typename T, typename Device>
void ESolver_KS<T, Device>::init(Input& inp, UnitCell& ucell)
{
ModuleBase::TITLE("ESolver_KS", "init");

ESolver_FP::init(inp,ucell);

//------------------Charge Mixing------------------
Expand Down Expand Up @@ -380,6 +375,8 @@ void ESolver_KS<T, Device>::print_wfcfft(Input& inp, std::ofstream &ofs)
template<typename T, typename Device>
void ESolver_KS<T, Device>::run(const int istep, UnitCell& ucell)
{
ModuleBase::TITLE("ESolver_KS", "run");

if (!(GlobalV::CALCULATION == "scf"
|| GlobalV::CALCULATION == "md"
|| GlobalV::CALCULATION == "relax"
Expand Down
58 changes: 41 additions & 17 deletions source/module_esolver/esolver_ks_lcao_elec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,14 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(int istep)
this->beforesolver(istep);
// Peize Lin add 2016-12-03
#ifdef __EXX // set xc type before the first cal of xc in pelec->init_scf
if (GlobalC::exx_info.info_ri.real_number)
this->exd->exx_beforescf(this->kv, *this->p_chgmix);
else
this->exc->exx_beforescf(this->kv, *this->p_chgmix);
if (GlobalC::exx_info.info_ri.real_number)
{
this->exd->exx_beforescf(this->kv, *this->p_chgmix);
}
else
{
this->exc->exx_beforescf(this->kv, *this->p_chgmix);
}
#endif // __EXX

this->pelec->init_scf(istep, this->sf.strucFac);
Expand All @@ -331,9 +335,10 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(int istep)
for (int is = 0; is < GlobalV::NSPIN; is++)
{
srho.begin(is, *(this->pelec->charge), this->pw_rho, GlobalC::Pgrid, GlobalC::ucell.symm);
}
// 1. calculate ewald energy.
// mohan update 2021-02-25
}

// 1. calculate ewald energy.
// mohan update 2021-02-25
if (!GlobalV::test_skip_ewald)
{
this->pelec->f_en.ewald_energy = H_Ewald_pw::compute_ewald(GlobalC::ucell, this->pw_rho, this->sf.strucFac);
Expand All @@ -350,22 +355,21 @@ void ESolver_KS_LCAO<TK, TR>::others(const int istep)
{
ModuleBase::TITLE("ESolver_KS_LCAO", "others");
ModuleBase::timer::tick("ESolver_KS_LCAO", "others");

if (GlobalV::CALCULATION == "get_S")
{
this->get_S();
ModuleBase::QUIT();
}

if (GlobalV::CALCULATION == "test_memory")
else if (GlobalV::CALCULATION == "test_memory")
{
Cal_Test::test_memory(this->pw_rho,
this->pw_wfc,
this->p_chgmix->get_mixing_mode(),
this->p_chgmix->get_mixing_ndim());
return;
}

if (GlobalV::CALCULATION == "test_neighbour")
else if (GlobalV::CALCULATION == "test_neighbour")
{
// test_search_neighbor();
if (GlobalV::SEARCH_RADIUS < 0)
Expand Down Expand Up @@ -452,14 +456,18 @@ void ESolver_KS_LCAO<TK, TR>::others(const int istep)
ModuleBase::timer::tick("ESolver_KS_LCAO", "others");
return;
}


template <>
void ESolver_KS_LCAO<double, double>::get_S()
void ESolver_KS_LCAO<double, double>::get_S(void)
{
ModuleBase::TITLE("ESolver_KS_LCAO", "get_S");
ModuleBase::WARNING_QUIT("ESolver_KS_LCAO<TK, TR>::get_S", "not implemented for");
ModuleBase::WARNING_QUIT("ESolver_KS_LCAO<double,double>::get_S", "not implemented for");
}


template <>
void ESolver_KS_LCAO<std::complex<double>, double>::get_S()
void ESolver_KS_LCAO<std::complex<double>, double>::get_S(void)
{
ModuleBase::TITLE("ESolver_KS_LCAO", "get_S");
// (1) Find adjacent atoms for each atom.
Expand All @@ -477,17 +485,21 @@ void ESolver_KS_LCAO<std::complex<double>, double>::get_S()
GlobalV::test_atom_input);

this->RA.for_2d(this->orb_con.ParaV, GlobalV::GAMMA_ONLY_LOCAL);

this->LM.ParaV = &this->orb_con.ParaV;

if (this->p_hamilt == nullptr)
{
this->p_hamilt = new hamilt::HamiltLCAO<std::complex<double>, double>(&this->LM, this->kv);
dynamic_cast<hamilt::OperatorLCAO<std::complex<double>, double>*>(this->p_hamilt->ops)->contributeHR();
}

ModuleIO::output_S_R(this->uhm, this->p_hamilt, "SR.csr");
}


template <>
void ESolver_KS_LCAO<std::complex<double>, std::complex<double>>::get_S()
void ESolver_KS_LCAO<std::complex<double>, std::complex<double>>::get_S(void)
{
ModuleBase::TITLE("ESolver_KS_LCAO", "get_S");
// (1) Find adjacent atoms for each atom.
Expand Down Expand Up @@ -516,8 +528,9 @@ void ESolver_KS_LCAO<std::complex<double>, std::complex<double>>::get_S()
ModuleIO::output_S_R(this->uhm, this->p_hamilt, "SR.csr");
}


template <typename TK, typename TR>
void ESolver_KS_LCAO<TK, TR>::nscf()
void ESolver_KS_LCAO<TK, TR>::nscf(void)
{
ModuleBase::TITLE("ESolver_KS_LCAO", "nscf");

Expand All @@ -533,9 +546,13 @@ void ESolver_KS_LCAO<TK, TR>::nscf()
// GlobalC::exx_lcao.cal_exx_elec_nscf(this->LOWF.ParaV[0]);
const std::string file_name_exx = GlobalV::global_out_dir + "HexxR" + std::to_string(GlobalV::MY_RANK);
if (GlobalC::exx_info.info_ri.real_number)
{
this->exd->read_Hexxs_csr(file_name_exx, GlobalC::ucell);
}
else
{
this->exc->read_Hexxs_csr(file_name_exx, GlobalC::ucell);
}

hamilt::HamiltLCAO<TK, TR>* hamilt_lcao = dynamic_cast<hamilt::HamiltLCAO<TK, TR>*>(this->p_hamilt);
auto exx = new hamilt::OperatorEXX<hamilt::OperatorLCAO<TK, TR>>(&this->LM,
Expand Down Expand Up @@ -625,7 +642,14 @@ void ESolver_KS_LCAO<TK, TR>::nscf()
INPUT.wannier_spin
);

myWannier.calculate(this->pelec->ekb, this->pw_wfc, this->pw_big, this->sf, this->kv, this->psi, this->LOWF.ParaV);
myWannier.calculate(
this->pelec->ekb,
this->pw_wfc,
this->pw_big,
this->sf,
this->kv,
this->psi,
this->LOWF.ParaV);
}
else if (INPUT.wannier_method == 2)
{
Expand Down
Loading