ampsci
c++ program for high-precision atomic structure calculations of single-valence systems
Loading...
Searching...
No Matches
CorrelationPotential.hpp
1#pragma once
2#include "Angular/CkTable.hpp"
3#include "Angular/SixJTable.hpp"
4#include "Coulomb/YkTable.hpp"
5#include "IO/FRW_fileReadWrite.hpp"
6#include "MBPT/Feynman.hpp"
7#include "MBPT/Goldstone.hpp"
8#include "MBPT/SpinorMatrix.hpp"
9#include "Wavefunction/DiracSpinor.hpp"
10#include <optional>
11#include <vector>
12
13namespace MBPT {
14
15struct SigmaData {
16 int kappa;
17 double en;
18 SpinorMatrix<double> Sigma;
19 int n{0};
20 double lambda{1.0};
21};
22
23enum class SigmaMethod { Goldstone, Feynman };
24
25struct rgrid_params {
26 double r0{1.0e-4};
27 double rmax{30.0};
28 std::size_t stride{4};
29};
30
31//==============================================================================
32
33class CorrelationPotential {
34 const HF::HartreeFock *m_HF;
35 std::vector<DiracSpinor> m_basis; // so we can delay goldstone construction
36 std::vector<SigmaData> m_Sigmas{};
37 double m_r0, m_rmax;
38 std::size_t m_stride;
39 std::size_t m_i0, m_size; // need?
40
41 SigmaMethod m_method;
42 int m_n_min_core;
43 // int m_n_min_core_F;
44 bool m_includeG;
45 bool m_includeBreit_b2;
46 int m_n_max_breit;
47
48 std::optional<Goldstone> m_Gold{};
49
50 FeynmanOptions m_Foptions;
51 bool m_calculate_fk; // if not, need fk and etak
52 std::vector<double> m_fk;
53 std::vector<double> m_etak;
54
55 std::optional<Feynman> m_Fy{};
56
57 // These are only for calculating fk and eta
58 std::optional<Feynman> m_Fy0{};
59 std::optional<Feynman> m_FyX{};
60 std::optional<Feynman> m_FyH{};
61
62 std::string m_fname{};
63
64public:
65 CorrelationPotential(const std::string &fname, const HF::HartreeFock *vHF,
66 const std::vector<DiracSpinor> &basis, double r0,
67 double rmax, std::size_t stride, int n_min_core,
68 SigmaMethod method, bool include_g = false,
69 bool include_Breit_b2 = false, int n_max_breit = 0,
70 const FeynmanOptions &Foptions = {},
71 bool calculate_fk = true,
72 const std::vector<double> &fk = {},
73 const std::vector<double> &etak = {});
74
75 // // not thread safe!
76 // void formSigma(int kappa, double en, int n = 0) {}
77 // not thread safe!
78 void formSigma(int kappa, double ev, int n, const DiracSpinor *Fv = nullptr);
79
80 bool empty() const { return m_Sigmas.empty(); }
81
82 const GMatrix *getSigma(int kappa, int n = 0) const;
83
84 double getLambda(int kappa, int n = 0) const;
85
86 void clear() { m_Sigmas.clear(); }
87
90 DiracSpinor SigmaFv(const DiracSpinor &Fv) const;
91 DiracSpinor operator()(const DiracSpinor &Fv) const { return SigmaFv(Fv); }
92
94 void scale_Sigma(const std::vector<double> &lambdas);
95
96 // if n=0, scales _all_
97 void scale_Sigma(double lambda, int kappa, int n = 0);
98
100 void print_scaling() const;
101
103 void print_info() const;
104
106 void print_subGrid() const;
107
108 void write(const std::string &fname) { read_write(fname, IO::FRW::write); }
109
110private:
111 bool read_write(const std::string &fname, IO::FRW::RoW rw);
112 void setup_Feynman();
113 std::vector<double> calculate_fk(double ev, const DiracSpinor &v) const;
114 std::vector<double> calculate_etak(double ev, const DiracSpinor &v) const;
115 const SigmaData *get(int kappa, int n = 0) const;
116
117 GMatrix formSigma_F(int kappa, double ev, const DiracSpinor *Fv = nullptr);
118 GMatrix formSigma_G(int kappa, double ev, const DiracSpinor *Fv = nullptr);
119
120public:
121 CorrelationPotential &operator=(const CorrelationPotential &) = default;
122 CorrelationPotential(const CorrelationPotential &) = default;
123 ~CorrelationPotential() = default;
124
125 //
126};
127
128} // namespace MBPT
Stores radial Dirac spinor: F_nk = (f, g)
Definition DiracSpinor.hpp:41
Solves relativistic Hartree-Fock equations for core and valence. Optionally includes Breit and QED ef...
Definition HartreeFock.hpp:70
Many-body perturbation theory.
Definition CI_Integrals.hpp:9