Skip to content

Commit 8c5ea60

Browse files
committed
just save
1 parent 4ebc6c1 commit 8c5ea60

File tree

4 files changed

+45
-60
lines changed

4 files changed

+45
-60
lines changed

source/module_esolver/esolver_ks.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -636,20 +636,14 @@ void ESolver_KS<T, Device>::runner(const int istep, UnitCell& ucell)
636636
// if ( (!GlobalC::exx_info.info_global.cal_exx && iter == 1) || one_step_exx )
637637
if ( !GlobalC::exx_info.info_global.cal_exx || (GlobalC::exx_info.info_global.cal_exx && one_step_exx) )
638638
{
639-
std::cout << "\n\n\n******\nrdmft-test-0.0\n******\n\n\n" << std::endl;
640-
641639
ModuleBase::matrix occ_number_ks(this->pelec->wg);
642640
for(int ik=0; ik < occ_number_ks.nr; ++ik)
643641
{
644642
for(int inb=0; inb < occ_number_ks.nc; ++inb) occ_number_ks(ik, inb) /= this->kv.wk[ik];
645643
}
646644

647-
std::cout << "\n\n\n******\nrdmft-test-0.1\n******\n\n\n" << std::endl;
648-
649645
this->update_elec_rdmft(occ_number_ks, *(this->psi));
650646

651-
std::cout << "\n\n\n******\nget the initial values of wfc and occ_numbers successfully\n******\n\n\n" << std::endl;
652-
653647
//initialize the gradients of Etotal on wg and wfc, and set all elements to 0.
654648
ModuleBase::matrix E_gradient_occNum(this->pelec->wg.nr, this->pelec->wg.nc, true);
655649
psi::Psi<T> E_gradient_wfc(this->psi->get_nk(), this->psi->get_nbands(), this->psi->get_nbasis());

source/module_rdmft/CMakeLists.txt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,6 @@ add_library(
66
rdmft_test.cpp
77
)
88

9-
# add_library(
10-
# psi
11-
# OBJECT
12-
# psi.cpp
13-
# )
14-
15-
# add_library(
16-
# psi_initializer
17-
# OBJECT
18-
# psi_initializer.cpp
19-
# psi_initializer_random.cpp
20-
# psi_initializer_atomic.cpp
21-
# psi_initializer_atomic_random.cpp
22-
# psi_initializer_nao.cpp
23-
# psi_initializer_nao_random.cpp
24-
# )
25-
269
# if(ENABLE_COVERAGE)
2710
# add_coverage(psi)
2811
# add_coverage(psi_initializer)

source/module_rdmft/rdmft.cpp

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -258,28 +258,18 @@ void RDMFT<TK, TR>::update_ion(UnitCell& ucell_in, ModulePW::PW_Basis& rho_basis
258258
template <typename TK, typename TR>
259259
void RDMFT<TK, TR>::update_elec(const ModuleBase::matrix& occ_number_in, const psi::Psi<TK>& wfc_in, const Charge* charge_in)
260260
{
261-
std::cout << "\n\n\n******\nrdmft-test-1.0\n******\n\n\n" << std::endl;
262261
// update occ_number, wg, wk_fun_occNum
263262
occ_number = (occ_number_in);
264263
wg = (occ_number);
265-
std::cout << "\n\n\n******\nrdmft-test-1.1\n******\n\n\n" << std::endl;
266-
267-
std::cout << "\n***\nnk_total: " << nk_total << "\n***\n" << std::endl;
268-
std::cout << "\n***\nnbands_total: " << nbands_total << "\n***\n" << std::endl;
269-
270-
std::cout << "\n***\nwg.nr: " << wg.nr<< "\n***\n" << std::endl;
271-
std::cout << "\n***\nwg.nc: " << wg.nc << "\n***\n" << std::endl;
272264

273265
for(int ik=0; ik < wg.nr; ++ik)
274266
{
275267
for(int inb=0; inb < wg.nc; ++inb)
276268
{
277269
wg(ik, inb) *= kv->wk[ik];
278-
std::cout << "\n\n\n******\nrdmft-test-1.2\n******\n\n\n" << std::endl;
279270
wk_fun_occNum(ik, inb) = kv->wk[ik] * occNum_func(occ_number(ik, inb), 2, XC_func_rdmft, alpha_power);
280271
}
281272
}
282-
std::cout << "\n\n\n******\nrdmft-test-1.3\n******\n\n\n" << std::endl;
283273

284274
// update wfc
285275
TK* pwfc_in = &wfc_in(0, 0, 0);
@@ -321,7 +311,7 @@ void RDMFT<TK, TR>::update_charge()
321311
}
322312

323313
GG->transfer_DM2DtoGrid(DM_gamma_only.get_DMR_vector());
324-
Gint_inout inout(charge->rho, Gint_Tools::job_type::rho);
314+
Gint_inout inout(charge->rho, Gint_Tools::job_type::rho, nspin);
325315
GG->cal_gint(&inout);
326316

327317
if (XC_Functional::get_func_type() == 3 || XC_Functional::get_func_type() == 5)
@@ -351,7 +341,7 @@ void RDMFT<TK, TR>::update_charge()
351341
}
352342

353343
GK->transfer_DM2DtoGrid(DM.get_DMR_vector());
354-
Gint_inout inout(charge->rho, Gint_Tools::job_type::rho);
344+
Gint_inout inout(charge->rho, Gint_Tools::job_type::rho, nspin);
355345
GK->cal_gint(&inout);
356346

357347
if (XC_Functional::get_func_type() == 3 || XC_Functional::get_func_type() == 5)
@@ -485,6 +475,7 @@ void RDMFT<TK, TR>::cal_V_TV()
485475
&GlobalC::ucell,
486476
orb->cutoffs(),
487477
&GlobalC::GridD,
478+
nspin,
488479

489480
charge,
490481
rho_basis,
@@ -504,6 +495,7 @@ void RDMFT<TK, TR>::cal_V_TV()
504495
&GlobalC::ucell,
505496
orb->cutoffs(),
506497
&GlobalC::GridD,
498+
nspin,
507499

508500
charge,
509501
rho_basis,
@@ -537,6 +529,7 @@ void RDMFT<TK, TR>::cal_V_hartree()
537529
&GlobalC::ucell,
538530
orb->cutoffs(),
539531
&GlobalC::GridD,
532+
nspin,
540533

541534
charge,
542535
rho_basis,
@@ -557,6 +550,7 @@ void RDMFT<TK, TR>::cal_V_hartree()
557550
&GlobalC::ucell,
558551
orb->cutoffs(),
559552
&GlobalC::GridD,
553+
nspin,
560554

561555
charge,
562556
rho_basis,
@@ -630,6 +624,7 @@ void RDMFT<TK, TR>::cal_V_XC()
630624
&GlobalC::ucell,
631625
orb->cutoffs(),
632626
&GlobalC::GridD,
627+
nspin,
633628

634629
charge,
635630
rho_basis,
@@ -652,6 +647,7 @@ void RDMFT<TK, TR>::cal_V_XC()
652647
&GlobalC::ucell,
653648
orb->cutoffs(),
654649
&GlobalC::GridD,
650+
nspin,
655651

656652
charge,
657653
rho_basis,
@@ -866,8 +862,8 @@ void RDMFT<TK, TR>::cal_Energy(const int cal_type)
866862
Parallel_Reduce::reduce_all(E_RDMFT[2]);
867863

868864
// // test
869-
std::cout << "\n\n\n******\nE_exx-type in rdmft: " << E_RDMFT[2] << "\n******\n\n" << std::endl;
870-
std::cout << "\n\n\n******\nE_dft-xc in rdmft: " << etxc << "\n******\n\n" << std::endl;
865+
// std::cout << "\n\n\n******\nE_exx-type in rdmft: " << E_RDMFT[2] << "\n******\n\n" << std::endl;
866+
// std::cout << "\n\n\n******\nE_dft-xc in rdmft: " << etxc << "\n******\n\n" << std::endl;
871867

872868
// if E_XC is hybrid functional
873869
E_RDMFT[2] += etxc;
@@ -907,31 +903,41 @@ void RDMFT<TK, TR>::cal_Energy(const int cal_type)
907903
}
908904

909905
// print results
910-
if( GlobalC::exx_info.info_global.cal_exx )
911-
{
912-
std::cout << "\n\nfrom class RDMFT: \nXC_fun: " << XC_func_rdmft << ", alpha_power:" << alpha_power << std::endl;
913-
914-
std::cout << std::fixed << std::setprecision(10) << "******\nE(TV + Hartree + XC) by RDMFT: " << E_RDMFT[3] << "\n\nETV_RDMFT: "
915-
<< E_RDMFT[0] << "\nEhartree_RDMFT: " << E_RDMFT[1] << "\nExc_RDMFT: " << E_RDMFT[2] << "\nE_Ewald: " << E_Ewald
916-
<< "\nE_entropy(-TS): " << E_entropy << "\nE_descf: " << E_descf << "\n\nEtotal_RDMFT: " << Etotal << "\n\nExc_ksdft: " << E_xc_KS
917-
<< "\nE_exx_ksdft: " << E_exx_KS <<"\n******\n\n" << std::endl;
906+
std::cout << "\n\nfrom class RDMFT: \nXC_fun: " << XC_func_rdmft << std::endl;
907+
if( GlobalC::exx_info.info_global.cal_exx ) std::cout << "alpha_power: " << alpha_power << std::endl;
908+
909+
std::cout << std::fixed << std::setprecision(10)
910+
<< "******\nE(TV + Hartree + XC) by RDMFT: " << E_RDMFT[3]
911+
<< "\n\nE_TV_RDMFT: " << E_RDMFT[0]
912+
<< "\nE_hartree_RDMFT: " << E_RDMFT[1]
913+
<< "\nExc_" << XC_func_rdmft << "_RDMFT: " << E_RDMFT[2]
914+
<< "\nE_Ewald: " << E_Ewald
915+
<< "\nE_entropy(-TS): " << E_entropy
916+
<< "\nE_descf: " << E_descf
917+
<< "\n\nEtotal_RDMFT: " << Etotal
918+
<< "\n\nExc_ksdft: " << E_xc_KS
919+
<< "\nE_exx_ksdft: " << E_exx_KS
920+
<<"\n******\n\n" << std::endl;
918921

919922
std::cout << "\netxc: " << etxc << "\nvtxc: " << vtxc << "\n";
920-
921923
std::cout << "\nE_deband_KS: " << E_deband_KS << "\nE_deband_harris_KS: " << E_deband_harris_KS << "\n\n" << std::endl;
922-
}
923-
else
924-
{
925-
std::cout << "\n\nfrom class RDMFT: \nXC_fun: " << XC_func_rdmft << std::endl;
926924

927-
std::cout << std::fixed << std::setprecision(10) << "******\nE(TV + Hartree + XC) by RDMFT: " << E_RDMFT[3] << "\n\nETV_RDMFT: "
928-
<< E_RDMFT[0] << "\nE_hartree_RDMFT: " << E_RDMFT[1] << "\nExc_" << XC_func_rdmft << "_RDMFT: " << E_RDMFT[2] << "\nE_Ewald: " << E_Ewald
929-
<< "\nE_entropy(-TS): " << E_entropy << "\nE_descf: " << E_descf << "\n\nEtotal_RDMFT: " << Etotal << "\n\nExc_ksdft: " << E_xc_KS
930-
<< "\nE_exx_ksdft: " << E_exx_KS <<"\n******\n\n" << std::endl;
931-
932-
std::cout << "\netxc: " << etxc << "\nvtxc: " << vtxc << "\n";
933-
934-
std::cout << "\nE_deband_KS: " << E_deband_KS << "\nE_deband_harris_KS: " << E_deband_harris_KS << "\n\n" << std::endl;
925+
if( 1 )
926+
{
927+
// GlobalV::ofs_running << std::setprecision(12);
928+
// GlobalV::ofs_running << std::setiosflags(std::ios::right);
929+
GlobalV::ofs_running << std::fixed << std::setprecision(10)
930+
<< "\n******\nE(TV + Hartree + XC) by RDMFT: " << E_RDMFT[3]
931+
<< "\n\nE_TV_RDMFT: " << E_RDMFT[0]
932+
<< "\nE_hartree_RDMFT: " << E_RDMFT[1]
933+
<< "\nExc_" << XC_func_rdmft << "_RDMFT: " << E_RDMFT[2]
934+
<< "\nE_Ewald: " << E_Ewald
935+
<< "\nE_entropy(-TS): " << E_entropy
936+
<< "\nE_descf: " << E_descf
937+
<< "\n\nEtotal_RDMFT: " << Etotal
938+
<< "\n\nExc_ksdft: " << E_xc_KS
939+
<< "\nE_exx_ksdft: " << E_exx_KS
940+
<<"\n******\n" << std::endl;
935941
}
936942

937943
ModuleBase::timer::tick("rdmftTest", "RDMFT_E&Egradient");

source/module_rdmft/rdmft_tools.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ class Veff_rdmft : public hamilt::OperatorLCAO<TK, TR>
301301
const UnitCell* ucell_in,
302302
const std::vector<double>& orb_cutoff,
303303
Grid_Driver* GridD_in,
304+
const int& nspin,
304305

305306
const Charge* charge_in,
306307
const ModulePW::PW_Basis* rho_basis_in,
@@ -329,7 +330,7 @@ class Veff_rdmft : public hamilt::OperatorLCAO<TK, TR>
329330

330331
this->initialize_HR(ucell_in, GridD_in);
331332

332-
GK_in->initialize_pvpR(*ucell_in, GridD_in);
333+
GK_in->initialize_pvpR(*ucell_in, GridD_in, nspin);
333334
}
334335
Veff_rdmft(Gint_Gamma* GG_in,
335336
hamilt::HS_Matrix_K<TK>* hsk_in,
@@ -339,6 +340,7 @@ class Veff_rdmft : public hamilt::OperatorLCAO<TK, TR>
339340
const UnitCell* ucell_in,
340341
const std::vector<double>& orb_cutoff,
341342
Grid_Driver* GridD_in,
343+
const int& nspin,
342344

343345
const Charge* charge_in,
344346
const ModulePW::PW_Basis* rho_basis_in,
@@ -367,7 +369,7 @@ class Veff_rdmft : public hamilt::OperatorLCAO<TK, TR>
367369

368370
this->initialize_HR(ucell_in, GridD_in);
369371

370-
GG_in->initialize_pvpR(*ucell_in, GridD_in);
372+
GG_in->initialize_pvpR(*ucell_in, GridD_in, nspin);
371373
}
372374

373375
~Veff_rdmft<TK, TR>(){};

0 commit comments

Comments
 (0)