ampsci
c++ program for high-precision atomic structure calculations of single-valence systems
DiagramRPA.hpp
1 #pragma once
2 #include "CorePolarisation.hpp"
3 #include "Coulomb/QkTable.hpp"
4 #include "HF/Breit.hpp"
5 #include "IO/FRW_fileReadWrite.hpp"
6 #include "Wavefunction/DiracSpinor.hpp"
7 #include <vector>
8 class Wavefunction;
9 class DiracSpinor;
10 namespace DiracOperator {
11 class TensorOperator;
12 }
13 namespace HF {
14 class HartreeFock;
15 }
16 
17 namespace ExternalField {
18 
20 class DiagramRPA : public CorePolarisation {
21 
22 private:
23  const HF::HartreeFock *p_hf;
24  std::vector<DiracSpinor> holes{};
25  std::vector<DiracSpinor> excited{};
26 
27  std::optional<HF::Breit> m_Br{};
28 
29  // t0's never change
30  // NO! They change if omega is updated (frequency dependent operator!)
31  std::vector<std::vector<double>> t0am{};
32  std::vector<std::vector<double>> t0ma{};
33  // t's updated each solve_core itteration
34  std::vector<std::vector<double>> tam{};
35  std::vector<std::vector<double>> tma{};
36 
37  // Note: W's depend on rank (also parity)! Can re-use!?
38  // These are probably an excellent candidate for unordered_map?
39  std::vector<std::vector<std::vector<std::vector<double>>>> Wanmb{};
40  std::vector<std::vector<std::vector<std::vector<double>>>> Wabmn{};
41  std::vector<std::vector<std::vector<std::vector<double>>>> Wmnab{};
42  std::vector<std::vector<std::vector<std::vector<double>>>> Wmban{};
43 
44 public:
47  const std::vector<DiracSpinor> &basis,
48  const HF::HartreeFock *in_hf, const std::string &atom = "Atom");
49 
52  const DiagramRPA *const drpa);
53 
54 public:
56  virtual void solve_core(const double omega, int max_its = 200,
57  const bool print = true) override final;
58 
60  virtual Method method() const override final { return Method::diagram; }
61 
63  virtual double dV(const DiracSpinor &Fa,
64  const DiracSpinor &Fb) const override final;
65 
66  double dV_diagram(const DiracSpinor &Fa, const DiracSpinor &Fb) const;
67 
70  virtual void clear() override final;
71 
73  void update_t0s(const DiracOperator::TensorOperator *const h = nullptr);
74 
77  void grab_tam(const DiagramRPA *const drpa) {
78  tam = drpa->tam;
79  tma = drpa->tma;
80  }
81 
82 private:
83  // Note: only writes W (depends on k/pi, and basis). Do not write t's, since
84  // they depend on operator. This makes it very fast when making small changes
85  // to operator (don't need to re-calc W)
86  // Note: doesn't depend on grid!
87  bool read_write(const std::string &fname, IO::FRW::RoW rw);
88 
89  void fill_W_matrix(const DiracOperator::TensorOperator *const h);
90  void setup_ts(const DiracOperator::TensorOperator *const h);
91 
92 public:
93  DiagramRPA &operator=(const DiagramRPA &) = delete;
94  DiagramRPA(const DiagramRPA &) = default;
95  ~DiagramRPA() = default;
96 };
97 
98 } // namespace ExternalField
General operator (virtual base class); operators derive from this.
Definition: TensorOperator.hpp:110
Stores radial Dirac spinor: F_nk = (f, g)
Definition: DiracSpinor.hpp:41
Virtual Core Polarisation class, for <a||dV||b>. See TDHF, DiagramRPA, etc.
Definition: CorePolarisation.hpp:35
RPA correction to matrix elements, using Diagram technique.
Definition: DiagramRPA.hpp:20
virtual void solve_core(const double omega, int max_its=200, const bool print=true) override final
Itterates the RPA equations for core electrons.
Definition: DiagramRPA.cpp:389
void update_t0s(const DiracOperator::TensorOperator *const h=nullptr)
Updates lowest-order t_am matrix elements and resets RPA (+updates operator)
Definition: DiagramRPA.cpp:308
DiagramRPA(const DiracOperator::TensorOperator *const h, const std::vector< DiracSpinor > &basis, const HF::HartreeFock *in_hf, const std::string &atom="Atom")
Normal constructor: needs core to split basis: only uses basis.
Definition: DiagramRPA.cpp:21
virtual double dV(const DiracSpinor &Fa, const DiracSpinor &Fb) const override final
Calculates RPA correction to matrix element: <A||dV||B>
Definition: DiagramRPA.cpp:335
virtual Method method() const override final
Returns RPA method.
Definition: DiagramRPA.hpp:60
virtual void clear() override final
Clears the t_am and t_ma RPA ME's [RPA ME's for hole-excited] @Details If a previous run failed,...
Definition: DiagramRPA.cpp:302
void grab_tam(const DiagramRPA *const drpa)
Copies the tam (and tma) values across from different RPAD. If two operators are similar,...
Definition: DiagramRPA.hpp:77
Solves relativistic Hartree-Fock equations for core and valence. Optionally includes Breit and QED ef...
Definition: HartreeFock.hpp:70
Stores Wavefunction (set of valence orbitals, grid, HF etc.)
Definition: Wavefunction.hpp:36
Dirac Operators: General + derived.
Definition: GenerateOperator.cpp:12
Calculates many-body corrections (RPA) to matrix elements of external field.
Definition: calcMatrixElements.cpp:14
Functions and classes for Hartree-Fock.
Definition: CI_Integrals.hpp:12