Version: SMASH-2.1
modusdefault.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2013-2021
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 
10 #ifndef SRC_INCLUDE_SMASH_MODUSDEFAULT_H_
11 #define SRC_INCLUDE_SMASH_MODUSDEFAULT_H_
12 
13 #include <memory>
14 
15 #include "configuration.h"
16 #include "cxx14compat.h"
17 #include "forwarddeclarations.h"
18 #include "fourvector.h"
19 #include "grandcan_thermalizer.h"
20 #include "grid.h"
21 #include "outputinterface.h"
22 #include "potentials.h"
23 
24 namespace smash {
25 
44 class ModusDefault {
45  public:
46  // Never needs a virtual destructor.
47 
48  // Missing functions for concrete Modus implementations:
49  // \todo(JB): Why is the function below commented out?
50  // double initial_conditions(Particles *particles);
51 
60  const OutputsList& /*out_list*/ = {}) {
61  return 0;
62  }
63 
65  bool is_collider() const { return false; }
67  bool is_box() const { return false; }
69  bool is_list() const { return false; }
71  bool is_sphere() const { return false; }
73  double sqrt_s_NN() const { return 0.; }
75  double impact_parameter() const { return 0.0; }
77  void sample_impact() const {}
80  double velocity_projectile() const { return 0.0; }
83  double velocity_target() const { return 0.0; }
88  double max_timestep(double) const { return -1.; }
90  double equilibration_time() const { return -1.; }
92  double length() const { return -1.; }
94  double radius() const { return -1.; }
104  double nuclei_passing_time() const { return 0.0; }
105 
122  const Particles& particles, double min_cell_length,
123  double timestep_duration, CollisionCriterion crit,
124  CellSizeStrategy strategy = CellSizeStrategy::Optimal) const {
126  if (crit == CollisionCriterion::Stochastic) {
128  }
129  return {particles, min_cell_length, timestep_duration, limit, strategy};
130  }
131 
138  std::unique_ptr<GrandCanThermalizer> create_grandcan_thermalizer(
139  Configuration& conf) const {
140  /* Lattice is placed such that the center is 0,0,0.
141  If one wants to have a central cell with center at 0,0,0 then
142  number of cells should be odd (2k+1) in every direction.
143  */
144 
179  const std::array<double, 3> l = conf.take({"Lattice_Sizes"});
180  const std::array<double, 3> origin = {-0.5 * l[0], -0.5 * l[1],
181  -0.5 * l[2]};
182  const bool periodicity = false;
183  return make_unique<GrandCanThermalizer>(conf, l, origin, periodicity);
184  }
185 
190  struct BadInput : public std::invalid_argument {
191  using std::invalid_argument::invalid_argument;
192  };
198  struct InvalidEnergy : public BadInput {
199  using BadInput::BadInput;
200  };
201 };
202 
203 } // namespace smash
204 
205 #endif // SRC_INCLUDE_SMASH_MODUSDEFAULT_H_
Interface to the SMASH configuration files.
Value take(std::initializer_list< const char * > keys)
The default interface for SMASH to read configuration values.
Abstracts a list of cells that partition the particles in the experiment into regions of space that c...
Definition: grid.h:96
Base class for Modus classes that provides default function implementations.
Definition: modusdefault.h:44
double radius() const
Definition: modusdefault.h:94
bool is_list() const
Definition: modusdefault.h:69
double velocity_target() const
Definition: modusdefault.h:83
int impose_boundary_conditions(Particles *, const OutputsList &={})
Enforces sensible positions for the particles.
Definition: modusdefault.h:59
Grid< GridOptions::Normal > create_grid(const Particles &particles, double min_cell_length, double timestep_duration, CollisionCriterion crit, CellSizeStrategy strategy=CellSizeStrategy::Optimal) const
Creates the Grid with normal boundary conditions.
Definition: modusdefault.h:121
double max_timestep(double) const
Definition: modusdefault.h:88
bool is_box() const
Definition: modusdefault.h:67
double nuclei_passing_time() const
Get the passing time of the two nuclei in a collision.
Definition: modusdefault.h:104
FermiMotion fermi_motion() const
Definition: modusdefault.h:86
bool is_sphere() const
Definition: modusdefault.h:71
double velocity_projectile() const
Definition: modusdefault.h:80
double sqrt_s_NN() const
Definition: modusdefault.h:73
double impact_parameter() const
Definition: modusdefault.h:75
bool is_collider() const
Definition: modusdefault.h:65
void sample_impact() const
sample impact parameter for collider modus
Definition: modusdefault.h:77
double equilibration_time() const
Definition: modusdefault.h:90
double length() const
Definition: modusdefault.h:92
The Particles class abstracts the storage and manipulation of particles.
Definition: particles.h:33
FermiMotion
Option to use Fermi Motion.
@ Off
Don't use fermi motion.
CollisionCriterion
Criteria used to check collisions.
@ Stochastic
Stochastic Criteiron.
Definition: action.h:24
CellNumberLimitation
Identifies whether the number of cells should be limited.
Definition: grid.h:55
@ ParticleNumber
Limit the number of cells to the number of particles.
@ None
No cell number limitation.
CellSizeStrategy
Indentifies the strategy of determining the cell size.
Definition: grid.h:33
@ Optimal
Look for optimal cell size.
BadInput is an error to throw if the configuration options are invalid.
Definition: modusdefault.h:190
Thrown when the requested energy is smaller than the masses of two particles.
Definition: modusdefault.h:198