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
5 changes: 0 additions & 5 deletions source/source_cell/sep_cell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
#include <string>
#include <vector>

// namespace GlobalC
// {
// Sep_Cell sep_cell;
// }

Sep_Cell::Sep_Cell() noexcept : ntype(0), omega(0.0), tpiba2(0.0)
{
}
Expand Down
5 changes: 0 additions & 5 deletions source/source_cell/sep_cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,4 @@ class Sep_Cell
double tpiba2; // tpiba ^ 2
};

// namespace GlobalC
// {
// extern Sep_Cell sep_cell;
// }

#endif // SEP_CEll
5 changes: 0 additions & 5 deletions source/source_cell/unitcell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,6 @@ void UnitCell::setup_cell(const std::string& fn, std::ofstream& log)
// readl sep potential, currently using the pseudopotential folder (pseudo_dir in INPUT)
//==========================
if (PARAM.inp.dfthalf_type > 0) {
// GlobalC::sep_cell.init(this->ntype);
// ok3 = GlobalC::sep_cell.read_sep_potentials(ifa, PARAM.inp.pseudo_dir, GlobalV::ofs_warning, this->atom_label);

sep_cell.init(this->ntype);
ok3 = sep_cell.read_sep_potentials(ifa, PARAM.inp.pseudo_dir, GlobalV::ofs_warning, this->atom_label);
}
Expand Down Expand Up @@ -285,7 +282,6 @@ void UnitCell::setup_cell(const std::string& fn, std::ofstream& log)

#ifdef __MPI
unitcell::bcast_unitcell(*this);
// GlobalC::sep_cell.bcast_sep_cell();
sep_cell.bcast_sep_cell();
#endif

Expand Down Expand Up @@ -350,7 +346,6 @@ void UnitCell::setup_cell(const std::string& fn, std::ofstream& log)
//===================================
this->set_iat2itia();

// GlobalC::sep_cell.set_omega(this->omega, this->tpiba2);
sep_cell.set_omega(this->omega, this->tpiba2);

return;
Expand Down
19 changes: 14 additions & 5 deletions source/source_esolver/esolver_ks_lcaopw.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include "esolver_ks_lcaopw.h"

#include "source_pw/module_pwdft/elecond.h"
#include "source_io/module_parameter/input_conv.h"

#include <iostream>

//--------------temporary----------------------------
Expand Down Expand Up @@ -141,9 +139,11 @@ namespace ModuleESolver

// add exx
#ifdef __EXX
if (GlobalC::exx_info.info_global.cal_exx)
bool cal_exx = GlobalC::exx_info.info_global.cal_exx;
double hybrid_alpha = GlobalC::exx_info.info_global.hybrid_alpha;
if (cal_exx)
{
this->pelec->set_exx(this->exx_lip->get_exx_energy()); // Peize Lin add 2019-03-09
this->pelec->set_exx(this->exx_lip->get_exx_energy(), cal_exx, hybrid_alpha); // Peize Lin add 2019-03-09
}
#endif

Expand Down Expand Up @@ -227,6 +227,13 @@ namespace ModuleESolver
#ifdef __LCAO
if (PARAM.inp.out_mat_xc)
{
#ifdef __EXX
bool cal_exx = GlobalC::exx_info.info_global.cal_exx;
double hybrid_alpha = GlobalC::exx_info.info_global.hybrid_alpha;
#else
bool cal_exx = false;
double hybrid_alpha = 0.0;
#endif
ModuleIO::write_Vxc(PARAM.inp.nspin,
PARAM.globalv.nlocal,
GlobalV::DRANK,
Expand All @@ -240,7 +247,9 @@ namespace ModuleESolver
this->locpp.vloc,
this->chr,
this->kv,
this->pelec->wg
this->pelec->wg,
cal_exx,
hybrid_alpha
#ifdef __EXX
,
*this->exx_lip
Expand Down
6 changes: 4 additions & 2 deletions source/source_esolver/esolver_ks_pw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,11 @@ template <typename T, typename Device>
void ESolver_KS_PW<T, Device>::iter_finish(UnitCell& ucell, const int istep, int& iter, bool& conv_esolver)
{
// Related to EXX
if (GlobalC::exx_info.info_global.cal_exx && !exx_helper->get_op_first_iter())
bool cal_exx = GlobalC::exx_info.info_global.cal_exx;
double hybrid_alpha = GlobalC::exx_info.info_global.hybrid_alpha;
if (cal_exx && !exx_helper->get_op_first_iter())
{
this->pelec->set_exx(exx_helper->cal_exx_energy(this->stp.template get_psi_t<T, Device>()));
this->pelec->set_exx(exx_helper->cal_exx_energy(this->stp.template get_psi_t<T, Device>()), cal_exx, hybrid_alpha);
}

// deband is calculated from "output" charge density
Expand Down
13 changes: 0 additions & 13 deletions source/source_esolver/esolver_of_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,19 +207,6 @@ void ESolver_OF::get_step_length(double* dEdtheta, double** ptemp_phi, UnitCell&
// while(true)
// {
// this->pelec->f_en.calculate_etot(this->pw_rho->nrxx,
// this->pw_rho->nxyz); temp_energy =
// this->pelec->f_en.etot; kinetic_energy =
// this->kinetic_energy(); pseudopot_energy = 0.; for (int
// is = 0; is < PARAM.inp.nspin; ++is) {
// pseudopot_energy +=
// this->inner_product(GlobalC::pot.vltot,
// ptemp_rho_[is], this->pw_rho->nrxx, this->dV_);
// }
// Parallel_Reduce::reduce_all(pseudopot_energy);
// temp_energy += kinetic_energy + pseudopot_energy;
// this->opt_dcsrch_->dcSrch(temp_energy, dEdalpha,
// thetaAlpha, this->task_); numDC++;

// if (strncmp(this->task_, "FG", 2) == 0)
// {
// for (int is = 0; is < PARAM.inp.nspin; ++is)
Expand Down
4 changes: 2 additions & 2 deletions source/source_estate/elecstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ class ElecState
bool vnew_exist = false;
void cal_converged();
void cal_energies(const int type);
void set_exx(const double& Eexx);
void set_exx(const std::complex<double>& Eexx);
void set_exx(const double& Eexx, const bool cal_exx, const double hybrid_alpha);
void set_exx(const std::complex<double>& Eexx, const bool cal_exx, const double hybrid_alpha);

double get_hartree_energy();
double get_etot_efield();
Expand Down
15 changes: 11 additions & 4 deletions source/source_estate/elecstate_exx.cpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
#include "source_estate/elecstate.h"
#include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info
#include "source_base/tool_quit.h"
#include <complex> // use std::complex

namespace elecstate
{

/// @brief calculation if converged
/// @date Peize Lin add 2016-12-03
void ElecState::set_exx(const double& Eexx)
void ElecState::set_exx(const double& Eexx, const bool cal_exx, const double hybrid_alpha)
{
ModuleBase::TITLE("energy", "set_exx");

if (GlobalC::exx_info.info_global.cal_exx)
if (cal_exx)
{
this->f_en.exx = GlobalC::exx_info.info_global.hybrid_alpha * Eexx;
this->f_en.exx = hybrid_alpha * Eexx;
}
return;
}

void ElecState::set_exx(const std::complex<double>& Eexx, const bool cal_exx, const double hybrid_alpha)
{
ModuleBase::WARNING_QUIT("ElecState::set_exx",
"std::complex<double> version is not implemented yet");
}

}
4 changes: 0 additions & 4 deletions source/source_estate/module_pot/pot_sep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ void PotSep::cal_fixed_v(double* vl_pseudo)
ModuleBase::TITLE("PotSep", "cal_fixed_v");
ModuleBase::timer::start("PotSep", "cal_fixed_v");

// GlobalC::vsep_cell.generate_vsep_r(this->rho_basis_[0], this->sf_[0]);

// const_cast<VSep*>(this->vsep_)->generate_vsep_r(this->rho_basis_[0], this->sf_[0]);

if (vsep_cell != nullptr)
{
for (int ir = 0; ir < this->rho_basis_->nrxx; ++ir)
Expand Down
18 changes: 16 additions & 2 deletions source/source_estate/module_pot/pot_xc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@ void PotXC::cal_v_eff(const Charge*const chg, const UnitCell*const ucell, Module
if (XC_Functional::get_ked_flag())
{
#ifdef USE_LIBXC
const double hybrid_alpha = XC_Functional::get_hybrid_alpha();
#ifdef __EXX
const double hse_omega = XC_Functional::get_hse_omega();
#else
const double hse_omega = 0.0;
#endif
const std::tuple<double, double, ModuleBase::matrix, ModuleBase::matrix> etxc_vtxc_v
= XC_Functional_Libxc::v_xc_meta(XC_Functional::get_func_id(), nrxx_current, ucell->omega, ucell->tpiba, chg,
PARAM.inp.nspin);
PARAM.inp.nspin, hybrid_alpha, hse_omega);
*(this->etxc_) = std::get<0>(etxc_vtxc_v);
*(this->vtxc_) = std::get<1>(etxc_vtxc_v);
v_eff += std::get<2>(etxc_vtxc_v);
Expand All @@ -37,11 +43,19 @@ void PotXC::cal_v_eff(const Charge*const chg, const UnitCell*const ucell, Module
}
else
{
const double hybrid_alpha = XC_Functional::get_hybrid_alpha();
#ifdef __EXX
const double hse_omega = XC_Functional::get_hse_omega();
#else
const double hse_omega = 0.0;
#endif
const std::tuple<double, double, ModuleBase::matrix> etxc_vtxc_v
= XC_Functional::v_xc(nrxx_current, chg, ucell,
PARAM.inp.nspin,
PARAM.globalv.domag,
PARAM.globalv.domag_z);
PARAM.globalv.domag_z,
hybrid_alpha,
hse_omega);
*(this->etxc_) = std::get<0>(etxc_vtxc_v);
*(this->vtxc_) = std::get<1>(etxc_vtxc_v);
v_eff += std::get<2>(etxc_vtxc_v);
Expand Down
20 changes: 18 additions & 2 deletions source/source_estate/module_pot/pot_xc_fdm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,19 @@ PotXC_FDM::PotXC_FDM(
this->dynamic_mode = true;
this->fixed_mode = false;

const double hybrid_alpha = XC_Functional::get_hybrid_alpha();
#ifdef __EXX
const double hse_omega = XC_Functional::get_hse_omega();
#else
const double hse_omega = 0.0;
#endif
const std::tuple<double, double, ModuleBase::matrix> etxc_vtxc_v_0
= XC_Functional::v_xc(this->chg_0->nrxx, this->chg_0, ucell,
PARAM.inp.nspin,
PARAM.globalv.domag,
PARAM.globalv.domag_z);
PARAM.globalv.domag_z,
hybrid_alpha,
hse_omega);
this->v_xc_0 = std::get<2>(etxc_vtxc_v_0);
}

Expand All @@ -50,11 +58,19 @@ void PotXC_FDM::cal_v_eff(
chg_01.rho_core[ir] = chg_0->rho_core[ir] + chg_1->rho_core[ir];
}

const double hybrid_alpha = XC_Functional::get_hybrid_alpha();
#ifdef __EXX
const double hse_omega = XC_Functional::get_hse_omega();
#else
const double hse_omega = 0.0;
#endif
const std::tuple<double, double, ModuleBase::matrix> etxc_vtxc_v_01
= XC_Functional::v_xc(chg_01.nrxx, &chg_01, ucell,
PARAM.inp.nspin,
PARAM.globalv.domag,
PARAM.globalv.domag_z);
PARAM.globalv.domag_z,
hybrid_alpha,
hse_omega);
const ModuleBase::matrix &v_xc_01 = std::get<2>(etxc_vtxc_v_01);

v_eff += v_xc_01 - this->v_xc_0;
Expand Down
1 change: 0 additions & 1 deletion source/source_hamilt/module_surchem/sol_force.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ void surchem::force_cor_one(const UnitCell& cell,
//ModuleBase::GlobalFunc::ZEROS(delta_phi_g, rho_basis->npw);

rho_basis->real2recip(this->delta_phi, delta_phi_g);
// GlobalC::UFFT.ToReciSpace(this->delta_phi, delta_phi_g,rho_basis);
// double Ael = 0;
// double Ael1 = 0;
// ModuleBase::GlobalFunc::ZEROS(vg, ngmc);
Expand Down
30 changes: 22 additions & 8 deletions source/source_hamilt/module_xc/libxc_abacus.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ namespace XC_Functional_Libxc
*/
extern std::vector<xc_func_type> init_func(
const std::vector<int> &func_id,
const int xc_polarized);
const int xc_polarized,
const double hybrid_alpha,
const double hse_omega);

extern void finish_func(std::vector<xc_func_type> &funcs);

Expand All @@ -63,7 +65,9 @@ namespace XC_Functional_Libxc
const int nspin,
const bool domag,
const bool domag_z,
const std::map<int, double>* scaling_factor);
const std::map<int, double>* scaling_factor,
const double hybrid_alpha,
const double hse_omega);

// for mGGA functional
extern std::tuple<double, double, ModuleBase::matrix, ModuleBase::matrix> v_xc_meta(
Expand All @@ -72,7 +76,9 @@ namespace XC_Functional_Libxc
const double &omega, // volume of cell
const double tpiba,
const Charge* const chr,
const int nspin);
const int nspin,
const double hybrid_alpha,
const double hse_omega);


//-------------------
Expand Down Expand Up @@ -162,7 +168,9 @@ namespace XC_Functional_Libxc
const double &rhodw,
double &exc,
double &vxcup,
double &vxcdw);
double &vxcdw,
const double hybrid_alpha,
const double hse_omega);


//-------------------
Expand All @@ -176,7 +184,9 @@ namespace XC_Functional_Libxc
const double &grho,
double &sxc,
double &v1xc,
double &v2xc);
double &v2xc,
const double hybrid_alpha,
const double hse_omega);

// the entire GGA functional, for nspin=2 case
extern void gcxc_spin_libxc(
Expand All @@ -190,7 +200,9 @@ namespace XC_Functional_Libxc
double &v1xcdw,
double &v2xcup,
double &v2xcdw,
double &v2xcud);
double &v2xcud,
const double hybrid_alpha,
const double hse_omega);


//-------------------
Expand All @@ -207,7 +219,8 @@ namespace XC_Functional_Libxc
double &v1xc,
double &v2xc,
double &v3xc,
const double &hybrid_alpha);
const double &hybrid_alpha,
const double &hse_omega);

extern void tau_xc_spin(
const std::vector<int> &func_id,
Expand All @@ -225,7 +238,8 @@ namespace XC_Functional_Libxc
double &v2xcud,
double &v3xcup,
double &v3xcdw,
const double &hybrid_alpha);
const double &hybrid_alpha,
const double &hse_omega);

} // namespace XC_Functional_Libxc

Expand Down
Loading
Loading