14 #include <boost/filesystem.hpp>
102 file_{path /
"SMASH_IC.dat",
"w"},
106 "# %s initial conditions: hypersurface of constant proper time\n",
108 std::fprintf(file_.get(),
"# tau x y eta mt px py Rap pdg charge\n");
109 std::fprintf(file_.get(),
"# fm fm fm none GeV GeV GeV none none e\n");
115 std::fprintf(
file_.
get(),
"# event %i start\n", event_number + 1);
120 std::fprintf(
file_.
get(),
"# event %i end\n", event_number + 1);
124 if (particles.
size() != 0) {
126 "End time might be too small for initial conditions output. "
127 "Hypersurface has not yet been crossed by ",
128 particles.
size(),
" particle(s).");
133 const std::unique_ptr<Clock> &,
145 const double m_trans = sqrt(particle.type().mass() * particle.type().mass() +
146 particle.momentum()[1] * particle.momentum()[1] +
147 particle.momentum()[2] * particle.momentum()[2]);
149 const double rapidity =
150 0.5 * log((particle.momentum()[0] + particle.momentum()[3]) /
151 (particle.momentum()[0] - particle.momentum()[3]));
155 bool is_spectator = particle.get_history().collisions_per_particle == 0;
159 std::fprintf(
file_.
get(),
"%g %g %g %g %g %g %g %g %s %i \n",
160 particle.position().tau(), particle.position()[1],
161 particle.position()[2], particle.position().eta(), m_trans,
162 particle.momentum()[1], particle.momentum()[2], rapidity,
163 particle.pdgcode().string().c_str(), particle.type().charge());
171 const double next_proper_time = particle.position().tau();
173 throw std::runtime_error(
174 "Hypersurface proper time changed during evolution.");