Version: SMASH-1.5
modusdefault.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2013-2018
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  double impact_parameter() const { return 0.0; }
76  double velocity_projectile() const { return 0.0; }
79  double velocity_target() const { return 0.0; }
84  double max_timestep(double) const { return -1.; }
85 
87  double length() const { return -1.; }
88 
101  const Particles& particles, double min_cell_length,
102  CellSizeStrategy strategy = CellSizeStrategy::Optimal) const {
103  return {particles, min_cell_length, strategy};
104  }
105 
112  std::unique_ptr<GrandCanThermalizer> create_grandcan_thermalizer(
113  Configuration& conf) const {
114  /* Lattice is placed such that the center is 0,0,0.
115  If one wants to have a central cell with center at 0,0,0 then
116  number of cells should be odd (2k+1) in every direction.
117  */
118 
150  const std::array<double, 3> l = conf.take({"Lattice_Sizes"});
151  const std::array<double, 3> origin = {-0.5 * l[0], -0.5 * l[1],
152  -0.5 * l[2]};
153  const bool periodicity = false;
154  return make_unique<GrandCanThermalizer>(conf, l, origin, periodicity);
155  }
156 
161  struct BadInput : public std::invalid_argument {
162  using std::invalid_argument::invalid_argument;
163  };
169  struct InvalidEnergy : public BadInput {
170  using BadInput::BadInput;
171  };
172 };
173 
174 } // namespace smash
175 
176 #endif // SRC_INCLUDE_MODUSDEFAULT_H_
double impact_parameter() 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:169
Grid< GridOptions::Normal > create_grid(const Particles &particles, double min_cell_length, CellSizeStrategy strategy=CellSizeStrategy::Optimal) const
Creates the Grid with normal boundary conditions.
Definition: modusdefault.h:100
bool cll_in_nucleus() const
Definition: modusdefault.h:69
Look for optimal cell size.
int impose_boundary_conditions(Particles *, const OutputsList &={})
Enforces sensible positions for the particles.
Definition: modusdefault.h:59
Interface to the SMASH configuration files.
int total_N_number() const
Definition: modusdefault.h:65
Base class for Modus classes that provides default function implementations.
Definition: modusdefault.h:44
BadInput is an error to throw if the configuration options are invalid.
Definition: modusdefault.h:161
Don&#39;t use fermi motion.
double length() const
Definition: modusdefault.h:87
double velocity_target() const
Definition: modusdefault.h:79
FermiMotion fermi_motion() const
Definition: modusdefault.h:82
double velocity_projectile() const
Definition: modusdefault.h:76
CellSizeStrategy
Indentifies the strategy of determining the cell size.
Definition: grid.h:33
Value take(std::initializer_list< const char *> keys)
The default interface for SMASH to read configuration values.
bool is_collider() const
Definition: modusdefault.h:71
int proj_N_number() const
Definition: modusdefault.h:67
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
double max_timestep(double) const
Definition: modusdefault.h:84
Definition: action.h:24