Skip to content

Commit cc1e82a

Browse files
committed
add esovler_of_tddft
1 parent 07658be commit cc1e82a

File tree

7 files changed

+449
-5
lines changed

7 files changed

+449
-5
lines changed

source/Makefile.Objects

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ OBJS_ESOLVER=esolver.o\
263263
esolver_lj.o\
264264
esolver_dp.o\
265265
esolver_of.o\
266+
esolver_of_tddft.o\
266267
esolver_of_tool.o\
267268
esolver_of_interface.o\
268269
pw_others.o\

source/source_esolver/esolver.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ extern "C"
2020
#include "esolver_dp.h"
2121
#include "esolver_lj.h"
2222
#include "esolver_of.h"
23+
#include "esolver_of_tddft.h"
2324
#include "source_io/module_parameter/md_parameter.h"
2425

2526
#include <stdexcept>
@@ -40,6 +41,10 @@ std::string determine_type()
4041
{
4142
esolver_type = "ofdft";
4243
}
44+
else if (PARAM.inp.esolver_type == "tdofdft")
45+
{
46+
esolver_type = "tdofdft";
47+
}
4348
else if (PARAM.inp.esolver_type == "ksdft")
4449
{
4550
esolver_type = "ksdft_pw";
@@ -321,6 +326,10 @@ ESolver* init_esolver(const Input_para& inp, UnitCell& ucell)
321326
{
322327
return new ESolver_OF();
323328
}
329+
else if (esolver_type == "tdofdft")
330+
{
331+
return new ESolver_OF_TDDFT();
332+
}
324333
else if (esolver_type == "lj_pot")
325334
{
326335
return new ESolver_LJ();

source/source_esolver/esolver_of.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ void ESolver_OF::before_opt(const int istep, UnitCell& ucell)
273273
// Here we initialize rho to be uniform,
274274
// because the rho got by pot.init_pot -> Charge::atomic_rho may contain minus elements.
275275
this->chr.rho[is][ibs] = this->nelec_[is] / this->pelec->omega;
276-
this->pphi_[is][ibs] = sqrt(this->chr.rho[is][ibs]);
276+
this->pphi_[is][ibs] = sqrt(this->chr.rho[is][ibs]);
277277
}
278278
}
279279
else

source/source_esolver/esolver_of.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ESolver_OF : public ESolver_FP
2727

2828
virtual void cal_stress(UnitCell& ucell, ModuleBase::matrix& stress) override;
2929

30-
private:
30+
protected:
3131
// ======================= variables ==========================
3232
// ---------- the kinetic energy density functionals ----------
3333
KEDF_Manager* kedf_manager_ = nullptr; // KEDF manager, which will be initialized in before_all_runners
@@ -83,7 +83,7 @@ class ESolver_OF : public ESolver_FP
8383

8484
// ============================ tools ===============================
8585
// --------------------- initialize ---------------------------------
86-
void init_elecstate(UnitCell& ucell);
86+
void init_elecstate(UnitCell& ucell);
8787
void allocate_array();
8888

8989
// --------------------- calculate physical qualities ---------------

0 commit comments

Comments
 (0)