Skip to content

Commit eae86c5

Browse files
committed
Fix(wannier90): bug for to_wannier90 class initialization in LCAO code
1 parent 0b250ad commit eae86c5

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

source/module_esolver/esolver_ks_lcao_elec.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ namespace ModuleESolver
366366
// add by jingan in 2018.11.7
367367
if (GlobalV::CALCULATION == "nscf" && INPUT.towannier90)
368368
{
369-
toWannier90 myWannier(GlobalC::kv.nkstot, GlobalC::ucell.G);
369+
toWannier90 myWannier(GlobalC::kv.nkstot, GlobalC::ucell.G, this->LOWF.wfc_k_grid);
370370
myWannier.init_wannier(nullptr);
371371
}
372372

source/src_io/to_wannier90.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,21 +1656,24 @@ void toWannier90::getUnkFromLcao()
16561656
}
16571657

16581658

1659-
1659+
if(this->unk_inLcao != nullptr)
1660+
{
1661+
delete this->unk_inLcao;
1662+
}
16601663
this->unk_inLcao = new psi::Psi<std::complex<double>>(num_kpts, GlobalV::NBANDS, GlobalC::wf.npwx, nullptr);
16611664
ModuleBase::ComplexMatrix *orbital_in_G = new ModuleBase::ComplexMatrix[num_kpts];
16621665

16631666
for(int ik = 0; ik < num_kpts; ik++)
16641667
{
16651668
// ��ȡȫ�ֵ�lcao�IJ�����ϵ��
16661669
get_lcao_wfc_global_ik(lcao_wfc_global[ik], this->wfc_k_grid[ik]);
1667-
1670+
16681671
int npw = GlobalC::kv.ngk[ik];
16691672
orbital_in_G[ik].create(GlobalV::NLOCAL,npw);
16701673
this->lcao2pw_basis(ik,orbital_in_G[ik]);
16711674

16721675
}
1673-
1676+
16741677
// ��lcao�����unkת��pw�����µ�unk
16751678
for(int ik = 0; ik < num_kpts; ik++)
16761679
{
@@ -1685,7 +1688,7 @@ void toWannier90::getUnkFromLcao()
16851688
}
16861689
}
16871690
}
1688-
1691+
16891692
// ��һ��
16901693
for(int ik = 0; ik < num_kpts; ik++)
16911694
{
@@ -1710,7 +1713,7 @@ void toWannier90::getUnkFromLcao()
17101713
}
17111714
}
17121715

1713-
1716+
17141717
for(int ik = 0; ik < GlobalC::kv.nkstot; ik++)
17151718
{
17161719
for(int ib = 0; ib < GlobalV::NBANDS; ib++)
@@ -1801,7 +1804,7 @@ void toWannier90::get_lcao_wfc_global_ik(std::complex<double> **ctot, std::compl
18011804
}
18021805
}
18031806
}
1804-
1807+
18051808
delete[] crecv;
18061809
delete[] trace_lo2;
18071810
}
@@ -1836,7 +1839,7 @@ void toWannier90::get_lcao_wfc_global_ik(std::complex<double> **ctot, std::compl
18361839
csend[mu*GlobalV::NBANDS+ib] = cc[ib][mu];
18371840
}
18381841
}
1839-
1842+
18401843
tag = GlobalV::DRANK * 3 + 2;
18411844
#ifdef __MPI
18421845
MPI_Send(csend, GlobalV::NBANDS*GlobalC::GridT.lgd, mpicomplex, 0, tag, DIAG_WORLD);

0 commit comments

Comments
 (0)