Skip to content

Commit e04dce3

Browse files
committed
fix bug
1 parent 67d93e7 commit e04dce3

File tree

1 file changed

+9
-2
lines changed
  • source/module_hamilt_lcao/module_gint

1 file changed

+9
-2
lines changed

source/module_hamilt_lcao/module_gint/gint.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ void Gint::transfer_DM2DtoGrid(std::vector<hamilt::HContainer<double>*> DM2D) {
254254
int mg = DM2D[0]->get_paraV()->get_global_row_size()/2;
255255
int ng = DM2D[0]->get_paraV()->get_global_col_size()/2;
256256
int nb = DM2D[0]->get_paraV()->get_block_size()/2;
257+
auto ijr_info = DM2D[0]->get_ijr_info();
257258
#ifdef __MPI
258259
int blacs_ctxt = DM2D[0]->get_paraV()->blacs_ctxt;
259260
std::vector<int> iat2iwt(ucell->nat);
@@ -263,9 +264,15 @@ void Gint::transfer_DM2DtoGrid(std::vector<hamilt::HContainer<double>*> DM2D) {
263264
Parallel_Orbitals *pv = new Parallel_Orbitals();
264265
pv->set(mg, ng, nb, blacs_ctxt);
265266
pv->set_atomic_trace(iat2iwt.data(), ucell->nat, mg);
266-
auto ijr_info = DM2D[0]->get_ijr_info();
267267
this-> DM2D_tmp = new hamilt::HContainer<double>(pv, nullptr, &ijr_info);
268268
this-> DM2D_tmp->set_zero();
269+
#else
270+
if (this->DM2D_tmp != nullptr) {
271+
delete this->DM2D_tmp;
272+
}
273+
this-> DM2D_tmp = new hamilt::HContainer<double>(*this->hRGint);
274+
this-> DM2D_tmp -> insert_ijrs(this->gridt->get_ijr_info(), *(this->ucell));
275+
this-> DM2D_tmp -> allocate(nullptr, true);
269276
#endif
270277
ModuleBase::Memory::record("Gint::DM2D_tmp", this->DM2D_tmp->get_memory_size());
271278
for (int is = 0; is < 4; is++){
@@ -275,7 +282,7 @@ void Gint::transfer_DM2DtoGrid(std::vector<hamilt::HContainer<double>*> DM2D) {
275282
int iat2 = ap.get_atom_j();
276283
for (int ir = 0; ir < ap.get_R_size(); ++ir) {
277284
const ModuleBase::Vector3<int> r_index = ap.get_R_index(ir);
278-
double* matrix_out = DM2D_tmp -> find_matrix(iat1, iat2, r_index)->get_pointer();
285+
double* matrix_out = this-> DM2D_tmp -> find_matrix(iat1, iat2, r_index)->get_pointer();
279286
double* matrix_in = ap.get_pointer(ir);
280287
for (int irow = 0; irow < ap.get_row_size()/2; irow ++) {
281288
for (int icol = 0; icol < ap.get_col_size()/2; icol ++) {

0 commit comments

Comments
 (0)