2#include "AdamsMoulton.hpp"
3#include "Physics/PhysConst_constants.hpp"
4#include "Wavefunction/DiracSpinor.hpp"
25 const std::vector<double> &H_off_diag = {},
28 const DiracSpinor *
const Fa0 =
nullptr,
double zion = 1,
33 int n,
int kappa,
const double en0,
const std::shared_ptr<const Grid> &gr,
34 const std::vector<double> &v,
const std::vector<double> &H_off_diag = {},
37 const DiracSpinor *
const Fa0 =
nullptr,
double zion = 1,
double mass = 1.0) {
39 boundState(Fnk, en0, v, H_off_diag, alpha, eps, VxFa, Fa0, zion, mass);
45 const std::vector<double> &v,
46 const std::vector<double> &H_off_diag,
const double alpha,
48 const DiracSpinor *
const Fa0 =
nullptr,
double zion = 1,
53 const std::vector<double> &v,
54 const std::vector<double> &H_off_diag,
57 const DiracSpinor *
const Fa0 =
nullptr,
double zion = 1,
69constexpr double cALR = 550.0;
88constexpr auto weight = [](std::size_t i) {
89 return 1.0 /
static_cast<double>(i * i + 1);
94 "\nFAIL in DiracODE: parameter K_Adams must be between 5 and 8\n");
148 const int in_k,
const double in_en,
const double in_alpha,
149 const std::vector<double> &V_off_diag = {},
151 const DiracSpinor *
const iFa0 =
nullptr,
double zion = 1,
152 double in_mass = 1.0);
154 const Grid *
const pgr;
155 const std::vector<double> *
const v;
156 const std::vector<double> *
const Hmag;
159 const double zion = 1.0;
161 const double en, alpha, cc;
165 double a(std::size_t i)
const final;
166 double b(std::size_t i)
const final;
167 double c(std::size_t i)
const final;
168 double d(std::size_t i)
const final;
170 double Sf(std::size_t i)
const final;
171 double Sg(std::size_t i)
const final;
183 int count_toomany = 0;
184 int count_toofew = 0;
185 double high_en = 0.0;
191 std::size_t pinf = 0;
194 bool correct_nodes =
false;
195 std::vector<double> dg{};
201TrackEnGuess trialSolution(
DiracSpinor *Fn,
const std::vector<double> &v,
202 const std::vector<double> &H_off_diag,
double alpha,
204 double zion,
double mass, std::vector<double> &f_in,
205 std::vector<double> &g_in, TrackEnGuess sofar);
209TrackEnGuess adjustEnergy(
DiracSpinor *Fn,
int required_nodes,
double alpha,
214void adjustTail(
DiracSpinor *Fn,
const std::vector<double> &v,
215 const std::vector<double> &H_off_diag,
double alpha,
216 double zion,
double mass,
const TrackEnGuess &sofar);
220std::size_t findPracticalInfinity(
const double en,
const std::vector<double> &v,
221 const std::vector<double> &r,
222 const double alr,
const double mass = 1.0);
225std::size_t findClassicalTurningPoint(
const double en,
226 const std::vector<double> &v,
227 std::size_t pinf, std::size_t d_ctp);
238void trialDiracSolution(std::vector<double> &f, std::vector<double> &g,
239 std::vector<double> &dg, std::vector<double> &f_in,
240 std::vector<double> &g_in,
const double en,
241 const int ka,
const std::vector<double> &v,
242 const std::vector<double> &H_off_diag,
const Grid &gr,
243 std::size_t ctp, std::size_t d_ctp, std::size_t pinf,
246 const DiracSpinor *
const Fa0 =
nullptr,
double zion = 1,
250int countNodes(
const std::vector<double> &f,
const std::size_t maxi);
253void largeEnergyChange(
double *en, TrackEnGuess *sofar,
double frac_de,
259double smallEnergyChangePT(
const double en,
const double anorm,
260 const std::vector<double> &f,
261 const std::vector<double> &dg, std::size_t ctp,
262 std::size_t d_ctp,
const double alpha,
263 TrackEnGuess *sofar);
271void solve_Dirac_outwards(std::vector<double> &f, std::vector<double> &g,
272 const DiracDerivative &Hd, std::size_t
final = 0);
280void solve_Dirac_inwards(std::vector<double> &f, std::vector<double> &g,
281 const DiracDerivative &Hd, std::size_t ctp,
282 std::size_t pinf,
double mass = 1.0);
330std::size_t extendTail(std::vector<double> &f, std::vector<double> &g,
331 const DiracDerivative &Hd, std::size_t pinf,
342void joinInOutSolutions(std::vector<double> &f, std::vector<double> &g,
343 std::vector<double> &dg,
344 const std::vector<double> &f_in,
345 const std::vector<double> &g_in, std::size_t ctp,
346 std::size_t d_ctp, std::size_t pinf);
Stores radial Dirac spinor: F_nk = (f, g)
Definition DiracSpinor.hpp:42
Non-uniform radial grid with Jacobian, suitable for atomic structure calculations.
Definition Grid.hpp:85
constexpr double lfrac_de
Fractional size of 'large' energy update steps (~12%).
Definition BoundState.hpp:73
constexpr int max_its
Max # attempts at converging bound-state energy.
Definition BoundState.hpp:71
constexpr double tail_cut
Relative cutoff for the large-r tail: extend outwards until |f| drops below tail_cut * max|f|....
Definition BoundState.hpp:84
constexpr double cALR
Parameter to determine 'asymptotically large r'.
Definition BoundState.hpp:69
constexpr std::size_t K_Adams
K (# steps) for Adams-Moulton method (between 1 and 12).
Definition BoundState.hpp:67
constexpr int nx
Order of coefficients in the large-r asymptotic expansion.
Definition BoundState.hpp:78
constexpr auto weight
Weighting function for meshing inward/outward solutions at the turning point. Must be positive; index...
Definition BoundState.hpp:88
constexpr double nx_eps
Convergence threshold for the asymptotic expansion.
Definition BoundState.hpp:80
constexpr int d_ctp
Number of grid points either side of the classical turning point.
Definition BoundState.hpp:75
Functions and classes used to solve the Dirac equation.
Definition AsymptoticSpinor.hpp:8
void regularAtInfinity(DiracSpinor &Fa, const double en, const std::vector< double > &v, const std::vector< double > &H_mag, const double alpha, const DiracSpinor *const VxFa, const DiracSpinor *const Fa0, double zion, double mass)
For given energy en, solves (local) DE with correct boundary conditions at infinity.
Definition BoundState.cpp:98
void regularAtOrigin(DiracSpinor &Fa, const double en, const std::vector< double > &v, const std::vector< double > &H_mag, const double alpha, const DiracSpinor *const VxFa, const DiracSpinor *const Fa0, double zion, double mass)
For given energy en, solves DE with correct boundary conditions at the origin.
Definition BoundState.cpp:77
void boundState(DiracSpinor &Fn, const double en0, const std::vector< double > &v, const std::vector< double > &H_mag, const double alpha, double eps_goal, const DiracSpinor *const VxFa, const DiracSpinor *const Fa0, double zion, double mass)
Solves bound-state problem for local potential (en < 0).
Definition BoundState.cpp:23
constexpr double alpha
Fine-structure constant: alpha = 1/137.035 999 177(21) [CODATA 2022].
Definition PhysConst_constants.hpp:24
Pure-virtual struct defining the derivative matrix for a 2x2 ODE system.
Definition AdamsMoulton.hpp:47
Derivative matrix for the radial Dirac equation, dF/du = D(u)*F(u) + S(u).
Definition BoundState.hpp:131
double a(std::size_t i) const final
D matrix elements (see DiracDerivative for definitions); index i is grid point.
Definition BoundState.cpp:643
double Sf(std::size_t i) const final
Inhomogeneous source terms from exchange potential VxFa.
Definition BoundState.cpp:655