Version: SMASH-1.5
deformednucleus.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2018
3  * SMASH Team
4  *
5  * GNU General Public License (GPLv3 or later)
6  */
8 
9 #include <cmath>
10 #include <stdexcept>
11 
12 #include "smash/angles.h"
13 #include "smash/configuration.h"
14 #include "smash/constants.h"
15 #include "smash/fourvector.h"
16 #include "smash/particledata.h"
17 #include "smash/random.h"
18 #include "smash/threevector.h"
19 
20 namespace smash {
21 
74 DeformedNucleus::DeformedNucleus(const std::map<PdgCode, int> &particle_list,
75  int nTest)
76  : Nucleus(particle_list, nTest) {}
77 
79  : Nucleus(config, nTest) {
80  if (config.has_value({"Deformed", "Automatic"}) &&
81  config.take({"Deformed", "Automatic"})) {
83  } else {
85  }
86 }
87 
88 double DeformedNucleus::deformed_woods_saxon(double r, double cosx) const {
90  (1 + std::exp(r - Nucleus::get_nuclear_radius() *
91  (1 + beta2_ * y_l_0(2, cosx) +
92  beta4_ * y_l_0(4, cosx)) /
94 }
95 
97  double a_radius;
98  Angles a_direction;
99  // Set a sensible maximum bound for radial sampling.
100  double radius_max =
103 
104  // Sample the distribution.
105  do {
106  a_direction.distribute_isotropically();
107  // sample r**2 dr
108  a_radius = radius_max * std::cbrt(random::canonical());
109  } while (random::canonical() >
110  deformed_woods_saxon(a_radius, a_direction.costheta()) /
112 
113  // Update (x, y, z) positions.
114  return a_direction.threevec() * a_radius;
115 }
116 
118  // Set the deformation parameters extracted from \iref{Moller:1993ed}.
119  switch (Nucleus::number_of_particles()) {
120  case 238: // Uranium
121  set_beta_2(0.28);
122  set_beta_4(0.093);
123  break;
124  case 208: // Lead
125  set_beta_2(0.0);
126  set_beta_4(0.0);
127  break;
128  case 197: // Gold
129  set_beta_2(-0.131);
130  set_beta_4(-0.031);
131  break;
132  case 63: // Copper
133  set_beta_2(0.162);
134  set_beta_4(-0.006);
135  break;
136  default:
137  throw std::domain_error(
138  "Mass number not listed for automatically setting deformation "
139  "parameters. Please specify at least \"Beta_2\" and \"Beta_4\" "
140  "manually and set \"Automatic: False.\" ");
141  }
142 
143  // Set a random nuclear rotation.
145 }
146 
148  Configuration &config) {
149  // Deformation parameters.
150  if (config.has_value({"Deformed", "Beta_2"})) {
151  set_beta_2(static_cast<double>(config.take({"Deformed", "Beta_2"})));
152  }
153  if (config.has_value({"Deformed", "Beta_4"})) {
154  set_beta_4(static_cast<double>(config.take({"Deformed", "Beta_4"})));
155  }
156  if (config.has_value({"Deformed", "Theta"})) {
157  set_polar_angle(static_cast<double>(config.take({"Deformed", "Theta"})));
158  }
159  if (config.has_value({"Deformed", "Phi"})) {
160  set_azimuthal_angle(static_cast<double>(config.take({"Deformed", "Phi"})));
161  }
162 }
163 
165  for (auto &particle : *this) {
166  /* Rotate every vector by the nuclear azimuth phi and polar angle
167  * theta (the Euler angles). This means applying the matrix for a
168  * rotation of phi about z, followed by the matrix for a rotation
169  * theta about the rotated x axis. The third angle psi is 0 by symmetry.*/
170  ThreeVector three_pos = particle.position().threevec();
172  0.);
173  particle.set_3position(three_pos);
174  }
175 }
176 
178  throw std::domain_error(
179  "Fermi momenta currently not implemented"
180  " for a deformed nucleus.");
181 }
182 
183 double DeformedNucleus::y_l_0(int l, double cosx) const {
184  if (l == 2) {
185  return (1. / 4) * std::sqrt(5 / M_PI) * (3. * (cosx * cosx) - 1);
186  } else if (l == 4) {
187  return (3. / 16) * std::sqrt(1 / M_PI) *
188  (35. * (cosx * cosx) * (cosx * cosx) - 30. * (cosx * cosx) + 3);
189  } else {
190  throw std::domain_error(
191  "Not a valid angular momentum quantum number in"
192  "DeformedNucleus::y_l_0.");
193  }
194 }
195 
196 } // namespace smash
void set_polar_angle(double theta)
Set the nucleus polar angle.
double theta() const
Definition: angles.h:272
ThreeVector distribute_nucleon() const override
Deformed Woods-Saxon sampling routine.
double y_l_0(int l, double cosx) const
Spherical harmonics Y_2_0 and Y_4_0.
double beta4_
Deformation parameter for angular momentum l=4.
The ThreeVector class represents a physical three-vector with the components .
Definition: threevector.h:30
double beta2_
Deformation parameter for angular momentum l=2.
void set_beta_4(double b4)
Set deformation coefficient for Y_4_0.
Collection of useful constants that are known at compile time.
A nucleus is a collection of particles that are initialized, before the beginning of the simulation a...
Definition: nucleus.h:27
ThreeVector threevec() const
Definition: angles.h:268
double get_nuclear_radius() const
Definition: nucleus.h:261
Angles nuclear_orientation_
Nucleus orientation (initial profile in xz plane) in terms of a pair of angles (theta, phi)
void set_deformation_parameters_from_config(Configuration &config)
Set parameters for spherical deformation of the nucleus from the values specified in the configuratio...
Interface to the SMASH configuration files.
void set_deformation_parameters_automatic()
Sets the deformation parameters of the radius according to the current mass number.
T canonical()
Definition: random.h:110
double phi() const
Definition: angles.h:260
bool has_value(std::initializer_list< const char *> keys) const
Returns whether there is a non-empty value behind the requested keys.
void set_azimuthal_angle(double phi)
Set the nucleus azimuthal angle.
double costheta() const
Definition: angles.h:259
DeformedNucleus(const std::map< PdgCode, int > &particle_list, int nTest)
Constructor for DeformedNucles which takes a particle list and the number of testparticles.
double get_diffusiveness() const
Definition: nucleus.h:231
void rotate() override
Rotates the nucleus according to members nucleus_polar_angle_ and nucleus_azimuthal_angle_ and update...
void generate_fermi_momenta() override
Does not allow to generate Fermi-momenta for a deformed nucleus.
Value take(std::initializer_list< const char *> keys)
The default interface for SMASH to read configuration values.
double get_saturation_density() const
Definition: nucleus.h:243
Angles provides a common interface for generating directions: i.e., two angles that should be interpr...
Definition: angles.h:59
void distribute_isotropically()
Populate the object with a new direction.
Definition: angles.h:188
double deformed_woods_saxon(double r, double cosx) const
Return the deformed Woods-Saxon probability for the given position.
void set_beta_2(double b2)
Set deformation coefficient for Y_2_0.
void rotate(double phi, double theta, double psi)
Rotate vector by the given Euler angles phi, theta, psi.
Definition: threevector.h:266
Definition: action.h:24
size_t number_of_particles() const
Number of physical particles in the nucleus:
Definition: nucleus.h:152