Skip to content

Commit

Permalink
Update input.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeshingles committed Sep 9, 2024
1 parent 2743fb5 commit d7d2faa
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions input.cc
Original file line number Diff line number Diff line change
Expand Up @@ -591,21 +591,22 @@ void add_transitions_to_unsorted_linelist(const int element, const int ion, cons
const float f_ul = g_ratio * ME * pow(CLIGHT, 3) / (8 * pow(QE * nu_trans * PI, 2)) * transition.A;

const int nupperdowntrans = get_ndowntrans(element, ion, level);
auto &downtransition =
temp_alltranslist[globals::elements[element].ions[ion].levels[level].alltrans_startdown + nupperdowntrans];
auto &downtransition = temp_alltranslist[globals::elements[element].ions[ion].levels[level].alltrans_startdown +
nupperdowntrans - 1];

// this is what classic did, but it is not quite correct. The downtrans list should be searched to find the
// correct index, not just using the last one. It probably works for the case where the transitions are sorted,
// but the assertion tripped on C IV in the classic dataset.
// assert_always(downtransition.targetlevelindex == lowerlevel);
assert_always(downtransition.targetlevelindex == lowerlevel);

downtransition.einstein_A += transition.A;
downtransition.osc_strength += f_ul;
downtransition.coll_str = std::max(downtransition.coll_str, transition.coll_str);

const int nloweruptrans = get_nuptrans(element, ion, lowerlevel);
auto &uptransition =
temp_alltranslist[globals::elements[element].ions[ion].levels[lowerlevel].alltrans_startup + nloweruptrans];
temp_alltranslist[globals::elements[element].ions[ion].levels[lowerlevel].alltrans_startup + nloweruptrans -
1];

// as above, the downtrans list should be searched to find the correct index instead of using the last one.
// assert_always(uptransition.targetlevelindex == level);
Expand Down

0 comments on commit d7d2faa

Please sign in to comment.