35 std::map<PdgCode, int> part = config.
take({
"Particles"});
39 config.
has_value({
"Saturation_Density"})) {
41 }
else if (!config.
has_value({
"Diffusiveness"}) &&
43 !config.
has_value({
"Saturation_Density"})) {
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.");
57 double total_mass = 0.;
59 total_mass += i->momentum().abs();
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;
237 if (which_range < 0.0) {
241 if (which_range >= prob_range2) {
243 if (which_range >= prob_range2 + prob_range3) {
257 double position_scaled = t + radius_scaled;
267 for (
auto i =
begin(); i !=
end(); i++) {
269 i->set_4momentum(i->pole_mass(), 0.0, 0.0, 0.0);
330 0.86 * std::pow(A, -1.0 / 3.0));
340 static_cast<double>(config.
take({
"Saturation_Density"})));
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>();
355 log.debug() << N_n <<
" neutrons, " << N_p <<
" protons.";
358 for (
auto i =
begin(); i !=
end(); i++) {
362 log.warn() <<
"No rule to calculate Fermi momentum " 363 <<
"for particle " << i->
pdgcode();
367 const double r = (i->
position() - nucleus_center).abs3();
381 ptot += ith_3momentum;
383 log.debug() <<
"Particle: " << *i
384 <<
", pF[GeV]: " <<
hbarc * std::pow(pi2_3 * rho, 1.0 / 3.0)
390 assert(ptot.
x1() == 0.0 && ptot.
x2() == 0.0 && ptot.
x3() == 0.0);
395 for (
auto i =
begin(); i !=
end(); i++) {
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;
415 for (
auto i =
begin(); i !=
end(); i++) {
421 this_position.
set_x3(this_position.
x3() * one_over_gamma);
422 i->set_4position(this_position);
429 i->set_4momentum(i->pole_mass(), mom_i.
x1(), mom_i.
x2(),
430 gamma * (beta_scalar * mom_i.
x0() + mom_i.
x3()));
437 for (
auto n = particle_list.cbegin();
n != particle_list.cend(); ++
n) {
439 double current_mass = current_type.
mass();
443 particles_.back().set_4momentum(current_mass, 0.0, 0.0, 0.0);
450 for (
auto i =
begin(); i !=
end(); i++) {
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);
462 external_particles->
insert(*
p);
469 centerpoint +=
p->position();
471 centerpoint /=
size();
476 return out <<
" #particles #testparticles mass [GeV] " 477 "radius [fm] diffusiveness [fm]\n" 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...
PdgCode pdgcode() const
Get the pdgcode of the particle.
void set_diffusiveness(double diffuse)
Sets the diffusiveness of the nucleus.
The ThreeVector class represents a physical three-vector with the components .
virtual ThreeVector distribute_nucleon()
The distribution of return values from this function is according to a spherically symmetric Woods-Sa...
void shift(double z_offset, double x_offset, double simulation_time)
Shifts the nucleus to correct impact parameter and z displacement.
double get_nuclear_radius() const
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.
const FourVector & position() const
Get the particle's position in Minkowski space.
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.
friend std::ostream & operator<<(std::ostream &, const Nucleus &)
Writes the state of the Nucleus object to the output stream.
A nucleus is a collection of particles that are initialized, before the beginning of the simulation a...
FourVector center() const
Calculate geometrical center of the nucleus.
virtual void rotate()
Rotates the nucleus.
ThreeVector threevec() const
Interface to the SMASH configuration files.
constexpr double hbarc
GeV <-> fm conversion factor.
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 cbegin() const
For const iterators over the particle list:
Generic numerical functions.
void boost(double beta_scalar)
Boosts the nuclei into the computational frame, such that the nucleons have the appropriate momentum ...
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
size_t size() const
Number of numerical (=test-)particles in the nucleus:
Value take(std::initializer_list< const char * > keys)
The default interface for SMASH to read configuration values.
Nucleus()=default
default constructor
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 get_diffusiveness() const
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 cend() 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...
double pole_mass() const
Get the particle's pole mass ("on-shell").
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].
void copy_particles(Particles *particles)
Copies the particles from this nucleus into the particle list.
std::vector< ParticleData > particles_
Particles associated with this nucleus.
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...
size_t number_of_particles() const
Number of physical particles in the nucleus:
The Particles class abstracts the storage and manipulation of particles.
void distribute_isotropically()
Populate the object with a new direction.
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:
const FourVector & momentum() const
Get the particle's 4-momentum.
virtual void set_parameters_from_config(Configuration &config)
Sets the parameters of the Woods-Saxon according to manually added values in the configuration file...