TBTK
InteractionAmplitude.h
1 #ifndef COM_DAFER45_TBTK_INTERACTION_AMPLITUDE
2 #define COM_DAFER45_TBTK_INTERACTION_AMPLITUDE
3 
4 #include "TBTK/Index.h"
5 
6 #include <complex>
7 #include <initializer_list>
8 
9 namespace TBTK{
10 
12 public:
15  std::complex<double> amplitude,
16  std::initializer_list<Index> creationOperatorIndices,
17  std::initializer_list<Index> annihilationOperatorIndices
18  );
19 
24  std::complex<double> (*amplitudeCallback)(const std::vector<Index>&, const std::vector<Index>&),
25  std::initializer_list<Index> toIndex,
26  std::initializer_list<Index> fromIndex
27  );
28 
31 
34 
38  std::complex<double> getAmplitude() const;
39 
41  unsigned int getNumCreationOperators() const;
42 
44  unsigned int getNumAnnihilationOperators() const;
45 
47  const Index& getCreationOperatorIndex(unsigned int n) const;
48 
50  const Index& getAnnihilationOperatorIndex(unsigned int n) const;
51 private:
53  std::complex<double> amplitude;
54 
57  std::complex<double> (*amplitudeCallback)(
58  const std::vector<Index> &toIndex,
59  const std::vector<Index> &fromIndex
60  );
61 
63  std::vector<Index> creationOperatorIndices;
64 
66  std::vector<Index> annihilationOperatorIndices;
67 };
68 
69 inline std::complex<double> InteractionAmplitude::getAmplitude() const{
70  if(amplitudeCallback)
71  return amplitudeCallback(creationOperatorIndices, annihilationOperatorIndices);
72  else
73  return amplitude;
74 }
75 
77  return creationOperatorIndices.size();
78 }
79 
81  return annihilationOperatorIndices.size();
82 }
83 
84 inline const Index& InteractionAmplitude::getCreationOperatorIndex(unsigned int n) const{
85  return creationOperatorIndices.at(n);
86 }
87 
88 inline const Index& InteractionAmplitude::getAnnihilationOperatorIndex(unsigned int n) const{
89  return annihilationOperatorIndices.at(n);
90 }
91 
92 }; //End of namespace TBTK
93 
94 #endif
std::complex< double > getAmplitude() const
Definition: InteractionAmplitude.h:69
const Index & getCreationOperatorIndex(unsigned int n) const
Definition: InteractionAmplitude.h:84
Flexible physical index.
const Index & getAnnihilationOperatorIndex(unsigned int n) const
Definition: InteractionAmplitude.h:88
unsigned int getNumCreationOperators() const
Definition: InteractionAmplitude.h:76
Flexible physical index.
Definition: Index.h:70
Definition: ModelFactory.h:35
Definition: InteractionAmplitude.h:11
InteractionAmplitude(std::complex< double > amplitude, std::initializer_list< Index > creationOperatorIndices, std::initializer_list< Index > annihilationOperatorIndices)
unsigned int getNumAnnihilationOperators() const
Definition: InteractionAmplitude.h:80