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
31 changes: 16 additions & 15 deletions source/source_pw/module_pwdft/setup_pot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include "source_pw/module_pwdft/VSep_in_pw.h"

template <typename T, typename Device>
void pw::setup_pot(const int istep,
UnitCell& ucell, // unitcell
void pw::setup_pot(const int istep,
UnitCell& ucell, // unitcell
const K_Vectors &kv, // kpoints
Structure_Factor &sf, // structure factors
elecstate::ElecState *pelec, // pointer of electrons
Expand All @@ -24,6 +24,16 @@ void pw::setup_pot(const int istep,
const Input_para& inp) // input parameters
{
ModuleBase::TITLE("pw", "setup_pot");

//----------------------------------------------------------
//! 0) DFT-1/2 calculations, sep potential need to generate
// before effective potential calculation
//----------------------------------------------------------
if (PARAM.inp.dfthalf_type > 0)
{
vsep_cell->generate_vsep_r(pw_rhod[0], sf.strucFac, ucell.sep_cell);
}

//----------------------------------------------------------
//! 1) Renew local pseudopotential
//----------------------------------------------------------
Expand Down Expand Up @@ -110,21 +120,12 @@ void pw::setup_pot(const int istep,
dftu->init(ucell, nullptr, kv.get_nks());
}

//----------------------------------------------------------
//! 7) DFT-1/2 calculations, sep potential need to generate
// before effective potential calculation
//----------------------------------------------------------
if (PARAM.inp.dfthalf_type > 0)
{
vsep_cell->generate_vsep_r(pw_rhod[0], sf.strucFac, ucell.sep_cell);
}

return;
}

template void pw::setup_pot<std::complex<float>, base_device::DEVICE_CPU>(
const int istep, // ionic step
UnitCell& ucell, // unitcell
UnitCell& ucell, // unitcell
const K_Vectors &kv, // kpoints
Structure_Factor &sf, // structure factors
elecstate::ElecState *pelec, // pointer of electrons
Expand All @@ -142,7 +143,7 @@ template void pw::setup_pot<std::complex<float>, base_device::DEVICE_CPU>(

template void pw::setup_pot<std::complex<double>, base_device::DEVICE_CPU>(
const int istep, // ionic step
UnitCell& ucell, // unitcell
UnitCell& ucell, // unitcell
const K_Vectors &kv, // kpoints
Structure_Factor &sf, // structure factors
elecstate::ElecState *pelec, // pointer of electrons
Expand All @@ -161,7 +162,7 @@ template void pw::setup_pot<std::complex<double>, base_device::DEVICE_CPU>(

template void pw::setup_pot<std::complex<float>, base_device::DEVICE_GPU>(
const int istep, // ionic step
UnitCell& ucell, // unitcell
UnitCell& ucell, // unitcell
const K_Vectors &kv, // kpoints
Structure_Factor &sf, // structure factors
elecstate::ElecState *pelec, // pointer of electrons
Expand All @@ -178,7 +179,7 @@ template void pw::setup_pot<std::complex<float>, base_device::DEVICE_GPU>(

template void pw::setup_pot<std::complex<double>, base_device::DEVICE_GPU>(
const int istep, // ionic step
UnitCell& ucell, // unitcell
UnitCell& ucell, // unitcell
const K_Vectors &kv, // kpoints
Structure_Factor &sf, // structure factors
elecstate::ElecState *pelec, // pointer of electrons
Expand Down
33 changes: 33 additions & 0 deletions tests/01_PW/209_PW_DFTHALF/INPUT
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
INPUT_PARAMETERS
#Parameters (1.General)
suffix autotest
calculation scf
ks_solver dav
dfthalf_type 1

symmetry 1
pseudo_dir ../../PP_ORB

#Parameters (2.Iteration)
ecutwfc 50
scf_thr 1e-9
scf_nmax 100


#Parameters (3.Basis)
basis_type pw

#Parameters (4.Smearing)
smearing_method gauss
smearing_sigma 0.002

#Parameters (5.Mixing)
mixing_type broyden
mixing_beta 0.7

dft_functional PBE

#OUT
out_bandgap true

pw_seed 1
4 changes: 4 additions & 0 deletions tests/01_PW/209_PW_DFTHALF/KPT
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
K_POINTS
0
Gamma
2 2 2 0 0 0
1 change: 1 addition & 0 deletions tests/01_PW/209_PW_DFTHALF/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DFT-1/2 method in PW basis, soc off
28 changes: 28 additions & 0 deletions tests/01_PW/209_PW_DFTHALF/STRU
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
ATOMIC_SPECIES
Li 0.0 Li_ONCV_PBE-1.2.upf upf201
F 0.0 F_ONCV_PBE-1.2.upf upf201

LATTICE_CONSTANT
1.0000000000

LATTICE_VECTORS
0.0000000000 3.8379626543 3.8379626543
3.8379626543 0.0000000000 3.8379626543
3.8379626543 3.8379626543 0.0000000000

SEP_FILES
Li 0
F 1 F_pbe_50.sep 0.0 2.2 20.0 1.0

ATOMIC_POSITIONS
Direct

Li #label
0.0000 #magnetism
1 #number of atoms
0.0000000000 0.0000000000 0.0000000000 m 1 1 1

F #label
0.0000 #magnetism
1 #number of atoms
0.5000000000 0.5000000000 0.5000000000 m 1 1 1
6 changes: 6 additions & 0 deletions tests/01_PW/209_PW_DFTHALF/result.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
etotref -906.0447337890729
etotperatomref -453.0223668945
pointgroupref O_h
spacegroupref O_h
nksibzref 3
totaltimeref 0.39
1 change: 1 addition & 0 deletions tests/01_PW/CASES_CPU.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
206_PW_SCAN_S2
207_PW_skip
208_PW_CG_float
209_PW_DFTHALF
801_PW_LT_sc
802_PW_LT_fcc
803_PW_LT_bcc
Expand Down
Loading
Loading