Skip to content

Commit 7c4ad27

Browse files
author
abacus_fixer
committed
Phase 7: switch setup_pot/setup_dftu_pw to Plus_U_Base interface
- setup_pot.h/cpp: include dftu_base.h instead of dftu.h - setup_pot.cpp: parameter type Plus_U& -> Plus_U_Base& - setup_pot.cpp: call dftu.init_base() instead of dftu.init() with nullptr pv - setup_dftu_pw.h/cpp: forward declare Plus_U_Base, parameter type updated - Callers (esolver_ks_pw.cpp) pass this->dftu (Plus_U), bound to Plus_U_Base& After this phase, the PW path no longer needs LCAO-specific Plus_U headers.
1 parent ce6b8a3 commit 7c4ad27

4 files changed

Lines changed: 15 additions & 15 deletions

File tree

source/source_pw/module_pwdft/setup_dftu_pw.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#include "source_pw/module_pwdft/setup_dftu_pw.h"
2-
#include "source_lcao/module_dftu/dftu.h"
2+
#include "source_pw/module_pwdft/dftu_base.h" // mohan add 2025-11-06
33
#include "source_io/module_parameter/parameter.h"
44

55
namespace pw
66
{
77

88
void iter_init_dftu_pw(const int iter,
99
const int istep,
10-
Plus_U& dftu,
10+
Plus_U_Base& dftu, // mohan add 2025-11-06
1111
const void* psi,
1212
const ModuleBase::matrix& wg,
1313
const UnitCell& ucell,

source/source_pw/module_pwdft/setup_dftu_pw.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
#include "source_estate/module_charge/charge_mixing.h"
77

88
struct Input_para;
9-
class Plus_U;
9+
class Plus_U_Base; // mohan add 2025-11-06
1010

1111
namespace pw
1212
{
1313

1414
void iter_init_dftu_pw(const int iter,
1515
const int istep,
16-
Plus_U& dftu,
16+
Plus_U_Base& dftu, // mohan add 2025-11-06
1717
const void* psi,
1818
const ModuleBase::matrix& wg,
1919
const UnitCell& ucell,

source/source_pw/module_pwdft/setup_pot.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "source_lcao/module_deltaspin/spin_constrain.h"
55
#include "source_pw/module_pwdft/onsite_proj.h"
66
#include "source_pw/module_pwdft/vnl_pw.h"
7-
#include "source_lcao/module_dftu/dftu.h"
7+
#include "source_pw/module_pwdft/dftu_base.h" // mohan add 2025-11-06
88
#include "source_pw/module_pwdft/vsep_pw.h"
99

1010
template <typename T, typename Device>
@@ -17,7 +17,7 @@ void pw::setup_pot(const int istep,
1717
const Charge &chr, // charge density
1818
pseudopot_cell_vl &locpp, // local pseudopotentials
1919
pseudopot_cell_vnl &ppcell, // non-local pseudopotentials
20-
Plus_U &dftu, // mohan add 2025-11-06
20+
Plus_U_Base &dftu, // mohan add 2025-11-06
2121
VSep* vsep_cell, // U-1/2 method
2222
psi::Psi<T, Device>* kspw_psi, // electronic wave functions
2323
hamilt::HamiltBase* p_hamilt, // hamiltonian
@@ -122,7 +122,7 @@ void pw::setup_pot(const int istep,
122122
if (PARAM.inp.dft_plus_u)
123123
{
124124
const int nlocal_dftu = 0;
125-
dftu.init(ucell, nullptr,
125+
dftu.init_base(ucell,
126126
PARAM.globalv.npol,
127127
PARAM.inp.nspin, PARAM.inp.orbital_corr, PARAM.inp.yukawa_potential, PARAM.inp.yukawa_lambda,
128128
PARAM.globalv.global_readin_dir,
@@ -150,7 +150,7 @@ template void pw::setup_pot<std::complex<float>, base_device::DEVICE_CPU>(
150150
const Charge &chr, // charge density
151151
pseudopot_cell_vl &locpp, // local pseudopotentials
152152
pseudopot_cell_vnl &ppcell, // non-local pseudopotentials
153-
Plus_U &dftu, // mohan add 2025-11-06
153+
Plus_U_Base &dftu, // mohan add 2025-11-06
154154
VSep* vsep_cell, // U-1/2 method
155155
psi::Psi<std::complex<float>, base_device::DEVICE_CPU>* kspw_psi, // electronic wave functions
156156
hamilt::HamiltBase* p_hamilt, // hamiltonian
@@ -170,7 +170,7 @@ template void pw::setup_pot<std::complex<double>, base_device::DEVICE_CPU>(
170170
const Charge &chr, // charge density
171171
pseudopot_cell_vl &locpp, // local pseudopotentials
172172
pseudopot_cell_vnl &ppcell, // non-local pseudopotentials
173-
Plus_U &dftu, // mohan add 2025-11-06
173+
Plus_U_Base &dftu, // mohan add 2025-11-06
174174
VSep* vsep_cell, // U-1/2 method
175175
psi::Psi<std::complex<double>, base_device::DEVICE_CPU>* kspw_psi, // electronic wave functions
176176
hamilt::HamiltBase* p_hamilt, // hamiltonian
@@ -191,7 +191,7 @@ template void pw::setup_pot<std::complex<float>, base_device::DEVICE_GPU>(
191191
const Charge &chr, // charge density
192192
pseudopot_cell_vl &locpp, // local pseudopotentials
193193
pseudopot_cell_vnl &ppcell, // non-local pseudopotentials
194-
Plus_U &dftu, // mohan add 2025-11-06
194+
Plus_U_Base &dftu, // mohan add 2025-11-06
195195
VSep* vsep_cell, // U-1/2 method
196196
psi::Psi<std::complex<float>, base_device::DEVICE_GPU>* kspw_psi, // electronic wave functions
197197
hamilt::HamiltBase* p_hamilt, // hamiltonian
@@ -210,7 +210,7 @@ template void pw::setup_pot<std::complex<double>, base_device::DEVICE_GPU>(
210210
const Charge &chr, // charge density
211211
pseudopot_cell_vl &locpp, // local pseudopotentials
212212
pseudopot_cell_vnl &ppcell, // non-local pseudopotentials
213-
Plus_U &dftu, // mohan add 2025-11-06
213+
Plus_U_Base &dftu, // mohan add 2025-11-06
214214
VSep* vsep_cell, // U-1/2 method
215215
psi::Psi<std::complex<double>, base_device::DEVICE_GPU>* kspw_psi, // electronic wave functions
216216
hamilt::HamiltBase* p_hamilt, // hamiltonian

source/source_pw/module_pwdft/setup_pot.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,24 @@
77
#include "source_estate/elecstate.h"
88
#include "source_pw/module_pwdft/vl_pw.h"
99
#include "source_hamilt/hamilt.h"
10-
#include "source_lcao/module_dftu/dftu.h" // mohan add 2025-11-06
10+
#include "source_pw/module_pwdft/dftu_base.h" // mohan add 2025-11-06
1111

1212
class pseudopot_cell_vnl;
1313

1414
namespace pw
1515
{
1616

1717
template <typename T, typename Device>
18-
void setup_pot(const int istep,
19-
UnitCell& ucell, // unitcell
18+
void setup_pot(const int istep,
19+
UnitCell& ucell, // unitcell
2020
const K_Vectors &kv, // kpoints
2121
Structure_Factor &sf, // structure factors
2222
elecstate::ElecState *pelec, // pointer of electrons
2323
const Parallel_Grid &para_grid, // parallel of FFT grids
2424
const Charge &chr, // charge density
2525
pseudopot_cell_vl &locpp, // local pseudopotentials
2626
pseudopot_cell_vnl &ppcell, // non-local pseudopotentials
27-
Plus_U &dftu, // mohan add 2025-11-06
27+
Plus_U_Base &dftu, // mohan add 2025-11-06
2828
VSep* vsep_cell, // U-1/2 method
2929
psi::Psi<T, Device>* kspw_psi, // electronic wave functions
3030
hamilt::HamiltBase* p_hamilt, // hamiltonian

0 commit comments

Comments
 (0)