@@ -258,28 +258,18 @@ void RDMFT<TK, TR>::update_ion(UnitCell& ucell_in, ModulePW::PW_Basis& rho_basis
258258template <typename TK, typename TR>
259259void 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 ******\n rdmft-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 ******\n rdmft-test-1.1\n ******\n\n\n " << std::endl;
266-
267- std::cout << " \n ***\n nk_total: " << nk_total << " \n ***\n " << std::endl;
268- std::cout << " \n ***\n nbands_total: " << nbands_total << " \n ***\n " << std::endl;
269-
270- std::cout << " \n ***\n wg.nr: " << wg.nr << " \n ***\n " << std::endl;
271- std::cout << " \n ***\n wg.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 ******\n rdmft-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 ******\n rdmft-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 ******\n E_exx-type in rdmft: " << E_RDMFT[2 ] << " \n ******\n\n " << std::endl;
870- std::cout << " \n\n\n ******\n E_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\n from class RDMFT: \n XC_fun: " << XC_func_rdmft << " , alpha_power:" << alpha_power << std::endl;
913-
914- std::cout << std::fixed << std::setprecision (10 ) << " ******\n E(TV + Hartree + XC) by RDMFT: " << E_RDMFT[3 ] << " \n\n ETV_RDMFT: "
915- << E_RDMFT[0 ] << " \n Ehartree_RDMFT: " << E_RDMFT[1 ] << " \n Exc_RDMFT: " << E_RDMFT[2 ] << " \n E_Ewald: " << E_Ewald
916- << " \n E_entropy(-TS): " << E_entropy << " \n E_descf: " << E_descf << " \n\n Etotal_RDMFT: " << Etotal << " \n\n Exc_ksdft: " << E_xc_KS
917- << " \n E_exx_ksdft: " << E_exx_KS <<" \n ******\n\n " << std::endl;
906+ std::cout << " \n\n from class RDMFT: \n XC_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+ << " ******\n E(TV + Hartree + XC) by RDMFT: " << E_RDMFT[3 ]
911+ << " \n\n E_TV_RDMFT: " << E_RDMFT[0 ]
912+ << " \n E_hartree_RDMFT: " << E_RDMFT[1 ]
913+ << " \n Exc_" << XC_func_rdmft << " _RDMFT: " << E_RDMFT[2 ]
914+ << " \n E_Ewald: " << E_Ewald
915+ << " \n E_entropy(-TS): " << E_entropy
916+ << " \n E_descf: " << E_descf
917+ << " \n\n Etotal_RDMFT: " << Etotal
918+ << " \n\n Exc_ksdft: " << E_xc_KS
919+ << " \n E_exx_ksdft: " << E_exx_KS
920+ <<" \n ******\n\n " << std::endl;
918921
919922 std::cout << " \n etxc: " << etxc << " \n vtxc: " << vtxc << " \n " ;
920-
921923 std::cout << " \n E_deband_KS: " << E_deband_KS << " \n E_deband_harris_KS: " << E_deband_harris_KS << " \n\n " << std::endl;
922- }
923- else
924- {
925- std::cout << " \n\n from class RDMFT: \n XC_fun: " << XC_func_rdmft << std::endl;
926924
927- std::cout << std::fixed << std::setprecision (10 ) << " ******\n E(TV + Hartree + XC) by RDMFT: " << E_RDMFT[3 ] << " \n\n ETV_RDMFT: "
928- << E_RDMFT[0 ] << " \n E_hartree_RDMFT: " << E_RDMFT[1 ] << " \n Exc_" << XC_func_rdmft << " _RDMFT: " << E_RDMFT[2 ] << " \n E_Ewald: " << E_Ewald
929- << " \n E_entropy(-TS): " << E_entropy << " \n E_descf: " << E_descf << " \n\n Etotal_RDMFT: " << Etotal << " \n\n Exc_ksdft: " << E_xc_KS
930- << " \n E_exx_ksdft: " << E_exx_KS <<" \n ******\n\n " << std::endl;
931-
932- std::cout << " \n etxc: " << etxc << " \n vtxc: " << vtxc << " \n " ;
933-
934- std::cout << " \n E_deband_KS: " << E_deband_KS << " \n E_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 ******\n E(TV + Hartree + XC) by RDMFT: " << E_RDMFT[3 ]
931+ << " \n\n E_TV_RDMFT: " << E_RDMFT[0 ]
932+ << " \n E_hartree_RDMFT: " << E_RDMFT[1 ]
933+ << " \n Exc_" << XC_func_rdmft << " _RDMFT: " << E_RDMFT[2 ]
934+ << " \n E_Ewald: " << E_Ewald
935+ << " \n E_entropy(-TS): " << E_entropy
936+ << " \n E_descf: " << E_descf
937+ << " \n\n Etotal_RDMFT: " << Etotal
938+ << " \n\n Exc_ksdft: " << E_xc_KS
939+ << " \n E_exx_ksdft: " << E_exx_KS
940+ <<" \n ******\n " << std::endl;
935941 }
936942
937943 ModuleBase::timer::tick (" rdmftTest" , " RDMFT_E&Egradient" );
0 commit comments