ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
chg_rho_detail.h File Reference
#include <functional>
#include <complex>
#include "charge.h"
#include "chg_mix_cfg.h"
#include "source_base/module_mixing/mixing.h"
#include "source_base/module_mixing/plain_mixing.h"
#include "source_base/tool_quit.h"
Include dependency graph for chg_rho_detail.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  module_charge
 Charge-density symmetrization free functions.
namespace  module_charge::detail

Functions

template<typename T>
std::function< void(T *, const T *, const T *)> module_charge::detail::make_twobeta_mix (const int total, const int nunit, const double mixing_beta, const double mixing_beta_mag)
 Create a two-beta mixing functor: mix the first nunit elements with mixing_beta and the rest (nunit..total) with mixing_beta_mag. Used for magnetic cases (nspin==2/4) where the charge channel and the magnetism channels use different betas.
template<typename T>
void module_charge::detail::pack_rho_mag (T *out, const T *d0, const T *d1, const int n)
 Pack charge and magnetism into interleaved layout: out[0..n] = d0 + d1 (charge channel) out[n..2n] = d0 - d1 (magnetism channel).
template<typename T>
void module_charge::detail::unpack_rho_mag (T *d0, T *d1, const T *in, const int n)
 Unpack interleaved layout back to charge and magnetism components: d0[i] = 0.5 * (in[i] + in[i+n]) d1[i] = 0.5 * (in[i] - in[i+n]).