Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:deepmodeling/abacus-develop into…
Browse files Browse the repository at this point in the history
… develop
  • Loading branch information
dyzheng committed May 13, 2022
2 parents 26d728c + 429e1f3 commit adf258d
Show file tree
Hide file tree
Showing 110 changed files with 14,076 additions and 6,235 deletions.
2 changes: 0 additions & 2 deletions source/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ VPATH=./src_global\
:./module_deepks\
:./module_xc\
:./module_esolver\
:./module_surchem\
:./src_pw\
:./src_lcao\
:./src_ions\
Expand Down Expand Up @@ -70,7 +69,6 @@ FP_OBJS_0=$(OBJS_FIRST_PRINCIPLES)\
$(OBJS_PARALLEL)\
$(OBJS_TOOLS) \
$(OBJS_COMMON)\
$(OBJS_SURCHEM)\
main.o\

FP_OBJS=$(patsubst %.o, ${OBJ_DIR}/%.o, ${FP_OBJS_0})
Expand Down
23 changes: 12 additions & 11 deletions source/Makefile.Objects
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ grid_bigcell.o\
grid_meshball.o\
gint_tools.o\
gint_gamma.o\
gint_gamma_common.o\
gint_gamma_fvl.o\
gint_gamma_vl.o\
gint_gamma_rho.o\
Expand All @@ -122,7 +121,7 @@ gint_k_init.o\
gint_k_vl.o\
gint_k_rho.o\
gint_k_fvl.o\
grid_base_beta.o\
gint_k_env.o \
ORB_control.o\
ORB_read.o\
ORB_atomic.o\
Expand All @@ -142,7 +141,6 @@ ELEC_evolve.o\
ELEC_scf.o\
ELEC_nscf.o\
LOOP_cell.o\
LOOP_elec.o\
LOOP_ions.o\
run_md_lcao.o\
DM_gamma.o\
Expand Down Expand Up @@ -233,9 +231,19 @@ OBJS_ESOLVER=esolver.o\
esolver_ks_pw.o\
esolver_sdft_pw.o\
esolver_ks_lcao.o\
esolver_ks_lcao_elec.o\
esolver_lj.o\
esolver_dp.o\

OBJS_SURCHEM=H_correction_pw.o\
cal_epsilon.o\
cal_pseudo.o\
cal_totn.o\
cal_vcav.o\
cal_vel.o\
corrected_energy.o\
minimize_cg.o\

OBJS_XC=xc_funct_corr_gga.o \
xc_funct_corr_lda.o \
xc_funct_exch_gga.o \
Expand All @@ -253,6 +261,7 @@ $(OBJS_PW)\
$(OBJS_LCAO)\
$(OBJS_ESOLVER)\
$(OBJS_XC)\
$(OBJS_SURCHEM)\
charge.o \
charge_mixing.o \
charge_pulay.o \
Expand Down Expand Up @@ -368,14 +377,6 @@ pzt2s.o\
pdtrsm.o\
pzhtrsm.o\

OBJS_SURCHEM=cal_epsilon.o\
cal_pseudo.o\
cal_totn.o\
cal_vcav.o\
cal_vel.o\
corrected_energy.o\
H_correction_pw.o\
minimize_cg.o\

PDIAG_MR_0=dcopy.o\
dlae2.o\
Expand Down
20 changes: 12 additions & 8 deletions source/module_cell/read_pp_upf201.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ int Pseudopot_upf::read_pseudo_upf201(std::ifstream &ifs)

if (ModuleBase::GlobalFunc::SCAN_BEGIN(ifs, "<PP_R", true, false))
{
ModuleBase::GlobalFunc::READ_VALUE(ifs, word); // type size columns
ifs.ignore(150, '>');
// ModuleBase::GlobalFunc::READ_VALUE(ifs, word); // type size columns
this->read_pseudo_upf201_r(ifs);
}
else if (ModuleBase::GlobalFunc::SCAN_BEGIN(ifs, "<PP_R>"))
Expand All @@ -139,7 +140,8 @@ int Pseudopot_upf::read_pseudo_upf201(std::ifstream &ifs)

if (ModuleBase::GlobalFunc::SCAN_BEGIN(ifs, "<PP_RAB", true, false))
{
ModuleBase::GlobalFunc::READ_VALUE(ifs, word); // type size columns
ifs.ignore(150, '>');
// ModuleBase::GlobalFunc::READ_VALUE(ifs, word); // type size columns
this->read_pseudo_upf201_rab(ifs);
}
else if (ModuleBase::GlobalFunc::SCAN_BEGIN(ifs, "<PP_RAB>"))
Expand Down Expand Up @@ -224,7 +226,8 @@ int Pseudopot_upf::read_pseudo_upf201(std::ifstream &ifs)

if (ModuleBase::GlobalFunc::SCAN_BEGIN(ifs, "<PP_DIJ", true, false))
{
ModuleBase::GlobalFunc::READ_VALUE(ifs, word); // type size columns
ifs.ignore(150, '>');
// ModuleBase::GlobalFunc::READ_VALUE(ifs, word); // type size columns
this->read_pseudo_upf201_dij(ifs);
}
else if ( ModuleBase::GlobalFunc::SCAN_BEGIN(ifs, "<PP_DIJ>"))
Expand Down Expand Up @@ -289,7 +292,8 @@ int Pseudopot_upf::read_pseudo_upf201(std::ifstream &ifs)
//--------------------------------------
if (ModuleBase::GlobalFunc::SCAN_BEGIN(ifs, "<PP_RHOATOM", true, false))
{
ModuleBase::GlobalFunc::READ_VALUE(ifs, word); // type size columns
ifs.ignore(150, '>');
// ModuleBase::GlobalFunc::READ_VALUE(ifs, word); // type size columns
this->read_pseudo_upf201_rhoatom(ifs);
}
else if (ModuleBase::GlobalFunc::SCAN_BEGIN(ifs, "<PP_RHOATOM>"))
Expand Down Expand Up @@ -527,10 +531,10 @@ void Pseudopot_upf::read_pseudo_upf201_dij(std::ifstream &ifs)
for(int j=0;j<nbeta;j++)
{
ifs >> dion(i,j);
if ( i != j && dion(i,j) != 0.0 )
{
ModuleBase::WARNING_QUIT("read_pseudo_upf201","Error: for i != j, Dij of Pseudopotential must be 0.0");
}
// if ( i != j && dion(i,j) != 0.0 )
// {
// ModuleBase::WARNING_QUIT("read_pseudo_upf201","Error: for i != j, Dij of Pseudopotential must be 0.0");
// }
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions source/module_elecstate/elecstate_lcao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void ElecStateLCAO::psiToRho(const psi::Psi<std::complex<double>>& psi)
//------------------------------------------------------------

ModuleBase::GlobalFunc::NOTE("Calculate the charge on real space grid!");
this->uhm->GK.cal_rho_k(this->loc->DM_R);
this->uhm->GK.cal_rho_k(this->loc->DM_R, this->charge);

this->charge->renormalize_rho();

Expand Down Expand Up @@ -142,7 +142,7 @@ void ElecStateLCAO::psiToRho(const psi::Psi<double>& psi)
// calculate the charge density on real space grid.
//------------------------------------------------------------
ModuleBase::GlobalFunc::NOTE("Calculate the charge on real space grid!");
this->uhm->GG.cal_rho(this->loc->DM);
this->uhm->GG.cal_rho(this->loc->DM, this->charge);

this->charge->renormalize_rho();

Expand Down
1 change: 1 addition & 0 deletions source/module_esolver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ add_library(
esolver_ks_pw.cpp
esolver_sdft_pw.cpp
esolver_ks_lcao.cpp
esolver_ks_lcao_elec.cpp
esolver_lj.cpp
esolver_dp.cpp
)
Expand Down
72 changes: 36 additions & 36 deletions source/module_esolver/esolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,47 @@

namespace ModuleESolver
{
void ESolver:: printname()
{
std::cout<<classname<<std::endl;
}


//Some API to operate E_Solver
void init_esolver(ESolver *&p_esolver, const string use_esol)
{
if(use_esol == "ksdft_pw")
{
p_esolver = new ESolver_KS_PW();
}
else if(use_esol == "ksdft_lcao")
{
p_esolver = new ESolver_KS_LCAO();
}
else if(use_esol == "sdft_pw")
void ESolver::printname()
{
p_esolver = new ESolver_SDFT_PW();
std::cout << classname << std::endl;
}
// else if(use_esol == "ofdft")
// {
// p_esolver = new OFDFT();
// }
else if(use_esol == "lj_pot")
{
p_esolver = new ESolver_LJ();
}
else if(use_esol == "dp_pot")


//Some API to operate E_Solver
void init_esolver(ESolver*& p_esolver, const string use_esol)
{
p_esolver = new ESolver_DP();
if (use_esol == "ksdft_pw")
{
p_esolver = new ESolver_KS_PW();
}
else if (use_esol == "ksdft_lcao")
{
p_esolver = new ESolver_KS_LCAO();
}
else if (use_esol == "sdft_pw")
{
p_esolver = new ESolver_SDFT_PW();
}
// else if(use_esol == "ofdft")
// {
// p_esolver = new OFDFT();
// }
else if (use_esol == "lj_pot")
{
p_esolver = new ESolver_LJ();
}
else if (use_esol == "dp_pot")
{
p_esolver = new ESolver_DP();
}
}
}

void clean_esolver(ESolver *&pesolver)
{
if(pesolver!=NULL)
void clean_esolver(ESolver*& pesolver)
{
delete pesolver;
if (pesolver != NULL)
{
delete pesolver;
}
}
}

}
}
82 changes: 40 additions & 42 deletions source/module_esolver/esolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,48 +16,46 @@
namespace ModuleESolver
{

class ESolver
{
// protected:
// ModuleBase::matrix lattice_v;
public:
ESolver(){
classname = "ESolver";
}
virtual ~ESolver(){};

//virtual void Init(Input_EnSolver &inp, matrix &lattice_v)=0
virtual void Init(Input &inp, UnitCell_pseudo &cell)=0;

// They shoud be add after atom class is refactored
// virtual void UpdateLatAtom(ModuleBase::matrix &lat_in, Atom &atom_in);
// virtual void UpdateLat(ModuleBase::matrix &lat_in);
// virtual void UpdateAtom(Atom &atom_in);

/// These two virtual `Run` will be merged in the future.
//virtual void Run(int istep, Atom &atom) = 0;
virtual void Run(const int istep, UnitCell_pseudo& cell) = 0;
virtual void Run(int istep,
Record_adj& ra /**< would be a 2nd-module of Cell*/,
Local_Orbital_Charge& loc /**< EState*/,
Local_Orbital_wfc& lowf /**< Psi*/,
LCAO_Hamilt& uhm /**< Hamilt*/) {};

virtual void cal_Energy(energy &en) = 0;
virtual void cal_Force(ModuleBase::matrix &force) = 0;
virtual void cal_Stress(ModuleBase::matrix &stress) = 0;

//Print current classname.
void printname();

//temporarily
//get iterstep used in current scf
virtual int getniter(){return 0;}
string classname;
};

void init_esolver(ESolver* &p_esolver, const string use_esol);
void clean_esolver(ESolver* &pesolver);
class ESolver
{
// protected:
// ModuleBase::matrix lattice_v;
public:
ESolver() {
classname = "ESolver";
}
virtual ~ESolver() {};

//virtual void Init(Input_EnSolver &inp, matrix &lattice_v)=0
virtual void Init(Input& inp, UnitCell_pseudo& cell) = 0;

// They shoud be add after atom class is refactored
// virtual void UpdateLatAtom(ModuleBase::matrix &lat_in, Atom &atom_in);
// virtual void UpdateLat(ModuleBase::matrix &lat_in);
// virtual void UpdateAtom(Atom &atom_in);

virtual void Run(int istep, UnitCell_pseudo& cell) = 0;

//Deal with exx and other calculation than scf/md/relax:
// such as nscf, istate-charge or envelope
virtual void othercalculation(const int istep) {};

virtual void cal_Energy(energy& en) = 0;
virtual void cal_Force(ModuleBase::matrix& force) = 0;
virtual void cal_Stress(ModuleBase::matrix& stress) = 0;
virtual void postprocess() {};

//Print current classname.
void printname();

//temporarily
//get iterstep used in current scf
virtual int getniter() { return 0; }
string classname;
};

void init_esolver(ESolver*& p_esolver, const string use_esol);
void clean_esolver(ESolver*& pesolver);

}

Expand Down
Loading

0 comments on commit adf258d

Please sign in to comment.