ampsci
High-precision calculations for one- and two-valence atomic systems
FieldShift.hpp
1#pragma once
2#include "DiracOperator/TensorOperator.hpp"
3#include "IO/InputBlock.hpp"
4#include "Maths/NumCalc_quadIntegrate.hpp"
5#include "Physics/PhysConst_constants.hpp"
6#include "Potentials/NuclearPotentials.hpp"
7#include "Wavefunction/Wavefunction.hpp"
8#include "qip/Vector.hpp" // qip::overloads
9
10namespace DiracOperator {
11
12//! @brief Field shift operator: dV = V(r, nuc2) - V(r, nuc1)
13/*! @details
14 Computes the change in nuclear potential between two nuclei differing in
15 size or shape. Also stores \f$\delta\langle r^2\rangle\f$ and
16 \f$\delta\langle r^4\rangle\f$ (in fm^2 and fm^4).
17*/
18class fieldshift final : public ScalarOperator {
19
20private:
21 double m_dr2{-1};
22 double m_dr4{-1};
23
24public:
25 fieldshift(const Grid &rgrid, const Nuclear::Nucleus &nuc1,
26 const Nuclear::Nucleus &nuc2, double scale = 1.0)
28 Parity::even, scale,
29 qip::overloads::operator-(Nuclear::formPotential(nuc2, rgrid.r()),
30 Nuclear::formPotential(nuc1, rgrid.r()))),
31 m_dr2(nuc2.r_rms() * nuc2.r_rms() - nuc1.r_rms() * nuc1.r_rms()),
32 m_dr4(r4(rgrid, nuc2) - r4(rgrid, nuc1)) {}
33
34 std::string name() const override { return std::string("Field shift"); }
35 std::string units() const override { return "au"; }
36
37 //! delta <r^2> (in fm^2)
38 double dr2() const { return m_dr2; }
39 //! delta <r^4> (in fm^4)
40 double dr4() const { return m_dr4; }
41
42 //! Helper function: calculates <r^4> (nuclear) in fm^4
43 static double r4(const Grid &grid, const Nuclear::Nucleus &nuc) {
44
45 // <r^4> = \int_0^\infty [\rho(r) r^4] 4 \pi r^2 dr / Z
46 // Z is from normalisation of rho:
47 // \int_0^\infty [\rho(r) r^2] 4 \pi r^2 dr = Z
48 // by normalisation of nuclear charge density.
49 // Require four factors of aB to convert output to femtometres.
50
51 constexpr auto abfm4factor = 4.0 * M_PI * qip::pow<4>(PhysConst::aB_fm);
52 const auto rho = Nuclear::fermiNuclearDensity_tcN(
53 Nuclear::deformation_effective_t(nuc.c(), nuc.t(), nuc.beta()), nuc.c(),
54 nuc.z(), grid);
55 const auto rpow6 = grid.rpow(6);
56
57 return NumCalc::integrate(grid.du(), 0.0, 0.0, rpow6, rho, grid.drdu()) *
58 abfm4factor / nuc.z();
59 }
60
61 //! Helper function: calculates <r^2> (nuclear) in fm^2
62 static double r2(const Grid &grid, const Nuclear::Nucleus &nuc) {
63
64 constexpr auto abfm2factor = 4.0 * M_PI * qip::pow<2>(PhysConst::aB_fm);
65 const auto rho = Nuclear::fermiNuclearDensity_tcN(
66 Nuclear::deformation_effective_t(nuc.c(), nuc.t(), nuc.beta()), nuc.c(),
67 nuc.z(), grid);
68 const auto rpow4 = grid.rpow(4);
69
70 return NumCalc::integrate(grid.du(), 0.0, 0.0, rpow4, rho, grid.drdu()) *
71 abfm2factor / nuc.z();
72 }
73};
74
75inline std::unique_ptr<DiracOperator::TensorOperator>
76generate_fieldshift(const IO::InputBlock &input, const Wavefunction &wf) {
77 using namespace DiracOperator;
78 input.check(
79 {{"", "Field shift operator."},
80 {"drrms",
81 "Change in nuclear rms charge radius (fm); must not be zero [0.01]"},
82 {"scale_factor", "Scale factor [1.0]"},
83 {"", "The following are normally not set:"},
84 {"dt", "Change in skin-thickness t (fm) [0.0]"},
85 {"dbeta", "Change in quadrupole deformation parameter, beta [0.0]"},
86 {"print", "Print details? [true]"}});
87 if (input.has_option("help")) {
88 return nullptr;
89 }
90
91 const auto drrms = input.get("drrms", 0.01);
92 const auto scale = input.get("scale_factor", 1.0);
93 const auto dt = input.get("dt", 0.0);
94 const auto dbeta = input.get("dbeta", 0.0);
95 const auto print = input.get("print", true);
96
97 const auto &nuc0 = wf.nucleus();
98
99 // Update parameters for "2nd" nucleus:
100 auto nuc1 = nuc0;
101 nuc1.set_rrms(nuc1.r_rms() + drrms);
102 nuc1.t() = nuc0.t() + dt;
103 nuc1.beta() = nuc0.beta() + dbeta;
104 const auto vnuc1 = Nuclear::formPotential(nuc1, wf.grid().r());
105
106 auto h = std::make_unique<fieldshift>(wf.grid(), nuc0, nuc1, scale);
107
108 if (print) {
109 std::cout << "Field shift:\n"
110 << "Nuc1: " << nuc0 << "\n"
111 << "Nuc2: " << nuc1 << "\n"
112 << "delta<r^2> = " << h->dr2() << " fm^2\n"
113 << "delta<r^4> = " << h->dr4() << " fm^4\n";
114 }
115
116 return h;
117}
118
119} // namespace DiracOperator
Rank-0 (scalar) tensor operator; derives from TensorOperator with k=0.
Definition TensorOperator.hpp:560
Field shift operator: dV = V(r, nuc2) - V(r, nuc1)
Definition FieldShift.hpp:18
std::string name() const override
Returns "name" of operator (e.g., 'E1')
Definition FieldShift.hpp:34
double dr2() const
delta <r^2> (in fm^2)
Definition FieldShift.hpp:38
double dr4() const
delta <r^4> (in fm^4)
Definition FieldShift.hpp:40
std::string units() const override
Returns units of operator as a string (usually au, may be MHz, etc.)
Definition FieldShift.hpp:35
static double r4(const Grid &grid, const Nuclear::Nucleus &nuc)
Helper function: calculates <r^4> (nuclear) in fm^4.
Definition FieldShift.hpp:43
static double r2(const Grid &grid, const Nuclear::Nucleus &nuc)
Helper function: calculates <r^2> (nuclear) in fm^2.
Definition FieldShift.hpp:62
Holds grid, including type + Jacobian (dr/du)
Definition Grid.hpp:31
const std::vector< double > & r() const
Grid points, r.
Definition Grid.hpp:75
std::vector< double > rpow(double k) const
Calculates+returns vector of 1/r.
Definition Grid.cpp:120
auto du() const
Linear step size dr = (dr/dr)*du.
Definition Grid.hpp:68
const std::vector< double > & drdu() const
Jacobian (dr/du)[i].
Definition Grid.hpp:80
Holds list of Options, and a list of other InputBlocks. Can be initialised with a list of options,...
Definition InputBlock.hpp:153
bool check(std::initializer_list< std::string > blocks, const std::vector< std::pair< std::string, std::string > > &list, bool print=false) const
Check all the options and blocks in this; if any of them are not present in 'list',...
Definition InputBlock.hpp:606
bool has_option(std::string_view key) const
Check is option is present (even if not set) in current block.
Definition InputBlock.hpp:212
T get(std::string_view key, T default_value) const
If 'key' exists in the options, returns value. Else, returns default_value. Note: If two keys with sa...
Definition InputBlock.hpp:428
Stores set of nuclear parameters (all radii in fm)
Definition NuclearPotentials.hpp:20
Stores Wavefunction (set of valence orbitals, grid, HF etc.)
Definition Wavefunction.hpp:37
const Grid & grid() const
Returns a const reference to the radial grid.
Definition Wavefunction.hpp:82
const Nuclear::Nucleus & nucleus() const
Returns Nuclear::nucleus object (contains nuc. parameters)
Definition Wavefunction.hpp:97
Dirac operators: TensorOperator base class and derived implementations for single-particle (one-body)...
Definition GenerateOperator.cpp:3
std::vector< double > formPotential(const Nucleus &nuc, const std::vector< double > &r)
Calls one of the above, depending on params. Fills V(r), given r.
Definition NuclearPotentials.cpp:356
std::vector< double > fermiNuclearDensity_tcN(double t, double c, double Z_norm, const Grid &grid)
Fermi charge distribution, rho(r) - normalised to Z_norm.
Definition NuclearPotentials.cpp:321
double deformation_effective_t(double c, double t, double beta)
Calculates effective skin thickness due to quadrupole deformation [See Eq. 8 of https://doi....
Definition NuclearData.cpp:96
void scale(std::vector< T > *vec, T x)
In-place scalar multiplication of std::vector - types must match.
Definition Vector.hpp:210