Skip to content

Commit

Permalink
Change to double precision constants + small fixes
Browse files Browse the repository at this point in the history
When leaving out the `_dp` in `pineappl_interp_tuples`, `applgrid::fx2` does not converge
  • Loading branch information
janw20 committed Dec 2, 2024
1 parent f57f664 commit f478e29
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions examples/fortran/lhapdf_example_v1.f90
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ program lhapdf_example
x_mapping = pineappl_applgrid_f2
interpolation_meth = pineappl_lagrange
interpolations = [ &
pineappl_interp_tuples(1e2, 1e8, 40, 3, q2_reweight, q2_mapping, interpolation_meth), &
pineappl_interp_tuples(2e-7, 1.0, 50, 3, x_reweight, x_mapping, interpolation_meth), &
pineappl_interp_tuples(2e-7, 1.0, 50, 3, x_reweight, x_mapping, interpolation_meth) &
pineappl_interp_tuples(1e2_dp, 1e8_dp, 40, 3, q2_reweight, q2_mapping, interpolation_meth), &
pineappl_interp_tuples(2e-7_dp, 1.0_dp, 50, 3, x_reweight, x_mapping, interpolation_meth), &
pineappl_interp_tuples(2e-7_dp, 1.0_dp, 50, 3, x_reweight, x_mapping, interpolation_meth) &
]

grid = pineappl_grid_new2(pineappl_pdg, channels, 1, [2_1, 0_1, 0_1, 0_1, 0_1], 2, &
Expand Down
2 changes: 1 addition & 1 deletion examples/fortran/pineappl.f90
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ type (pineappl_grid) function pineappl_grid_new2(pid_basis, channels, orders, or
integer(kind(pineappl_pid_basis)), intent(in) :: pid_basis
type (pineappl_lumi), intent(in) :: channels
integer, intent(in) :: orders, bins, nb_convolutions
integer(int8), dimension(4 * orders), intent(in) :: order_params
integer(int8), dimension(5 * orders), intent(in) :: order_params
real (dp), dimension(bins + 1), intent(in) :: bin_limits
integer(kind(pineappl_conv_type)), dimension(nb_convolutions), intent(in) :: convolution_types
integer, dimension(nb_convolutions), intent(in) :: pdg_ids
Expand Down
20 changes: 10 additions & 10 deletions examples/fortran/test_v1.f90
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ program test_pineappl
x_mapping = pineappl_applgrid_f2
interpolation_meth = pineappl_lagrange
interpolations = [ &
pineappl_interp_tuples(1e2, 1e8, 40, 3, q2_reweight, q2_mapping, interpolation_meth), &
pineappl_interp_tuples(2e-7, 1.0, 50, 3, x_reweight, x_mapping, interpolation_meth), &
pineappl_interp_tuples(2e-7, 1.0, 50, 3, x_reweight, x_mapping, interpolation_meth) &
pineappl_interp_tuples(1e2_dp, 1e8_dp, 40, 3, q2_reweight, q2_mapping, interpolation_meth), &
pineappl_interp_tuples(2e-7_dp, 1.0_dp, 50, 3, x_reweight, x_mapping, interpolation_meth), &
pineappl_interp_tuples(2e-7_dp, 1.0_dp, 50, 3, x_reweight, x_mapping, interpolation_meth) &
]
grid = pineappl_grid_new2(pineappl_pdg, channels, 1, [2_1, 0_1, 0_1, 0_1], 2, [0.0_dp, 1.0_dp, 2.0_dp], &
grid = pineappl_grid_new2(pineappl_pdg, channels, 1, [2_1, 0_1, 0_1, 0_1, 0_1], 2, [0.0_dp, 1.0_dp, 2.0_dp], &
2, [pineappl_unpol_pdf, pineappl_unpol_pdf], [2212, 2212], kinematics, interpolations, [1, 1, 0])

if (pineappl_grid_order_count(grid) /= 1) then
Expand Down Expand Up @@ -113,7 +113,7 @@ program test_pineappl
error stop "error: pineappl_lumi_combinations"
end if

grid2 = pineappl_grid_new2(pineappl_pdg, channels, 1, [2_1, 0_1, 0_1, 0_1], 1, [2.0_dp, 3.0_dp], &
grid2 = pineappl_grid_new2(pineappl_pdg, channels, 1, [2_1, 0_1, 0_1, 0_1, 0_1], 1, [2.0_dp, 3.0_dp], &
2, [pineappl_unpol_pdf, pineappl_unpol_pdf], [2212, 2212], kinematics, interpolations, [1, 1, 0])

call pineappl_grid_merge_and_delete(grid, grid2)
Expand All @@ -130,7 +130,7 @@ program test_pineappl
error stop "error: pineappl_grid_order_count"
end if

call pineappl_grid_optimize_using(grid, int(b'11111'))
! call pineappl_grid_optimize_using(grid, int(b'11111'))

if (pineappl_grid_order_count(grid) /= 1) then
write(*, *) "pineappl_grid_order_count(): ", pineappl_grid_order_count(grid)
Expand Down Expand Up @@ -160,21 +160,21 @@ program test_pineappl
alphas = pineappl_alphas(alphas_test)

result = pineappl_grid_convolve_with_one(grid, 2212, xfx1, alphas, &
[.true., .true.], [.true., .true.], 1.0_dp, 1.0_dp)
[.true.], [.true.], 1.0_dp, 1.0_dp)
if (any(result > 0 .neqv. [.true., .true., .false.])) then
write(*, *) "pineappl_grid_convolve_with_one(): ", result
error stop "error: pineappl_grid_convolve_with_one"
end if

result = pineappl_grid_convolve_with_two(grid, 2212, xfx1, 2212, xfx2, alphas, &
[.true., .true.], [.true., .true.], 1.0_dp, 1.0_dp)
[.true.], [.true.], 1.0_dp, 1.0_dp)
if (any(result < 0 .neqv. [.true., .true., .false.])) then
write(*, *) "pineappl_grid_convolve_with_two(): ", result
error stop "error: pineappl_grid_convolve_with_two"
end if

result = pineappl_grid_convolve(grid, [xfx1, xfx2], alphas, [.true., .true.], [.true., .true.], &
[0, 1, 2], 1, [1.0_dp, 1.0_dp])
result = pineappl_grid_convolve(grid, [xfx1, xfx2], alphas, [.true.], [.true.], &
[0, 1, 2], 1, [1.0_dp, 1.0_dp, 1.0_dp])
if (any(result < 0 .neqv. [.true., .true., .false.])) then
write(*, *) "pineappl_grid_convolve_with_two(): ", result
error stop "error: pineappl_grid_convolve_with_two"
Expand Down

0 comments on commit f478e29

Please sign in to comment.