Version: SMASH-1.6
deformednucleus.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2019
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 
42 // For readability and layout issues parts of the customnucleus userguide
43 // needs to be located here. The example configuration can however be found in
44 // customnucleus.cc
45 
96 DeformedNucleus::DeformedNucleus(const std::map<PdgCode, int> &particle_list,
97  int nTest)
98  : Nucleus(particle_list, nTest) {}
99 
101  : Nucleus(config, nTest) {
102  if (config.has_value({"Deformed", "Automatic"}) &&
103  config.take({"Deformed", "Automatic"})) {
105  } else {
107  }
108 }
109 
110 double DeformedNucleus::deformed_woods_saxon(double r, double cosx) const {
112  (1 + std::exp((r - Nucleus::get_nuclear_radius() *
113  (1 + beta2_ * y_l_0(2, cosx) +
114  beta4_ * y_l_0(4, cosx))) /
116 }
117 
119  double a_radius;
120  Angles a_direction;
121  // Set a sensible maximum bound for radial sampling.
122  double radius_max =
125 
126  // Sample the distribution.
127  do {
128  a_direction.distribute_isotropically();
129  // sample r**2 dr
130  a_radius = radius_max * std::cbrt(random::canonical());
131  } while (random::canonical() >
132  deformed_woods_saxon(a_radius, a_direction.costheta()) /
134 
135  // Update (x, y, z) positions.
136  return a_direction.threevec() * a_radius;
137 }
138 
140  // Set the deformation parameters extracted from \iref{Moller:1993ed}.
141  switch (Nucleus::number_of_particles()) {
142  case 238: // Uranium
143  set_beta_2(0.28);
144  set_beta_4(0.093);
145  break;
146  case 208: // Lead
147  set_beta_2(0.0);
148  set_beta_4(0.0);
149  break;
150  case 197: // Gold
151  set_beta_2(-0.131);
152  set_beta_4(-0.031);
153  break;
154  case 63: // Copper
155  set_beta_2(0.162);
156  set_beta_4(-0.006);
157  break;
158  default:
159  throw std::domain_error(
160  "Mass number not listed for automatically setting deformation "
161  "parameters. Please specify at least \"Beta_2\" and \"Beta_4\" "
162  "manually and set \"Automatic: False.\" ");
163  }
164 
165  // Set a random nuclear rotation.
167 }
168 
170  Configuration &config) {
171  // Deformation parameters.
172  if (config.has_value({"Deformed", "Beta_2"})) {
173  set_beta_2(static_cast<double>(config.take({"Deformed", "Beta_2"})));
174  }
175  if (config.has_value({"Deformed", "Beta_4"})) {
176  set_beta_4(static_cast<double>(config.take({"Deformed", "Beta_4"})));
177  }
178  if (config.has_value({"Deformed", "Theta"})) {
179  set_polar_angle(static_cast<double>(config.take({"Deformed", "Theta"})));
180  }
181  if (config.has_value({"Deformed", "Phi"})) {
182  set_azimuthal_angle(static_cast<double>(config.take({"Deformed", "Phi"})));
183  }
184 }
185 
187  for (auto &particle : *this) {
188  /* Rotate every vector by the nuclear azimuth phi and polar angle
189  * theta (the Euler angles). This means applying the matrix for a
190  * rotation of phi about z, followed by the matrix for a rotation
191  * theta about the rotated x axis. The third angle psi is 0 by symmetry.*/
192  ThreeVector three_pos = particle.position().threevec();
194  0.);
195  particle.set_3position(three_pos);
196  }
197 }
198 
200  throw std::domain_error(
201  "Fermi momenta currently not implemented"
202  " for a deformed nucleus.");
203 }
204 
205 double DeformedNucleus::y_l_0(int l, double cosx) const {
206  if (l == 2) {
207  return (1. / 4) * std::sqrt(5 / M_PI) * (3. * (cosx * cosx) - 1);
208  } else if (l == 4) {
209  return (3. / 16) * std::sqrt(1 / M_PI) *
210  (35. * (cosx * cosx) * (cosx * cosx) - 30. * (cosx * cosx) + 3);
211  } else {
212  throw std::domain_error(
213  "Not a valid angular momentum quantum number in"
214  "DeformedNucleus::y_l_0.");
215  }
216 }
217 
218 } // namespace smash
void set_polar_angle(double theta)
Set the nucleus polar angle.
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 get_nuclear_radius() const
Definition: nucleus.h:266
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.
double deformed_woods_saxon(double r, double cosx) const
Return the deformed Woods-Saxon probability for the given position.
A nucleus is a collection of particles that are initialized, before the beginning of the simulation a...
Definition: nucleus.h:27
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.
bool has_value(std::initializer_list< const char * > keys) const
Returns whether there is a non-empty value behind the requested keys.
double get_saturation_density() const
Definition: nucleus.h:248
void set_deformation_parameters_automatic()
Sets the deformation parameters of the radius according to the current mass number.
T canonical()
Definition: random.h:113
void set_azimuthal_angle(double phi)
Set the nucleus azimuthal angle.
ThreeVector threevec() const
Definition: angles.h:268
Value take(std::initializer_list< const char * > keys)
The default interface for SMASH to read configuration values.
double get_diffusiveness() const
Definition: nucleus.h:236
double y_l_0(int l, double cosx) const
Spherical harmonics Y_2_0 and Y_4_0.
DeformedNucleus(const std::map< PdgCode, int > &particle_list, int nTest)
Constructor for DeformedNucles which takes a particle list and the number of testparticles.
ThreeVector distribute_nucleon() override
Deformed Woods-Saxon sampling routine.
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.
double costheta() const
Definition: angles.h:259
Angles provides a common interface for generating directions: i.e., two angles that should be interpr...
Definition: angles.h:59
size_t number_of_particles() const
Number of physical particles in the nucleus:
Definition: nucleus.h:155
void distribute_isotropically()
Populate the object with a new direction.
Definition: angles.h:188
void set_beta_2(double b2)
Set deformation coefficient for Y_2_0.
double phi() const
Definition: angles.h:260
double theta() const
Definition: angles.h:272
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