34 integer,
dimension(11) :: idx_daughter
53 character(len=4),
allocatable,
dimension(:),
private ::
src_ignore
97 if ( alloc_stat /= 0)
call raise_exception(
'Allocation of "beta_pn" failed',&
98 "init_ext_beta_rates",&
108 if (verbose_level .ge. 1)
then
109 call write_data_to_std_out(
"Amount beta-decay format rates",int_to_str(
nbeta_pn*11))
129 integer,
intent(inout) :: rrate_length
130 integer :: alloc_stat
136 if (.not.
allocated(rrate_array))
then
142 allocate(rrate_array(
nbeta),stat=alloc_stat)
143 if ( alloc_stat /= 0)
call raise_exception(
'Allocation of "rrate_array" failed.',&
144 "merge_beta_decays",&
155 if (alloc_stat .ne. 0)
call raise_exception(
'Deallocation of "beta_decays" failed',&
156 "merge_beta_decays", 120002)
174 integer,
intent(in) :: rrate_length
176 type(
beta_pn_type),
dimension(:),
allocatable :: rrate_tmp
180 integer :: z_tmp,n_tmp
181 integer :: replace_count
182 logical,
dimension(:),
allocatable :: mask
189 if (istat .ne. 0)
call raise_exception(
'Allocation of "mask" failed',
"ignore_reactions",&
197 if ((.not. rrate_array(j)%is_weak) .or. &
198 (.not. rrate_array(j)%reac_type .eq.
rrt_betm) .or. &
199 (.not. rrate_array(j)%group .eq. 1)) cycle
200 if (rrate_array(j)%parts(1) .ne.
beta_pn(i)%idx_parent) cycle
203 if (any(
src_ignore .eq. adjustr(rrate_array(j)%source)))
then
204 replace_count = replace_count+1
210 if (replace_count .gt. 0)
then
213 if (verbose_level .ge. 2)
then
214 print*,
"Ignoring "//
int_to_str(replace_count)//
" beta-decay rates by source criterium (beta_decay_src_ignore)."
221 if (istat .ne. 0)
call raise_exception(
'Deallocation of "beta_pn" failed',
"ignore_reactions",&
228 if (istat .ne. 0)
call raise_exception(
'Allocation of "beta_pn" failed',
"ignore_reactions",&
234 deallocate(rrate_tmp,stat=istat)
235 if (istat .ne. 0)
call raise_exception(
'Deallocation of "rrate_tmp" failed',
"ignore_reactions",&
239 if (verbose_level .ge. 2)
then
240 print*,
"Warning: Specified 'beta_decay_src_ignore', but no rate ignored."
263 integer,
intent(in) :: sourcefile
265 real(
r_kind),
dimension(11) :: pn
266 character(5) :: parent
280 read(sourcefile,*, iostat = read_stat) parent,halflife
281 read(sourcefile,*, iostat = read_stat) pn(1:11)
282 index_tmp =
benam(parent)
283 if (read_stat /= 0)
exit
284 if (index_tmp .eq. 0) cycle
289 z_tmp =
isotope(index_tmp)%p_nr
290 n_tmp =
isotope(index_tmp)%n_nr
291 a_tmp = z_tmp + n_tmp
294 index_tmp =
findaz(a_tmp-(j-1),z_tmp+1)
295 if (index_tmp .ne. -1)
exit
298 if (j .ne. 12) count = count + 1
318 logical,
dimension(:),
allocatable :: mask,mask_bet
320 integer :: replace_count
323 integer :: length_rate_array
324 integer :: nbeta_clean
328 info_entry(
"remove_weak_rates")
330 allocate(mask(length_rate_array),stat=istat)
331 if (istat .ne. 0)
call raise_exception(
'Allocation of "mask" failed',
"remove_weak_rates",&
335 do i = 1 , length_rate_array
336 if ((.not. rrate_array(i)%is_weak) .or. &
337 (.not. rrate_array(i)%reac_type .eq.
rrt_betm)) cycle
339 if (
beta_pn(j)%idx_parent .eq. rrate_array(i)%parts(1))
then
342 if (rrate_array(i)%parts(k) .eq. 0)
exit part_loop
347 if (
beta_pn(j)%idx_daughter(m) .eq. -1) cycle parts_bet
349 if ((
beta_pn(j)%idx_daughter(m) .eq. rrate_array(i)%parts(k)) &
350 .or. (rrate_array(i)%parts(k) .eq.
ineu))
then
357 if (delete .eqv. .false.)
exit part_loop
362 replace_count = replace_count + 1
368 if (verbose_level.ge.2)
then
369 print*,
'Replacing ',replace_count,
' weak rates!'
373 if ((replace_count .gt. 0) .or. (
nbeta_pn .gt. 0))
then
380 if (istat .ne. 0)
call raise_exception(
'Deallocation of "beta_pn" failed',
"remove_weak_rates",&
384 allocate(rrate_tmp(length_rate_array-replace_count),stat=istat)
385 if (istat .ne. 0)
call raise_exception(
'Allocation of "rrate_tmp" failed',
"remove_weak_rates",&
388 rrate_tmp = pack(rrate_array,mask)
390 deallocate(rrate_array,stat=istat)
391 if (istat .ne. 0)
call raise_exception(
'Deallocation of "rrate" failed',
"remove_weak_rates",&
393 length_rate_array = length_rate_array-replace_count
395 allocate(rrate_array(length_rate_array+
nbeta),stat=istat)
396 if (istat .ne. 0)
call raise_exception(
'Allocation of "rrate" failed',
"remove_weak_rates",&
399 rrate_array(1:length_rate_array) = rrate_tmp(1:length_rate_array)
401 length_rate_array = length_rate_array +
nbeta
403 deallocate(rrate_tmp,stat=istat)
404 if (istat .ne. 0)
call raise_exception(
'Deallocation of "rrate_tmp" failed',
"remove_weak_rates",&
408 info_exit(
"remove_weak_rates")
426 integer,
intent(out) :: rrate_beta_length
436 if (
beta_pn(i)%pn(j) .eq. 0) cycle pn_loop
441 rrate_beta_length = count
444 allocate(rrate_beta(count),stat=istat)
445 if (istat .ne. 0)
call raise_exception(
'Allocation of "rrate_beta" failed',
"create_rrate_array",&
452 if (
beta_pn(i)%pn(j) .eq. 0) cycle pn_loop2
454 rrate_beta(count)%parts(:) = 0
455 rrate_beta(count)%source =
"wext"
456 rrate_beta(count)%is_reverse = .false.
457 rrate_beta(count)%cached = -1
458 rrate_beta(count)%is_resonant = .false.
459 rrate_beta(count)%is_weak = .true.
460 rrate_beta(count)%is_const = .true.
461 rrate_beta(count)%q_value =
beta_pn(i)%Qval(j)
462 rrate_beta(count)%reac_src =
rrs_wext
463 rrate_beta(count)%reac_type =
rrt_betm
464 rrate_beta(count)%param(:) = 0.0d0
465 rrate_beta(count)%one_over_n_fac = 1.0d0
468 if ((
beta_pn(i)%Av_Qtot .eq. -1) .or. (
beta_pn(i)%Av_Qnu .eq. -1))
then
482 rrate_beta(count)%group = min(j,2)
483 rrate_beta(count)%parts(1) =
beta_pn(i)%idx_parent
484 rrate_beta(count)%ch_amount(1) = -1
487 rrate_beta(count)%parts(2) =
beta_pn(i)%idx_daughter(j)
488 rrate_beta(count)%ch_amount(2) = 1
490 rrate_beta(count)%parts(2) =
ineu
491 rrate_beta(count)%parts(3) =
beta_pn(i)%idx_daughter(j)
492 rrate_beta(count)%ch_amount(2) = j-1
493 rrate_beta(count)%ch_amount(3) = 1
497 rrate_beta(count)%param(1) = dlog(
beta_pn(i)%Pn(j)*(dlog(2.0d0)/
beta_pn(i)%halflife))
538 integer,
intent(in) :: sourcefile
540 real(
r_kind),
dimension(11) :: pn
541 character(5) :: parent
553 character(200) :: helper
554 integer :: par_ind_tmp
560 info_entry(
"read_beta_decays")
566 read(sourcefile,
"(A)", iostat = read_stat) helper
569 if ((helper(i-1:i-1) .ne.
' ') .and. (helper(i:i) .eq.
' '))
then
571 col_count = col_count +1
576 if (col_count .eq. 2)
then
578 else if (col_count .eq. 4)
then
581 call raise_exception(
'First line of the beta decay file has an incompatible amount of columns. '//&
582 'It should be either 2 or 4, but got '//
int_to_str(col_count)//
".",&
591 if (fformat .eq. 1)
then
592 read(sourcefile,*, iostat = read_stat) parent,halflife
595 elseif (fformat .eq. 2)
then
596 read(sourcefile,*, iostat = read_stat) parent,halflife,qtot,qnu
598 read(sourcefile,*, iostat = read_stat) pn(1:11)
600 if (read_stat /= 0)
exit read_loop
601 par_ind_tmp =
benam(parent)
602 if (par_ind_tmp .eq. 0) cycle read_loop
606 z_tmp =
isotope(par_ind_tmp)%p_nr
607 n_tmp =
isotope(par_ind_tmp)%n_nr
608 a_tmp = z_tmp + n_tmp
612 index_tmp =
findaz(a_tmp-(j-1),z_tmp+1)
613 if (index_tmp .ne. -1)
exit
618 if (j .eq. 12) cycle read_loop
625 beta_pn(i)%idx_parent = par_ind_tmp
632 index_tmp =
findaz(a_tmp-(j-1),z_tmp+1)
633 beta_pn(i)%idx_daughter(j) = index_tmp
637 if (
beta_pn(i)%idx_daughter(j) .ne. -1)
then
644 if (
beta_pn(i)%idx_daughter(j) .eq. -1)
then
645 probnot = probnot +
beta_pn(i)%Pn(j)
649 if ((
beta_pn(i)%idx_daughter(j) .ne. -1) .and. (probnot .ne. 0))
then
656 if (probnot .ne. 0)
then
658 if (
beta_pn(i)%idx_daughter(j) .eq. -1)
then
659 probnot = probnot +
beta_pn(i)%Pn(j)
663 if ((
beta_pn(i)%idx_daughter(j) .ne. -1) .and. (probnot .ne. 0))
then
670 if (
beta_pn(i)%Av_Qtot .eq. -1)
then
677 if (probnot .ne. 0)
then
678 call raise_exception(
'No daughter nucleus of beta decay file seemed to be implemented.',&
683 info_exit(
"read_beta_decays")