Merge branch 'develop' into mixed_ncrystal_pr

This commit is contained in:
Paul Romano 2023-01-09 13:13:11 +07:00
commit b6d6bdf3f5
166 changed files with 7699 additions and 4693 deletions

View file

@ -388,7 +388,14 @@ void sample_photon_reaction(Particle& p)
xs_lower(i_shell) + f * (xs_upper(i_shell) - xs_lower(i_shell)));
if (prob > cutoff) {
double E_electron = p.E() - shell.binding_energy;
// Determine binding energy based on whether atomic relaxation data is
// present (if not, use value from Compton profile data)
double binding_energy = element.has_atomic_relaxation_
? shell.binding_energy
: element.binding_energy_[i_shell];
// Determine energy of secondary electron
double E_electron = p.E() - binding_energy;
// Sample mu using non-relativistic Sauter distribution.
// See Eqns 3.19 and 3.20 in "Implementing a photon physics
@ -1149,7 +1156,7 @@ void inelastic_scatter(const Nuclide& nuc, const Reaction& rx, Particle& p)
// evaluate yield
double yield = (*rx.products_[0].yield_)(E_in);
if (std::floor(yield) == yield) {
if (std::floor(yield) == yield && yield > 0) {
// If yield is integral, create exactly that many secondary particles
for (int i = 0; i < static_cast<int>(std::round(yield)) - 1; ++i) {
p.create_secondary(p.wgt(), p.u(), p.E(), ParticleType::neutron);