ampsci
c++ program for high-precision atomic structure calculations of single-valence systems
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
DiracSpinor

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

#include <DiracSpinor.hpp>

Public Types

using Index = uint16_t
 

Public Member Functions

 DiracSpinor (int in_n, int in_kappa, std::shared_ptr< const Grid > in_rgrid)
 Constructor: Requires n (PQN), kappa (Dirac QN), and grid (shared pointer, as it's a shared resource)
 
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
 
int twojp1 () const
 2j+1
 
int parity () const
 (-1)^l, returns +/- 1
 
int k_index () const
 kappa index (see AtomData)
 
Index nk_index () const
 (n,kappa) index (see AtomData)
 
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+
 
void set_new_kappa (int new_kappa)
 Changes 'kappa' angular quantum number. Use with caution!
 
const Gridgrid () const
 Resturns a const reference to the radial grid.
 
std::shared_ptr< const Gridgrid_sptr () const
 Resturns copy of shared_ptr to grid [shared resource] - used when we want to construct a new DiracSpinor that shares this grid.
 
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) XXX Kill this?
 
double rinf () const
 rinf = r[max_pt]
 
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 DiracSpinorscale (const double factor)
 Scales DiracSpinor (f and g) by constant.
 
const DiracSpinorscale (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>
 
std::pair< double, double > r0pinfratio () const
 Returns [f[p0]/f_max , f[pinf]/f_max] - for tests.
 
std::vector< double > rho () const
 rho(r) = sum_m |Psi^2|(r) = (2j+1) * x_occ * |F^2|(r)
 
int num_electrons () const
 Number of occupied electrons: (2j+1)*occ_frac.
 
DiracSpinoroperator+= (const DiracSpinor &rhs)
 Addition of two DiracSpinors - must have same kappa.
 
DiracSpinoroperator-= (const DiracSpinor &rhs)
 
DiracSpinoroperator*= (const double x)
 Scalar multiplication.
 
DiracSpinoroperator*= (const std::vector< double > &v)
 Multiplication by array (function)
 

Static Public Member Functions

static bool comp_l (const DiracSpinor &lhs, const DiracSpinor &rhs)
 Custom comparitors (for sorting): l, j, kappa_index, energy.
 
static bool comp_j (const DiracSpinor &lhs, const DiracSpinor &rhs)
 
static bool comp_ki (const DiracSpinor &lhs, const DiracSpinor &rhs)
 
static bool comp_n (const DiracSpinor &lhs, const DiracSpinor &rhs)
 
static bool comp_en (const DiracSpinor &lhs, const DiracSpinor &rhs)
 
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. More...
 
static DiracSpinor orthogonaliseWrt (const DiracSpinor &Fin, const std::vector< DiracSpinor > &orbs)
 Forces Fin to be orthogonal to orbs. If Fn (i.e., {n,k}) in in orbs, replaces Fin with that from 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)
 Returns formatted states string (e.g., '7sp5d') given list of orbs.
 
static DiracSpinor exactHlike (int n, int k, std::shared_ptr< const Grid > rgrid, double zeff, double alpha=0.0)
 Constructs H-like (pointlike) DiracSpinor - mainly for testing.
 
static const DiracSpinorfind (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_kindex (const std::vector< DiracSpinor > &orbs)
 Returns maximum kappa_index found in {orbs}.
 
static std::pair< std::vector< DiracSpinor >, std::vector< DiracSpinor > > split_by_energy (const std::vector< DiracSpinor > &orbitals, double energy, int n_min_core=1)
 
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)
 

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)
 
DiracSpinor operator- (DiracSpinor lhs, const DiracSpinor &rhs)
 
DiracSpinor operator* (DiracSpinor Fa, const double x)
 
DiracSpinor operator* (const double x, DiracSpinor Fa)
 
DiracSpinor operator* (const std::vector< double > &v, DiracSpinor Fa)
 
bool operator== (const DiracSpinor &lhs, const DiracSpinor &rhs)
 Comparitor overloads (compares n, then kappa):
 
bool operator!= (const DiracSpinor &lhs, const DiracSpinor &rhs)
 
bool operator< (const DiracSpinor &lhs, const DiracSpinor &rhs)
 
bool operator> (const DiracSpinor &lhs, const DiracSpinor &rhs)
 
bool operator<= (const DiracSpinor &lhs, const DiracSpinor &rhs)
 
bool operator>= (const DiracSpinor &lhs, const DiracSpinor &rhs)
 
std::ostream & operator<< (std::ostream &ostr, const DiracSpinor &Fa)
 Writes short symbol to ostream.
 

Detailed Description

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 constant n and k=kappa values + grid
  • A shared pointer to the Grid is stored (to avoid many copies of Grid)
Operator Overloads
  • Intuative 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-asign: Fb = Fa (provided Fa and Fb have same n and kappa!)
  • n and kappa are constant, cannot be changed. Avoids angular errors.
  • all 'set_' functions return mutable references to variables

Member Function Documentation

◆ orthonormaliseOrbitals()

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

(approximately) OrthoNormalises a set of any orbitals.

Note: only updates orbs, not energies


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