File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -137,12 +137,13 @@ double ElecState::cal_delta_eband(const UnitCell& ucell) const
137137 {
138138 v_ofk = this ->pot ->get_effective_vofk (0 );
139139 // cause in the get_effective_vofk, the func will return nullptr
140- if (v_ofk!= nullptr )
140+ if (v_ofk== nullptr && this -> charge -> rhopw -> nrxx > 0 )
141141 {
142- for (int ir = 0 ; ir < this ->charge ->rhopw ->nrxx ; ir++)
143- {
144- deband_aux -= this ->charge ->kin_r [0 ][ir] * v_ofk[ir];
145- }
142+ ModuleBase::WARNING_QUIT (" ElecState::cal_delta_eband" ," v_ofk is nullptr" );
143+ }
144+ for (int ir = 0 ; ir < this ->charge ->rhopw ->nrxx ; ir++)
145+ {
146+ deband_aux -= this ->charge ->kin_r [0 ][ir] * v_ofk[ir];
146147 }
147148 }
148149
@@ -156,12 +157,13 @@ double ElecState::cal_delta_eband(const UnitCell& ucell) const
156157 if (v_ofk_flag)
157158 {
158159 v_ofk = this ->pot ->get_effective_vofk (1 );
159- if (v_ofk!=nullptr )
160+ if (v_ofk==nullptr && this ->charge ->rhopw ->nrxx >0 )
161+ {
162+ ModuleBase::WARNING_QUIT (" ElecState::cal_delta_eband" ," v_ofk is nullptr" );
163+ }
164+ for (int ir = 0 ; ir < this ->charge ->rhopw ->nrxx ; ir++)
160165 {
161- for (int ir = 0 ; ir < this ->charge ->rhopw ->nrxx ; ir++)
162- {
163- deband_aux -= this ->charge ->kin_r [1 ][ir] * v_ofk[ir];
164- }
166+ deband_aux -= this ->charge ->kin_r [1 ][ir] * v_ofk[ir];
165167 }
166168 }
167169 }
You can’t perform that action at this time.
0 commit comments