95 std::string particle_list_file_directory =
96 config.
take({
"Custom",
"File_Directory"});
98 std::string particle_list_file_name = config.
take({
"Custom",
"File_Name"});
101 throw std::runtime_error(
102 "Your Particle List is already filled before reading in from the " 104 "Something went wrong. Please check your config.");
113 std::map<PdgCode, int> particle_list = config.
take({
"Particles"});
114 for (
const auto& particle : particle_list)
120 const std::string path =
121 file_path(particle_list_file_directory, particle_list_file_name);
125 }
else if (!same_file) {
142 for (
const auto& it : vec) {
144 if (it.isospin == 1) {
146 }
else if (it.isospin == 0) {
149 throw std::runtime_error(
150 "Your particles charges are not 1 = proton or 0 = neutron." 151 "Check whether your list is correct or there is an error.");
155 double current_mass = current_type.
mass();
157 particles_.back().set_4momentum(current_mass, 0.0, 0.0, 0.0);
179 return nucleon_position;
189 for (
auto i =
begin(); i !=
end(); i++) {
191 i->set_4momentum(i->pole_mass(), 0.0, 0.0, 0.0);
204 const auto& log = logger<LogArea::Collider>();
205 log.warn() <<
"Fermi motion activated with a custom nucleus.\n";
206 log.warn() <<
"Be aware that generating the Fermi momenta\n" 207 <<
"assumes nucleons distributed according to a\n" 208 <<
"Woods-Saxon distribution.";
212 const std::string& file_name) {
213 if (file_directory.back() ==
'/') {
214 return file_directory + file_name;
216 return file_directory +
'/' + file_name;
221 int particle_number)
const {
222 int A = particle_number;
224 std::vector<Nucleoncustom> custom_nucleus;
226 for (
int i = 0; i < A; ++i) {
227 std::getline(infile, line);
231 infile.seekg(0, infile.beg);
232 std::getline(infile, line);
235 std::istringstream iss(line);
236 if (!(iss >> nucleon.
x >> nucleon.
y >> nucleon.
z >>
238 throw std::runtime_error(
239 "SMASH could not read in a line from your initial nuclei input file." 240 "Check if your file has the following format: x y z spinprojection " 244 custom_nucleus.push_back(nucleon);
246 return custom_nucleus;
double euler_psi_
Euler angel psi.
void generate_fermi_momenta() override
Generates Fermi momenta as it is done in the mother class but in addition prints a warning that the F...
std::vector< Nucleoncustom > readfile(std::ifstream &infile, int particle_number) const
The returned vector contains Data for one nucleus given in the particlelist.
The ThreeVector class represents a physical three-vector with the components .
bool isospin
to differentiate between protons isospin=1 and neutrons isospin=0
std::vector< Nucleoncustom > custom_nucleus_
Vector contianing Data for one nucleus given in the particlelist.
Collection of useful constants that are known at compile time.
double euler_phi_
Euler angel phi.
size_t index
Index needed to read out vector in distribute nucleon.
int number_of_nucleons_
Number of Nucleons per Nucleus Set initally to zero to be modified in the constructor.
CustomNucleus(Configuration &config, int testparticles, bool same_file)
Constructor that needs configuration parameters from input file and the number of testparticles...
std::unique_ptr< std::ifstream > filestream_
Filestream variable used if projectile and target are read in from different files and they therefore...
Interface to the SMASH configuration files.
static const ParticleType & find(PdgCode pdgcode)
Returns the ParticleType object for the given pdgcode.
void arrange_nucleons() override
Sets the positions of the nucleons inside a nucleus.
Contains data for one nucleon that is read in from the list.
std::string file_path(const std::string &file_directory, const std::string &file_name)
Generates the name of the stream file.
Value take(std::initializer_list< const char * > keys)
The default interface for SMASH to read configuration values.
static std::unique_ptr< std::ifstream > filestream_shared_
Filestream variable used if projectile and target are read in from the same file and they use the sam...
Particle type contains the static properties of a particle species.
virtual void generate_fermi_momenta()
Generates momenta according to Fermi motion for the nucleons.
PdgCode stores a Particle Data Group Particle Numbering Scheme particle type number.
double euler_theta_
Euler angel theta.
bool spinprojection
spinprojection of the nucleon
void random_euler_angles()
Randomly generate Euler angles.
void fill_from_list(const std::vector< Nucleoncustom > &vec)
Fills Particlelist from vector containing data for one nucleus.
std::unique_ptr< std::ifstream > * used_filestream_
Pointer to the used filestream pointer.
std::vector< ParticleData > particles_
Particles associated with this nucleus.
std::vector< ParticleData >::iterator begin()
For iterators over the particle list:
virtual void set_parameters_automatic()
Sets the deformation parameters of the Woods-Saxon distribution according to the current mass number...
The FourVector class holds relevant values in Minkowski spacetime with (+, −, −, −) metric signature.
void align_center()
Shifts the nucleus so that its center is at (0,0,0)
ThreeVector distribute_nucleon() override
Returns position of a nucleon as given in the external file.
void rotate(double phi, double theta, double psi)
Rotate vector by the given Euler angles phi, theta, psi.
std::vector< ParticleData >::iterator end()
For iterators over the particle list: