Skip to content

Commit ea3b234

Browse files
add a warningquit if magnetism is larger than charge
1 parent 4e67212 commit ea3b234

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

source/source_estate/module_charge/charge_mixing_rho.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ void Charge_Mixing::mix_rho_recip(Charge* chr)
9898
{
9999
chr->rhog[0][ig] = 0.5 * (rhog_mag[ig] + rhog_mag[ig+npw]);
100100
chr->rhog[1][ig] = 0.5 * (rhog_mag[ig] - rhog_mag[ig+npw]);
101+
if (chr->rhog[1][ig] < 0.0)
102+
{
103+
ModuleBase::WARNING_QUIT("Charge_Mixing", "Magnetism is larger than Charge at some grid, please try a smaller mixing_beta_mag!");
104+
}
101105
}
102106
// delete
103107
delete[] rhog_mag;
@@ -391,6 +395,10 @@ void Charge_Mixing::mix_rho_real(Charge* chr)
391395
{
392396
chr->rho[0][ir] = 0.5 * (rho_mag[ir] + rho_mag[ir+nrxx]);
393397
chr->rho[1][ir] = 0.5 * (rho_mag[ir] - rho_mag[ir+nrxx]);
398+
if (chr->rho[1][ir] < 0.0)
399+
{
400+
ModuleBase::WARNING_QUIT("Charge_Mixing", "Magnetism is larger than Charge at some grid, please try a smaller mixing_beta_mag!");
401+
}
394402
}
395403
// delete
396404
delete[] rho_mag;

0 commit comments

Comments
 (0)