QNANO
Coulomb_Matrix_Elements.h
1 #ifndef QNANO_NEW_COULOMB_MATRIX_ELEMENTS_DEFINED_H
2 #define QNANO_NEW_COULOMB_MATRIX_ELEMENTS_DEFINED_H
3 
4 #include "tools/Tensor4.h"
5 #include "tools/QNANO_Matrix.h"
6 #include "tools/Reader.h"
7 #include "manybody/Manybody_Hilbert_Space.h"
8 
14 public:
16  enum Type{ none, direct, exchange, ee, hh} type;
17  static std::string get_type_string(enum Type type_);
18 
19  void resize(int nr_e, int nr_h);
20  void resize(const Manybody_Hilbert_Space &HS);
21  void setup(Type type_, const Manybody_Hilbert_Space &HS, const std::string &filename=""){
22  type=type_;
23  resize(HS);
24  if(filename!="")read(filename);
25  }
26 
28  void check_size_consistency()const;
30  void check_Hermitian(double accuracy=1e-6)const;
32  void check_consistency(double accuracy=1e-6)const{check_size_consistency(); check_Hermitian(accuracy);}
33 
35  bool is_hole(size_t i)const;
36 
38  void read(const std::string &filename, bool read_size_from_file=false);
39  void read_noheader(std::ifstream &ifs, const std::string &filename_for_error="");
40  void print(const std::string &filename, int round_figure=8)const;
41 
42 
44  void apply_trafo(const QNANO_Matrix &trafo_e, const QNANO_Matrix &trafo_h);
45 
47  void make_Hermitian();
48 
49  //Copy and Constructors
50  void copy_noresize(const Coulomb_Matrix_Elements& other);
51 
52  void copy(const Coulomb_Matrix_Elements& other){
53  type=other.type;
54  Tensor4::copy(other);
55  }
56  Coulomb_Matrix_Elements &operator=(const Coulomb_Matrix_Elements &other){
57  copy(other);
58  return *this;
59  }
61  copy(other);
62  }
63  Coulomb_Matrix_Elements(Type type_=none) : type(type_) {}
64  Coulomb_Matrix_Elements(Type type_, size_t i, size_t j, size_t k, size_t l)
65  : Tensor4(i,j,k,l), type(type_) {
66 // check_consistency();
67  }
68  Coulomb_Matrix_Elements(Type type_, int nr_e, int nr_h) : type(type_){
69  resize(nr_e,nr_h);
71  }
72  Coulomb_Matrix_Elements(Type type_, const Manybody_Hilbert_Space &HS, const std::string &filename="") : type(type_){
73  resize(HS);
74  if(filename!="")read(filename);
75  }
76  Coulomb_Matrix_Elements(Type type_, const std::string &filename)
77  : type(type_) {
78  read(filename, true);
80  }
81 
82 
83 
84 };
85 
86 
87 #endif
void read(const std::string &filename, bool read_size_from_file=false)
reader+printer:
Definition: Coulomb_Matrix_Elements.cc:38
Definition: Manybody_Hilbert_Space.h:8
void check_size_consistency() const
check if sizes are consistend with the type of the matrix element
Definition: Coulomb_Matrix_Elements.cc:125
Type
type: is it a direct, exchange, electron-electron or hole-hole matrix element?
Definition: Coulomb_Matrix_Elements.h:16
Class to store a rank-4 (complex) tensor:
Definition: Tensor4.h:9
void check_consistency(double accuracy=1e-6) const
check overall consistency
Definition: Coulomb_Matrix_Elements.h:32
Definition: Coulomb_Matrix_Elements.h:13
void apply_trafo(const QNANO_Matrix &trafo_e, const QNANO_Matrix &trafo_h)
apply unitary transformation for electron and hole states
Definition: Coulomb_Matrix_Elements.cc:208
bool is_hole(size_t i) const
does an index correspond to a hole (true) or to an electron(false)
Definition: Coulomb_Matrix_Elements.cc:171
void make_Hermitian()
used if only upper diagonal is specified in file
Definition: Coulomb_Matrix_Elements.cc:348
void check_Hermitian(double accuracy=1e-6) const
check if Hermitian
Definition: Coulomb_Matrix_Elements.cc:149
Definition: QNANO_Matrix.h:7