Skip to content

Commit d91fada

Browse files
author
abacus_fixer
committed
Merge branch '2026-09-02-line2-DFPT' of github.com:mohanchen/abacus-mc into 2026-09-02-line2-DFPT
2 parents fac954b + 5b01339 commit d91fada

94 files changed

Lines changed: 2756 additions & 2147 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENTS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ rules. Read the complete governance document before making or reviewing changes:
103103
- Member -> free function: inventory `this->` reads; pass as params (const
104104
for config, ref for mutable state); move only when body is `this`-free;
105105
keep thin wrapper; compile each step.
106+
- Extract a base-class nested-vector member in three steps (hold + forward,
107+
switch writers, delete legacy) so no commit mixes old-storage writes with
108+
new-storage reads.
106109

107110
## Local Commands
108111

source/Makefile.Objects

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ OBJS_ELECSTAT=elecstate.o\
281281
read_orb.o\
282282
setup_estate_pw.o\
283283
update_pot.o\
284+
occ_matrix.o
284285

285286
OBJS_ELECSTAT_LCAO=elecstate_lcao.o\
286287
init_dm.o\
@@ -410,13 +411,12 @@ OBJS_HAMILT_LCAO=hamilt_lcao.o\
410411
veff_lcao.o\
411412
veff_dh.o\
412413
meta_lcao.o\
413-
dftu_lcao_op.o\
414+
dftu_nao_op.o\
414415
deepks_lcao.o\
415416
op_exx_lcao.o\
416417
dspin_lcao.o\
417418
dspin_fs.o\
418419
setup_dftu_lcao.o\
419-
dftu_fs.o\
420420
operator_fs_utils.o\
421421

422422
OBJS_HCONTAINER=base_matrix.o\
@@ -821,9 +821,10 @@ OBJS_SRCPW=h_ewald_pw.o\
821821
setup_pwwfc.o\
822822
update_cell_pw.o\
823823
dftu_base.o\
824-
dftu_output.o\
825-
dftu_tools_pw.o\
826-
dftu_cal_occ_pw.o\
824+
dftu_base_io.o\
825+
dftu_base_occ.o\
826+
dftu_base_tools.o\
827+
yukawa_screening.o\
827828
setup_dftu_pw.o\
828829
deltaspin_pw.o\
829830
deltaspin_pw_impl.o\
@@ -898,14 +899,16 @@ OBJS_VDW=vdw.o\
898899
vdwd3_autoset_xcname.o\
899900
vdwd3_auto_xcpar.o
900901

901-
OBJS_DFTU=dftu_lcao.o\
902-
dftu_force.o\
903-
dftu_yukawa.o\
904-
dftu_folding.o\
905-
dftu_lcao_pots.o\
906-
dftu_lcao_energy.o\
907-
dftu_lcao_op_legacy.o\
908-
dftu_lcao_occ.o\
902+
OBJS_DFTU=dftu_nao.o\
903+
dftu_nao_fs_k.o\
904+
dftu_nao_for_r.o\
905+
dftu_nao_fs_r.o\
906+
dftu_nao_str_r.o\
907+
dftu_nao_folding.o\
908+
dftu_nao_pots.o\
909+
dftu_nao_energy.o\
910+
dftu_nao_op_legacy.o\
911+
dftu_nao_occ.o\
909912
dftu_hamilt.o
910913

911914
OBJS_DELTASPIN=basic_funcs.o\

source/source_base/module_container/ATen/core/tensor.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ bool Tensor::AllocateFrom(const Tensor& other, const TensorShape& shape) {
295295

296296
void Tensor::sync(const Tensor& rhs) {
297297
REQUIRES_OK(this->data_type_ == rhs.data_type_
298-
&& this->device_ == rhs.device_)
298+
&& this->device_ == rhs.device_,
299+
"sync: data_type and device must match between tensors")
299300

300301
if (this->shape_ == rhs.shape_) {
301302
TEMPLATE_ALL_2(data_type_, device_,

source/source_base/module_container/ATen/kernels/memory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ struct synchronize_memory_stride {
8181
const std::vector<int64_t>& out_size,
8282
const std::vector<int64_t>& in_size)
8383
{
84-
REQUIRES_OK(in_size.size() == out_size.size() && in_size.size() <= 2);
84+
REQUIRES_OK(in_size.size() == out_size.size() && in_size.size() <= 2, "rank mismatch: in_size and out_size must have the same rank <= 2");
8585
if (in_size.size() == 1) {
8686
synchronize_memory<T, Device_out, Device_in>()(arr_out, arr_in, in_size[0]);
8787
}

source/source_base/module_container/base/macros/macros.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
__func__, \
7171
__FILE__, \
7272
static_cast<uint32_t>(__LINE__), \
73-
CHECK_MSG(expr, ##__VA_ARGS__)); \
73+
CHECK_MSG(expr, __VA_ARGS__)); \
7474
}
7575

7676
// The macro TEMPLATE_1() expands to a switch statement conditioned on

source/source_esolver/esolver_ks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "source_hamilt/module_xc/xc_functional.h"
1414
#include "source_io/module_output/output_log.h" // use write_head
1515
#include "source_estate/elecstate_print.h" // print_etot
16-
#include "source_lcao/module_dftu/dftu_lcao.h" // mohan add 2025-11-07
16+
#include "source_lcao/module_dftu/dftu_nao.h" // mohan add 2025-11-07
1717
#include "source_hamilt/module_xc/general_exx_info.h" // for init_general_exx_info
1818

1919
namespace ModuleESolver

source/source_esolver/esolver_ks.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "source_hamilt/hamilt.h" // use Hamiltonian
99
#include "source_hamilt/hamilt_base.h" // use Hamiltonian base class
1010
#include "source_hamilt/module_xc/general_exx_info.h" // ESolver owns General_Exx_Info value
11-
#include "source_lcao/module_dftu/dftu_lcao.h" // mohan add 20251107
11+
#include "source_lcao/module_dftu/dftu_nao.h" // mohan add 20251107
1212
#include "source_pw/module_pwdft/vnl_pw.h"
1313

1414
namespace ModuleESolver

source/source_esolver/esolver_ks_pw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ void ESolver_KS_PW<T, Device>::iter_init(UnitCell& ucell, const int istep, const
202202

203203
// update local occupations for DFT+U
204204
// should before lambda loop in DeltaSpin
205-
pw::iter_init_dftu_pw(iter,
205+
DFTU_BASE::iter_init_dftu_pw(iter,
206206
istep,
207207
this->dftu,
208208
this->stp.template get_psi_t<T, Device>(),

source/source_esolver/lcao_others.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "source_lcao/hamilt_lcao.h"
1616
#include "source_lcao/lcao_domain.h"
1717
#include "source_lcao/module_deltaspin/spin_constrain.h"
18-
#include "source_lcao/module_dftu/dftu_lcao.h"
18+
#include "source_lcao/module_dftu/dftu_nao.h"
1919
#include "source_lcao/module_operator_lcao/op_exx_lcao.h"
2020
#include "source_lcao/module_operator_lcao/operator_lcao.h"
2121

source/source_estate/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ list(APPEND objects
4242
module_charge/symm_rhog.cpp
4343
fp_energy.cpp
4444
occupy.cpp
45+
occ_matrix.cpp
4546
param_update.cpp
4647
setup_estate_pw.cpp
4748
update_pot.cpp

0 commit comments

Comments
 (0)