Version: SMASH-2.1
smash.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2012-2021
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 #include <getopt.h>
10 
11 #include <set>
12 #include <sstream>
13 #include <vector>
14 
15 #include <boost/filesystem/fstream.hpp>
16 
17 #include "smash/cxx14compat.h"
18 #include "smash/decaymodes.h"
19 #include "smash/experiment.h"
20 #include "smash/filelock.h"
21 #include "smash/random.h"
24 #include "smash/sha256.h"
25 #include "smash/stringfunctions.h"
26 /* build dependent variables */
27 #include "smash/config.h"
28 
29 namespace smash {
30 
31 namespace {
43 void usage(const int rc, const std::string &progname) {
131  std::printf("\nUsage: %s [option]\n\n", progname.c_str());
132  std::printf(
133  " -h, --help usage information\n"
134  "\n"
135  " -i, --inputfile <file> path to input configuration file\n"
136  " (default: ./config.yaml)\n"
137  " -d, --decaymodes <file> override default decay modes from file\n"
138  " -p, --particles <file> override default particles from file\n"
139  "\n"
140  " -c, --config <YAML> specify config value overrides\n"
141  " (multiple -c arguments are supported)\n"
142  " -m, --modus <modus> shortcut for -c 'General: { Modus: <modus> "
143  "}'\n"
144  " -e, --endtime <time> shortcut for -c 'General: { End_Time: <time> "
145  "}'"
146  "\n"
147  "\n"
148  " -o, --output <dir> output directory (default: ./data/<runid>)\n"
149  " -l, --list-2-to-n list all possible 2->n reactions (with n>1)\n"
150  " -r, --resonance <pdg> dump width(m) and m*spectral function(m^2)"
151  " for resonance pdg\n"
152  " -s, --cross-sections <pdg1>,<pdg2>[,mass1,mass2[,plab1,...]] \n"
153  " dump all partial cross-sections of "
154  "pdg1 + pdg2 reactions versus sqrt(s).\n"
155  " -S, --cross-sections-fs <pdg1>,<pdg2>[,mass1,mass2[,plab1,...]] \n"
156  " dump an approximation of the final-state"
157  " cross-sections\n"
158  " of pdg1 + pdg2 reactions versus sqrt(s).\n"
159  " Contributions from strings are not considered"
160  " for the final state.\n"
161  " Masses are optional, by default pole masses"
162  " are used.\n"
163  " Note the required comma and no spaces.\n"
164  " -f, --force force overwriting files in the output "
165  "directory"
166  "\n"
167  " -x, --dump_iSS Dump particle table in iSS format\n"
168  " This format is used in MUSIC and CLVisc\n"
169  " relativistic hydro codes\n"
170  " -q, --quiet Supress disclaimer print-out\n"
171  " -n, --no-cache Don't cache integrals on disk\n"
172  " -v, --version\n\n");
173  std::exit(rc);
174 }
175 
178  std::cout
179  << "###################################################################"
180  << "############"
181  << "\n"
182  << "\n"
183  << " :::s.\n"
184  << " .... ''ss:: "
185  "ah:\n"
186  << " a::''. ..:sss "
187  ".HH.\n"
188  << " mss'.. ...s'm. sSA##As mAhh##hsh##s. .hA##ASa sS###As "
189  "hMAh##h.\n"
190  << " :a':'. .'':as sM#' .HHm''HMS''AMs mMA' .AMs aMA. "
191  "'HHa..HM:\n"
192  << " .a:s'. ..''ss 'h#H#S. mMm 'M#' .HH. 'MH. :MA 'h#H#S. "
193  "hMm :M#\n"
194  << " .::ss'. .... 'SMm .HH. SMa hMm sM#..mHMs 'AMa "
195  "'MH. SMa\n"
196  << " .s::' #SMASHh aMS .MH: HM: #MMMmMM. #SMASHh "
197  "aMS .MM.\n"
198  << "\n"
199  << "###################################################################"
200  << "############"
201  << "\n"
202  << " This is SMASH version: " << VERSION_MAJOR << "\n"
203  << " Simulating Many Accelerated Strongly-interacting Hadrons"
204  << "\n"
205  << "\n"
206  << " Distributed under the GNU General Public License 3.0"
207  << " (GPLv3 or later)."
208  << "\n"
209  << " See LICENSE for details."
210  << "\n"
211  << " For the full list of contributors see AUTHORS."
212  << "\n"
213  << "\n"
214  << " When using SMASH, please cite"
215  << "\n"
216  << " J. Weil et al., Phys.Rev. C94 (2016) no.5, 054905"
217  << "\n"
218  << " together with the software DOI for the specific code version "
219  << "employed:"
220  << "\n"
221  << " https://doi.org/10.5281/zenodo.3484711."
222  << "\n"
223  << " In addition, if Pythia is used please cite"
224  << "\n"
225  << " T. Sjöstrand, S. Mrenna and P. Skands, JHEP05 (2006) 026,"
226  << "\n"
227  << " Comput. Phys. Comm. 178 (2008) 852."
228  << "\n"
229  << "\n"
230  << " Webpage: https://smash-transport.github.io"
231  << "\n"
232  << "\n"
233  << " Report issues at https://github.com/smash-transport/smash"
234  << "\n"
235  << " or contact us by email at elfner@itp.uni-frankfurt.de"
236  << "\n"
237  << "\n"
238  << "###################################################################"
239  << "############"
240  << "\n"
241  << "\n";
242 }
243 
249 struct OutputDirectoryExists : public std::runtime_error {
250  using std::runtime_error::runtime_error;
251 };
258 struct OutputDirectoryOutOfIds : public std::runtime_error {
259  using std::runtime_error::runtime_error;
260 };
261 
264  const bf::path p = bf::absolute("data");
265  if (!bf::exists(p)) {
266  return p / "0";
267  }
268  bf::path p2;
269  for (int id = 0; id < std::numeric_limits<int>::max(); ++id) {
270  p2 = p / std::to_string(id);
271  if (!bf::exists(p2)) {
272  break;
273  }
274  }
275  if (p == p2) {
276  throw OutputDirectoryOutOfIds("no unique data subdir ID left");
277  }
278  return p2;
279 }
280 
287 void ensure_path_is_valid(const bf::path &path) {
288  if (bf::exists(path)) {
289  if (!bf::is_directory(path)) {
290  throw OutputDirectoryExists("The given path (" + path.native() +
291  ") exists, but it is not a directory.");
292  }
293  } else {
294  if (!bf::create_directories(path)) {
295  throw OutputDirectoryExists(
296  "Race condition detected: The directory " + path.native() +
297  " did not exist a few cycles ago, but was created in the meantime by "
298  "a different process.");
299  }
300  }
301 }
302 
311  return ScatterActionsFinder(configuration, params);
312 }
313 
323  const std::string smash_version = "1.8";
324  const std::set<std::string> compatible_config_versions = {"1.8"};
325 
326  const std::string config_version = configuration.read({"Version"});
327 
328  if (compatible_config_versions.find(config_version) ==
329  compatible_config_versions.end()) {
330  std::stringstream err;
331  err << "The version of the configuration file (" << config_version
332  << ") is not compatible with the SMASH version (" << smash_version
333  << ").\nThe following config versions are supported:\n";
334  for (auto it : compatible_config_versions) {
335  err << it << " ";
336  }
337  err << "\nPlease consider updating your config or using a compatible SMASH"
338  " version.";
339  throw std::runtime_error(err.str());
340  }
341 }
342 
347  const std::string report = configuration.unused_values_report();
348 
349  if (report != "{}") {
350  throw std::runtime_error(
351  "The following configuration values were not used:\n" + report);
352  }
353 }
354 
362  for (const std::string s :
363  {"Version", "particles", "decaymodes", "Modi", "General", "Output",
364  "Lattice", "Potentials", "Forced_Thermalization"}) {
365  if (configuration.has_value({s.c_str()})) {
366  configuration.take({s.c_str()});
367  }
368  }
369 }
370 
376 }
377 
382  sha256::Hash hash,
383  bf::path tabulations_path) {
385  logg[LMain].info("Tabulating cross section integrals...");
386  IsoParticleType::tabulate_integrals(hash, tabulations_path);
387 }
388 
389 } // unnamed namespace
390 
391 } // namespace smash
392 
403 int main(int argc, char *argv[]) {
404  using namespace smash; // NOLINT(build/namespaces)
405 
406  constexpr option longopts[] = {
407  {"config", required_argument, 0, 'c'},
408  {"decaymodes", required_argument, 0, 'd'},
409  {"endtime", required_argument, 0, 'e'},
410  {"force", no_argument, 0, 'f'},
411  {"help", no_argument, 0, 'h'},
412  {"inputfile", required_argument, 0, 'i'},
413  {"modus", required_argument, 0, 'm'},
414  {"particles", required_argument, 0, 'p'},
415  {"output", required_argument, 0, 'o'},
416  {"list-2-to-n", no_argument, 0, 'l'},
417  {"resonance", required_argument, 0, 'r'},
418  {"cross-sections", required_argument, 0, 's'},
419  {"cross-sections-fs", required_argument, 0, 'S'},
420  {"dump-iSS", no_argument, 0, 'x'},
421  {"version", no_argument, 0, 'v'},
422  {"no-cache", no_argument, 0, 'n'},
423  {"quiet", no_argument, 0, 'q'},
424  {nullptr, 0, 0, 0}};
425 
426  // strip any path to progname
427  const std::string progname = bf::path(argv[0]).filename().native();
428 
429  try {
430  bool force_overwrite = false;
431  bf::path output_path = default_output_path(), input_path("./config.yaml");
432  std::vector<std::string> extra_config;
433  char *particles = nullptr, *decaymodes = nullptr, *modus = nullptr,
434  *end_time = nullptr, *pdg_string = nullptr, *cs_string = nullptr;
435  bool list2n_activated = false;
436  bool resonance_dump_activated = false;
437  bool cross_section_dump_activated = false;
438  bool final_state_cross_sections = false;
439  bool particles_dump_iSS_format = false;
440  bool cache_integrals = true;
441 
442  // parse command-line arguments
443  int opt;
444  bool suppress_disclaimer = false;
445  while ((opt = getopt_long(argc, argv, "c:d:e:fhi:m:p:o:lr:s:S:xvnq",
446  longopts, nullptr)) != -1) {
447  switch (opt) {
448  case 'c':
449  extra_config.emplace_back(optarg);
450  break;
451  case 'd':
452  decaymodes = optarg;
453  break;
454  case 'f':
455  force_overwrite = true;
456  break;
457  case 'i':
458  input_path = optarg;
459  break;
460  case 'h':
461  usage(EXIT_SUCCESS, progname);
462  break;
463  case 'm':
464  modus = optarg;
465  break;
466  case 'p':
467  particles = optarg;
468  break;
469  case 'e':
470  end_time = optarg;
471  break;
472  case 'o':
473  output_path = optarg;
474  break;
475  case 'l':
476  list2n_activated = true;
477  suppress_disclaimer = true;
478  break;
479  case 'r':
480  resonance_dump_activated = true;
481  pdg_string = optarg;
482  suppress_disclaimer = true;
483  break;
484  case 'S':
485  final_state_cross_sections = true;
486  // fallthrough
487  case 's':
488  cross_section_dump_activated = true;
489  cs_string = optarg;
490  suppress_disclaimer = true;
491  break;
492  case 'x':
493  particles_dump_iSS_format = true;
494  suppress_disclaimer = true;
495  break;
496  case 'v':
497  std::printf(
498  "%s\n"
499  "Branch : %s\nSystem : %s\nCompiler : %s %s\n"
500  "Build : %s\nDate : %s\n",
501  VERSION_MAJOR, GIT_BRANCH, CMAKE_SYSTEM, CMAKE_CXX_COMPILER_ID,
502  CMAKE_CXX_COMPILER_VERSION, CMAKE_BUILD_TYPE, BUILD_DATE);
503  std::exit(EXIT_SUCCESS);
504  case 'n':
505  cache_integrals = false;
506  break;
507  case 'q':
508  suppress_disclaimer = true;
509  break;
510  default:
511  usage(EXIT_FAILURE, progname);
512  }
513  }
514 
515  // Abort if there are unhandled arguments left.
516  if (optind < argc) {
517  std::cout << argv[0] << ": invalid argument -- '" << argv[optind]
518  << "'\n";
519  usage(EXIT_FAILURE, progname);
520  }
521 
522  if (!suppress_disclaimer) {
524  }
525 
526  // Read in config file
527  Configuration configuration(input_path.parent_path(),
528  input_path.filename());
529  // Merge config passed via command line
530  for (const auto &config : extra_config) {
531  configuration.merge_yaml(config);
532  }
533 
534  // Set up logging
536  configuration.take({"Logging", "default"}, einhard::ALL));
537  create_all_loggers(configuration["Logging"]);
538 
540 
541  // check if version matches before doing anything else
543 
545  " create ParticleType and DecayModes");
546 
547  auto particles_and_decays =
548  load_particles_and_decaymodes(particles, decaymodes);
549  /* For particles and decaymodes: external file is superior to config.
550  * Hovever, warn in case of conflict.
551  */
552  if (configuration.has_value({"particles"}) && particles) {
553  logg[LMain].warn(
554  "Ambiguity: particles from external file ", particles,
555  " requested, but there is also particle list in the config."
556  " Using particles from ",
557  particles);
558  }
559  if (!configuration.has_value({"particles"}) || particles) {
560  configuration["particles"] = particles_and_decays.first;
561  }
562 
563  if (configuration.has_value({"decaymodes"}) && decaymodes) {
564  logg[LMain].warn(
565  "Ambiguity: decaymodes from external file ", decaymodes,
566  " requested, but there is also decaymodes list in the config."
567  " Using decaymodes from",
568  decaymodes);
569  }
570  if (!configuration.has_value({"decaymodes"}) || decaymodes) {
571  configuration["decaymodes"] = particles_and_decays.second;
572  }
573 
574  // Calculate a hash of the SMASH version, the particles and decaymodes.
575  const std::string version(VERSION_MAJOR);
576  const std::string particle_string = configuration["particles"].to_string();
577  const std::string decay_string = configuration["decaymodes"].to_string();
578  sha256::Context hash_context;
579  hash_context.update(version);
580  hash_context.update(particle_string);
581  hash_context.update(decay_string);
582  const auto hash = hash_context.finalize();
583  logg[LMain].info() << "Config hash: " << sha256::hash_to_string(hash);
584 
585  bf::path tabulations_path;
586  if (cache_integrals) {
587  tabulations_path = output_path.parent_path() / "tabulations";
588  bf::create_directories(tabulations_path);
589  logg[LMain].info() << "Tabulations path: " << tabulations_path;
590  } else {
591  tabulations_path = "";
592  }
593  if (list2n_activated) {
594  /* Print only 2->n, n > 1. Do not dump decays, which can be found in
595  * decaymodes.txt anyway */
596  configuration.merge_yaml("{Collision_Term: {Two_to_One: False}}");
597  logg[LMain].info() << "Tabulations path: " << tabulations_path;
598  initialize_particles_and_decays(configuration, hash, tabulations_path);
599  auto scat_finder = actions_finder_for_dump(configuration);
600 
603 
604  scat_finder.dump_reactions();
605  std::exit(EXIT_SUCCESS);
606  }
607  if (particles_dump_iSS_format) {
609  ParticleTypePtrList list;
610  list.clear();
611  for (const auto &ptype : ParticleType::list_all()) {
612  list.push_back(&ptype);
613  }
614  std::sort(list.begin(), list.end(),
616  return a->mass() < b->mass();
617  });
618  for (const ParticleTypePtr &ptype : list) {
619  if (ptype->pdgcode().is_lepton() || ptype->baryon_number() < 0) {
620  continue;
621  }
622  const auto &decay_modes = ptype->decay_modes();
623  const auto &modelist = decay_modes.decay_mode_list();
624  int ndecays = ptype->is_stable() ? 1 : modelist.size();
625  std::printf("%13i %s %10.5f %10.5f %5i %5i %5i %5i %5i %5i %5i %5i\n",
626  ptype->pdgcode().get_decimal(),
627  smash::utf8::fill_left(ptype->name(), 12, ' ').c_str(),
628  ptype->mass(), ptype->width_at_pole(),
629  ptype->pdgcode().spin_degeneracy(), ptype->baryon_number(),
630  ptype->strangeness(), ptype->pdgcode().charmness(),
631  ptype->pdgcode().bottomness(), ptype->isospin() + 1,
632  ptype->charge(), ndecays);
633  if (!ptype->is_stable()) {
634  for (const auto &decay : modelist) {
635  auto ptypes = decay->particle_types();
636  std::printf("%13i %13i %20.5f %13i %13i %13i %13i %13i\n",
637  ptype->pdgcode().get_decimal(), 2, decay->weight(),
638  ptypes[0]->pdgcode().get_decimal(),
639  ptypes[1]->pdgcode().get_decimal(), 0, 0, 0);
640  }
641  } else {
642  std::printf("%13i %13i %20.5f %13i %13i %13i %13i %13i\n",
643  ptype->pdgcode().get_decimal(), 1, 1.0,
644  ptype->pdgcode().get_decimal(), 0, 0, 0, 0);
645  }
646  }
647  std::exit(EXIT_SUCCESS);
648  }
649  if (resonance_dump_activated) {
650  // Ignore config values that don't make sense.
651  initialize_particles_and_decays(configuration, hash, tabulations_path);
652  const auto _dummy = ExperimentBase::create(configuration, "");
655 
656  PdgCode pdg(pdg_string);
657  const ParticleType &res = ParticleType::find(pdg);
659  std::exit(EXIT_SUCCESS);
660  }
661  if (cross_section_dump_activated) {
662  initialize_particles_and_decays(configuration, hash, tabulations_path);
663  std::string arg_string(cs_string);
664  std::vector<std::string> args = split(arg_string, ',');
665  const unsigned int n_arg = args.size();
666  if (n_arg != 2 && n_arg != 4 && n_arg < 5) {
667  throw std::invalid_argument("-s usage: pdg1,pdg2[,m1,m2[,sqrts1,...]]");
668  }
669  PdgCode pdg_a(args[0]), pdg_b(args[1]);
670  const ParticleType &a = ParticleType::find(pdg_a);
671  const ParticleType &b = ParticleType::find(pdg_b);
672  if (n_arg < 4) {
673  for (unsigned int i = 0; i < 4 - n_arg; i++) {
674  args.push_back("");
675  }
676  }
677  double ma = (args[2] == "") ? a.mass() : std::stod(args[2]);
678  double mb = (args[3] == "") ? b.mass() : std::stod(args[3]);
679  if (a.is_stable() && args[2] != "" && std::stod(args[2]) != a.mass()) {
680  ma = a.mass();
681  std::cerr << "Warning: pole mass is used for stable particle "
682  << a.name() << " instead of " << args[2] << std::endl;
683  }
684  if (b.is_stable() && args[3] != "" && std::stod(args[3]) != b.mass()) {
685  mb = b.mass();
686  std::cerr << "Warning: pole mass is used for stable particle "
687  << b.name() << " instead of " << args[3] << std::endl;
688  }
689  const size_t plab_size = n_arg <= 4 ? 0 : n_arg - 4;
690  std::vector<double> plab;
691  plab.reserve(plab_size);
692  for (size_t i = 4; i < n_arg; i++) {
693  plab.push_back(std::stod(args.at(i)));
694  }
695  auto scat_finder = actions_finder_for_dump(configuration);
696 
699 
700  scat_finder.dump_cross_sections(a, b, ma, mb, final_state_cross_sections,
701  plab);
702  std::exit(EXIT_SUCCESS);
703  }
704  if (modus) {
705  configuration["General"]["Modus"] = std::string(modus);
706  }
707  if (end_time) {
708  configuration["General"]["End_Time"] = std::abs(std::atof(end_time));
709  }
710 
711  int64_t seed = configuration.read({"General", "Randomseed"});
712  if (seed < 0) {
713  configuration["General"]["Randomseed"] = random::generate_63bit_seed();
714  }
715 
716  // Check output path
717  ensure_path_is_valid(output_path);
718  const bf::path lock_path = output_path / "smash.lock";
719  FileLock lock(lock_path);
720  if (!lock.acquire()) {
721  throw std::runtime_error(
722  "Another instance of SMASH is already writing to the specified "
723  "output directory. If you are sure this is not the case, remove \"" +
724  lock_path.native() + "\".");
725  }
726  logg[LMain].debug("output path: ", output_path);
727  if (!force_overwrite && bf::exists(output_path / "config.yaml")) {
728  throw std::runtime_error(
729  "Output directory would get overwritten. Select a different output "
730  "directory, clean up, or tell SMASH to ignore existing files.");
731  }
732 
733  /* Keep a copy of the configuration that was used in the output directory
734  * also save information about SMASH build as a comment */
735  bf::ofstream(output_path / "config.yaml")
736  << "# " << VERSION_MAJOR << '\n'
737  << "# Branch : " << GIT_BRANCH << '\n'
738  << "# System : " << CMAKE_SYSTEM << '\n'
739  << "# Compiler : " << CMAKE_CXX_COMPILER_ID << ' '
740  << CMAKE_CXX_COMPILER_VERSION << '\n'
741  << "# Build : " << CMAKE_BUILD_TYPE << '\n'
742  << "# Date : " << BUILD_DATE << '\n'
743  << configuration.to_string() << '\n';
745  " create ParticleType and DecayModes");
746  initialize_particles_and_decays(configuration, hash, tabulations_path);
747 
748  // Create an experiment
749  logg[LMain].trace(SMASH_SOURCE_LOCATION, " create Experiment");
750  auto experiment = ExperimentBase::create(configuration, output_path);
751 
752  // Version value is not used in experiment. Get rid of it to prevent
753  // warning.
754  configuration.take({"Version"});
756 
757  // Run the experiment
758  logg[LMain].trace(SMASH_SOURCE_LOCATION, " run the Experiment");
759  experiment->run();
760  } catch (std::exception &e) {
761  logg[LMain].fatal() << "SMASH failed with the following error:\n"
762  << e.what();
763  return EXIT_FAILURE;
764  }
765 
766  logg[LMain].trace() << SMASH_SOURCE_LOCATION << " about to return from main";
767  return 0;
768 }
Interface to the SMASH configuration files.
bool has_value(std::initializer_list< const char * > keys) const
Returns whether there is a non-empty value behind the requested keys.
void merge_yaml(const std::string &yaml)
Merge the configuration in yaml into the existing tree.
std::string to_string() const
Returns a YAML string of the current tree.
std::string unused_values_report() const
Returns a string listing the key/value pairs that have not been taken yet.
Value take(std::initializer_list< const char * > keys)
The default interface for SMASH to read configuration values.
Value read(std::initializer_list< const char * > keys) const
Additional interface for SMASH to read configuration values without removing them.
static void load_decaymodes(const std::string &input)
Loads the DecayModes map as described in the input string.
Definition: decaymodes.cc:164
Guard to create a file lock.
Definition: filelock.h:30
bool acquire()
Try to acquire the file lock.
Definition: filelock.cc:20
static void tabulate_integrals(sha256::Hash hash, const bf::path &tabulations_path)
Tabulate all relevant integrals.
A pointer-like interface to global references to ParticleType objects.
Definition: particletype.h:665
Particle type contains the static properties of a particle species.
Definition: particletype.h:97
void dump_width_and_spectral_function() const
Prints out width and spectral function versus mass to the standard output.
static void check_consistency()
const std::string & name() const
Definition: particletype.h:141
bool is_stable() const
Definition: particletype.h:239
double mass() const
Definition: particletype.h:144
static void create_type_list(const std::string &particles)
Initialize the global ParticleType list (list_all) from the given input data.
PdgCode stores a Particle Data Group Particle Numbering Scheme particle type number.
Definition: pdgcode.h:108
A simple scatter finder: Just loops through all particles and checks each pair for a collision.
A SHA256 context.
Definition: sha256.h:28
void update(uint8_t const *buffer, size_t buffer_size)
Add data to the SHA256 context.
Definition: sha256.cc:153
Hash finalize()
Performs the final calculation of the hash and returns the digest (32 byte buffer containing 256bit h...
Definition: sha256.cc:185
#define SMASH_SOURCE_LOCATION
Hackery that is required to output the location in the source code where the log statement occurs.
Definition: logging.h:243
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > logg
An array that stores all pre-configured Logger objects.
Definition: logging.cc:39
void set_default_loglevel(einhard::LogLevel level)
Set the default log level (what will be returned from subsequent default_loglevel calls).
Definition: logging.cc:24
void create_all_loggers(Configuration config)
Called from main() right after the Configuration object is fully set up to create all logger objects ...
Definition: logging.cc:118
Configuration configuration(std::string overrides={})
Return a configuration object filled with data from src/config.yaml.
Definition: setup.h:173
std::unique_ptr< ExperimentBase > experiment(const Configuration &c=configuration())
Create an experiment.
Definition: setup.h:187
@ ALL
Log all message.
Definition: einhard.hpp:106
void ignore_simulation_config_values(Configuration &configuration)
Remove all config values that are only needed for simulations.
Definition: smash.cc:361
ScatterActionsFinder actions_finder_for_dump(Configuration configuration)
Prepares ActionsFinder for cross-section and reaction dumps.
Definition: smash.cc:309
void check_for_unused_config_values(const Configuration &configuration)
Checks if there are unused config values.
Definition: smash.cc:346
void ensure_path_is_valid(const bf::path &path)
Ensures the output path is valid.
Definition: smash.cc:287
void print_disclaimer()
Print the disclaimer.
Definition: smash.cc:177
void initialize_particles_and_decays(Configuration &configuration, sha256::Hash hash, bf::path tabulations_path)
Initialize the particles and decays from the configuration, the hash and the path to the cashed reson...
Definition: smash.cc:381
void check_config_version_is_compatible(Configuration configuration)
Checks if the SMASH version is compatible with the version of the configuration file.
Definition: smash.cc:322
constexpr int p
Proton.
int64_t generate_63bit_seed()
Generates a seed with a truly random 63-bit value, if possible.
Definition: random.cc:18
std::array< uint8_t, HASH_SIZE > Hash
A SHA256 hash.
Definition: sha256.h:25
std::string hash_to_string(Hash hash)
Convert a SHA256 hash to a hexadecimal string.
Definition: sha256.cc:230
std::string fill_left(const std::string &s, size_t width, char fill=' ')
Fill string with characters to the left until the given width is reached.
Definition: action.h:24
std::vector< std::string > split(const std::string &s, char delim)
Split string by delimiter.
std::pair< std::string, std::string > load_particles_and_decaymodes(const char *particles_file, const char *decaymodes_file)
Loads particles and decaymodes from provided files particles_file and decaymodes_file.
void setup_default_float_traps()
Setup the floating-point traps used throughout SMASH.
static constexpr int LMain
Definition: experiment.h:87
ExperimentParameters create_experiment_parameters(Configuration config)
Gathers all general Experiment parameters.
Definition: experiment.cc:474
int main(int argc, char *argv[])
Main program Smashes Many Accelerated Strongly-Interacting Hadrons :-)
Definition: smash.cc:403
Helper structure for Experiment.
Exception class that is thrown, if the requested output directory already exists and -f was not speci...
Definition: smash.cc:249
Exception class that is thrown, if no new output path can be generated (there is a directory name for...
Definition: smash.cc:258