Skip to content

Commit c58daa7

Browse files
committed
Fix rate tables for r_li7_pa_he4
Works on #497 The problem occurs when using a custom rate table for for r_li7_pa_he4 in that we could not find the rate id in the reaclib data. During normal operation we dont look up the rate in reaclib as it has a hard coded rate id and we use a function call in set_raw_rate to get the rate value, rather than use reaclib. But when we load the rate from a table we do need to do a lookup on reaclib to know the forward and reverse rate id. But the code for working out the handle for a rate was assuming this rate was still r_li7_p_to_he4_he4 as we had two identical outputs, rather than marking it as an _ap reaction. Thus we could never find the rate in reaclib. Reported-by Hannah Brinkman
1 parent 6cea2d1 commit c58daa7

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

rates/private/raw_rates.f90

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,10 @@ subroutine eval_table_reverse(ir, rir, tf, temp, fr, rr, ierr)
909909
dlambda_dlnT = 0d0
910910

911911
call do_reaclib_indices_for_reaction(reaction_name(rir), reaclib_rates, lo, hi, ierr)
912-
if(ierr/=0) return
912+
if(ierr/=0) then
913+
write(*,*) "Error: Could not get reaclib index for rate ",rir, ' ',trim(reaction_name(rir))
914+
return
915+
end if
913916

914917
inv_lambda = 0d0
915918
dinv_lambda_dlnT = 0d0

rates/private/reaclib_support.f90

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,8 +636,22 @@ end function two_one
636636

637637
logical function two_two()
638638
two_two = .true.
639-
if (in1 == 0 .or. in2 == 0 .or. out1 == 0 .or. out2 == 0 .or. &
640-
in1 == in2 .or. out1 == out2) return
639+
640+
if (in1 == 0 .or. in2 == 0 .or. out1 == 0 .or. out2 == 0) return
641+
642+
! Special case r_li7_pa_he4, this must come first otherwise the out1==out2
643+
! check will label this rate as a _to_ reaction instead of an _ap reaction
644+
if (nuclides% Z(in1) == 1 .and. nuclides% N(in1) == 0 .and. &
645+
nuclides% Z(out1) == 2 .and. nuclides% N(out1) == 2 .and. &
646+
nuclides% Z(out2) == 2 .and. nuclides% N(out2) == 2 .and. &
647+
nuclides% Z(in2) == 3 .and. nuclides% N(in2) == 4) then
648+
handle = trim(handle) // '_pa'
649+
two_two = .false.
650+
return
651+
end if
652+
653+
if(in1==in2 .or. out1==out2) return
654+
641655
two_two = .false.
642656
if (nuclides% Z(in1) == 2 .and. nuclides% N(in1) == 2 .and. &
643657
nuclides% Z(out1) == 1 .and. nuclides% N(out1) == 0 .and. &

0 commit comments

Comments
 (0)