ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
template_helpers.cpp File Reference

Stub implementations for the TK=double (nspin=2) template specialization. More...

#include "lambda_loop_helper.h"
#include "spin_constrain.h"
Include dependency graph for template_helpers.cpp:

Detailed Description

Stub implementations for the TK=double (nspin=2) template specialization.

Why stubs?
Even for nspin=2 (collinear spin), ABACUS uses complex arithmetic internally for the Hamiltonian and wavefunctions. The TK=double specialization exists only to satisfy the linker when the code is compiled with nspin=2. All actual computation is done by the TK=std::complex<double> specialization.
Design rationale
  • The SpinConstrain template is instantiated for both TK=double and TK=complex<double>
  • For TK=double, all methods that perform actual computation are no-ops
  • Simple getters/setters (nspin, npol, atomCounts, etc.) still work correctly because they are not template-specialized (they use the base template)
History
The following routines were originally member-function stubs of SpinConstrain<double>. They have been lifted to free-function stubs in the spinconstrain namespace alongside their complex<double> counterparts (see lambda_loop_helper.cpp). Each returns the safe no-op value.