Skip to content

Refactor dc_solver to use spin_kind_e and fix spin-polarized double counting#6

Open
jaemolihm wants to merge 1 commit intoTRIQS:unstablefrom
jaemolihm:dc_fix
Open

Refactor dc_solver to use spin_kind_e and fix spin-polarized double counting#6
jaemolihm wants to merge 1 commit intoTRIQS:unstablefrom
jaemolihm:dc_fix

Conversation

@jaemolihm
Copy link

Bug fixed

  • The old code unconditionally overrode per-spin density N_sigma to N_total/2, making spin-dependent DC formulas (sFLL, sAMF) identical to their charge-only counterparts (cFLL, cAMF). Now the override only applies when spin_kind != Polarized. When Polarized, actual per-spin densities are preserved, so sFLL/sAMF produce genuinely spin-dependent corrections.

New entrypoints

One can now compute the self-energy given the density matrix. (Useful, e.g,. for CTHYB with density matrix measurement)

  • dc_solver::dc_self_energy(density_matrix) and DcSolver.dc_self_energy(density_matrix)
  • dc_solver::dc_energy(density_matrix) and DcSolver.dc_energy(density_matrix)

Breaking changes

  • Removed triqs_modest.misc.double_counting(...), double_counting_sigma_dc, and double_counting_energy_dc. Their functionality is now fully covered by the dc_solver class methods.
  • Changed input signature dc_solver constructor: (long n_sigma, ...)(spin_kind_e spin_kind, ...), same for Python DcSolver constructor.
  • Changed return type dc_solver::dc_energy(gimp): nda::matrix<double>double (previously, it was returning the same value twice)

…ounting

The dc_solver constructor now takes spin_kind_e instead of n_sigma,
enabling correct spin-dependent behavior for Polarized systems.
Previously, per-spin densities were unconditionally overridden to
N_total/2, making sFLL/sAMF identical to cFLL/cAMF.

- Add density matrix overloads for dc_self_energy and dc_energy
- Change dc_energy return type from nda::matrix<double> to double
- Add n_sigma_from_spin_kind free function to local_space.hpp
- Register spin_kind_e enum in the dc Python module
- Remove redundant free functions (double_counting, double_counting_sigma_dc,
  double_counting_energy_dc)
- Add hardcoded-value tests for dc_formulas, density matrix overloads,
  Polarized vs NonPolarized, and NonColinear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant