Skip to content

Commit

Permalink
Add mixing factor 2 in Hubbard U one-electron contribution
Browse files Browse the repository at this point in the history
  • Loading branch information
mtaillefumier committed Nov 25, 2022
1 parent b879d52 commit 4693d18
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/dft/energy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,15 @@ total_energy(Simulation_context const& ctx, K_point_set const& kset, Density con

case electronic_structure_method_t::pseudopotential: {
tot_en = (kset.valence_eval_sum() - energy_vxc(density, potential) - energy_bxc(density, potential) -
potential.PAW_one_elec_energy(density)) -
potential.PAW_one_elec_energy(density) - one_electron_energy_hubbard(density, potential)) -
0.5 * energy_vha(potential) + energy_exc(density, potential) + potential.PAW_total_energy() +
ewald_energy + kset.entropy_sum();
break;
}
}

if (ctx.hubbard_correction()) {
tot_en += ::sirius::energy(density.occupation_matrix());
tot_en -= ::sirius::one_electron_energy_hubbard(density, potential);
tot_en += ::sirius::hubbard_energy(density);
}

return tot_en;
Expand All @@ -194,7 +193,7 @@ double
one_electron_energy(Density const& density, Potential const& potential)
{
return energy_vha(potential) + energy_vxc(density, potential) + energy_bxc(density, potential) +
potential.PAW_one_elec_energy(density) + one_electron_energy_hubbard(density, potential);
potential.PAW_one_elec_energy(density) + one_electron_energy_hubbard(density, potential);
}

double
Expand All @@ -213,7 +212,7 @@ energy_potential(Density const& density, Potential const& potential)
double e =
energy_veff(density, potential) + energy_bxc(density, potential) + potential.PAW_one_elec_energy(density);
if (potential.ctx().hubbard_correction()) {
e += ::sirius::energy(density.occupation_matrix());
e += ::sirius::hubbard_energy(density);
}
return e;
}
Expand Down
7 changes: 7 additions & 0 deletions src/hubbard/hubbard_potential_energy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ calculate_energy_collinear_nonlocal(Simulation_context const& ctx__, const int i
}
}

if (ctx__.num_spins() == 1) {
hubbard_energy *= 2.0;
}
return -0.5 * hubbard_energy;
}

Expand Down Expand Up @@ -631,6 +634,10 @@ one_electron_energy_hubbard(Hubbard_matrix const& om__, Hubbard_matrix const& pm
}
}
}

if (ctx.num_spins() == 1) {
tmp *= 2.0;
}
return std::real(tmp);
}
return 0.0;
Expand Down

0 comments on commit 4693d18

Please sign in to comment.