Version: SMASH-2.2
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 "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 -1.; }
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.; }
97  bool calculation_frame_is_fixed_target() const { return false; }
107  double nuclei_passing_time() const { return 0.0; }
108 
128  const Particles& particles, double min_cell_length,
129  double timestep_duration, CollisionCriterion crit,
130  const bool include_unformed_particles,
131  CellSizeStrategy strategy = CellSizeStrategy::Optimal) const {
133  if (crit == CollisionCriterion::Stochastic) {
135  }
136  return {particles,
137  min_cell_length,
138  timestep_duration,
139  limit,
140  include_unformed_particles,
141  strategy};
142  }
143 
150  std::unique_ptr<GrandCanThermalizer> create_grandcan_thermalizer(
151  Configuration& conf) const {
152  /* Lattice is placed such that the center is 0,0,0.
153  If one wants to have a central cell with center at 0,0,0 then
154  number of cells should be odd (2k+1) in every direction.
155  */
156 
191  const std::array<double, 3> l = conf.take({"Lattice_Sizes"});
192  const std::array<double, 3> origin = {-0.5 * l[0], -0.5 * l[1],
193  -0.5 * l[2]};
194  const bool periodicity = false;
195  return make_unique<GrandCanThermalizer>(conf, l, origin, periodicity);
196  }
197 
202  struct BadInput : public std::invalid_argument {
203  using std::invalid_argument::invalid_argument;
204  };
210  struct InvalidEnergy : public BadInput {
211  using BadInput::BadInput;
212  };
213 };
214 
215 } // namespace smash
216 
217 #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
bool calculation_frame_is_fixed_target() const
Definition: modusdefault.h:97
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
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:107
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
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:127
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:202
Thrown when the requested energy is smaller than the masses of two particles.
Definition: modusdefault.h:210