Version: SMASH-1.6
smash::Nucleus Class Reference

#include <nucleus.h>

A nucleus is a collection of particles that are initialized, before the beginning of the simulation and all have the same velocity.

Definition at line 27 of file nucleus.h.

Inheritance diagram for smash::Nucleus:
[legend]
Collaboration diagram for smash::Nucleus:
[legend]

Classes

struct  TestparticleConfusion
 

Public Member Functions

 Nucleus ()=default
 default constructor More...
 
 Nucleus (Configuration &config, int nTest)
 Constructor for Nucleus, that needs the configuration parameters from the inputfile and the number of testparticles. More...
 
 Nucleus (const std::map< PdgCode, int > &particle_list, int nTest)
 
virtual ~Nucleus ()=default
 
double mass () const
 
virtual ThreeVector distribute_nucleon ()
 The distribution of return values from this function is according to a spherically symmetric Woods-Saxon distribution suitable for this nucleus. More...
 
double woods_saxon (double x)
 Woods-Saxon distribution. More...
 
void arrange_nucleons ()
 Sets the positions of the nucleons inside a nucleus. More...
 
virtual void set_parameters_automatic ()
 Sets the deformation parameters of the Woods-Saxon distribution according to the current mass number. More...
 
virtual void set_parameters_from_config (Configuration &config)
 Sets the parameters of the Woods-Saxon according to manually added values in the configuration file. More...
 
virtual void generate_fermi_momenta ()
 Generates momenta according to Fermi motion for the nucleons. More...
 
void boost (double beta_scalar)
 Boosts the nuclei into the computational frame, such that the nucleons have the appropriate momentum and the nuclei are lorentz-contracted. More...
 
void fill_from_list (const std::map< PdgCode, int > &particle_list, int testparticles)
 Adds particles from a map PDG code => Number_of_particles_with_that_PDG_code to the nucleus. More...
 
void shift (double z_offset, double x_offset, double simulation_time)
 Shifts the nucleus to correct impact parameter and z displacement. More...
 
virtual void rotate ()
 Rotates the nucleus. More...
 
void copy_particles (Particles *particles)
 Copies the particles from this nucleus into the particle list. More...
 
size_t size () const
 Number of numerical (=test-)particles in the nucleus: More...
 
size_t number_of_particles () const
 Number of physical particles in the nucleus: More...
 
FourVector center () const
 Calculate geometrical center of the nucleus. More...
 
void align_center ()
 Shifts the nucleus so that its center is at (0,0,0) More...
 
std::vector< ParticleData >::iterator begin ()
 For iterators over the particle list: More...
 
std::vector< ParticleData >::iterator end ()
 For iterators over the particle list: More...
 
std::vector< ParticleData >::const_iterator cbegin () const
 For const iterators over the particle list: More...
 
std::vector< ParticleData >::const_iterator cend () const
 For const iterators over the particle list: More...
 
void set_diffusiveness (double diffuse)
 Sets the diffusiveness of the nucleus. More...
 
double get_diffusiveness () const
 
void set_saturation_density (double density)
 Sets the saturation density of the nucleus. More...
 
double get_saturation_density () const
 
double default_nuclear_radius ()
 
void set_nuclear_radius (double rad)
 Sets the nuclear radius. More...
 
double get_nuclear_radius () const
 

Protected Attributes

std::vector< ParticleDataparticles_
 Particles associated with this nucleus. More...
 

Private Attributes

double diffusiveness_
 Diffusiveness of Woods-Saxon distribution of this nucleus in fm (for diffusiveness_ == 0, we obtain a hard sphere). More...
 
double saturation_density_ = nuclear_density
 Saturation density of this nucleus. More...
 
double nuclear_radius_
 Nuclear radius of this nucleus. More...
 
double proton_radius_ = 1.2
 Single proton radius in fm. More...
 
size_t testparticles_ = 1
 Number of testparticles per physical particle. More...
 

Friends

std::ostream & operator<< (std::ostream &, const Nucleus &)
 Writes the state of the Nucleus object to the output stream. More...
 

Constructor & Destructor Documentation

smash::Nucleus::Nucleus ( )
default

default constructor

smash::Nucleus::Nucleus ( Configuration config,
int  nTest 
)

Constructor for Nucleus, that needs the configuration parameters from the inputfile and the number of testparticles.

Parameters
[in]configcontains the parameters from the inputfile on the numbers of particles with a certain PDG code
[in]nTestnumber of testparticles

Definition at line 33 of file nucleus.cc.

33  {
34  // Fill nuclei with particles.
35  std::map<PdgCode, int> part = config.take({"Particles"});
36  fill_from_list(part, nTest);
37  // Look for user-defined values or take the default parameters.
38  if (config.has_value({"Diffusiveness"}) && config.has_value({"Radius"}) &&
39  config.has_value({"Saturation_Density"})) {
41  } else if (!config.has_value({"Diffusiveness"}) &&
42  !config.has_value({"Radius"}) &&
43  !config.has_value({"Saturation_Density"})) {
45  } else {
46  throw std::invalid_argument(
47  "Diffussiveness, Radius and Saturation_Density "
48  "required to manually configure the Woods-Saxon"
49  " distribution. Only one/two were provided. \n"
50  "Providing none of the above mentioned "
51  "parameters automatically configures the "
52  "distribution based on the atomic number.");
53  }
54 }
void fill_from_list(const std::map< PdgCode, int > &particle_list, int testparticles)
Adds particles from a map PDG code => Number_of_particles_with_that_PDG_code to the nucleus...
Definition: nucleus.cc:434
virtual void set_parameters_automatic()
Sets the deformation parameters of the Woods-Saxon distribution according to the current mass number...
Definition: nucleus.cc:283
virtual void set_parameters_from_config(Configuration &config)
Sets the parameters of the Woods-Saxon according to manually added values in the configuration file...
Definition: nucleus.cc:335

Here is the call graph for this function:

smash::Nucleus::Nucleus ( const std::map< PdgCode, int > &  particle_list,
int  nTest 
)

Definition at line 28 of file nucleus.cc.

28  {
29  fill_from_list(particle_list, nTest);
31 }
void fill_from_list(const std::map< PdgCode, int > &particle_list, int testparticles)
Adds particles from a map PDG code => Number_of_particles_with_that_PDG_code to the nucleus...
Definition: nucleus.cc:434
virtual void set_parameters_automatic()
Sets the deformation parameters of the Woods-Saxon distribution according to the current mass number...
Definition: nucleus.cc:283

Here is the call graph for this function:

virtual smash::Nucleus::~Nucleus ( )
virtualdefault

Member Function Documentation

double smash::Nucleus::mass ( ) const
Returns
Mass of the nucleus [GeV]. It needs to be double to allow for calculations at LHC energies.

Definition at line 56 of file nucleus.cc.

56  {
57  double total_mass = 0.;
58  for (auto i = cbegin(); i != cend(); i++) {
59  total_mass += i->momentum().abs();
60  }
61  return total_mass / (testparticles_ + 0.0);
62 }
std::vector< ParticleData >::const_iterator cbegin() const
For const iterators over the particle list:
Definition: nucleus.h:220
std::vector< ParticleData >::const_iterator cend() const
For const iterators over the particle list:
Definition: nucleus.h:224
size_t testparticles_
Number of testparticles per physical particle.
Definition: nucleus.h:206

Here is the call graph for this function:

Here is the caller graph for this function:

ThreeVector smash::Nucleus::distribute_nucleon ( )
virtual

The distribution of return values from this function is according to a spherically symmetric Woods-Saxon distribution suitable for this nucleus.

Woods-Saxon-distribution

\(\frac{dN}{dr} = \frac{r^2}{\exp\left(\frac{r-r_0}{d}\right) + 1}\) where \(d\) is the diffusiveness_ parameter and \(r_0\) is nuclear_radius_.

Returns
Woods-Saxon distributed position.

The distribution

Nucleons in nuclei are distributed according to a Woods-Saxon-distribution (see Woods:1954zz)

\[\frac{dN}{d^3r} = \frac{\rho_0}{\exp\left(\frac{r-r_0}{d}\right) +1},\]

where \(d\) is the diffusiveness of the nucleus. For \(d=0\), the nucleus is a hard sphere. \(\rho_0\) and \(r_0\) are, in this limit, the nuclear ground state density and nuclear radius, respectively. For small \(d\), this is still approximately true.

This distribution is obviously spherically symmetric, hence we can rewrite \(d^3r = 4\pi r^2 dr\) and obtain

\[\frac{dN}{4\pi\rho_0dr} = \frac{r^2}{\exp\left(\frac{r-r_0}{d}\right) + 1}.\]

Let us rewrite that in units of \(d\) (that's the diffusiveness) and drop any constraints on normalization (since in the end we only care about relative probabilities: we create as many nucleons as we need). Now, \(p(B)\) is the un-normalized probability to obtain a point at \(r = Bd\) (with \(R = r_0/d\)):

\[p(B) = \frac{B^2}{\exp(B-R) + 1}.\]

Splitting it up in two regimes

We shift the distribution so that \(B-R\) is 0 at \(t = 0\): \(t = B-R\):

\[p^{(1)}(t)= \frac{(t+R)^2}{\exp(t)+1}\]

and observe

\[\frac{1}{\exp(x)+1} = \frac{e^{-x}}{e^{-x}e^{x}+e^{-x}} = \frac{e^{-x}}{e^{-x}+1}.\]

The distribution function can now be split into two cases. For negative t (first case), \(-|t| = t\), and for positive t (second case), \(-|t| = -t\):

\[p^{(1)}(t) = \frac{1}{e^{-|t|}+1} \cdot (t+R)^2 \cdot \begin{cases} 1 & -R \le t < 0 \\ e^{-t} & t \ge 0 \end{cases}.\]

Apart from the first term, all that remains here can easily and exactly be generated from unrejected uniform random numbers (see below). The first term itself - \((1+e^{-|t|})^{-1}\) - is a number between 1/2 and 1.

If we now have a variable \(t\) distributed according to the remainder, \(p^{(2)}(t)\), and reject \(t\) with a probability \(p^{(rej)}(t) = 1 - p^{(survive)}(t) = 1 - (1+e^{-|t|})^{-1}\), the resulting distribution is \(p^{(combined)}(t) = p^{(2)}(t) \cdot p^{(survive)}(t)\). Hence, we need to generate \(p^{(2)}(t)\), which we can normalize to

\[\tilde{p}^{(2)}(t) = \frac{1}{1+3/R+6/R^2+6/R^3} \cdot \begin{cases} \frac{3}{R^3} (t+R)^2 & -R \le t < 0 \\ e^{-t} \left( \frac{3}{R}+\frac{6}{R^2}t+\frac{6}{R^3}\frac{1}{2}t^2 \right) & t \ge 0 \end{cases}.\]

(the tilde \(\tilde{p}\) means that this is normalized).

Four parts inside the rejection

Let \(c_1 = 1+3/R+6/R^2+6/R^3\). The above means:

\[\mbox{Choose: } \begin{cases} \tilde p^{({\rm I})} = \frac{3}{R^3}(t+R)^2 \Theta(-t) \Theta(t+R) \\ \tilde p^{({\rm II})}= e^{-t}\Theta(t) \\ \tilde p^{({\rm III})}=e^{-t}\Theta(t) t \\ \tilde p^{({\rm IV})} =e^{-t}\Theta(t) \frac{1}{2} t^2 \end{cases} \mbox{ with a probability of }\begin{cases} \frac{1}{c_1} \cdot 1 \\ \frac{1}{c_1} \cdot \frac{3}{R} \\ \frac{1}{c_1} \cdot \frac{6}{R^2} \\ \frac{1}{c_1} \cdot \frac{6}{R^3} \end{cases}.\]

Let us see how those are generated. \(\chi_i\) are uniformly distributed numbers between 0 and 1.

\[p(\chi_i) = \Theta(\chi_i)\Theta(1-\chi_i)\]

For simple distributions (only one \(\chi\) involved), we invert \(t(\chi)\), derive it w.r.t. \(t\) and normalize.

Case I: \(p^{({\rm I})}\)

Simply from one random number:

\[t = R\left( \sqrt[ 3 ]{\chi} - 1 \right)\]

\[\tilde p^{({\rm I})} = \frac{3}{R^3}(t+R)^2 \mbox{ for } -R \le t \le 0\]

Case II: \(p^{({\rm II})}\)

Again, from one only:

\[t = -\log(\chi)\]

\[p(t) = \frac{d\chi}{dt}\]

\[p^{({\rm II})} = e^{-t} \mbox{ for } t > 0\]

Case III: \(p^{({\rm III})}\)

Here, we need two variables:

\[t = -\log{\chi_1} -\log{\chi_2}\]

\(p^{({\rm III})}\) is now the folding of \(p^{({\rm II})}\) with itself[1]:

\[p^{({\rm III})} = \int_{-\infty}^{\infty} d\tau e^{-\tau} e^{-(t-\tau)} \Theta(\tau) \Theta(t-\tau) = t e^{-t} \mbox{ for } t > 0\]

Case IV: \(p^{({\rm IV})}\)

Three variables needed:

\[t = -\log{\chi_1} -\log{\chi_2} -\log{\chi_3}\]

\(p^{({\rm IV})}\) is now the folding of \(p^{({\rm II})}\) with \(p^{({\rm III})}\):

\[p^{({\rm IV})} = \int_{ - \infty}^{\infty} d\tau e^{- \tau} \left( t - \tau \right) e^{ - (t - \tau)} \Theta(\tau) \Theta(t - \tau) = \frac{1}{2} t^2 e^{ -t} \mbox{ for } t > 0\]

[1]: This is [the probability to find a \(\tau\)] times [the probability to find the value \(\tau_2 = t-\tau\) that added to \(\tau\) yields \(t\)], integrated over all possible combinations that have that property.

From the beginning

So, the algorithm needs to do all this from the end:

  • Decide which branch \(\tilde p^{({\rm I - IV})}\) to go into
  • Generate \(t\) from the distribution in the respective branches
  • Reject that number with a probability \(1-(1+\exp(-|t|))^{-1}\) (the efficiency of this should be \(\gg \frac{1}{2}\))
  • Shift and rescale \(t\) to \(r = d\cdot t + r_0\)

Reimplemented in smash::CustomNucleus, and smash::DeformedNucleus.

Definition at line 216 of file nucleus.cc.

216  {
217  // Get the solid angle of the nucleon.
218  Angles dir;
219  dir.distribute_isotropically();
220  // diffusiveness_ zero or negative? Use hard sphere.
221  if (almost_equal(diffusiveness_, 0.)) {
222  return dir.threevec() * nuclear_radius_ * std::cbrt(random::canonical());
223  }
224  if (almost_equal(nuclear_radius_, 0.)) {
225  return smash::ThreeVector();
226  }
227  double radius_scaled = nuclear_radius_ / diffusiveness_;
228  double prob_range1 = 1.0;
229  double prob_range2 = 3. / radius_scaled;
230  double prob_range3 = 2. * prob_range2 / radius_scaled;
231  double prob_range4 = 1. * prob_range3 / radius_scaled;
232  double ranges234 = prob_range2 + prob_range3 + prob_range4;
233  double t;
235  do {
236  double which_range = random::uniform(-prob_range1, ranges234);
237  if (which_range < 0.0) {
238  t = radius_scaled * (std::cbrt(random::canonical()) - 1.);
239  } else {
240  t = -std::log(random::canonical());
241  if (which_range >= prob_range2) {
242  t -= std::log(random::canonical());
243  if (which_range >= prob_range2 + prob_range3) {
244  t -= std::log(random::canonical());
245  }
246  }
247  }
255  } while (random::canonical() > 1. / (1. + std::exp(-std::abs(t))));
257  double position_scaled = t + radius_scaled;
258  double position = position_scaled * diffusiveness_;
259  return dir.threevec() * position;
260 }
The ThreeVector class represents a physical three-vector with the components .
Definition: threevector.h:30
bool almost_equal(const N x, const N y)
Checks two numbers for relative approximate equality.
Definition: numerics.h:42
T canonical()
Definition: random.h:113
T uniform(T min, T max)
Definition: random.h:88
double nuclear_radius_
Nuclear radius of this nucleus.
Definition: nucleus.h:199
double diffusiveness_
Diffusiveness of Woods-Saxon distribution of this nucleus in fm (for diffusiveness_ == 0...
Definition: nucleus.h:195

Here is the call graph for this function:

Here is the caller graph for this function:

double smash::Nucleus::woods_saxon ( double  x)

Woods-Saxon distribution.

Parameters
[in]xthe position at which to evaluate the function
Returns
un-normalized Woods-saxon probability

Definition at line 262 of file nucleus.cc.

262  {
263  return r * r / (std::exp((r - nuclear_radius_) / diffusiveness_) + 1);
264 }
double nuclear_radius_
Nuclear radius of this nucleus.
Definition: nucleus.h:199
double diffusiveness_
Diffusiveness of Woods-Saxon distribution of this nucleus in fm (for diffusiveness_ == 0...
Definition: nucleus.h:195
void smash::Nucleus::arrange_nucleons ( )

Sets the positions of the nucleons inside a nucleus.

Definition at line 266 of file nucleus.cc.

266  {
267  for (auto i = begin(); i != end(); i++) {
268  // Initialize momentum
269  i->set_4momentum(i->pole_mass(), 0.0, 0.0, 0.0);
270  /* Sampling the Woods-Saxon, get the radial
271  * position and solid angle for the nucleon. */
272  ThreeVector pos = distribute_nucleon();
273 
274  // Set the position of the nucleon.
275  i->set_4position(FourVector(0.0, pos));
276  }
277 
278  // Recenter and rotate
279  align_center();
280  rotate();
281 }
virtual ThreeVector distribute_nucleon()
The distribution of return values from this function is according to a spherically symmetric Woods-Sa...
Definition: nucleus.cc:216
virtual void rotate()
Rotates the nucleus.
Definition: nucleus.h:137
std::vector< ParticleData >::iterator begin()
For iterators over the particle list:
Definition: nucleus.h:214
void align_center()
Shifts the nucleus so that its center is at (0,0,0)
Definition: nucleus.h:178
std::vector< ParticleData >::iterator end()
For iterators over the particle list:
Definition: nucleus.h:218

Here is the call graph for this function:

void smash::Nucleus::set_parameters_automatic ( )
virtual

Sets the deformation parameters of the Woods-Saxon distribution according to the current mass number.

The values are taken from DeJager:1987qc. They are in agreement with MC-Glauber models such as GLISSANDO (see Rybczynski:2013yba) and TGlauber MC (see Loizides:2017ack)

Definition at line 283 of file nucleus.cc.

283  {
285  switch (A) {
286  case 1: // single particle
287  /* In case of testparticles, an infinite reaction loop will be
288  * avoided by a small finite spread according to a single particles
289  * 'nucleus'. The proper solution will be to introduce parallel
290  * ensembles. */
292  ? 0.
293  : 1. - std::exp(-(testparticles_ - 1.) * 0.1));
294  set_diffusiveness(testparticles_ == 1 ? -1. : 0.02);
295  break;
296  case 238: // Uranium
297  // Default values.
298  set_diffusiveness(0.556);
299  set_nuclear_radius(6.86);
300  set_saturation_density(0.166);
301  break;
302  case 208: // Lead
303  // Default values.
304  set_diffusiveness(0.54);
305  set_nuclear_radius(6.67);
306  set_saturation_density(0.161);
307  break;
308  case 197: // Gold
309  // Default values.
310  set_diffusiveness(0.535);
311  set_nuclear_radius(6.38);
312  set_saturation_density(0.1695);
313  break;
314  case 63: // Copper
315  // Default values.
316  set_diffusiveness(0.5977);
317  set_nuclear_radius(4.20641);
318  set_saturation_density(0.1686);
319  break;
320  default:
321  if (A <= 16) {
322  // radius: rough guess for all nuclei not listed explicitly with A <= 16
323  // saturation density already has reasonable default
324  set_nuclear_radius(1.2 * std::cbrt(A));
325  set_diffusiveness(0.545);
326  } else {
327  // radius and diffusiveness taken from \iref{Rybczynski:2013yba}
328  set_diffusiveness(0.54);
329  set_nuclear_radius(1.12 * std::pow(A, 1.0 / 3.0) -
330  0.86 * std::pow(A, -1.0 / 3.0));
331  }
332  }
333 }
void set_diffusiveness(double diffuse)
Sets the diffusiveness of the nucleus.
Definition: nucleus.h:231
void set_nuclear_radius(double rad)
Sets the nuclear radius.
Definition: nucleus.h:261
void set_saturation_density(double density)
Sets the saturation density of the nucleus.
Definition: nucleus.h:241
size_t number_of_particles() const
Number of physical particles in the nucleus:
Definition: nucleus.h:155
size_t testparticles_
Number of testparticles per physical particle.
Definition: nucleus.h:206

Here is the call graph for this function:

Here is the caller graph for this function:

void smash::Nucleus::set_parameters_from_config ( Configuration config)
virtual

Sets the parameters of the Woods-Saxon according to manually added values in the configuration file.

Parameters
configThe configuration for this nucleus (projectile or target).

Definition at line 335 of file nucleus.cc.

335  {
336  set_diffusiveness(static_cast<double>(config.take({"Diffusiveness"})));
337  set_nuclear_radius(static_cast<double>(config.take({"Radius"})));
338  // Saturation density (normalization for accept/reject sampling)
340  static_cast<double>(config.take({"Saturation_Density"})));
341 }
void set_diffusiveness(double diffuse)
Sets the diffusiveness of the nucleus.
Definition: nucleus.h:231
void set_nuclear_radius(double rad)
Sets the nuclear radius.
Definition: nucleus.h:261
void set_saturation_density(double density)
Sets the saturation density of the nucleus.
Definition: nucleus.h:241

Here is the call graph for this function:

Here is the caller graph for this function:

void smash::Nucleus::generate_fermi_momenta ( )
virtual

Generates momenta according to Fermi motion for the nucleons.

For neutrons and protons Fermi momenta are calculated as \( p_{F} = (3 \pi^2 \rho)^{1/3}\), where \( rho \) is neutron density for neutrons and proton density for protons. The actual momenta \(p_x\), \(p_y\), \(p_z\) are uniformly distributed in the sphere with radius \(p_F\).

Reimplemented in smash::DeformedNucleus.

Definition at line 343 of file nucleus.cc.

343  {
344  const int N_n = std::count_if(begin(), end(), [](const ParticleData i) {
345  return i.pdgcode() == pdg::n;
346  });
347  const int N_p = std::count_if(begin(), end(), [](const ParticleData i) {
348  return i.pdgcode() == pdg::p;
349  });
350  const FourVector nucleus_center = center();
351  const int A = N_n + N_p;
352  constexpr double pi2_3 = 3.0 * M_PI * M_PI;
353  const auto &log = logger<LogArea::Nucleus>();
354 
355  log.debug() << N_n << " neutrons, " << N_p << " protons.";
356 
357  ThreeVector ptot = ThreeVector(0.0, 0.0, 0.0);
358  for (auto i = begin(); i != end(); i++) {
359  // Only protons and neutrons get Fermi momenta
360  if (i->pdgcode() != pdg::p && i->pdgcode() != pdg::n) {
361  if (i->is_baryon()) {
362  log.warn() << "No rule to calculate Fermi momentum "
363  << "for particle " << i->pdgcode();
364  }
365  continue;
366  }
367  const double r = (i->position() - nucleus_center).abs3();
368  double rho = nuclear_density /
369  (std::exp((r - nuclear_radius_) / diffusiveness_) + 1.);
370  if (i->pdgcode() == pdg::p) {
371  rho = rho * N_p / A;
372  }
373  if (i->pdgcode() == pdg::n) {
374  rho = rho * N_n / A;
375  }
376  const double p =
377  hbarc * std::pow(pi2_3 * rho * random::uniform(0.0, 1.0), 1.0 / 3.0);
378  Angles phitheta;
379  phitheta.distribute_isotropically();
380  const ThreeVector ith_3momentum = phitheta.threevec() * p;
381  ptot += ith_3momentum;
382  i->set_3momentum(ith_3momentum);
383  log.debug() << "Particle: " << *i
384  << ", pF[GeV]: " << hbarc * std::pow(pi2_3 * rho, 1.0 / 3.0)
385  << " r[fm]: " << r
386  << " Nuclear radius[fm]: " << nuclear_radius_;
387  }
388  if (A == 0) {
389  // No Fermi momenta should be assigned
390  assert(ptot.x1() == 0.0 && ptot.x2() == 0.0 && ptot.x3() == 0.0);
391  } else {
392  /* Ensure zero total momentum of nucleus - redistribute ptot equally
393  * among protons and neutrons */
394  const ThreeVector centralizer = ptot / A;
395  for (auto i = begin(); i != end(); i++) {
396  if (i->pdgcode() == pdg::p || i->pdgcode() == pdg::n) {
397  i->set_4momentum(i->pole_mass(),
398  i->momentum().threevec() - centralizer);
399  }
400  }
401  }
402 }
FourVector center() const
Calculate geometrical center of the nucleus.
Definition: nucleus.cc:466
constexpr double hbarc
GeV <-> fm conversion factor.
Definition: constants.h:25
T uniform(T min, T max)
Definition: random.h:88
double nuclear_radius_
Nuclear radius of this nucleus.
Definition: nucleus.h:199
double diffusiveness_
Diffusiveness of Woods-Saxon distribution of this nucleus in fm (for diffusiveness_ == 0...
Definition: nucleus.h:195
constexpr int p
Proton.
constexpr double nuclear_density
Ground state density of symmetric nuclear matter [fm^-3].
Definition: constants.h:42
std::vector< ParticleData >::iterator begin()
For iterators over the particle list:
Definition: nucleus.h:214
constexpr int n
Neutron.
std::vector< ParticleData >::iterator end()
For iterators over the particle list:
Definition: nucleus.h:218

Here is the call graph for this function:

void smash::Nucleus::boost ( double  beta_scalar)

Boosts the nuclei into the computational frame, such that the nucleons have the appropriate momentum and the nuclei are lorentz-contracted.

Note that the usual boost cannot be applied for nuclei, since the particles would end up with different times and the binding energy needs to be taken into account.

Parameters
[in]beta_scalarvelocity in z-direction used for boost.

Definition at line 404 of file nucleus.cc.

404  {
405  double beta_squared = beta_scalar * beta_scalar;
406  double one_over_gamma = std::sqrt(1.0 - beta_squared);
407  double gamma = 1.0 / one_over_gamma;
408  /* We are talking about a /passive/ lorentz transformation here, as
409  * far as I can see, so we need to boost in the direction opposite to
410  * where we want to go
411  * ( The vector we transform - p - stays unchanged, but we go into
412  * a system that moves with -beta. Now in this frame, it seems
413  * like p has been accelerated with +beta.
414  * ) */
415  for (auto i = begin(); i != end(); i++) {
416  /* a real Lorentz Transformation would leave the particles at
417  * different times here, which we would then have to propagate back
418  * to equal times. Since we know the result, we can simply multiply
419  * the z-value with 1/gamma. */
420  FourVector this_position = i->position();
421  this_position.set_x3(this_position.x3() * one_over_gamma);
422  i->set_4position(this_position);
423  /* The simple Lorentz transformation of momenta does not take into account
424  * that nucleus has binding energy. Here we apply the method used
425  * in the JAM code \iref{Nara:1999dz}: p' = p_beam + gamma*p_F.
426  * This formula is derived under assumption that all nucleons have
427  * the same binding energy. */
428  FourVector mom_i = i->momentum();
429  i->set_4momentum(i->pole_mass(), mom_i.x1(), mom_i.x2(),
430  gamma * (beta_scalar * mom_i.x0() + mom_i.x3()));
431  }
432 }
std::vector< ParticleData >::iterator begin()
For iterators over the particle list:
Definition: nucleus.h:214
std::vector< ParticleData >::iterator end()
For iterators over the particle list:
Definition: nucleus.h:218

Here is the call graph for this function:

void smash::Nucleus::fill_from_list ( const std::map< PdgCode, int > &  particle_list,
int  testparticles 
)

Adds particles from a map PDG code => Number_of_particles_with_that_PDG_code to the nucleus.

E.g., the map [2212: 6, 2112: 7] initializes C-13 (6 protons and 7 neutrons). The particles are only created, no position or momenta are yet assigned. It is also possible to use any other PDG code, in addition to nucleons.

Parameters
[out]particle_listThe particle slots that are created.
[in]testparticlesNumber of test particles to use.

Definition at line 434 of file nucleus.cc.

435  {
436  testparticles_ = testparticles;
437  for (auto n = particle_list.cbegin(); n != particle_list.cend(); ++n) {
438  const ParticleType &current_type = ParticleType::find(n->first);
439  double current_mass = current_type.mass();
440  for (unsigned int i = 0; i < n->second * testparticles_; i++) {
441  // append particle to list and set its PDG code.
442  particles_.emplace_back(current_type);
443  particles_.back().set_4momentum(current_mass, 0.0, 0.0, 0.0);
444  }
445  }
446 }
static const ParticleType & find(PdgCode pdgcode)
Returns the ParticleType object for the given pdgcode.
std::vector< ParticleData > particles_
Particles associated with this nucleus.
Definition: nucleus.h:210
constexpr int n
Neutron.
size_t testparticles_
Number of testparticles per physical particle.
Definition: nucleus.h:206

Here is the call graph for this function:

Here is the caller graph for this function:

void smash::Nucleus::shift ( double  z_offset,
double  x_offset,
double  simulation_time 
)

Shifts the nucleus to correct impact parameter and z displacement.

Parameters
[in]z_offsetis the shift in z-direction
[in]x_offsetis the shift in x-direction
[in]simulation_timeset the time and formation_time of each particle to this value.

Definition at line 448 of file nucleus.cc.

448  {
449  // Move the nucleus in z and x directions, and set the time.
450  for (auto i = begin(); i != end(); i++) {
451  FourVector this_position = i->position();
452  this_position.set_x3(this_position.x3() + z_offset);
453  this_position.set_x1(this_position.x1() + x_offset);
454  this_position.set_x0(simulation_time);
455  i->set_4position(this_position);
456  i->set_formation_time(simulation_time);
457  }
458 }
std::vector< ParticleData >::iterator begin()
For iterators over the particle list:
Definition: nucleus.h:214
std::vector< ParticleData >::iterator end()
For iterators over the particle list:
Definition: nucleus.h:218

Here is the call graph for this function:

virtual void smash::Nucleus::rotate ( )
inlinevirtual

Rotates the nucleus.

(Due to spherical symmetry of nondeformed nuclei, there is nothing to do.)

Reimplemented in smash::DeformedNucleus.

Definition at line 137 of file nucleus.h.

137 {}

Here is the call graph for this function:

Here is the caller graph for this function:

void smash::Nucleus::copy_particles ( Particles particles)

Copies the particles from this nucleus into the particle list.

Parameters
[out]particlesParticle list with all constituents of a nucleus

Definition at line 460 of file nucleus.cc.

460  {
461  for (auto p = begin(); p != end(); p++) {
462  external_particles->insert(*p);
463  }
464 }
constexpr int p
Proton.
std::vector< ParticleData >::iterator begin()
For iterators over the particle list:
Definition: nucleus.h:214
std::vector< ParticleData >::iterator end()
For iterators over the particle list:
Definition: nucleus.h:218

Here is the call graph for this function:

Here is the caller graph for this function:

size_t smash::Nucleus::size ( ) const
inline

Number of numerical (=test-)particles in the nucleus:

Definition at line 147 of file nucleus.h.

147 { return particles_.size(); }
std::vector< ParticleData > particles_
Particles associated with this nucleus.
Definition: nucleus.h:210

Here is the caller graph for this function:

size_t smash::Nucleus::number_of_particles ( ) const
inline

Number of physical particles in the nucleus:

Exceptions
TestparticleConfusionif the number of the nucleons is not a multiple of testparticles_.

Definition at line 155 of file nucleus.h.

155  {
156  size_t nop = particles_.size() / testparticles_;
157  /* if size() is not a multiple of testparticles_, this will throw an
158  * error. */
159  if (nop * testparticles_ != particles_.size()) {
160  throw TestparticleConfusion(
161  "Number of test particles and test particles"
162  "per particle are incompatible");
163  }
164  return nop;
165  }
std::vector< ParticleData > particles_
Particles associated with this nucleus.
Definition: nucleus.h:210
size_t testparticles_
Number of testparticles per physical particle.
Definition: nucleus.h:206

Here is the call graph for this function:

Here is the caller graph for this function:

FourVector smash::Nucleus::center ( ) const

Calculate geometrical center of the nucleus.

Returns
\(\vec r_s = \frac{1}{N} \sum_{i=1}^N \vec r_i\) (for a nucleus with N particles that are at the positions \(\vec r_i\)).

Definition at line 466 of file nucleus.cc.

466  {
467  FourVector centerpoint(0.0, 0.0, 0.0, 0.0);
468  for (auto p = cbegin(); p != cend(); p++) {
469  centerpoint += p->position();
470  }
471  centerpoint /= size();
472  return centerpoint;
473 }
std::vector< ParticleData >::const_iterator cbegin() const
For const iterators over the particle list:
Definition: nucleus.h:220
size_t size() const
Number of numerical (=test-)particles in the nucleus:
Definition: nucleus.h:147
std::vector< ParticleData >::const_iterator cend() const
For const iterators over the particle list:
Definition: nucleus.h:224
constexpr int p
Proton.

Here is the call graph for this function:

Here is the caller graph for this function:

void smash::Nucleus::align_center ( )
inline

Shifts the nucleus so that its center is at (0,0,0)

See also
center()

Definition at line 178 of file nucleus.h.

178  {
179  FourVector centerpoint = center();
180  for (auto p = particles_.begin(); p != particles_.end(); ++p) {
181  p->set_4position(p->position() - centerpoint);
182  }
183  }
FourVector center() const
Calculate geometrical center of the nucleus.
Definition: nucleus.cc:466
constexpr int p
Proton.
std::vector< ParticleData > particles_
Particles associated with this nucleus.
Definition: nucleus.h:210

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector<ParticleData>::iterator smash::Nucleus::begin ( )
inline

For iterators over the particle list:

Definition at line 214 of file nucleus.h.

214  {
215  return particles_.begin();
216  }
std::vector< ParticleData > particles_
Particles associated with this nucleus.
Definition: nucleus.h:210

Here is the caller graph for this function:

std::vector<ParticleData>::iterator smash::Nucleus::end ( )
inline

For iterators over the particle list:

Definition at line 218 of file nucleus.h.

218 { return particles_.end(); }
std::vector< ParticleData > particles_
Particles associated with this nucleus.
Definition: nucleus.h:210

Here is the caller graph for this function:

std::vector<ParticleData>::const_iterator smash::Nucleus::cbegin ( ) const
inline

For const iterators over the particle list:

Definition at line 220 of file nucleus.h.

220  {
221  return particles_.cbegin();
222  }
std::vector< ParticleData > particles_
Particles associated with this nucleus.
Definition: nucleus.h:210

Here is the caller graph for this function:

std::vector<ParticleData>::const_iterator smash::Nucleus::cend ( ) const
inline

For const iterators over the particle list:

Definition at line 224 of file nucleus.h.

224  {
225  return particles_.cend();
226  }
std::vector< ParticleData > particles_
Particles associated with this nucleus.
Definition: nucleus.h:210

Here is the caller graph for this function:

void smash::Nucleus::set_diffusiveness ( double  diffuse)
inline

Sets the diffusiveness of the nucleus.

See also
diffusiveness_

Definition at line 231 of file nucleus.h.

231 { diffusiveness_ = diffuse; }
double diffusiveness_
Diffusiveness of Woods-Saxon distribution of this nucleus in fm (for diffusiveness_ == 0...
Definition: nucleus.h:195

Here is the caller graph for this function:

double smash::Nucleus::get_diffusiveness ( ) const
inline
Returns
the diffusiveness of the nucleus
See also
diffusiveness_

Definition at line 236 of file nucleus.h.

236 { return diffusiveness_; }
double diffusiveness_
Diffusiveness of Woods-Saxon distribution of this nucleus in fm (for diffusiveness_ == 0...
Definition: nucleus.h:195

Here is the caller graph for this function:

void smash::Nucleus::set_saturation_density ( double  density)
inline

Sets the saturation density of the nucleus.

See also
saturation_density_

Definition at line 241 of file nucleus.h.

241  {
242  saturation_density_ = density;
243  }
double saturation_density_
Saturation density of this nucleus.
Definition: nucleus.h:197

Here is the caller graph for this function:

double smash::Nucleus::get_saturation_density ( ) const
inline
Returns
the saturation density of the nucleus
See also
saturation_density_

Definition at line 248 of file nucleus.h.

248 { return saturation_density_; }
double saturation_density_
Saturation density of this nucleus.
Definition: nucleus.h:197

Here is the caller graph for this function:

double smash::Nucleus::default_nuclear_radius ( )
inline
Returns
a default radius for the nucleus Nuclear radius is calculated with the proton radius times the third root of the number of nucleons.

Definition at line 254 of file nucleus.h.

254  {
255  return proton_radius_ * std::pow(number_of_particles(), 1. / 3.);
256  }
double proton_radius_
Single proton radius in fm.
Definition: nucleus.h:204
size_t number_of_particles() const
Number of physical particles in the nucleus:
Definition: nucleus.h:155

Here is the call graph for this function:

void smash::Nucleus::set_nuclear_radius ( double  rad)
inline

Sets the nuclear radius.

See also
nuclear_radius

Definition at line 261 of file nucleus.h.

261 { nuclear_radius_ = rad; }
double nuclear_radius_
Nuclear radius of this nucleus.
Definition: nucleus.h:199

Here is the caller graph for this function:

double smash::Nucleus::get_nuclear_radius ( ) const
inline
Returns
the nuclear radius
See also
nuclear_radius

Definition at line 266 of file nucleus.h.

266 { return nuclear_radius_; }
double nuclear_radius_
Nuclear radius of this nucleus.
Definition: nucleus.h:199

Here is the caller graph for this function:

Member Data Documentation

double smash::Nucleus::diffusiveness_
private

Diffusiveness of Woods-Saxon distribution of this nucleus in fm (for diffusiveness_ == 0, we obtain a hard sphere).

Definition at line 195 of file nucleus.h.

double smash::Nucleus::saturation_density_ = nuclear_density
private

Saturation density of this nucleus.

Definition at line 197 of file nucleus.h.

double smash::Nucleus::nuclear_radius_
private

Nuclear radius of this nucleus.

Definition at line 199 of file nucleus.h.

double smash::Nucleus::proton_radius_ = 1.2
private

Single proton radius in fm.

See also
default_nuclear_radius

Definition at line 204 of file nucleus.h.

size_t smash::Nucleus::testparticles_ = 1
private

Number of testparticles per physical particle.

Definition at line 206 of file nucleus.h.

std::vector<ParticleData> smash::Nucleus::particles_
protected

Particles associated with this nucleus.

Definition at line 210 of file nucleus.h.


The documentation for this class was generated from the following files: