23 static constexpr
int LNucleus = LogArea::Nucleus::id;
33 std::map<PdgCode, int> part = config.
take({
"Particles"});
37 config.
has_value({
"Saturation_Density"})) {
39 }
else if (!config.
has_value({
"Diffusiveness"}) &&
41 !config.
has_value({
"Saturation_Density"})) {
45 throw std::invalid_argument(
46 "Diffusiveness, Radius and Saturation_Density "
47 "required to manually configure the Woods-Saxon"
48 " distribution. Only one/two were provided. \n"
49 "Providing none of the above mentioned "
50 "parameters automatically configures the "
51 "distribution based on the atomic number.");
56 double total_mass = 0.;
58 total_mass += i->momentum().abs();
227 double prob_range1 = 1.0;
228 double prob_range2 = 3. / radius_scaled;
229 double prob_range3 = 2. * prob_range2 / radius_scaled;
230 double prob_range4 = 1. * prob_range3 / radius_scaled;
231 double ranges234 = prob_range2 + prob_range3 + prob_range4;
236 if (which_range < 0.0) {
240 if (which_range >= prob_range2) {
242 if (which_range >= prob_range2 + prob_range3) {
256 double position_scaled = t + radius_scaled;
266 for (
auto i =
begin(); i !=
end(); i++) {
268 i->set_4momentum(i->pole_mass(), 0.0, 0.0, 0.0);
293 }
else if ((A == 238) && (Z == 92)) {
297 }
else if ((A == 208) && (Z == 82)) {
301 }
else if ((A == 197) && (Z == 79)) {
305 }
else if ((A == 129) && (Z == 54)) {
309 }
else if ((A == 63) && (Z == 29)) {
313 }
else if (A == 96) {
318 }
else if (Z == 44) {
326 0.86 * std::pow(A, -1.0 / 3.0));
345 static_cast<double>(config.
take({
"Saturation_Density"})));
356 const int A = N_n + N_p;
357 constexpr
double pi2_3 = 3.0 * M_PI * M_PI;
358 logg[
LNucleus].debug() << N_n <<
" neutrons, " << N_p <<
" protons.";
361 for (
auto i =
begin(); i !=
end(); i++) {
365 logg[
LNucleus].warn() <<
"No rule to calculate Fermi momentum "
366 <<
"for particle " << i->
pdgcode();
370 const double r = (i->
position() - nucleus_center).abs3();
386 ptot += ith_3momentum;
388 logg[
LNucleus].debug() <<
"Particle: " << *i <<
", pF[GeV]: "
389 <<
hbarc * std::pow(pi2_3 * rho, 1.0 / 3.0)
395 assert(ptot.
x1() == 0.0 && ptot.
x2() == 0.0 && ptot.
x3() == 0.0);
400 for (
auto i =
begin(); i !=
end(); i++) {
410 double beta_squared = beta_scalar * beta_scalar;
411 double one_over_gamma = std::sqrt(1.0 - beta_squared);
412 double gamma = 1.0 / one_over_gamma;
420 for (
auto i =
begin(); i !=
end(); i++) {
426 this_position.
set_x3(this_position.
x3() * one_over_gamma);
427 i->set_4position(this_position);
434 i->set_4momentum(i->pole_mass(), mom_i.
x1(), mom_i.
x2(),
435 gamma * (beta_scalar * mom_i.
x0() + mom_i.
x3()));
442 for (
auto n = particle_list.cbegin();
n != particle_list.cend(); ++
n) {
444 double current_mass = current_type.
mass();
448 particles_.back().set_4momentum(current_mass, 0.0, 0.0, 0.0);
455 for (
auto i =
begin(); i !=
end(); i++) {
457 this_position.
set_x3(this_position.
x3() + z_offset);
458 this_position.
set_x1(this_position.
x1() + x_offset);
459 this_position.
set_x0(simulation_time);
460 i->set_4position(this_position);
461 i->set_formation_time(simulation_time);
467 external_particles->
insert(*
p);
474 centerpoint +=
p->position();
476 centerpoint /=
size();
503 const auto result =
integrate(0.01, 1, -1, 1, [&](
double t,
double cosx) {
504 const double r = (1 - t) / t;
505 return twopi * std::pow(r, 2.0) *
513 return out <<
" #particles #testparticles mass [GeV] "
514 "radius [fm] diffusiveness [fm]\n"
515 <<
format(
n.number_of_particles(),
nullptr, 12)
517 <<
format(
n.get_nuclear_radius(),
nullptr, 14)
518 <<
format(
n.get_diffusiveness(),
nullptr, 20);
Angles provides a common interface for generating directions: i.e., two angles that should be interpr...
ThreeVector threevec() const
void distribute_isotropically()
Populate the object with a new direction.
Interface to the SMASH configuration files.
bool has_value(std::initializer_list< const char * > keys) const
Return whether there is a non-empty value behind the requested keys.
Value take(std::initializer_list< const char * > keys)
The default interface for SMASH to read configuration values.
The FourVector class holds relevant values in Minkowski spacetime with (+, −, −, −) metric signature.
ThreeVector threevec() const
A C++ interface for numerical integration in two dimensions with the Cuba Cuhre integration function.
A nucleus is a collection of particles that are initialized, before the beginning of the simulation a...
Nucleus()=default
default constructor
double euler_theta_
Euler angel theta.
std::vector< ParticleData >::const_iterator cbegin() const
For const iterators over the particle list:
virtual double nucleon_density_unnormalized(double r, double, double) const
Return the unnormalized Woods-Saxon distribution for the given position without deformation.
void shift(double z_offset, double x_offset, double simulation_time)
Shifts the nucleus to correct impact parameter and z displacement.
double get_saturation_density() const
double woods_saxon(double x)
Woods-Saxon distribution.
void random_euler_angles()
Randomly generate Euler angles.
virtual void arrange_nucleons()
Sets the positions of the nucleons inside a nucleus.
virtual double calculate_saturation_density() const
virtual void rotate()
Rotates the nucleus.
double default_nuclear_radius()
Default nuclear radius calculated as:
double diffusiveness_
Diffusiveness of Woods-Saxon distribution of this nucleus in fm (for diffusiveness_ == 0,...
FourVector center() const
Calculate geometrical center of the nucleus.
virtual void generate_fermi_momenta()
Generates momenta according to Fermi motion for the nucleons.
virtual void set_parameters_automatic()
Sets the deformation parameters of the Woods-Saxon distribution according to the current mass number.
std::vector< ParticleData >::const_iterator cend() const
For const iterators over the particle list:
virtual void set_parameters_from_config(Configuration &config)
Sets the parameters of the Woods-Saxon according to manually added values in the configuration file.
size_t size() const
Number of numerical (=test-)particles in the nucleus:
size_t testparticles_
Number of testparticles per physical particle.
virtual double nucleon_density(double r, double, double) const
Return the Woods-Saxon probability density for the given position.
double euler_phi_
Euler angel phi.
double nuclear_radius_
Nuclear radius of this nucleus.
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.
std::vector< ParticleData > particles_
Particles associated with this nucleus.
double euler_psi_
Euler angel psi.
void align_center()
Shifts the nucleus so that its center is at (0,0,0)
void copy_particles(Particles *particles)
Copies the particles from this nucleus into the particle list.
virtual void set_saturation_density(double density)
Sets the saturation density of the nucleus.
void set_nuclear_radius(double rad)
Sets the nuclear radius.
void set_diffusiveness(double diffuse)
Sets the diffusiveness of the nucleus.
std::vector< ParticleData >::iterator begin()
For iterators over the particle list:
size_t number_of_protons() const
Number of physical protons in the nucleus:
void boost(double beta_scalar)
Boosts the nuclei into the computational frame, such that the nucleons have the appropriate momentum ...
virtual ThreeVector distribute_nucleon()
The distribution of return values from this function is according to a spherically symmetric Woods-Sa...
size_t number_of_particles() const
Number of physical particles in the nucleus:
std::vector< ParticleData >::iterator end()
For iterators over the particle list:
ParticleData contains the dynamic information of a certain particle.
PdgCode pdgcode() const
Get the pdgcode of the particle.
void set_4momentum(const FourVector &momentum_vector)
Set the particle's 4-momentum directly.
const FourVector & momentum() const
Get the particle's 4-momentum.
double pole_mass() const
Get the particle's pole mass ("on-shell").
void set_3momentum(const ThreeVector &mom)
Set the momentum of the particle without modifying the energy.
const FourVector & position() const
Get the particle's position in Minkowski space.
Particle type contains the static properties of a particle species.
static const ParticleType & find(PdgCode pdgcode)
Returns the ParticleType object for the given pdgcode.
The Particles class abstracts the storage and manipulation of particles.
const ParticleData & insert(const ParticleData &p)
Inserts the particle into the list of particles.
The ThreeVector class represents a physical three-vector with the components .
Collection of useful constants that are known at compile time.
std::ostream & operator<<(std::ostream &out, const ActionPtr &action)
Convenience: dereferences the ActionPtr to Action.
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > logg
An array that stores all pre-configured Logger objects.
FormattingHelper< T > format(const T &value, const char *unit, int width=-1, int precision=-1)
Acts as a stream modifier for std::ostream to output an object with an optional suffix string and wit...
static Integrator integrate
constexpr double hbarc
GeV <-> fm conversion factor.
static constexpr int LNucleus
bool almost_equal(const N x, const N y)
Checks two numbers for relative approximate equality.