High-precision calculations for one- and two-valence atomic systems
DiracSpinor

ok

Stores radial Dirac spinor: F_nk = (f, g)

\[ \psi_{n\kappa m} = \frac{1}{r} \begin{pmatrix} f_{n\kappa}(r)\,\Omega_{\kappa m}\\ g_{n\kappa}(r)\,\Omega_{-\kappa m} \end{pmatrix}, \quad F_{n\kappa} = \begin{pmatrix} f_{n\kappa}(r)\\ g_{n\kappa}(r) \end{pmatrix} \]

Construction.
Takes in n and k=kappa values + grid
  • A shared pointer to the Grid is stored (to avoid many copies of Grid)
Operator Overloads
  • Intuitive operator overloads are provided (Fa, Fb are DiracSpinors):
  • v * Fa, where v is a double or vector works the obvious way
  • Fa * Fb = <Fa|Fb>
  • Fa == Fb returns true if {na,ka}=={nb,kb}
  • Fa > Fb : first compares n, and then kappa (via kappa_index)
  • Fa +/- Fb : Adds/subtracts the two spinors (and updates p0/pinf)
  • You can make copies: auto Fnew = Fa
  • And you can re-assign: Fb = Fa (copies all, including n and kappa)
  • n has no setter; kappa only via set_new_kappa(). Avoids angular errors.
  • non-const accessors (e.g., en(), f(), max_pt()) return mutable references to variables
Continuum orbitals
Note
Continuum (and other unlabelled) orbitals have n = 0. Since they are identified only by kappa, all n = 0 orbitals with the same kappa compare equal (operator==), and their nk_index() coincides with that of a bound state (see nk_index). They must not be mixed with each other, or with bound states, in anything that identifies orbitals by {n, kappa}. This might need to be updated later.

#include <DiracSpinor.hpp>

Public Types

enum class  Branch { electron , positron , both }
 Which energy branch of a set of orbitals state_config() describes. More...
 
using Index = uint16_t
 Integer type for the compressed (n,kappa) index.
 

Public Member Functions

 DiracSpinor (int in_n, int in_kappa, std::shared_ptr< const Grid > in_rgrid, bool negative_energy=false)
 Constructor: Requires n (PQN), kappa (Dirac QN), and grid.
 
int n () const
 Principal quantum number, n.
 
int kappa () const
 Dirac quantum number, kappa.
 
int l () const
 Orbital angular momentum Q number.
 
double jjp1 () const
 j(j+1)
 
int twoj () const
 2j (twice the total angular momentum)
 
int twojp1 () const
 2j+1
 
int parity () const
 (-1)^l, returns +/- 1
 
std::size_t k_index () const
 kappa index (see Angular::kappa_to_kindex)
 
Index nk_index () const
 (n,kappa) index
 
std::string symbol (bool gnuplot=false) const
 Single-electron term symbol (e.g., 6s_1/2). Gnuplot=true => 6s_{1/2}.
 
std::string shortSymbol () const
 e.g., 6p_1/2 => 6p-, 6p_3/2 => 6p+
 
bool & exotic ()
 Checks if spinor is for "exotic" lepton, or regular electron.
 
bool exotic () const
 Checks if spinor is for "exotic" lepton, or regular electron.
 
bool negativeEnergyStateQ () const
 Returns true if this is a negative-energy (Dirac sea) state.
 
void set_new_kappa (int new_kappa)
 Changes 'kappa' angular quantum number. Use with caution!
 
const Grid & grid () const
 Returns a const reference to the radial grid.
 
std::shared_ptr< const Grid > grid_sptr () const
 Returns copy of shared_ptr to grid [shared resource].
 
double en () const
 Single-particle energy, not including rest energy.
 
double & en ()
 
const std::vector< double > & f () const
 Upper (large) radial component function, f.
 
std::vector< double > & f ()
 
double f (std::size_t i) const
 Upper (large) radial component, f(r_i)
 
double & f (std::size_t i)
 
const std::vector< double > & g () const
 Lower (small) radial component function, g.
 
std::vector< double > & g ()
 
double g (std::size_t i) const
 Lower (small) radial component, g(r_i)
 
double & g (std::size_t i)
 
auto min_pt () const
 First non-zero point (index for f[i])
 
auto & min_pt ()
 
auto max_pt () const
 Effective size(); index after last non-zero point (index for f[i])
 
auto & max_pt ()
 
double r0 () const
 r0 = r[min_pt] (in atomic units)
 
double rinf () const
 rinf = r[max_pt - 1], the last point of the spinor (au); 0 if max_pt = 0
 
auto its () const
 Number of iterations until energy convergence (for latest routine only)
 
auto & its ()
 
auto occ_frac () const
 Occupation fraction. =1 for closed shells. =1/(2j+1) for valence.
 
auto & occ_frac ()
 
auto eps () const
 Fractional energy convergence: eps = |(en'-en)/en|.
 
auto & eps ()
 
const DiracSpinor & scale (const double factor)
 Scales DiracSpinor (f and g) by constant.
 
const DiracSpinor & scale (const std::vector< double > &v)
 Scales DiracSpinor (f and g) by function of r.
 
void normalise (double norm_to=1.0)
 By default normalises to 1, but can normalise to other number.
 
void zero_boundaries ()
 Forces f(r) and g(r) to be zero outside of [p0,pinf)
 
double norm () const
 Returns the norm, defined: Norm = Sqrt[<a|a>].
 
double norm2 () const
 Returns the norm^2, defined: Norm2 = <a|a>
 
int num_nodes (double rel_cut=1.0e-3) const
 Number of nodes (sign changes) in f(r).
 
std::pair< double, double > r0pinfratio () const
 Returns [f[p0]/f_max , f[pinf-1]/f_max] - for tests; {0,0} if f = 0.
 
std::vector< double > rho () const
 Radial density: rho(r) = (2j+1) * x_occ * |F^2|(r)
 
int num_electrons () const
 Number of occupied electrons: (2j+1)*occ_frac, rounded to an integer.
 
DiracSpinor & operator+= (const DiracSpinor &rhs)
 Adds rhs to this, in place (should generally have same kappa, but forced)
 
DiracSpinor & operator-= (const DiracSpinor &rhs)
 Subtracts rhs from this, in place; should generally have same kappa (see +=)
 
DiracSpinor & add_scaled (double x, const DiracSpinor &rhs)
 Adds x*rhs to this, in place (no temporary); should generally have same kappa.
 
DiracSpinor & operator*= (const double x)
 Scales this by scalar x, in place.
 
DiracSpinor & operator*= (const std::vector< double > &v)
 Multiplies this by function v(r), pointwise, in place.
 
void orthog (const DiracSpinor &rhs)
 A more correct way to force orthogonality than normal.
 

Static Public Member Functions

static bool comp_l (const DiracSpinor &lhs, const DiracSpinor &rhs)
 Comparator (for sorting): by l.
 
static bool comp_j (const DiracSpinor &lhs, const DiracSpinor &rhs)
 Comparator (for sorting): by 2j.
 
static bool comp_ki (const DiracSpinor &lhs, const DiracSpinor &rhs)
 Comparator (for sorting): by kappa_index.
 
static bool comp_n (const DiracSpinor &lhs, const DiracSpinor &rhs)
 Comparator (for sorting): by n.
 
static bool comp_en (const DiracSpinor &lhs, const DiracSpinor &rhs)
 Comparator (for sorting): by energy.
 
static std::pair< double, std::string > check_ortho (const std::vector< DiracSpinor > &a, const std::vector< DiracSpinor > &b)
 Returns worst |<a|b>| (or ||<a|b>|-1| for a=b) {val, state_names}.
 
static void orthonormaliseOrbitals (std::vector< DiracSpinor > &orbs, int num_its=1)
 (approximately) OrthoNormalises a set of any orbitals
 
static DiracSpinor orthogonaliseWrt (const DiracSpinor &Fin, const std::vector< DiracSpinor > &orbs)
 Forces Fin to be orthogonal to orbs.
 
static DiracSpinor orthonormaliseWrt (const DiracSpinor &Fin, const std::vector< DiracSpinor > &orbs)
 As orthogonaliseWrt(), but normalises Fin afterwards.
 
static std::string shortSymbol (int n, int kappa)
 e.g., 6p_1/2 => 6p-, 6p_3/2 => 6p+
 
static std::string state_config (const std::vector< DiracSpinor > &orbs, Branch branch=Branch::both)
 Returns formatted states string (e.g., '7sp5d') given list of orbs.
 
static std::string config_string (const std::vector< int > &n_per_l)
 Formats a list of numbers into the compressed states-string notation.
 
static DiracSpinor exactHlike (int n, int k, std::shared_ptr< const Grid > rgrid, double zeff, double alpha=PhysConst::alpha, double mass=1.0)
 Constructs an exact H-like (pointlike Coulomb) DiracSpinor.
 
static DiracSpinor exactHlike_cntm (double en, int k, std::shared_ptr< const Grid > rgrid, double zeff, double alpha=PhysConst::alpha, double mass=1.0)
 Constructs an exact (Dirac-Coulomb) continuum DiracSpinor.
 
static std::vector< DiracSpinor > HlikeBasis (int max_l, int num_ns, std::shared_ptr< const Grid > rgrid, double zeff, double alpha=PhysConst::alpha, double mass=1.0)
 Constructs a basis of H-like (pointlike) DiracSpinors.
 
static std::vector< DiracSpinor > HlikeBasis (const std::string &basis_string, std::shared_ptr< const Grid > rgrid, double zeff, double alpha=PhysConst::alpha, double mass=1.0)
 Constructs a basis of H-like (pointlike) DiracSpinors.
 
static const DiracSpinor * find (int n, int k, const std::vector< DiracSpinor > &orbs)
 Searches for {n,k} in list of orbitals, returns pointer (may be null)
 
static int max_tj (const std::vector< DiracSpinor > &orbs)
 Returns maximum (2j) found in {orbs}.
 
static int max_l (const std::vector< DiracSpinor > &orbs)
 Returns maximum l found in {orbs}.
 
static int max_n (const std::vector< DiracSpinor > &orbs)
 Returns maximum n found in {orbs}.
 
static int max_n (const std::vector< DiracSpinor > &orbs, int kappa)
 Returns maximum n found in {orbs}, for given kappa.
 
static std::size_t max_kindex (const std::vector< DiracSpinor > &orbs)
 Returns maximum kappa_index found in {orbs}.
 
static double max_En (const std::vector< DiracSpinor > &orbs)
 Returns maximum Energy found in {orbs}.
 
static double min_En (const std::vector< DiracSpinor > &orbs)
 Returns minimum Energy found in {orbs}.
 
static std::pair< std::vector< DiracSpinor >, std::vector< DiracSpinor > > split_by_energy (const std::vector< DiracSpinor > &orbitals, double Fermi_energy, int n_min_core=1, int n_max_excited=9999, bool include_negative_energy=true)
 Splits orbitals into two groups (i.e., core, excited) by energy.
 
static std::pair< std::vector< DiracSpinor >, std::vector< DiracSpinor > > split_by_core (const std::vector< DiracSpinor > &orbitals, const std::vector< DiracSpinor > &core, int n_min_core=1)
 Splits orbitals into two groups (i.e., core, excited)
 
static std::vector< DiracSpinor > subset (const std::vector< DiracSpinor > &basis, const std::string &subset_string, bool exclude_negative_energy=true)
 Takes a subset of a basis (by copy), according to subset_string.
 

Friends

double operator* (const DiracSpinor &Fa, const DiracSpinor &Fb)
 Returns radial integral (Fa,Fb) = Int(fa*fb + ga*gb)
 
DiracSpinor operator+ (DiracSpinor lhs, const DiracSpinor &rhs)
 Returns lhs + rhs; should generally have same kappa (see +=)
 
DiracSpinor operator- (DiracSpinor lhs, const DiracSpinor &rhs)
 Returns lhs - rhs; should generally have same kappa (see +=)
 
DiracSpinor operator* (DiracSpinor Fa, const double x)
 Returns Fa scaled by scalar x.
 
DiracSpinor operator* (const double x, DiracSpinor Fa)
 Returns Fa scaled by scalar x.
 
DiracSpinor operator* (const std::vector< double > &v, DiracSpinor Fa)
 Returns Fa multiplied by function v(r), pointwise.
 
bool operator== (const DiracSpinor &lhs, const DiracSpinor &rhs)
 Equality: true if {n,kappa} match.
 
bool operator!= (const DiracSpinor &lhs, const DiracSpinor &rhs)
 Inequality: true if {n,kappa} differ.
 
bool operator< (const DiracSpinor &lhs, const DiracSpinor &rhs)
 Ordering: compares n, then kappa (via kappa_index)
 
bool operator> (const DiracSpinor &lhs, const DiracSpinor &rhs)
 Ordering: compares n, then kappa (via kappa_index)
 
bool operator<= (const DiracSpinor &lhs, const DiracSpinor &rhs)
 Ordering: compares n, then kappa (via kappa_index)
 
bool operator>= (const DiracSpinor &lhs, const DiracSpinor &rhs)
 Ordering: compares n, then kappa (via kappa_index)
 
std::ostream & operator<< (std::ostream &ostr, const DiracSpinor &Fa)
 Writes short symbol to ostream.
 

Member Typedef Documentation

◆ Index

using DiracSpinor::Index = uint16_t

Integer type for the compressed (n,kappa) index.

Member Enumeration Documentation

◆ Branch

enum class DiracSpinor::Branch
strong

Which energy branch of a set of orbitals state_config() describes.

Constructor & Destructor Documentation

◆ DiracSpinor()

DiracSpinor::DiracSpinor ( int  in_n,
int  in_kappa,
std::shared_ptr< const Grid >  in_rgrid,
bool  negative_energy = false 
)

Constructor: Requires n (PQN), kappa (Dirac QN), and grid.

Grid is a shared pointer, as it's a shared resource. f and g are initialised to zero over the full grid (max_pt() = grid size).

Parameters
in_nPrincipal quantum number
in_kappaDirac quantum number, kappa
in_rgridRadial grid (shared resource)
negative_energyMarks a negative-energy (Dirac sea) solution

Member Function Documentation

◆ n()

int DiracSpinor::n ( ) const
inline

Principal quantum number, n.

◆ kappa()

int DiracSpinor::kappa ( ) const
inline

Dirac quantum number, kappa.

◆ l()

int DiracSpinor::l ( ) const
inline

Orbital angular momentum Q number.

◆ jjp1()

double DiracSpinor::jjp1 ( ) const
inline

j(j+1)

◆ twoj()

int DiracSpinor::twoj ( ) const
inline

2j (twice the total angular momentum)

◆ twojp1()

int DiracSpinor::twojp1 ( ) const
inline

2j+1

◆ parity()

int DiracSpinor::parity ( ) const
inline

(-1)^l, returns +/- 1

◆ k_index()

std::size_t DiracSpinor::k_index ( ) const
inline

kappa index (see Angular::kappa_to_kindex)

◆ nk_index()

Index DiracSpinor::nk_index ( ) const
inline

(n,kappa) index

See Angular::nk_to_index.

Warning
Unique only for 1 <= n <= 256: larger n overflows Index (not checked here; see SplineBasis::form_basis and Angular::nk_to_index).
Note
For n = 0 (continuum orbitals), it coincides with a bound-state index (that of n = 2: e.g., continuum s and 2s, p_1/2 and 2p_1/2, d_3/2 and 3s), so continuum and bound states must not share a table keyed by this index.

◆ symbol()

std::string DiracSpinor::symbol ( bool  gnuplot = false) const

Single-electron term symbol (e.g., 6s_1/2). Gnuplot=true => 6s_{1/2}.

◆ shortSymbol() [1/2]

std::string DiracSpinor::shortSymbol ( ) const

e.g., 6p_1/2 => 6p-, 6p_3/2 => 6p+

◆ exotic() [1/2]

bool & DiracSpinor::exotic ( )
inline

Checks if spinor is for "exotic" lepton, or regular electron.

◆ exotic() [2/2]

bool DiracSpinor::exotic ( ) const
inline

Checks if spinor is for "exotic" lepton, or regular electron.

◆ negativeEnergyStateQ()

bool DiracSpinor::negativeEnergyStateQ ( ) const
inline

Returns true if this is a negative-energy (Dirac sea) state.

Set at construction (by the basis builder); independent of alpha and mass.

◆ set_new_kappa()

void DiracSpinor::set_new_kappa ( int  new_kappa)

Changes 'kappa' angular quantum number. Use with caution!

◆ grid()

const Grid & DiracSpinor::grid ( ) const
inline

Returns a const reference to the radial grid.

◆ grid_sptr()

std::shared_ptr< const Grid > DiracSpinor::grid_sptr ( ) const
inline

Returns copy of shared_ptr to grid [shared resource].

Used when we want to construct a new DiracSpinor that shares this grid.

◆ en()

double DiracSpinor::en ( ) const
inline

Single-particle energy, not including rest energy.

◆ f() [1/2]

const std::vector< double > & DiracSpinor::f ( ) const
inline

Upper (large) radial component function, f.

◆ f() [2/2]

double DiracSpinor::f ( std::size_t  i) const
inline

Upper (large) radial component, f(r_i)

◆ g() [1/2]

const std::vector< double > & DiracSpinor::g ( ) const
inline

Lower (small) radial component function, g.

◆ g() [2/2]

double DiracSpinor::g ( std::size_t  i) const
inline

Lower (small) radial component, g(r_i)

◆ min_pt()

auto DiracSpinor::min_pt ( ) const
inline

First non-zero point (index for f[i])

◆ max_pt()

auto DiracSpinor::max_pt ( ) const
inline

Effective size(); index after last non-zero point (index for f[i])

◆ r0()

double DiracSpinor::r0 ( ) const

r0 = r[min_pt] (in atomic units)

◆ rinf()

double DiracSpinor::rinf ( ) const

rinf = r[max_pt - 1], the last point of the spinor (au); 0 if max_pt = 0

◆ its()

auto DiracSpinor::its ( ) const
inline

Number of iterations until energy convergence (for latest routine only)

◆ occ_frac()

auto DiracSpinor::occ_frac ( ) const
inline

Occupation fraction. =1 for closed shells. =1/(2j+1) for valence.

◆ eps()

auto DiracSpinor::eps ( ) const
inline

Fractional energy convergence: eps = |(en'-en)/en|.

◆ scale() [1/2]

const DiracSpinor & DiracSpinor::scale ( const double  factor)

Scales DiracSpinor (f and g) by constant.

◆ scale() [2/2]

const DiracSpinor & DiracSpinor::scale ( const std::vector< double > &  v)

Scales DiracSpinor (f and g) by function of r.

Pointwise, over [min_pt, max_pt). Points beyond the end of v (up to max_pt) are set to zero.

◆ normalise()

void DiracSpinor::normalise ( double  norm_to = 1.0)

By default normalises to 1, but can normalise to other number.

◆ zero_boundaries()

void DiracSpinor::zero_boundaries ( )

Forces f(r) and g(r) to be zero outside of [p0,pinf)

◆ norm()

double DiracSpinor::norm ( ) const

Returns the norm, defined: Norm = Sqrt[<a|a>].

◆ norm2()

double DiracSpinor::norm2 ( ) const

Returns the norm^2, defined: Norm2 = <a|a>

◆ num_nodes()

int DiracSpinor::num_nodes ( double  rel_cut = 1.0e-3) const

Number of nodes (sign changes) in f(r).

Should be n-l-1 for bound states.

Only counts out to the last point where |f| >= rel_cut*max|f|, so that small-amplitude sign changes in the tail (e.g., the exchange-dominated tail of Hartree-Fock orbitals), which are not physical nodes, are not counted. Likewise, sign changes before |f| first reaches 1e-10*max|f| (near the nucleus, where high-l orbitals are negligible) are not counted.

Parameters
rel_cutRelative amplitude cut-off for the tail (see above)
Returns
Number of nodes; -1 if f is zero or not finite (failed solution).

◆ r0pinfratio()

std::pair< double, double > DiracSpinor::r0pinfratio ( ) const

Returns [f[p0]/f_max , f[pinf-1]/f_max] - for tests; {0,0} if f = 0.

◆ rho()

std::vector< double > DiracSpinor::rho ( ) const

Radial density: rho(r) = (2j+1) * x_occ * |F^2|(r)

\( \rho(r) = 4\pi r^2 \, x_{\rm occ} \sum_m |\psi_{n\kappa m}|^2 = (2j+1) \, x_{\rm occ} \, (f^2 + g^2) \), with x_occ = occ_frac(). Integrates (over r) to the number of electrons, for a normalised orbital.

◆ num_electrons()

int DiracSpinor::num_electrons ( ) const

Number of occupied electrons: (2j+1)*occ_frac, rounded to an integer.

◆ operator+=()

DiracSpinor & DiracSpinor::operator+= ( const DiracSpinor &  rhs)

Adds rhs to this, in place (should generally have same kappa, but forced)

Kappa is not checked: the result keeps n and kappa of this. Range [min_pt, max_pt) is extended to include that of rhs.

◆ operator-=()

DiracSpinor & DiracSpinor::operator-= ( const DiracSpinor &  rhs)

Subtracts rhs from this, in place; should generally have same kappa (see +=)

◆ add_scaled()

DiracSpinor & DiracSpinor::add_scaled ( double  x,
const DiracSpinor &  rhs 
)

Adds x*rhs to this, in place (no temporary); should generally have same kappa.

◆ operator*=() [1/2]

DiracSpinor & DiracSpinor::operator*= ( const double  x)

Scales this by scalar x, in place.

◆ operator*=() [2/2]

DiracSpinor & DiracSpinor::operator*= ( const std::vector< double > &  v)

Multiplies this by function v(r), pointwise, in place.

◆ comp_l()

static bool DiracSpinor::comp_l ( const DiracSpinor &  lhs,
const DiracSpinor &  rhs 
)
inlinestatic

Comparator (for sorting): by l.

◆ comp_j()

static bool DiracSpinor::comp_j ( const DiracSpinor &  lhs,
const DiracSpinor &  rhs 
)
inlinestatic

Comparator (for sorting): by 2j.

◆ comp_ki()

static bool DiracSpinor::comp_ki ( const DiracSpinor &  lhs,
const DiracSpinor &  rhs 
)
inlinestatic

Comparator (for sorting): by kappa_index.

◆ comp_n()

static bool DiracSpinor::comp_n ( const DiracSpinor &  lhs,
const DiracSpinor &  rhs 
)
inlinestatic

Comparator (for sorting): by n.

◆ comp_en()

static bool DiracSpinor::comp_en ( const DiracSpinor &  lhs,
const DiracSpinor &  rhs 
)
inlinestatic

Comparator (for sorting): by energy.

◆ check_ortho()

std::pair< double, std::string > DiracSpinor::check_ortho ( const std::vector< DiracSpinor > &  a,
const std::vector< DiracSpinor > &  b 
)
static

Returns worst |<a|b>| (or ||<a|b>|-1| for a=b) {val, state_names}.

◆ orthonormaliseOrbitals()

void DiracSpinor::orthonormaliseOrbitals ( std::vector< DiracSpinor > &  orbs,
int  num_its = 1 
)
static

(approximately) OrthoNormalises a set of any orbitals

Symmetric: each orbital is orthogonalised against all others of the same kappa, \( \ket{a} \to \ket{a} - \frac{1}{2}\sum_{b \neq a} \ket{b}\langle b|a\rangle \) (overlaps from the start of the iteration), then normalised. Half of each overlap is removed from each of the pair, so the overlaps are removed to first order only. Repeated num_its times.

Note
Only updates orbs, not energies

◆ orthogonaliseWrt()

DiracSpinor DiracSpinor::orthogonaliseWrt ( const DiracSpinor &  Fin,
const std::vector< DiracSpinor > &  orbs 
)
static

Forces Fin to be orthogonal to orbs.

If Fn (i.e., {n,k}) is in orbs, replaces Fin with that from orbs. Otherwise, subtracts the projection of Fin onto each orbital in orbs with the same kappa (exact only if orbs are orthonormal).

Note
Energy is not updated (unless Fin is replaced from orbs).

◆ orthonormaliseWrt()

DiracSpinor DiracSpinor::orthonormaliseWrt ( const DiracSpinor &  Fin,
const std::vector< DiracSpinor > &  orbs 
)
static

As orthogonaliseWrt(), but normalises Fin afterwards.

◆ orthog()

void DiracSpinor::orthog ( const DiracSpinor &  rhs)

A more correct way to force orthogonality than normal.

|this> -> |this> - <this|rhs>|rhs>, only over the range where both spinors are defined: min_pt() and max_pt() of this are unchanged. Does nothing if kappa differs.

Note
Assumes rhs is normalised.

◆ shortSymbol() [2/2]

std::string DiracSpinor::shortSymbol ( int  n,
int  kappa 
)
static

e.g., 6p_1/2 => 6p-, 6p_3/2 => 6p+

◆ state_config()

std::string DiracSpinor::state_config ( const std::vector< DiracSpinor > &  orbs,
Branch  branch = Branch::both 
)
static

Returns formatted states string (e.g., '7sp5d') given list of orbs.

For the electron states, the number is the maximum n for each l. For the negative-energy (positron) states, it is the number kept for each kappa (the larger of the two kappa, for each l). By default (both), the two are joined with '+' when negative-energy states are present (e.g., '30spd20f+9spdf'), so they are always visible.

◆ config_string()

std::string DiracSpinor::config_string ( const std::vector< int > &  n_per_l)
static

Formats a list of numbers into the compressed states-string notation.

One number per l, starting at l=0, e.g., {30,30,20,20} => '30sp20df'. Zero entries are skipped.

◆ exactHlike()

DiracSpinor DiracSpinor::exactHlike ( int  n,
int  k,
std::shared_ptr< const Grid >  rgrid,
double  zeff,
double  alpha = PhysConst::alpha,
double  mass = 1.0 
)
static

Constructs an exact H-like (pointlike Coulomb) DiracSpinor.

Relativistic Dirac-Coulomb bound orbital for nuclear charge zeff (see DiracHydrogen).

Note
alpha <= 0 gives the non-relativistic (Schrodinger) solution instead: f = P_nl, g = 0.

◆ exactHlike_cntm()

DiracSpinor DiracSpinor::exactHlike_cntm ( double  en,
int  k,
std::shared_ptr< const Grid >  rgrid,
double  zeff,
double  alpha = PhysConst::alpha,
double  mass = 1.0 
)
static

Constructs an exact (Dirac-Coulomb) continuum DiracSpinor.

Energy-normalised relativistic continuum orbital (en > 0; n set to 0). Requires FLINT for the relativistic case (see DiracContinuum::available).

Note
alpha <= 0 gives the non-relativistic solution instead (f = P_el, g = 0), which does not require FLINT.
Warning
Relativistic case without FLINT: prints a warning and returns NaN (assert fails if NDEBUG is not defined).

◆ HlikeBasis() [1/2]

std::vector< DiracSpinor > DiracSpinor::HlikeBasis ( int  max_l,
int  num_ns,
std::shared_ptr< const Grid >  rgrid,
double  zeff,
double  alpha = PhysConst::alpha,
double  mass = 1.0 
)
static

Constructs a basis of H-like (pointlike) DiracSpinors.

Parameters
max_lmaximum l (both kappas calculated)
num_nsnumber of principal quantum numbers per l (not max n)
masslepton mass in units of m_e (default 1 = electron)
Note
alpha <= 0 gives the non-relativistic solutions (f = P_nl, g = 0)

◆ HlikeBasis() [2/2]

std::vector< DiracSpinor > DiracSpinor::HlikeBasis ( const std::string &  basis_string,
std::shared_ptr< const Grid >  rgrid,
double  zeff,
double  alpha = PhysConst::alpha,
double  mass = 1.0 
)
static

Constructs a basis of H-like (pointlike) DiracSpinors.

Parameters
basis_stringe.g., "6sp5d": max n for each kappa; all n down to n_min = l+1 are included
masslepton mass in units of m_e (default 1 = electron)
Note
alpha <= 0 gives the non-relativistic solutions (f = P_nl, g = 0)

◆ find()

const DiracSpinor * DiracSpinor::find ( int  n,
int  k,
const std::vector< DiracSpinor > &  orbs 
)
static

Searches for {n,k} in list of orbitals, returns pointer (may be null)

◆ max_tj()

int DiracSpinor::max_tj ( const std::vector< DiracSpinor > &  orbs)
static

Returns maximum (2j) found in {orbs}.

◆ max_l()

int DiracSpinor::max_l ( const std::vector< DiracSpinor > &  orbs)
static

Returns maximum l found in {orbs}.

◆ max_n() [1/2]

int DiracSpinor::max_n ( const std::vector< DiracSpinor > &  orbs)
static

Returns maximum n found in {orbs}.

◆ max_n() [2/2]

int DiracSpinor::max_n ( const std::vector< DiracSpinor > &  orbs,
int  kappa 
)
static

Returns maximum n found in {orbs}, for given kappa.

◆ max_kindex()

std::size_t DiracSpinor::max_kindex ( const std::vector< DiracSpinor > &  orbs)
static

Returns maximum kappa_index found in {orbs}.

◆ max_En()

double DiracSpinor::max_En ( const std::vector< DiracSpinor > &  orbs)
static

Returns maximum Energy found in {orbs}.

◆ min_En()

double DiracSpinor::min_En ( const std::vector< DiracSpinor > &  orbs)
static

Returns minimum Energy found in {orbs}.

◆ split_by_energy()

std::pair< std::vector< DiracSpinor >, std::vector< DiracSpinor > > DiracSpinor::split_by_energy ( const std::vector< DiracSpinor > &  orbitals,
double  Fermi_energy,
int  n_min_core = 1,
int  n_max_excited = 9999,
bool  include_negative_energy = true 
)
static

Splits orbitals into two groups (i.e., core, excited) by energy.

  • The first group contains orbitals with energy <= Fermi_energy
  • The second group contains orbitals with energy > Fermi_energy
  • The first group is also limited to have n >= n_min_core (i.e., exclude deep core states)
  • The second group is limited to have n <= n_max_excited
  • Negative-energy states (if present) all go to the second group (n_max_excited is not applied to them). Set include_negative_energy = false to drop them entirely instead

◆ split_by_core()

std::pair< std::vector< DiracSpinor >, std::vector< DiracSpinor > > DiracSpinor::split_by_core ( const std::vector< DiracSpinor > &  orbitals,
const std::vector< DiracSpinor > &  core,
int  n_min_core = 1 
)
static

Splits orbitals into two groups (i.e., core, excited)

  • The first group contains orbitals with {n,kappa} in the given core
  • The second group contains all of the rest
  • The first group is also limited to have n >= n_min_core (i.e., exclude deep core states)

◆ subset()

std::vector< DiracSpinor > DiracSpinor::subset ( const std::vector< DiracSpinor > &  basis,
const std::string &  subset_string,
bool  exclude_negative_energy = true 
)
static

Takes a subset of a basis (by copy), according to subset_string.

  • Includes only states matching the subset_string (e.g., "6sp5d": max n for each kappa)
  • Negative-energy states are excluded, unless exclude_negative_energy is false: then all those with kappa in subset_string are included (the n limit is not applied to them)

Friends And Related Symbol Documentation

◆ operator* [1/4]

double operator* ( const DiracSpinor &  Fa,
const DiracSpinor &  Fb 
)
friend

Returns radial integral (Fa,Fb) = Int(fa*fb + ga*gb)

◆ operator+

DiracSpinor operator+ ( DiracSpinor  lhs,
const DiracSpinor &  rhs 
)
friend

Returns lhs + rhs; should generally have same kappa (see +=)

◆ operator-

DiracSpinor operator- ( DiracSpinor  lhs,
const DiracSpinor &  rhs 
)
friend

Returns lhs - rhs; should generally have same kappa (see +=)

◆ operator* [2/4]

DiracSpinor operator* ( DiracSpinor  Fa,
const double  x 
)
friend

Returns Fa scaled by scalar x.

◆ operator* [3/4]

DiracSpinor operator* ( const double  x,
DiracSpinor  Fa 
)
friend

Returns Fa scaled by scalar x.

◆ operator* [4/4]

DiracSpinor operator* ( const std::vector< double > &  v,
DiracSpinor  Fa 
)
friend

Returns Fa multiplied by function v(r), pointwise.

◆ operator==

bool operator== ( const DiracSpinor &  lhs,
const DiracSpinor &  rhs 
)
friend

Equality: true if {n,kappa} match.

Note
Compares labels only: any two continuum orbitals (n = 0) with the same kappa compare equal, whatever their energy.

◆ operator!=

bool operator!= ( const DiracSpinor &  lhs,
const DiracSpinor &  rhs 
)
friend

Inequality: true if {n,kappa} differ.

◆ operator<

bool operator< ( const DiracSpinor &  lhs,
const DiracSpinor &  rhs 
)
friend

Ordering: compares n, then kappa (via kappa_index)

◆ operator>

bool operator> ( const DiracSpinor &  lhs,
const DiracSpinor &  rhs 
)
friend

Ordering: compares n, then kappa (via kappa_index)

◆ operator<=

bool operator<= ( const DiracSpinor &  lhs,
const DiracSpinor &  rhs 
)
friend

Ordering: compares n, then kappa (via kappa_index)

◆ operator>=

bool operator>= ( const DiracSpinor &  lhs,
const DiracSpinor &  rhs 
)
friend

Ordering: compares n, then kappa (via kappa_index)

◆ operator<<

std::ostream & operator<< ( std::ostream &  ostr,
const DiracSpinor &  Fa 
)
friend

Writes short symbol to ostream.


The documentation for this class was generated from the following files: