Skip to content

Commit 98240e6

Browse files
committed
add LCAO_set.h and LCAO_set.cpp
1 parent accd6da commit 98240e6

File tree

4 files changed

+94
-20
lines changed

4 files changed

+94
-20
lines changed

source/Makefile.Objects

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@ OBJS_LCAO=evolve_elec.o\
634634
spar_hsr.o\
635635
spar_st.o\
636636
spar_u.o\
637+
LCAO_set.o\
637638
LCAO_set_fs.o\
638639
LCAO_set_st.o\
639640
LCAO_nl_mu.o\

source/source_lcao/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ if(ENABLE_LCAO)
3333
spar_hsr.cpp
3434
spar_st.cpp
3535
spar_u.cpp
36+
LCAO_set.cpp
3637
LCAO_set_fs.cpp
3738
LCAO_set_st.cpp
3839
LCAO_nl_mu.cpp

source/source_lcao/LCAO_set.cpp

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
#include "source_lcao/LCAO_set_pot.h"
22
#include "source_io/module_parameter/parameter.h"
33

4-
namespace LCAO_domain
5-
{
6-
7-
void set_psi_occ_dm_chg(psi, kv, pv, inp, pelec, dmat, chr)
4+
template <typename TK>
5+
void LCAO_domain::set_psi_occ_dm_chg(
6+
const K_Vectors &kv, // k-points
7+
psi::Psi<TK>* psi, // coefficients of NAO basis
8+
const Parallel_Orbitals &pv, // parallel scheme of NAO basis
9+
elecstate::ElecState* pelec, // eigen values and weights
10+
LCAO_domain::Setup_DM<TK> &dmat, // density matrix
11+
Charge &chr, // charge density
12+
const Input_para &inp) // input parameters
813
{
914
//! 1) init electronic wave function psi
1015
Setup_Psi<TK>::allocate_psi(psi, kv, pv, inp);
@@ -16,54 +21,69 @@ void set_psi_occ_dm_chg(psi, kv, pv, inp, pelec, dmat, chr)
1621
pv, *psi, pelec->ekb, pelec->wg, kv.ik2iktot,
1722
kv.get_nkstot(), inp.nspin))
1823
{
19-
ModuleBase::WARNING_QUIT("ESolver_KS_LCAO", "read electronic wave functions failed");
24+
ModuleBase::WARNING_QUIT("set_psi_occ_dm_chg", "read electronic wave functions failed");
2025
}
2126
}
2227

23-
// 3) set occupations, tddft does not need to set occupations in the first scf
28+
//! 3) set occupations, tddft does not need to set occupations in the first scf
2429
if (inp.ocp && inp.esolver_type != "tddft")
2530
{
2631
elecstate::fixed_weights(inp.ocp_kb, inp.nbands, inp.nelec,
27-
pelec->klist, pelec->wg, pelec->skip_weights);
32+
kv, pelec->wg, pelec->skip_weights);
2833
}
2934

30-
// 4) init DMK, but DMR is constructed in before_scf()
35+
//! 4) init DMK, but DMR is constructed in before_scf()
3136
dmat.allocate_dm(&kv, &pv, inp.nspin);
3237

33-
// 5) init charge density
38+
//! 5) init charge density
3439
chr.allocate(inp.nspin);
40+
41+
return;
3542
}
3643

3744

38-
void set_pot(pelec, locpp, pw_rho, pw_rhod, sf, solvent, dftu, pv, kv, orb_, exx_nao, deepks)
45+
46+
void LCAO_domain::set_pot(
47+
const K_Vectors &kv,
48+
const Structure_Factor& sf,
49+
const ModulePW::PW_Basis &pw_rho,
50+
const ModulePW::PW_Basis &pw_rhod,
51+
elecstate::ElecState* pelec,
52+
const LCAO_Orbitals& orb,
53+
const Parallel_Orbitals &pv,
54+
pseudopot_cell_vl &locpp,
55+
Plus_U &dftu,
56+
surchem& solvent,
57+
Exx_NAO<T> &exx_nao,
58+
Setup_DeePKS<T> &deepks,
59+
const Input_para &inp)
3960
{
40-
// 1) init local pseudopotentials
61+
//! 1) init local pseudopotentials
4162
locpp.init_vloc(ucell, pw_rho);
4263
ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "LOCAL POTENTIAL");
4364

44-
// 2) init potentials
65+
//! 2) init potentials
4566
if (pelec->pot == nullptr)
4667
{
4768
// where is the pot deleted?
48-
pelec->pot = new elecstate::Potential(pw_rhod, pw_rho,
69+
pelec->pot = new elecstate::Potential(&pw_rhod, &pw_rho,
4970
&ucell, &(locpp.vloc), &(sf), &(solvent),
5071
&(pelec->f_en.etxc), &(pelec->f_en.vtxc));
5172
}
5273

53-
// 3) initialize DFT+U
74+
//! 3) initialize DFT+U
5475
if (inp.dft_plus_u)
5576
{
56-
dftu.init(ucell, &pv, kv.get_nks(), &orb_);
77+
dftu.init(ucell, &pv, kv.get_nks(), &orb);
5778
}
5879

59-
// 4) init exact exchange calculations
60-
exx_nao.before_runner(ucell, kv, orb_, pv, inp);
80+
//! 4) init exact exchange calculations
81+
exx_nao.before_runner(ucell, kv, orb, pv, inp);
6182

62-
// 5) init deepks
63-
deepks.before_runner(ucell, kv.get_nks(), orb_, pv, inp);
83+
//! 5) init deepks
84+
deepks.before_runner(ucell, kv.get_nks(), orb, pv, inp);
6485

6586
return;
6687
}
6788

6889

69-
}

source/source_lcao/LCAO_set.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#ifndef LCAO_SET_H
2+
#define LCAO_SET_H
3+
4+
#include "source_cell/klist.h"
5+
#include "source_psi/psi.h"
6+
#include "source_estate/elecstate.h"
7+
#include "source_lcao/setup_dm.h"
8+
#include "source_pw/module_pwdft/structure_factor.h"
9+
#include "source_basis/module_pw/pw_basis.h"
10+
#include "source_hamilt/module_surchem/surchem.h"
11+
#include "source_pw/module_pwdft/VL_in_pw.h"
12+
#include "source_lcao/module_deepks/LCAO_deepks.h"
13+
#include "source_lcao/module_dftu/dftu.h"
14+
#include "source_lcao/setup_exx.h"
15+
#include "source_lcao/setup_deepks.h"
16+
17+
/**
18+
* @brief set up wave functions, occupation numbers,
19+
* density matrix and charge density
20+
*/
21+
template <typename TK>
22+
void LCAO_domain::set_psi_occ_dm_chg(
23+
const K_Vectors &kv, // k-points
24+
psi::Psi<TK>* psi, // coefficients of NAO basis
25+
const Parallel_Orbitals &pv, // parallel scheme of NAO basis
26+
elecstate::ElecState* pelec, // eigen values and weights
27+
LCAO_domain::Setup_DM<TK> &dmat, // density matrix
28+
Charge &chr, // charge density
29+
const Input_para& inp) // input parameters
30+
31+
/**
32+
* @brief set up potentials, including local pseudopotentials,
33+
* +U potential, solvent potential, exx potential and deepks potential
34+
*/
35+
template <typename TK>
36+
void LCAO_domain::set_pot(
37+
const K_Vectors &kv,
38+
const Structure_Factor& sf,
39+
const ModulePW::PW_Basis &pw_rho,
40+
const ModulePW::PW_Basis &pw_rhod,
41+
elecstate::ElecState* pelec,
42+
const LCAO_Orbitals& orb,
43+
const Parallel_Orbitals &pv,
44+
pseudopot_cell_vl &locpp,
45+
Plus_U &dftu,
46+
surchem& solvent,
47+
Exx_NAO<T> &exx_nao,
48+
Setup_DeePKS<T> &deepks,
49+
const Input_para &inp);
50+
51+
52+
#endif

0 commit comments

Comments
 (0)