#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.
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) | |
Constructor which directly initializes the Nucleus with particles and respective counts. More... | |
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... | |
virtual 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... | |
size_t | number_of_protons () const |
Number of physical protons in the nucleus: More... | |
FourVector | center () const |
Calculate geometrical center of the nucleus. More... | |
void | set_label (BelongsTo label) |
Sets target / projectile labels on nucleons. More... | |
void | align_center () |
Shifts the nucleus so that its center is at (0,0,0) More... | |
virtual double | nucleon_density (double r, double, double) const |
Return the Woods-Saxon probability density for the given position. More... | |
virtual double | nucleon_density_unnormalized (double r, double, double) const |
Return the unnormalized Woods-Saxon distribution for the given position without deformation. More... | |
virtual double | calculate_saturation_density () const |
virtual void | set_saturation_density (double density) |
Sets the saturation density of the nucleus. 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 |
double | get_saturation_density () const |
double | default_nuclear_radius () |
Default nuclear radius calculated as: More... | |
void | set_nuclear_radius (double rad) |
Sets the nuclear radius. More... | |
double | get_nuclear_radius () const |
Protected Member Functions | |
void | random_euler_angles () |
Randomly generate Euler angles. More... | |
Protected Attributes | |
std::vector< ParticleData > | particles_ |
Particles associated with this nucleus. More... | |
double | saturation_density_ = nuclear_density |
Saturation density of this nucleus. More... | |
double | euler_phi_ |
Euler angel phi. More... | |
double | euler_theta_ |
Euler angel theta. More... | |
double | euler_psi_ |
Euler angel psi. 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 | 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... | |
|
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.
[in] | config | contains the parameters from the inputfile on the numbers of particles with a certain PDG code |
[in] | nTest | number of testparticles |
Definition at line 31 of file nucleus.cc.
smash::Nucleus::Nucleus | ( | const std::map< PdgCode, int > & | particle_list, |
int | nTest | ||
) |
Constructor which directly initializes the Nucleus with particles and respective counts.
Only used for testing.
[in] | particle_list | std::map, which maps PdgCode and count of this particle. |
[in] | nTest | Number of test particles. |
Definition at line 25 of file nucleus.cc.
|
virtualdefault |
double smash::Nucleus::mass | ( | ) | const |
Definition at line 55 of file nucleus.cc.
|
virtual |
The distribution of return values from this function is according to a spherically symmetric Woods-Saxon distribution suitable for this nucleus.
\(\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_.
Nucleons in nuclei are distributed according to a Woods-Saxon-distribution (see Woods:1954zz [62])
\[\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}.\]
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).
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.
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\]
Again, from one only:
\[t = -\log(\chi)\]
\[p(t) = \frac{d\chi}{dt}\]
\[p^{({\rm II})} = e^{-t} \mbox{ for } t > 0\]
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\]
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.
So, the algorithm needs to do all this from the end:
Reimplemented in smash::DeformedNucleus, and smash::CustomNucleus.
Definition at line 215 of file nucleus.cc.
double smash::Nucleus::woods_saxon | ( | double | x | ) |
Woods-Saxon distribution.
[in] | x | the position at which to evaluate the function |
Definition at line 261 of file nucleus.cc.
|
virtual |
Sets the positions of the nucleons inside a nucleus.
Reimplemented in smash::CustomNucleus.
Definition at line 265 of file nucleus.cc.
|
virtual |
Sets the deformation parameters of the Woods-Saxon distribution according to the current mass number.
The values are taken from DeVries:1987atn [19] and Loizides:2014vua [35]. They are in agreement with MC-Glauber models such as GLISSANDO (see Rybczynski:2013yba [46]) and TGlauber MC (see Loizides:2017ack [36]).
Definition at line 282 of file nucleus.cc.
|
virtual |
Sets the parameters of the Woods-Saxon according to manually added values in the configuration file.
config | The configuration for this nucleus (projectile or target). |
Definition at line 340 of file nucleus.cc.
|
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::CustomNucleus.
Definition at line 348 of file nucleus.cc.
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.
[in] | beta_scalar | velocity in z-direction used for boost. |
Definition at line 409 of file nucleus.cc.
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.
[out] | particle_list | The particle slots that are created. |
[in] | testparticles | Number of test particles to use. |
Definition at line 439 of file nucleus.cc.
void smash::Nucleus::shift | ( | double | z_offset, |
double | x_offset, | ||
double | simulation_time | ||
) |
Shifts the nucleus to correct impact parameter and z displacement.
[in] | z_offset | is the shift in z-direction |
[in] | x_offset | is the shift in x-direction |
[in] | simulation_time | set the time and formation_time of each particle to this value. |
Definition at line 453 of file nucleus.cc.
|
inlinevirtual |
Rotates the nucleus.
(Due to spherical symmetry of nondeformed nuclei, there is nothing to do.)
Reimplemented in smash::DeformedNucleus.
void smash::Nucleus::copy_particles | ( | Particles * | particles | ) |
|
inline |
|
inline |
Number of physical particles in the nucleus:
TestparticleConfusion | if the number of the nucleons is not a multiple of testparticles_. |
Definition at line 165 of file nucleus.h.
|
inline |
FourVector smash::Nucleus::center | ( | ) | const |
Calculate geometrical center of the nucleus.
Definition at line 471 of file nucleus.cc.
|
inline |
Sets target / projectile labels on nucleons.
|
inline |
|
virtual |
Return the Woods-Saxon probability density for the given position.
This corresponds to the nuclear density at the very same position.
[in] | r | The radius at which to sample |
Reimplemented in smash::DeformedNucleus.
Definition at line 487 of file nucleus.cc.
|
virtual |
Return the unnormalized Woods-Saxon distribution for the given position without deformation.
[in] | r | The radius |
Reimplemented in smash::DeformedNucleus.
Definition at line 492 of file nucleus.cc.
|
virtual |
Reimplemented in smash::DeformedNucleus.
Definition at line 496 of file nucleus.cc.
|
inlinevirtual |
Sets the saturation density of the nucleus.
Definition at line 261 of file nucleus.h.
|
protected |
Randomly generate Euler angles.
Necessary for rotation of deformed and custom nuclei, whenever a new nucleus of this kind is initialized.
Definition at line 480 of file nucleus.cc.
|
inline |
For iterators over the particle list:
|
inline |
|
inline |
For const iterators over the particle list:
|
inline |
For const iterators over the particle list:
|
inline |
Sets the diffusiveness of the nucleus.
Definition at line 326 of file nucleus.h.
|
inline |
Definition at line 331 of file nucleus.h.
|
inline |
Definition at line 336 of file nucleus.h.
|
inline |
Default nuclear radius calculated as:
Definition at line 344 of file nucleus.h.
|
inline |
|
inline |
|
private |
|
private |
|
private |
Single proton radius in fm.
|
private |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |