IM-SRG++  0
TwoBodyME.hh
1 
2 #ifndef TwoBodyME_h
3 #define TwoBodyME_h 1
4 
5 #include <memory>
6 #include <fstream>
7 #include "ModelSpace.hh"
8 class TwoBodyME_ph;
9 
31 class TwoBodyME
32 {
33  public:
34  ModelSpace* modelspace;
35  map<array<int,2>,arma::mat> MatEl;
36  int nChannels;
37  bool hermitian;
38  bool antihermitian;
39  int rank_J;
40  int rank_T;
41  int parity;
42 
43  ~TwoBodyME();
44  TwoBodyME();
46  TwoBodyME(TwoBodyME_ph&); // Transform a ph operator to pp.
47  TwoBodyME(ModelSpace* ms, int rankJ, int rankT, int parity);
48 
49  TwoBodyME& operator*=(const double);
50  TwoBodyME& operator+=(const TwoBodyME&);
51  TwoBodyME& operator-=(const TwoBodyME&);
52 
53 // void Copy(const TwoBodyME&);
54  void Allocate();
55  bool IsHermitian(){return hermitian;};
56  bool IsAntiHermitian(){return antihermitian;};
57  bool IsNonHermitian(){return not (hermitian or antihermitian);};
58  void SetHermitian();
59  void SetAntiHermitian();
60  void SetNonHermitian();
61 
62  arma::mat& GetMatrix(int chbra, int chket){return MatEl.at({chbra,chket});};
63  arma::mat& GetMatrix(int ch){return GetMatrix(ch,ch);};
64  arma::mat& GetMatrix(array<int,2> a){return GetMatrix(a[0],a[1]);};
65  const arma::mat& GetMatrix(int chbra, int chket)const {return MatEl.at({chbra,chket});};
66  const arma::mat& GetMatrix(int ch)const {return GetMatrix(ch,ch);};
67 
68  //TwoBody setter/getters
69  double GetTBME(int ch_bra, int ch_ket, int a, int b, int c, int d) const;
70  double GetTBME_norm(int ch_bra, int ch_ket, int a, int b, int c, int d) const;
71  void SetTBME(int ch_bra, int ch_ket, int a, int b, int c, int d, double tbme);
72  void AddToTBME(int ch_bra, int ch_ket, int a, int b, int c, int d, double tbme);
73  double GetTBME(int ch_bra, int ch_ket, Ket &bra, Ket &ket) const;
74  void SetTBME(int ch_bra, int ch_ket, Ket &bra, Ket& ket, double tbme);
75  void AddToTBME(int ch_bra, int ch_ket, Ket &bra, Ket& ket, double tbme);
76  double GetTBME_norm(int ch_bra, int ch_ket, int ibra, int iket) const;
77  void SetTBME(int ch_bra, int ch_ket, int ibra, int iket, double tbme);
78  void AddToTBME(int ch_bra, int ch_ket, int ibra, int iket, double tbme);
79  double GetTBME(int j_bra, int p_bra, int t_bra, int j_ket, int p_ket, int t_ket, Ket& bra, Ket& ket) const;
80  void SetTBME(int j_bra, int p_bra, int t_bra, int j_ket, int p_ket, int t_ket, Ket& bra, Ket& ket, double tbme);
81  void AddToTBME(int j_bra, int p_bra, int t_bra, int j_ket, int p_ket, int t_ket, Ket& bra, Ket& ket, double tbme);
82  double GetTBME(int j_bra, int p_bra, int t_bra, int j_ket, int p_ket, int t_ket, int a, int b, int c, int d) const;
83  void SetTBME(int j_bra, int p_bra, int t_bra, int j_ket, int p_ket, int t_ket, int a, int b, int c, int d, double tbme);
84  void AddToTBME(int j_bra, int p_bra, int t_bra, int j_ket, int p_ket, int t_ket, int a, int b, int c, int d, double tbme);
85  double GetTBME_J(int j_bra, int j_ket, int a, int b, int c, int d) const;
86  void SetTBME_J(int j_bra, int j_ket, int a, int b, int c, int d, double tbme);
87  void AddToTBME_J(int j_bra, int j_ket, int a, int b, int c, int d, double tbme);
88  double GetTBME_J_norm(int j_bra, int j_ket, int a, int b, int c, int d) const;
89 
90  // Scalar setters/getters for backwards compatibility
91  double GetTBME(int ch, int a, int b, int c, int d) const;
92  double GetTBME_norm(int ch, int a, int b, int c, int d) const;
93  void SetTBME(int ch, int a, int b, int c, int d, double tbme);
94  void AddToTBME(int ch, int a, int b, int c, int d, double tbme);
95  double GetTBME(int ch, Ket &bra, Ket &ket) const;
96  double GetTBME_norm(int ch, Ket &bra, Ket &ket) const;
97  void SetTBME(int ch, Ket &bra, Ket& ket, double tbme);
98  void AddToTBME(int ch, Ket &bra, Ket& ket, double tbme);
99  double GetTBME_norm(int ch, int ibra, int iket) const;
100  void SetTBME(int ch, int ibra, int iket, double tbme);
101  void AddToTBME(int ch, int ibra, int iket, double tbme);
102  double GetTBME(int j, int p, int t, Ket& bra, Ket& ket) const;
103  void SetTBME(int j, int p, int t, Ket& bra, Ket& ket, double tbme);
104  void AddToTBME(int j, int p, int t, Ket& bra, Ket& ket, double tbme);
105  double GetTBME(int j, int p, int t, int a, int b, int c, int d) const;
106  double GetTBME_norm(int j, int p, int t, int a, int b, int c, int d) const;
107  void SetTBME(int j, int p, int t, int a, int b, int c, int d, double tbme);
108  void AddToTBME(int j, int p, int t, int a, int b, int c, int d, double tbme);
109  double GetTBME_J(int j, int a, int b, int c, int d) const;
110  void SetTBME_J(int j, int a, int b, int c, int d, double tbme);
111  void AddToTBME_J(int j, int a, int b, int c, int d, double tbme);
112 
113 
114  double GetTBME_J_norm(int j, int a, int b, int c, int d) const;
115 
116 
117  void Set_pn_TBME_from_iso(int j, int T, int tz, int a, int b, int c, int d, double tbme);
118  double Get_iso_TBME_from_pn(int j, int T, int tz, int a, int b, int c, int d);
119 
120  double GetTBMEmonopole(int a, int b, int c, int d) const;
121  double GetTBMEmonopole_norm(int a, int b, int c, int d) const;
122  double GetTBMEmonopole(Ket & bra, Ket & ket) const;
123 
124 // void AddToTBME_RelCM(int n1, int l1, int n2, int l2, int L12, int S12, int J12, int T12, int Tz12, int n3, int l3, int n4, int l4, int L34, int S34, int J34, int T34, int Tz34, double Vrel, double Vcm);
125 // vector<pair<int,double>> GetLabFrameKets(int n, int lam, int N, int LAM, int L, int S, int J, int T, int Tz);
126 
127  void Erase();
128  void Scale(double);
129  double Norm() const;
130  void Symmetrize();
131  void AntiSymmetrize();
132  void Eye();
133  void PrintMatrix(int chbra,int chket) const { MatEl.at({chbra,chket}).print();};
134  int Dimension();
135  int size();
136 
137  void WriteBinary(ofstream&);
138  void ReadBinary(ifstream&);
139 
140 
141 };
142 
143 
144 
145 
146 #endif
void Erase()
Take a matrix element expressed in relative/CM frame, and add it to the lab frame TBME...
Definition: TwoBodyME.cc:658
double GetTBMEmonopole(int a, int b, int c, int d) const
Definition: TwoBodyME.cc:480
void Set_pn_TBME_from_iso(int j, int T, int tz, int a, int b, int c, int d, double tbme)
Definition: TwoBodyME.cc:439
Definition: ModelSpace.hh:157
double GetTBME_norm(int ch_bra, int ch_ket, int a, int b, int c, int d) const
This returns the normalized matrix element.
Definition: TwoBodyME.cc:117
double GetTBME(int ch_bra, int ch_ket, int a, int b, int c, int d) const
This returns the matrix element times a factor .
Definition: TwoBodyME.cc:108
Definition: TwoBodyME.hh:31
Definition: ModelSpace.hh:51