Skip to content

Commit 4d57ca0

Browse files
author
Kai Luo
committed
Fix: enable debug output for initial variable in ESolver_RDMFT_LCAO setup
1 parent 6cc8863 commit 4d57ca0

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

source/source_esolver/directmin_problems/rdmft_lcao.cpp

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ RDMFT_LCAO<TK, TR>::RDMFT_LCAO(UnitCell& ucell, const Input_para& inp)
4949

5050
rdmft_ptr = dynamic_cast<rdmft::RDMFT<TK, TR>*>(&(this->rdmft_solver));
5151

52+
// copy the content of this->rdmft_solver to pointer rdmft_ptr
53+
5254
// initialize rdmft
5355
// this->rdmft_ptr.init(this->GG,
5456
// this->GK,
@@ -63,15 +65,24 @@ RDMFT_LCAO<TK, TR>::RDMFT_LCAO(UnitCell& ucell, const Input_para& inp)
6365
// inp.rdmft_power_alpha);
6466
// call update_ion for rdmft_ptr;
6567
ESolver_KS_LCAO<TK, TR>::before_scf(ucell, 0);
66-
// rdmft_ptr->update_ion(ucell, *(this->pw_rho), this->locpp.vloc, this->sf.strucFac);
68+
rdmft_ptr->update_ion(ucell, *(this->pw_rho), this->locpp.vloc, this->sf.strucFac);
6769

68-
// rdmft_ptr->cal_Energy();
70+
// for debug
71+
std::cout << "Local pseudopotential in RDMFT_LCAO before" << std::endl;
72+
// this->locpp.vloc.print(std::cout);
73+
// this->locpp.print_vloc(ucell, this->pw_rho);
6974

70-
// std::cout << "Called f() in RDMFT_LCAO, Etotal = " << this->rdmft_ptr->Etotal << std::endl;
71-
// std::cout << "Called f() in RDMFT_LCAO, E[0] = " << this->rdmft_ptr->E_RDMFT[0] << std::endl;
72-
// std::cout << "Called f() in RDMFT_LCAO, E[1] = " << this->rdmft_ptr->E_RDMFT[1] << std::endl;
73-
// std::cout << "Called f() in RDMFT_LCAO, E[2] = " << this->rdmft_ptr->E_RDMFT[2] << std::endl;
74-
// std::cout << "Called f() in RDMFT_LCAO, E[3] = " << this->rdmft_ptr->E_RDMFT[3] << std::endl;
75+
//
76+
GlobalV::ofs_running
77+
<< "Before calling cal_Energy in RDMFT_LCAO constructor" << std::endl;
78+
rdmft_ptr->cal_Energy(1);
79+
80+
GlobalV::ofs_running << "Called f() in RDMFT_LCAO, Etotal = " << this->rdmft_solver.Etotal << std::endl;
81+
GlobalV::ofs_running << "Called f() in RDMFT_LCAO, Etotal = " << this->rdmft_ptr->Etotal << std::endl;
82+
GlobalV::ofs_running << "Called f() in RDMFT_LCAO, E[0] = " << this->rdmft_ptr->E_RDMFT[0] << std::endl;
83+
GlobalV::ofs_running << "Called f() in RDMFT_LCAO, E[1] = " << this->rdmft_ptr->E_RDMFT[1] << std::endl;
84+
GlobalV::ofs_running << "Called f() in RDMFT_LCAO, E[2] = " << this->rdmft_ptr->E_RDMFT[2] << std::endl;
85+
GlobalV::ofs_running << "Called f() in RDMFT_LCAO, E[3] = " << this->rdmft_ptr->E_RDMFT[3] << std::endl;
7586

7687
// const integer nbands = static_cast<integer>(inp.nbands > 0 ? inp.nbands : 1);
7788
// const integer stiefel_n = nbands;
@@ -159,10 +170,10 @@ realdp RDMFT_LCAO<TK, TR>::f(const Variable& x) const
159170

160171
VariableToOccNumWfc(x, occ_num, wfc);
161172

162-
if(false)
173+
if(true)
163174
{
164175
std::cout << "Calling f" << std::endl;
165-
176+
std::cout << "Occupation number:" << std::endl;
166177
occ_num.print(std::cout);
167178
std::cout << "Wavefunction coefficients:" << std::endl;
168179
const int nks = wfc.get_nk();

source/source_esolver/esolver_rdmft_lcao.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ void ESolver_RDMFT_LCAO<TK, TR>::setup_initial_guess(UnitCell& ucell, const Inpu
803803

804804

805805
// this->X = std::move(initial_variable);
806-
if(false) // for debug
806+
if(true) // for debug
807807
this->X.Print("Initial variable for DirectMin:");
808808
// }
809809
}

0 commit comments

Comments
 (0)