Version: SMASH-1.7
modusdefault.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2013-2019
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 
10 #ifndef SRC_INCLUDE_MODUSDEFAULT_H_
11 #define SRC_INCLUDE_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  int total_N_number() const { return 0; }
67  int proj_N_number() const { return 0; }
69  bool cll_in_nucleus() const { return false; }
71  bool is_collider() const { return false; }
73  bool is_list() const { return false; }
75  double impact_parameter() const { return 0.0; }
78  double velocity_projectile() const { return 0.0; }
81  double velocity_target() const { return 0.0; }
86  double max_timestep(double) const { return -1.; }
87 
89  double length() const { return -1.; }
90 
100  double nuclei_passing_time() const { return 0.0; }
101 
116  const Particles& particles, double min_cell_length,
117  double timestep_duration,
118  CellSizeStrategy strategy = CellSizeStrategy::Optimal) const {
119  return {particles, min_cell_length, timestep_duration, strategy};
120  }
121 
128  std::unique_ptr<GrandCanThermalizer> create_grandcan_thermalizer(
129  Configuration& conf) const {
130  /* Lattice is placed such that the center is 0,0,0.
131  If one wants to have a central cell with center at 0,0,0 then
132  number of cells should be odd (2k+1) in every direction.
133  */
134 
169  const std::array<double, 3> l = conf.take({"Lattice_Sizes"});
170  const std::array<double, 3> origin = {-0.5 * l[0], -0.5 * l[1],
171  -0.5 * l[2]};
172  const bool periodicity = false;
173  return make_unique<GrandCanThermalizer>(conf, l, origin, periodicity);
174  }
175 
180  struct BadInput : public std::invalid_argument {
181  using std::invalid_argument::invalid_argument;
182  };
188  struct InvalidEnergy : public BadInput {
189  using BadInput::BadInput;
190  };
191 };
192 
193 } // namespace smash
194 
195 #endif // SRC_INCLUDE_MODUSDEFAULT_H_
bool is_list() const
Definition: modusdefault.h:73
FermiMotion
Option to use Fermi Motion.
Thrown when the requested energy is smaller than the masses of two particles.
Definition: modusdefault.h:188
Look for optimal cell size.
double length() const
Definition: modusdefault.h:89
bool is_collider() const
Definition: modusdefault.h:71
int impose_boundary_conditions(Particles *, const OutputsList &={})
Enforces sensible positions for the particles.
Definition: modusdefault.h:59
Interface to the SMASH configuration files.
Base class for Modus classes that provides default function implementations.
Definition: modusdefault.h:44
bool cll_in_nucleus() const
Definition: modusdefault.h:69
int proj_N_number() const
Definition: modusdefault.h:67
BadInput is an error to throw if the configuration options are invalid.
Definition: modusdefault.h:180
Value take(std::initializer_list< const char * > keys)
The default interface for SMASH to read configuration values.
Don&#39;t use fermi motion.
double velocity_target() const
Definition: modusdefault.h:81
double nuclei_passing_time() const
Get the passing time of the two nuclei in a collision.
Definition: modusdefault.h:100
double impact_parameter() const
Definition: modusdefault.h:75
double max_timestep(double) const
Definition: modusdefault.h:86
CellSizeStrategy
Indentifies the strategy of determining the cell size.
Definition: grid.h:33
double velocity_projectile() const
Definition: modusdefault.h:78
The Particles class abstracts the storage and manipulation of particles.
Definition: particles.h:33
Abstracts a list of cells that partition the particles in the experiment into regions of space that c...
Definition: grid.h:79
FermiMotion fermi_motion() const
Definition: modusdefault.h:84
int total_N_number() const
Definition: modusdefault.h:65
Definition: action.h:24
Grid< GridOptions::Normal > create_grid(const Particles &particles, double min_cell_length, double timestep_duration, CellSizeStrategy strategy=CellSizeStrategy::Optimal) const
Creates the Grid with normal boundary conditions.
Definition: modusdefault.h:115