Version: SMASH-1.5
clebschgordan.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2018
3  * SMASH Team
4  *
5  * GNU General Public License (GPLv3 or later)
6  */
7 
8 #ifndef SRC_INCLUDE_CLEBSCHGORDAN_H_
9 #define SRC_INCLUDE_CLEBSCHGORDAN_H_
10 
11 #include <algorithm>
12 
13 #include "particletype.h"
14 
15 namespace smash {
16 
31 double clebsch_gordan(const int j_a, const int j_b, const int j_c,
32  const int m_a, const int m_b, const int m_c);
33 
43  const ParticleType &p_b,
44  const ParticleType &Res) {
45  const double cg =
46  clebsch_gordan(p_a.isospin(), p_b.isospin(), Res.isospin(),
47  p_a.isospin3(), p_b.isospin3(), Res.isospin3());
48  return cg * cg;
49 }
50 
60 double isospin_clebsch_gordan_sqr_3to1(const ParticleType &p_a,
61  const ParticleType &p_b,
62  const ParticleType &p_c,
63  const ParticleType &Res);
64 
77 double isospin_clebsch_gordan_sqr_2to2(const ParticleType &p_a,
78  const ParticleType &p_b,
79  const ParticleType &p_c,
80  const ParticleType &p_d,
81  const int I = -1);
82 
84 class I_tot_range {
85  private:
87  int I_min_;
89  int I_max_;
90 
91  public:
98  I_tot_range(const ParticleType &p_a, const ParticleType &p_b) {
99  // Compute total isospin range with given particles.
100  const int I_z_abs = std::abs(p_a.isospin3() + p_b.isospin3());
101  I_max_ = p_a.isospin() + p_b.isospin();
102  I_min_ = std::max(std::abs(p_a.isospin() - p_b.isospin()), I_z_abs);
103  }
104 
114  I_tot_range(const ParticleType &p_a, const ParticleType &p_b,
115  const ParticleType &p_c, const ParticleType &p_d) {
116  // Compute total isospin range with given initial and final particles.
117  const int I_z = p_a.isospin3() + p_b.isospin3();
118  if (I_z != p_c.isospin3() + p_d.isospin3()) {
119  /* This reaction is forbidden by isospin conservation.
120  * Set impossible values to make sure an empty range is returned. */
121  I_min_ = 1;
122  I_max_ = 0;
123  return;
124  }
125  I_max_ =
126  std::min(p_a.isospin() + p_b.isospin(), p_c.isospin() + p_d.isospin());
127  I_min_ = std::max(std::abs(p_a.isospin() - p_b.isospin()),
128  std::abs(p_c.isospin() - p_d.isospin()));
129  I_min_ = std::max(I_min_, std::abs(I_z));
130  }
131 
133  class iterator : public std::iterator<std::forward_iterator_tag, int> {
134  private:
136  int c_;
139 
140  public:
147  iterator(int start, I_tot_range &parent) : c_(start), parent_(parent) {}
149  int operator*() { return c_; }
151  const iterator *operator++() {
152  c_ -= 2;
153  return this;
154  }
157  c_ -= 2;
158  return iterator(c_ + 2, parent_);
159  }
164  bool operator==(const iterator &other) { return c_ == other.c_; }
169  bool operator!=(const iterator &other) { return c_ != other.c_; }
170  };
171 
173  iterator begin() { return iterator(I_max_, *this); }
176  if (I_min_ > I_max_) {
177  return begin();
178  }
179  return iterator(I_min_ - 2, *this);
180  }
181 };
182 
183 } // namespace smash
184 
185 #endif // SRC_INCLUDE_CLEBSCHGORDAN_H_
const iterator * operator++()
bool operator==(const iterator &other)
int isospin3() const
Definition: particletype.h:166
int I_min_
Value of minimum total isospin.
Definition: clebschgordan.h:87
bool operator!=(const iterator &other)
I_tot_range(const ParticleType &p_a, const ParticleType &p_b)
Get the allowed range of total isospin for a collision a + b.
Definition: clebschgordan.h:98
double isospin_clebsch_gordan_sqr_3to1(const ParticleType &p_a, const ParticleType &p_b, const ParticleType &p_c, const ParticleType &Res)
Calculate the squared isospin Clebsch-Gordan coefficient for three particles p_a, p_b and p_c couplin...
Range of total isospin for reaction of particle a with particle b.
Definition: clebschgordan.h:84
int I_max_
Value of maximum total isospin.
Definition: clebschgordan.h:89
I_tot_range & parent_
Parent class giving the total isospin range.
Particle type contains the static properties of a particle species.
Definition: particletype.h:87
double isospin_clebsch_gordan_sqr_2to1(const ParticleType &p_a, const ParticleType &p_b, const ParticleType &Res)
Calculate the squared isospin Clebsch-Gordan coefficient for two particles p_a and p_b coupling to a ...
Definition: clebschgordan.h:42
I_tot_range(const ParticleType &p_a, const ParticleType &p_b, const ParticleType &p_c, const ParticleType &p_d)
Get the allowed range of total isospin for a collision a + b <-> c + d.
int isospin() const
Returns twice the isospin vector length .
double isospin_clebsch_gordan_sqr_2to2(const ParticleType &p_a, const ParticleType &p_b, const ParticleType &p_c, const ParticleType &p_d, const int I=-1)
Calculate the squared isospin Clebsch-Gordan coefficient for a 2-to-2 reaction A + B -> C + D...
iterator(int start, I_tot_range &parent)
Construct an iterator.
int c_
Element of the iterator.
double clebsch_gordan(const int j_a, const int j_b, const int j_c, const int m_a, const int m_b, const int m_c)
Calculate Clebsch-Gordan coefficient .
Definition: action.h:24
Iterator class for determination of total isospin.