Version: SMASH-3.1
modusdefault.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2013-2022
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 "forwarddeclarations.h"
17 #include "fourvector.h"
18 #include "grandcan_thermalizer.h"
19 #include "grid.h"
20 #include "outputinterface.h"
21 #include "potentials.h"
22 
23 namespace smash {
24 
43 class ModusDefault {
44  public:
45  // Never needs a virtual destructor.
46 
47  // Missing functions for concrete Modus implementations:
48  // \todo(JB): Why is the function below commented out?
49  // double initial_conditions(Particles *particles);
50 
59  const OutputsList& /*out_list*/ = {}) {
60  return 0;
61  }
62 
64  bool is_collider() const { return false; }
66  bool is_box() const { return false; }
68  bool is_list() const { return false; }
70  bool is_sphere() const { return false; }
72  double sqrt_s_NN() const { return 0.; }
74  double impact_parameter() const { return -1.; }
76  void sample_impact() const {}
79  double velocity_projectile() const { return 0.0; }
82  double velocity_target() const { return 0.0; }
87  double max_timestep(double) const { return -1.; }
89  double equilibration_time() const { return -1.; }
91  double length() const { return -1.; }
93  double radius() const { return -1.; }
96  bool calculation_frame_is_fixed_target() const { return false; }
106  double nuclei_passing_time() const { return 0.0; }
107 
127  const Particles& particles, double min_cell_length,
128  double timestep_duration, CollisionCriterion crit,
129  const bool include_unformed_particles,
130  CellSizeStrategy strategy = CellSizeStrategy::Optimal) const {
132  if (crit == CollisionCriterion::Stochastic) {
134  }
135  return {particles,
136  min_cell_length,
137  timestep_duration,
138  limit,
139  include_unformed_particles,
140  strategy};
141  }
142 
149  std::unique_ptr<GrandCanThermalizer> create_grandcan_thermalizer(
150  Configuration& conf) const {
151  /* Lattice is placed such that the center is 0,0,0.
152  If one wants to have a central cell with center at 0,0,0 then
153  number of cells should be odd (2k+1) in every direction.
154  */
155  const std::array<double, 3> l = conf.take({"Lattice_Sizes"});
156  const std::array<double, 3> origin = {-0.5 * l[0], -0.5 * l[1],
157  -0.5 * l[2]};
158  const bool periodicity = false;
159  return std::make_unique<GrandCanThermalizer>(conf, l, origin, periodicity);
160  }
161 
166  struct BadInput : public std::invalid_argument {
167  using std::invalid_argument::invalid_argument;
168  };
174  struct InvalidEnergy : public BadInput {
175  using BadInput::BadInput;
176  };
177 };
178 
179 } // namespace smash
180 
181 #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:43
bool calculation_frame_is_fixed_target() const
Definition: modusdefault.h:96
double radius() const
Definition: modusdefault.h:93
std::unique_ptr< GrandCanThermalizer > create_grandcan_thermalizer(Configuration &conf) const
Creates GrandCanThermalizer.
Definition: modusdefault.h:149
bool is_list() const
Definition: modusdefault.h:68
double velocity_target() const
Definition: modusdefault.h:82
int impose_boundary_conditions(Particles *, const OutputsList &={})
Enforces sensible positions for the particles.
Definition: modusdefault.h:58
double max_timestep(double) const
Definition: modusdefault.h:87
bool is_box() const
Definition: modusdefault.h:66
double nuclei_passing_time() const
Get the passing time of the two nuclei in a collision.
Definition: modusdefault.h:106
FermiMotion fermi_motion() const
Definition: modusdefault.h:85
bool is_sphere() const
Definition: modusdefault.h:70
double velocity_projectile() const
Definition: modusdefault.h:79
double sqrt_s_NN() const
Definition: modusdefault.h:72
double impact_parameter() const
Definition: modusdefault.h:74
bool is_collider() const
Definition: modusdefault.h:64
void sample_impact() const
sample impact parameter for collider modus
Definition: modusdefault.h:76
double equilibration_time() const
Definition: modusdefault.h:89
Grid< GridOptions::Normal > create_grid(const Particles &particles, double min_cell_length, double timestep_duration, CollisionCriterion crit, const bool include_unformed_particles, CellSizeStrategy strategy=CellSizeStrategy::Optimal) const
Creates the Grid with normal boundary conditions.
Definition: modusdefault.h:126
double length() const
Definition: modusdefault.h:91
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:166
Thrown when the requested energy is smaller than the masses of two particles.
Definition: modusdefault.h:174