34 std::map<PdgCode, int> part = config.
take({
"Particles"});
38 config.
has_value({
"Saturation_Density"})) {
40 }
else if (!config.
has_value({
"Diffusiveness"}) &&
42 !config.
has_value({
"Saturation_Density"})) {
45 throw std::invalid_argument(
46 "Diffussiveness, 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);
329 0.86 * pow(A, -1.0 / 3.0));
339 static_cast<double>(config.
take({
"Saturation_Density"})));
350 const int A = N_n + N_p;
351 constexpr
double pi2_3 = 3.0 * M_PI * M_PI;
352 const auto &log = logger<LogArea::Nucleus>();
354 log.debug() << N_n <<
" neutrons, " << N_p <<
" protons.";
357 for (
auto i =
begin(); i !=
end(); i++) {
361 log.warn() <<
"No rule to calculate Fermi momentum " 362 <<
"for particle " << i->
pdgcode();
366 const double r = (i->
position() - nucleus_center).abs3();
380 ptot += ith_3momentum;
382 log.debug() <<
"Particle: " << *i
383 <<
", pF[GeV]: " <<
hbarc * std::pow(pi2_3 * rho, 1.0 / 3.0)
389 assert(ptot.
x1() == 0.0 && ptot.
x2() == 0.0 && ptot.
x3() == 0.0);
394 for (
auto i =
begin(); i !=
end(); i++) {
404 double beta_squared = beta_scalar * beta_scalar;
405 double one_over_gamma = std::sqrt(1.0 - beta_squared);
406 double gamma = 1.0 / one_over_gamma;
414 for (
auto i =
begin(); i !=
end(); i++) {
420 this_position.
set_x3(this_position.
x3() * one_over_gamma);
421 i->set_4position(this_position);
428 i->set_4momentum(i->pole_mass(), mom_i.
x1(), mom_i.
x2(),
429 gamma * (beta_scalar * mom_i.
x0() + mom_i.
x3()));
436 for (
auto n = particle_list.cbegin();
n != particle_list.cend(); ++
n) {
438 double current_mass = current_type.
mass();
442 particles_.back().set_4momentum(current_mass, 0.0, 0.0, 0.0);
449 for (
auto i =
begin(); i !=
end(); i++) {
451 this_position.
set_x3(this_position.
x3() + z_offset);
452 this_position.
set_x1(this_position.
x1() + x_offset);
453 this_position.
set_x0(simulation_time);
454 i->set_4position(this_position);
455 i->set_formation_time(simulation_time);
461 external_particles->
insert(*
p);
468 centerpoint +=
p->position();
470 centerpoint /=
size();
475 return out <<
" #particles #testparticles mass [GeV] " 476 "radius [fm] diffusiveness [fm]\n" 477 <<
format(
n.number_of_particles(),
nullptr, 12)
479 <<
format(
n.get_nuclear_radius(),
nullptr, 14)
480 <<
format(
n.get_diffusiveness(),
nullptr, 20);
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...
size_t size() const
Number of numerical (=test-)particles in the nucleus:
void set_diffusiveness(double diffuse)
Sets the diffusiveness of the nucleus.
The ThreeVector class represents a physical three-vector with the components .
void shift(double z_offset, double x_offset, double simulation_time)
Shifts the nucleus to correct impact parameter and z displacement.
bool almost_equal(const N x, const N y)
Checks two numbers for relative approximate equality.
void set_nuclear_radius(double rad)
Sets the nuclear radius.
FourVector center() const
Calculate geometrical center of the nucleus.
void set_3momentum(const ThreeVector &mom)
Set the momentum of the particle without modifying the energy.
Collection of useful constants that are known at compile time.
double pole_mass() const
Get the particle's pole mass ("on-shell").
A nucleus is a collection of particles that are initialized, before the beginning of the simulation a...
ThreeVector threevec() const
virtual void rotate()
Rotates the nucleus.
const FourVector & momentum() const
Get the particle's 4-momentum.
Interface to the SMASH configuration files.
constexpr double hbarc
GeV <-> fm conversion factor.
Nucleus(Configuration &config, int nTest)
Constructor for Nucleus, that needs the configuration parameters from the inputfile and the number of...
Generic numerical functions.
void boost(double beta_scalar)
Boosts the nuclei into the computational frame, such that the nucleons have the appropriate momentum ...
virtual ThreeVector distribute_nucleon() const
The distribution of return values from this function is according to a spherically symmetric Woods-Sa...
bool has_value(std::initializer_list< const char *> keys) const
Returns whether there is a non-empty value behind the requested keys.
std::vector< ParticleData >::const_iterator cend() const
For const iterators over the particle list:
void set_saturation_density(double density)
Sets the saturation density of the nucleus.
static const ParticleType & find(PdgCode pdgcode)
Returns the ParticleType object for the given pdgcode.
ThreeVector threevec() const
const FourVector & position() const
Get the particle's position in Minkowski space.
Particle type contains the static properties of a particle species.
void set_4momentum(const FourVector &momentum_vector)
Set the particle's 4-momentum directly.
virtual void generate_fermi_momenta()
Generates momenta according to Fermi motion for the nucleons.
double woods_saxon(double x)
Woods-Saxon distribution.
const ParticleData & insert(const ParticleData &p)
Inserts the particle into the list of particles.
std::vector< ParticleData >::const_iterator cbegin() const
For const iterators over the particle list:
double nuclear_radius_
Nuclear radius of this nucleus.
double diffusiveness_
Diffusiveness of Woods-Saxon distribution of this nucleus in fm (for diffusiveness_ == 0...
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...
void arrange_nucleons()
Sets the positions of the nucleons inside a nucleus.
constexpr double nuclear_density
Ground state density of symmetric nuclear matter [fm^-3].
PdgCode pdgcode() const
Get the pdgcode of the particle.
void copy_particles(Particles *particles)
Copies the particles from this nucleus into the particle list.
std::vector< ParticleData > particles_
Particles associated with this nucleus.
Value take(std::initializer_list< const char *> keys)
The default interface for SMASH to read configuration values.
std::vector< ParticleData >::iterator begin()
For iterators over the particle list:
Angles provides a common interface for generating directions: i.e., two angles that should be interpr...
The Particles class abstracts the storage and manipulation of particles.
void distribute_isotropically()
Populate the object with a new direction.
std::ostream & operator<<(std::ostream &out, const ActionPtr &action)
Convenience: dereferences the ActionPtr to Action.
virtual void set_parameters_automatic()
Sets the deformation parameters of the Woods-Saxon distribution according to the current mass number...
size_t testparticles_
Number of testparticles per physical particle.
The FourVector class holds relevant values in Minkowski spacetime with (+, −, −, −) metric signature.
void align_center()
Shifts the nucleus so that its center is at (0,0,0)
ParticleData contains the dynamic information of a certain particle.
std::vector< ParticleData >::iterator end()
For iterators over the particle list:
size_t number_of_particles() const
Number of physical particles in the nucleus:
virtual void set_parameters_from_config(Configuration &config)
Sets the parameters of the Woods-Saxon according to manually added values in the configuration file...