26 const bf::path &output_path) {
27 const auto &log = logger<LogArea::Experiment>();
50 const std::string modus_chooser = config.read({
"General",
"Modus"});
51 log.debug() <<
"Modus for this calculation: " << modus_chooser;
53 if (modus_chooser ==
"Box") {
54 return make_unique<Experiment<BoxModus>>(config, output_path);
55 }
else if (modus_chooser ==
"List") {
56 return make_unique<Experiment<ListModus>>(config, output_path);
57 }
else if (modus_chooser ==
"Collider") {
58 return make_unique<Experiment<ColliderModus>>(config, output_path);
59 }
else if (modus_chooser ==
"Sphere") {
60 return make_unique<Experiment<SphereModus>>(config, output_path);
62 throw InvalidModusRequest(
"Invalid Modus (" + modus_chooser +
63 ") requested from ExperimentBase::create.");
327 const auto &log = logger<LogArea::Experiment>();
330 const int ntest = config.
take({
"General",
"Testparticles"}, 1);
332 throw std::invalid_argument(
"Testparticle number should be positive!");
335 const std::string modus_chooser = config.
take({
"General",
"Modus"});
342 const double dt = config.
take({
"General",
"Delta_Time"}, 1.);
343 const double t_end = config.
read({
"General",
"End_Time"});
346 std::unique_ptr<Clock> output_clock =
nullptr;
347 if (config.
has_value({
"Output",
"Output_Times"})) {
348 if (config.
has_value({
"Output",
"Output_Interval"})) {
349 throw std::invalid_argument(
350 "Please specify either Output_Interval or Output_Times");
352 std::vector<double> output_times = config.
take({
"Output",
"Output_Times"});
355 output_times.push_back(t_end + 1.);
356 output_clock = make_unique<CustomClock>(output_times);
358 const double output_dt = config.
take({
"Output",
"Output_Interval"}, t_end);
359 output_clock = make_unique<UniformClock>(0.0, output_dt);
362 auto config_coll = config[
"Collision_Term"];
365 const double low_snn_cut =
366 config_coll.
take({
"Elastic_NN_Cutoff_Sqrts"}, 1.98);
369 if (proton && pion &&
370 low_snn_cut > proton->mass() + proton->mass() + pion->mass()) {
371 log.warn(
"The cut-off should be below the threshold energy",
372 " of the process: NN to NNpi");
374 const bool potential_affect_threshold =
375 config.
take({
"Lattice",
"Potentials_Affect_Thresholds"},
false);
376 return {make_unique<UniformClock>(0.0, dt),
377 std::move(output_clock),
379 config.
take({
"General",
"Gaussian_Sigma"}, 1.),
380 config.
take({
"General",
"Gauss_Cutoff_In_Sigma"}, 4.),
381 config_coll.take({
"Two_to_One"},
true),
383 config_coll.take({
"Strings"}, modus_chooser !=
"Box"),
384 config_coll.take({
"Use_AQM"},
true),
385 config_coll.take({
"Strings_with_Probability"},
true),
389 potential_affect_threshold};
393 uint64_t scatterings_this_interval,
396 const SystemTimeSpan elapsed_seconds = SystemClock::now() - time_start;
399 const QuantumNumbers difference = conserved_initial - current_values;
401 std::ostringstream ss;
403 ss << field<8, 3> << time << field<13, 3> << difference.
momentum().
x0()
404 << field<16, 3> << scatterings_this_interval
405 << field<11, 3> << particles.
size() << field<10, 3> << elapsed_seconds;
static std::unique_ptr< ExperimentBase > create(Configuration config, const bf::path &output_path)
Factory method that creates and initializes a new Experiment<Modus>.
Value read(std::initializer_list< const char * > keys) const
Additional interface for SMASH to read configuration values without removing them.
Interface to the SMASH configuration files.
ExperimentParameters create_experiment_parameters(Configuration config)
Gathers all general Experiment parameters.
bool has_value(std::initializer_list< const char * > keys) const
Returns whether there is a non-empty value behind the requested keys.
std::string format_measurements(const Particles &particles, uint64_t scatterings_this_interval, const QuantumNumbers &conserved_initial, SystemTimePoint time_start, double time)
Generate the tabulated string which will be printed to the screen when SMASH is running.
#define source_location
Hackery that is required to output the location in the source code where the log statement occurs...
Value take(std::initializer_list< const char * > keys)
The default interface for SMASH to read configuration values.
A container for storing conserved values.
SystemClock::duration SystemTimeSpan
The time duration type (alias) used for measuring run times.
void remove_all_but(const std::string &key)
Removes all entries in the map except for key.
std::bitset< 10 > ReactionsBitSet
Container for the 2 to 2 reactions in the code.
FourVector momentum() const
Use string fragmentation.
std::chrono::time_point< std::chrono::system_clock > SystemTimePoint
Type (alias) that is used to store the current time.
static const ParticleTypePtr try_find(PdgCode pdgcode)
Returns the ParticleTypePtr for the given pdgcode.
The Particles class abstracts the storage and manipulation of particles.
Helper structure for Experiment.