92 std::string fd = config.
take({
"Custom",
"File_Directory"});
95 std::string fn = config.
take({
"Custom",
"File_Name"});
99 throw std::runtime_error(
100 "Your Particle List is already filled before reading in from the " 102 "Something went wrong. Please check your config.");
111 std::map<PdgCode, int> particle_list = config.
take({
"Particles"});
112 for (
const auto& particle : particle_list)
131 for (
const auto& it : vec) {
133 if (it.isospin == 1) {
135 }
else if (it.isospin == 0) {
138 throw std::runtime_error(
139 "Your particles charges are not 1 = proton or 0 = neutron." 140 "Check whether your list is correct or there is an error.");
144 double current_mass = current_type.
mass();
146 particles_.back().set_4momentum(current_mass, 0.0, 0.0, 0.0);
162 const std::string& file_name) {
163 if (file_directory.back() ==
'/') {
164 return file_directory + file_name;
166 return file_directory +
'/' + file_name;
171 int particle_number)
const {
172 int A = particle_number;
174 std::vector<Nucleoncustom> nucleon;
176 while (std::getline(infile, line)) {
178 std::istringstream iss(line);
181 throw std::runtime_error(
182 "SMASH could not read in a line from your initial nuclei input file." 183 "Check if your file has follwing format: x y z spinprojection " 187 nucleon.push_back(nuc);
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 .
std::vector< Nucleoncustom > custom_nucleon_
Vector contianing Data for one nucleus given in the particlelist.
bool isospin
to differentiate between protons isospin=1 and neutrons isospin=0
static bool checkfileopen_
Bool variable to check if the file was already opened.
size_t index
Index needed to read out vector in distribute nucleon.
int number_of_nucleons_
of Nucleons per Nucleus Set initally to zero to be modified in the constructor.
Interface to the SMASH configuration files.
static std::string streamfile(const std::string &file_directory, const std::string &file_name)
Generates the name of the stream file.
static const ParticleType & find(PdgCode pdgcode)
Returns the ParticleType object for the given pdgcode.
Contains data for one nucleon that is read in from the list.
Value take(std::initializer_list< const char * > keys)
The default interface for SMASH to read configuration values.
Particle type contains the static properties of a particle species.
PdgCode stores a Particle Data Group Particle Numbering Scheme particle type number.
static std::unique_ptr< std::ifstream > filestream_
Variable carrying the output of the streamfile function.
bool spinprojection
spinprojection of the nucleon
void fill_from_list(const std::vector< Nucleoncustom > &vec)
Fills Particlelist from vector containing data for one nucleus.
CustomNucleus(Configuration &config, int testparticles)
Constructor that needs configuration parameters from input file and the number of testparticles...
std::vector< ParticleData > particles_
Particles associated with this nucleus.
std::string particle_list_file_directory_
Directory where the nucleon configurations are located.
std::string particle_list_file_name_
File name of the nucleon configurations.
virtual void set_parameters_automatic()
Sets the deformation parameters of the Woods-Saxon distribution according to the current mass number...
ThreeVector distribute_nucleon() override
Returns position of a nucleon as given in the external file.