Merge lp:~maddevelopers/mg5amcnlo/COLLIER into lp:~maddevelopers/mg5amcnlo/2.4.3

Proposed by Valentin Hirschi
Status: Superseded
Proposed branch: lp:~maddevelopers/mg5amcnlo/COLLIER
Merge into: lp:~maddevelopers/mg5amcnlo/2.4.3
Diff against target: 79117 lines (+70271/-2119)
170 files modified
Template/LO/Source/make_opts (+4/-4)
Template/NLO/SubProcesses/BinothLHA.f (+8/-4)
Template/NLO/SubProcesses/check_poles.f (+2/-0)
Template/NLO/SubProcesses/makefile_loop.inc (+1/-0)
Template/loop_material/StandAlone/Cards/MadLoopParams.dat (+81/-12)
Template/loop_material/StandAlone/SubProcesses/MadLoopCommons.inc (+151/-6)
Template/loop_material/StandAlone/SubProcesses/MadLoopParamReader.f (+64/-7)
Template/loop_material/StandAlone/SubProcesses/MadLoopParams.inc (+12/-5)
Template/loop_material/StandAlone/SubProcesses/makefile (+2/-0)
input/.mg5_configuration_default.txt (+7/-2)
madgraph/interface/amcatnlo_run_interface.py (+1/-1)
madgraph/interface/loop_interface.py (+4/-2)
madgraph/interface/madevent_interface.py (+4/-4)
madgraph/interface/madgraph_interface.py (+32/-6)
madgraph/iolibs/export_fks.py (+42/-12)
madgraph/iolibs/export_v4.py (+58/-18)
madgraph/iolibs/template_files/loop/check_sa.inc (+1/-0)
madgraph/iolibs/template_files/loop/check_sa_loop_induced.inc (+1/-0)
madgraph/iolibs/template_files/loop_optimized/COLLIER_interface.inc (+646/-0)
madgraph/iolibs/template_files/loop_optimized/CT_interface.inc (+8/-8)
madgraph/iolibs/template_files/loop_optimized/GOLEM_interface.inc (+2/-2)
madgraph/iolibs/template_files/loop_optimized/TIR_interface.inc (+36/-13)
madgraph/iolibs/template_files/loop_optimized/loop_matrix_standalone.inc (+102/-16)
madgraph/iolibs/template_files/matrix_loop_induced_madevent.inc (+4/-1)
madgraph/iolibs/template_files/matrix_loop_induced_madevent_group.inc (+4/-1)
madgraph/loop/loop_exporters.py (+129/-26)
madgraph/madevent/sum_html.py (+3/-0)
madgraph/various/banner.py (+19/-5)
madgraph/various/misc.py (+8/-1)
madgraph/various/process_checks.py (+53/-13)
madgraph/various/q_polynomial.py (+14/-0)
tests/IOTests.py (+1/-1)
tests/acceptance_tests/test_cmd.py (+1/-0)
tests/acceptance_tests/test_histograms.py (+0/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%COLLIER_interface.f (+732/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%CT_interface.f (+11/-265)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%GOLEM_interface.f (+2/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%TIR_interface.f (+25/-6)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%loop_matrix.f (+117/-11)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%mp_compute_loop_coefs.f (+13/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%COLLIER_interface.f (+732/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%CT_interface.f (+11/-265)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%GOLEM_interface.f (+2/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%TIR_interface.f (+25/-6)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%loop_matrix.f (+117/-11)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%mp_compute_loop_coefs.f (+13/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_QCDsq_eq_4.f (+116/-10)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_QCDsq_gt_0_QEDAmpAndQEDsq_gt_2.f (+116/-10)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_QCDsq_gt_4.f (+116/-10)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_QEDsq_le_4.f (+116/-10)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_WGTsq_le_10_QEDAmpAndQEDsq_gt_2.f (+116/-10)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDQEDpert_default.f (+116/-10)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QCDpert_default.f (+116/-10)
tests/input_files/IOTestsComparison/LoopSquaredOrder_IOTest/Loop_sqso_uux_ddx/loop_matrix_QEDpert_default.f (+116/-10)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%MadLoopCommons.f (+143/-11)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%MadLoopParamReader.f (+64/-7)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%COLLIER_interface.f (+740/-0)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%CT_interface.f (+27/-280)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%GOLEM_interface.f (+2/-1)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%TIR_interface.f (+25/-6)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%loop_matrix.f (+117/-11)
tests/input_files/IOTestsComparison/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%P0_gg_ttx%mp_compute_loop_coefs.f (+13/-3)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%COLLIER_interface.f (+732/-0)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%CT_interface.f (+19/-274)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%GOLEM_interface.f (+2/-1)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%TIR_interface.f (+25/-6)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%loop_matrix.f (+117/-11)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%mp_compute_loop_coefs.f (+13/-3)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/gg_wmtbx/unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/CT_interface.f (+2/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/TIR_interface.f (+13/-5)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/loop_matrix.f (+111/-10)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/CT_interface.f (+2/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/TIR_interface.f (+13/-5)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/loop_matrix.f (+111/-10)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_LoopInduced/gg_hh/unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/ddx_ttx/unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_default/gg_ttx/unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/CT_interface.f (+2/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/TIR_interface.f (+13/-5)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/loop_matrix.f (+111/-10)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/CT_interface.f (+2/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/TIR_interface.f (+13/-5)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/loop_matrix.f (+111/-10)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/unique_id.inc (+2/-0)
tests/input_files/loop_MSSM/CT_couplings.py (+22863/-0)
tests/input_files/loop_MSSM/CT_vertices.py (+7619/-0)
tests/input_files/loop_MSSM/MSSM_NLO.log (+87/-0)
tests/input_files/loop_MSSM/README.txt (+7/-0)
tests/input_files/loop_MSSM/__init__.py (+48/-0)
tests/input_files/loop_MSSM/coupling_orders.py (+17/-0)
tests/input_files/loop_MSSM/couplings.py (+6439/-0)
tests/input_files/loop_MSSM/function_library.py (+71/-0)
tests/input_files/loop_MSSM/lorentz.py (+198/-0)
tests/input_files/loop_MSSM/object_library.py (+377/-0)
tests/input_files/loop_MSSM/parameters.py (+1756/-0)
tests/input_files/loop_MSSM/particles.py (+814/-0)
tests/input_files/loop_MSSM/propagators.py (+35/-0)
tests/input_files/loop_MSSM/restrict_default.dat (+526/-0)
tests/input_files/loop_MSSM/restrict_parallel_test.dat (+532/-0)
tests/input_files/loop_MSSM/restrict_parallel_test_gogo.dat (+532/-0)
tests/input_files/loop_MSSM/restrict_test.dat (+532/-0)
tests/input_files/loop_MSSM/vertices.py (+9119/-0)
tests/input_files/loop_MSSM/write_param_card.py (+207/-0)
tests/parallel_tests/test_ML5.py (+1/-2)
tests/parallel_tests/test_ML5MSSMQCD.py (+5/-10)
vendor/CutTools/src/avh/avh_olo.f90 (+425/-425)
vendor/CutTools/src/cts/cts_cutroutines.f90 (+1/-1)
vendor/CutTools/src/cts/cts_cuttools.f90 (+2/-2)
vendor/CutTools/src/cts/cts_loopfunctions.f90 (+2/-2)
vendor/IREGI/src/makefile_ML5_lib (+11/-8)
vendor/IREGI/src/mis_warp.f90 (+1/-1)
vendor/IREGI/src/oneloop/ONI/example/example.f (+4/-4)
vendor/IREGI/src/oneloop/avh_olo_foriregi.f90 (+11045/-0)
vendor/IREGI/src/oneloop/example/example.f (+4/-4)
vendor/IREGI/src/oneloop/example_arprec/f_test.f (+4/-4)
vendor/IREGI/src/oneloop/example_ddfun90/example.f (+4/-4)
vendor/IREGI/src/oneloop/example_mpfun90/example.f (+4/-4)
vendor/IREGI/src/oneloop/example_qdcpp/f_test.f (+4/-4)
vendor/IREGI/src/oneloop/src/avh_olo_a0.h90 (+1/-1)
vendor/IREGI/src/oneloop/src/avh_olo_an.h90 (+1/-1)
vendor/IREGI/src/oneloop/src/avh_olo_arprec.f90 (+3/-3)
vendor/IREGI/src/oneloop/src/avh_olo_arrays.f90 (+3/-3)
vendor/IREGI/src/oneloop/src/avh_olo_auxfun.f90 (+3/-3)
vendor/IREGI/src/oneloop/src/avh_olo_b0.h90 (+1/-1)
vendor/IREGI/src/oneloop/src/avh_olo_b11.h90 (+1/-1)
vendor/IREGI/src/oneloop/src/avh_olo_bn.h90 (+1/-1)
vendor/IREGI/src/oneloop/src/avh_olo_bnlog.f90 (+7/-7)
vendor/IREGI/src/oneloop/src/avh_olo_box.f90 (+7/-7)
vendor/IREGI/src/oneloop/src/avh_olo_boxc.f90 (+6/-6)
vendor/IREGI/src/oneloop/src/avh_olo_bub.f90 (+6/-6)
vendor/IREGI/src/oneloop/src/avh_olo_c0.h90 (+2/-2)
vendor/IREGI/src/oneloop/src/avh_olo_comb.f90 (+25/-25)
vendor/IREGI/src/oneloop/src/avh_olo_d0.h90 (+2/-2)
vendor/IREGI/src/oneloop/src/avh_olo_ddfun90.f90 (+2/-2)
vendor/IREGI/src/oneloop/src/avh_olo_dilog.f90 (+8/-8)
vendor/IREGI/src/oneloop/src/avh_olo_intrinsic.f90 (+3/-3)
vendor/IREGI/src/oneloop/src/avh_olo_kinds.f90 (+1/-1)
vendor/IREGI/src/oneloop/src/avh_olo_main.f90 (+9/-9)
vendor/IREGI/src/oneloop/src/avh_olo_mpfun90.f90 (+3/-3)
vendor/IREGI/src/oneloop/src/avh_olo_olog.f90 (+6/-6)
vendor/IREGI/src/oneloop/src/avh_olo_print.f90 (+2/-2)
vendor/IREGI/src/oneloop/src/avh_olo_qdcpp.f90 (+2/-2)
vendor/IREGI/src/oneloop/src/avh_olo_qmplx.f90 (+6/-6)
vendor/IREGI/src/oneloop/src/avh_olo_tri.f90 (+6/-6)
vendor/IREGI/src/oneloop/src/avh_olo_units.f90 (+1/-1)
vendor/IREGI/src/oneloop/src/avh_olo_version.f90 (+1/-1)
vendor/IREGI/src/oneloop/src/avh_olo_wrp01.f90 (+14/-14)
vendor/SMWidth/makefile_MW5 (+15/-9)
vendor/SMWidth/mis_warp.f90 (+1/-1)
To merge this branch: bzr merge lp:~maddevelopers/mg5amcnlo/COLLIER
Reviewer Review Type Date Requested Status
Hua-Sheng Shao Pending
davide.pagani.85 Pending
Rikkert Frederix Pending
Olivier Mattelaer Pending
marco zaro Pending
Review via email: mp+298984@code.launchpad.net

This proposal supersedes a proposal from 2016-06-24.

This proposal has been superseded by a proposal from 2016-07-02.

Description of the change

This branch introduces the longed-for interface to COLLIER!

All tests pass (incl. the comparison with the multitude of benchmark processes) and MG5aMC user can now effortlessly use COLLIER for all the applications that can involve MadLoop.

So please give it a try simply by running a couple of loop processes with different setup, and after having installed COLLIER with

MG5_aMC> install collier

Regarding performances, COLLIER holds up to its promises (when properly using its global caching system). I compiled a tex document that summarizes the profiling I did so far:

https://drive.google.com/open?id=0By4qXx23HZGESkU2c0RMQ0J1RGs

In summary, we observe that:

a) COLLIER is faster than CutTools but slower than Ninja, although one must keep in mind that Ninja's timings must be doubled in practice for the stability test.

b) COLLIER scales worse than integrand reduction with the rank of the loop *and its multiplicity* (and significantly so, something I had not appreciated before). This is striking when looking at the timings of the 2 > 6 process. But it is nice that the COLI branch of COLLIER has no hard limitation in rank or multiplicity.

c) COLLIER's stability is indeed astonishing! The numerical stability plots speak for themselves... And this was not even for the most difficult processes we can generate with MadLoop (see http://arxiv.org/pdf/1604.01363.pdf). However, COLLIER's internal stability assessment is quite a bit over-conservative.

Finally, there are a number of new COLLIER-related parameters that you can find at the end of the MadLoopParams.dat card (please have a look). Speaking of which, notice that I decided to change the default value of the following three existing MadLoop parameters starting from this version:

    a) NRotationsDP 1-> 0
       We have been using that for quite some time and it doubles
       MadLoop runtime. I think we now have enough confidence in the
       loop direction stability test to drop it.

    b) COLLIERUseInternalStabilityTest False -> True
       Even though for complicated processes this test seems to
       overshoot the actual stability by up to 5 digits, it seems to never
       undershoots it, so it is safe to rely on it and it comes in at no
       additional computational time.
       So we can use it and if at some point too many unstable PS point show
       (but that should almost never occur) with COLLIER, then we can turn this off
       and fall back on the loop-direction stability test instead.

    c) UseQPIntegrandForNinja False -> True
       For complicated processes where a lot of points need stability rescuing
       with Ninja, it turns out that quad. prec. in the integrand can
       significantly increases the accuracy (up to 4-5 digits), so it
       is actually better to leave this on, especially since we
       now have COLLIER first.

Let me know your comments/questions on the above, the interface and the code if you want to look at it.

Cheers

To post a comment you must log in.
Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote : Posted in a previous version of this proposal

Hi Valentin,

This is so cool.
I did not have the time to check yet but this is some first comment:

1) I would refrain to include this in 2.4.1, mainly because I want to have that version as bug fix only and be released very very soon (in max two weeks).

2) I do not understand the reason "UseQPIntegrandForNinja False -> True". You said "especially since we now have COLLIER first." This is actually not really True 99% of the user will not install collier and your option should reflect that scenario (or you update your option according to the tool available which can be really interesting.

Cheers,

Olivier

Revision history for this message
Valentin Hirschi (valentin-hirschi) wrote : Posted in a previous version of this proposal

Hi Olivier,

On Thu, May 26, 2016 at 2:03 AM, Olivier Mattelaer <
<email address hidden>> wrote:

> Hi Valentin,
>
> This is so cool.
> I did not have the time to check yet but this is some first comment:
>
> 1) I would refrain to include this in 2.4.1, mainly because I want to have
> that version as bug fix only and be released very very soon (in max two
> weeks).
>

I understand. But I think that this implementation is fairly robust as it
doesn't modify anything else except MadLoop's output (to the exception of
the 'unique_id' additional option to generate_subrpocess_v4).
But still, I understand if you would rather delay it, just for safety; I'm
ok with this.

> 2) I do not understand the reason "UseQPIntegrandForNinja False -> True".
> You said "especially since we now have COLLIER first." This is actually not
> really True 99% of the user will not install collier and your option should
> reflect that scenario (or you update your option according to the tool
> available which can be really interesting.
>

I will have COLLIER installed by default from a local copy that can then be
updated at any point by the user from the online tarball using the command
'install collier'. (I'll ask D&D for their consent on this first, event
though the tool is public, just to be politically correct). Basically, the
same strategy as I used for Ninja.
And COLLIER has *no dependence*, is in plain fortran90 and only needs a
minute or so to install. So yes, everybody will have it :).

Regarding the order, I think I want to still keep Ninja first, then
followed by COLLIER and finally CutTools (though it should almost never get
there anymore).

Cheers,

>
> Cheers,
>
> Olivier
>
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/COLLIER/+merge/295787
> Your team MadDevelopers is subscribed to branch
> lp:~maddevelopers/mg5amcnlo/2.4.1.
>

--
Valentin

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote : Posted in a previous version of this proposal

Hi Valentin,

I wanted to start this review today. But I was stop quickly:

Enter COLLIER directory and installing COLLIER
/Users/omatt/Documents/eclipse/COLLIER/HEPTools/HEPToolsInstallers/installCOLLIER.sh: line 14: cmake: command not found
make: *** No targets specified and no makefile found. Stop.
Copying the static library and modules generated to target directory
cp: libcollier.a: No such file or directory
cp: modules/*.mod: No such file or directory
Finished installing COLLIER

Cheers,

Olivier

review: Needs Fixing
Revision history for this message
Valentin Hirschi (valentin-hirschi) wrote : Posted in a previous version of this proposal

Dear reviewers,

The points raised by Olivier and Rikkert (offline) have been resolved.
This branch is mature and I plan on merging it early next week, so please have a quick look/trial by then if you can.

Cheers,

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote : Posted in a previous version of this proposal

Hi,

No the tests are not working...
So you can not merge.

Cheers,

Olivier

review: Disapprove
Revision history for this message
Valentin Hirschi (valentin-hirschi) wrote : Posted in a previous version of this proposal

Hi Olivier,

On Mon, Jun 27, 2016 at 7:36 AM, Olivier Mattelaer <
<email address hidden>> wrote:

> Review: Disapprove
>
> Hi,
>
> No the tests are not working...
> So you can not merge.
>

It goes without saying that I'll run and fix the tests before actually
performing the merge...
I like to do it at the very end when I'm really about to merge, and not
preemptively before each merging proposal (at least for these "simple"
branches; it avoids having to run the tests each time when you implement
something the reviewer asked for).

So can I take this as your green light from a structural/functional
standpoint?
I can also send you the test-fixed version for you to try just before I
merge if you want.

Cheers,

>
> Cheers,
>
>
> Olivier
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/COLLIER/+merge/298349
> Your team MadDevelopers is subscribed to branch
> lp:~maddevelopers/mg5amcnlo/2.5.0.
>

--
Valentin

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote : Posted in a previous version of this proposal

Hi Valentin,

It is always important that at least two people runs the test to be sure that all file are include correctly
and that you do not have test which are machine dependent (which means useless test).
So clearly you do not have a green light.

Cheers,

Olivier

> On Jun 27, 2016, at 17:30, Valentin Hirschi <email address hidden> wrote:
>
> Hi Olivier,
>
> On Mon, Jun 27, 2016 at 7:36 AM, Olivier Mattelaer <
> <email address hidden>> wrote:
>
>> Review: Disapprove
>>
>> Hi,
>>
>> No the tests are not working...
>> So you can not merge.
>>
>
> It goes without saying that I'll run and fix the tests before actually
> performing the merge...
> I like to do it at the very end when I'm really about to merge, and not
> preemptively before each merging proposal (at least for these "simple"
> branches; it avoids having to run the tests each time when you implement
> something the reviewer asked for).
>
> So can I take this as your green light from a structural/functional
> standpoint?
> I can also send you the test-fixed version for you to try just before I
> merge if you want.
>
> Cheers,
>
>
>>
>> Cheers,
>>
>>
>> Olivier
>> --
>> https://code.launchpad.net/~maddevelopers/mg5amcnlo/COLLIER/+merge/298349
>> Your team MadDevelopers is subscribed to branch
>> lp:~maddevelopers/mg5amcnlo/2.5.0.
>>
>
>
>
> --
> Valentin
>
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/COLLIER/+merge/298349
> You are reviewing the proposed merge of lp:~maddevelopers/mg5amcnlo/COLLIER into lp:~maddevelopers/mg5amcnlo/2.5.0.

Revision history for this message
Valentin Hirschi (valentin-hirschi) wrote : Posted in a previous version of this proposal

I stressed "from a structural/functional standpoint" and also that I would
tell you to run the tests once I will have run/fix them myself.
So I'll let you know.

On Mon, Jun 27, 2016 at 1:00 PM, Olivier Mattelaer <
<email address hidden>> wrote:

> Hi Valentin,
>
> It is always important that at least two people runs the test to be sure
> that all file are include correctly
> and that you do not have test which are machine dependent (which means
> useless test).
> So clearly you do not have a green light.
>
> Cheers,
>
> Olivier
>
> > On Jun 27, 2016, at 17:30, Valentin Hirschi <email address hidden>
> wrote:
> >
> > Hi Olivier,
> >
> > On Mon, Jun 27, 2016 at 7:36 AM, Olivier Mattelaer <
> > <email address hidden>> wrote:
> >
> >> Review: Disapprove
> >>
> >> Hi,
> >>
> >> No the tests are not working...
> >> So you can not merge.
> >>
> >
> > It goes without saying that I'll run and fix the tests before actually
> > performing the merge...
> > I like to do it at the very end when I'm really about to merge, and not
> > preemptively before each merging proposal (at least for these "simple"
> > branches; it avoids having to run the tests each time when you implement
> > something the reviewer asked for).
> >
> > So can I take this as your green light from a structural/functional
> > standpoint?
> > I can also send you the test-fixed version for you to try just before I
> > merge if you want.
> >
> > Cheers,
> >
> >
> >>
> >> Cheers,
> >>
> >>
> >> Olivier
> >> --
> >>
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/COLLIER/+merge/298349
> >> Your team MadDevelopers is subscribed to branch
> >> lp:~maddevelopers/mg5amcnlo/2.5.0.
> >>
> >
> >
> >
> > --
> > Valentin
> >
> >
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/COLLIER/+merge/298349
> > You are reviewing the proposed merge of
> lp:~maddevelopers/mg5amcnlo/COLLIER into lp:~maddevelopers/mg5amcnlo/
> 2.5.0.
>
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/COLLIER/+merge/298349
> Your team MadDevelopers is subscribed to branch
> lp:~maddevelopers/mg5amcnlo/2.5.0.
>

--
Valentin

Revision history for this message
Valentin Hirschi (valentin-hirschi) wrote : Posted in a previous version of this proposal
Download full text (3.2 KiB)

Hi Olivier,

So I fixed the usual default_configuration test and the IOTests. All the
others are passing except three acceptance tests, which are also failing in
2.4.3, and which are related to the fact that the command 'compute_width'
is broken when resorting to a numerical madevent integration.

This is made clear by the fact that 'test_width_computation' fails in
2.4.3. I suspected that it was related to the fact that your removed the
files 'results.dat' which is used by 'compute_width' and indeed the test
passes in rev.274 but not in rev.275 of 2.4.3, so could you fix this?
Once this is fixed, I expect all tests to pass in COLLIER branch. Can you
run them and confirm that you are ok to merge it in 2.5.0?

Cheers

On Mon, Jun 27, 2016 at 1:24 PM, Valentin Hirschi <
<email address hidden>> wrote:

> I stressed "from a structural/functional standpoint" and also that I would
> tell you to run the tests once I will have run/fix them myself.
> So I'll let you know.
>
> On Mon, Jun 27, 2016 at 1:00 PM, Olivier Mattelaer <
> <email address hidden>> wrote:
>
> > Hi Valentin,
> >
> > It is always important that at least two people runs the test to be sure
> > that all file are include correctly
> > and that you do not have test which are machine dependent (which means
> > useless test).
> > So clearly you do not have a green light.
> >
> > Cheers,
> >
> > Olivier
> >
> > > On Jun 27, 2016, at 17:30, Valentin Hirschi <
> <email address hidden>>
> > wrote:
> > >
> > > Hi Olivier,
> > >
> > > On Mon, Jun 27, 2016 at 7:36 AM, Olivier Mattelaer <
> > > <email address hidden>> wrote:
> > >
> > >> Review: Disapprove
> > >>
> > >> Hi,
> > >>
> > >> No the tests are not working...
> > >> So you can not merge.
> > >>
> > >
> > > It goes without saying that I'll run and fix the tests before actually
> > > performing the merge...
> > > I like to do it at the very end when I'm really about to merge, and not
> > > preemptively before each merging proposal (at least for these "simple"
> > > branches; it avoids having to run the tests each time when you
> implement
> > > something the reviewer asked for).
> > >
> > > So can I take this as your green light from a structural/functional
> > > standpoint?
> > > I can also send you the test-fixed version for you to try just before I
> > > merge if you want.
> > >
> > > Cheers,
> > >
> > >
> > >>
> > >> Cheers,
> > >>
> > >>
> > >> Olivier
> > >> --
> > >>
> >
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/COLLIER/+merge/298349
> > >> Your team MadDevelopers is subscribed to branch
> > >> lp:~maddevelopers/mg5amcnlo/2.5.0.
> > >>
> > >
> > >
> > >
> > > --
> > > Valentin
> > >
> > >
> >
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/COLLIER/+merge/298349
> > > You are reviewing the proposed merge of
> > lp:~maddevelopers/mg5amcnlo/COLLIER into lp:~maddevelopers/mg5amcnlo/
> > 2.5.0.
> >
> >
> > --
> >
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/COLLIER/+merge/298349
> > Your team MadDevelopers is subscribed to branch
> > lp:~maddevelopers/mg5amcnlo/2.5.0.
> >
>
>
>
> --
> Valentin
>
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/COLLIER/+merge/298349
> Your team MadDeve...

Read more...

Unmerged revisions

437. By Valentin Hirschi

1. Reinstated the 'wrong' loop_MSSM for parallel tests, but only in the input_files.
2. Merged with latest version of 2.4.3.

436. By Valentin Hirschi

1. Fixed an issue in the compilation of SMWidth
2. Updated all IOTest to correspond to a setup without Ninja Quad prec. We will do so until clang releases a version supporting __float128 (and quadmath in general).

435. By Valentin Hirschi

1. Merged with latest 2.4.3

434. By Valentin Hirschi

1. Fixed IOTests and default config tests.

433. By Valentin Hirschi

1. Changed the default value of the ML reduction order to 6|7|1.

432. By Valentin Hirschi

1. Added comments and updated the Offline HEPTools installer.

431. By Valentin Hirschi

1. Merged with latest version 2.4.3

430. By Valentin Hirschi

1.

429. By Valentin Hirschi

1. Fixed BinothLHA.f

428. By Valentin Hirschi

1. Added LARS's fix to COLLIER for rank 7+
2. Completely isolated the OneLOop of IREGI and CutTools so as to prevent interferences with other reduction tools using OneLOop.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Template/LO/Source/make_opts'
2--- Template/LO/Source/make_opts 2016-07-01 22:45:47 +0000
3+++ Template/LO/Source/make_opts 2016-07-02 20:37:49 +0000
4@@ -1,9 +1,9 @@
5 DEFAULT_F2PY_COMPILER=f2py
6 DEFAULT_F_COMPILER=gfortran
7-MACFLAG=-mmacosx-version-min=10.7
8-DEFAULT_CPP_COMPILER=clang
9-STDLIB=-lc++
10-STDLIB_FLAG=-stdlib=libc++
11+MACFLAG=
12+DEFAULT_CPP_COMPILER=g++
13+STDLIB=-lstdc++
14+STDLIB_FLAG=
15 #end_of_make_opts_variables
16 # Rest of the makefile
17
18
19=== modified file 'Template/NLO/SubProcesses/BinothLHA.f'
20--- Template/NLO/SubProcesses/BinothLHA.f 2016-03-02 09:31:23 +0000
21+++ Template/NLO/SubProcesses/BinothLHA.f 2016-07-02 20:37:49 +0000
22@@ -85,6 +85,8 @@
23 c itself again to perform stability check to make sure no unstable EPS
24 c splips unnoticed.
25 CALL FORCE_STABILITY_CHECK(.TRUE.)
26+ CALL COLLIER_COMPUTE_UV_POLES(.FALSE.)
27+ CALL COLLIER_COMPUTE_IR_POLES(.FALSE.)
28 firsttime_run = .false.
29 endif
30 if (firsttime) then
31@@ -102,6 +104,7 @@
32 c Just set the accuracy found to a positive value as it is not specified
33 c once the initial pole check is performed.
34 if (mc_hel.eq.0) then
35+
36 call sloopmatrix_thres(p,virt_wgts,tolerance,accuracies
37 $ ,ret_code)
38 prec_found = accuracies(0)
39@@ -164,18 +167,19 @@
40 c MadLoop initialization PS points.
41 cpol=.false.
42 if ((firsttime .or. mc_hel.eq.0) .and. mod(ret_code,100)/10.ne.3
43- $ .and. mod(ret_code,100)/10.ne.4) then
44+ $ .and. mod(ret_code,100)/10.ne.4) then
45 call getpoles(p,QES2,madfks_double,madfks_single,fksprefact)
46 avgPoleRes(1)=(single+madfks_single)/2.0d0
47 avgPoleRes(2)=(double+madfks_double)/2.0d0
48 PoleDiff(1)=dabs(single - madfks_single)
49 PoleDiff(2)=dabs(double - madfks_double)
50 if ((dabs(avgPoleRes(1))+dabs(avgPoleRes(2))).ne.0d0) then
51- cpol = .not. (((PoleDiff(1)+PoleDiff(2))/
52+ cpol = .not. ((((PoleDiff(1)+PoleDiff(2))/
53 $ (dabs(avgPoleRes(1))+dabs(avgPoleRes(2)))) .lt.
54- $ tolerance*10d0)
55+ $ tolerance*10d0).or.(mod(ret_code,10).eq.7))
56 else
57- cpol = .not.(PoleDiff(1)+PoleDiff(2).lt.tolerance*10d0)
58+ cpol = .not.((PoleDiff(1)+PoleDiff(2).lt.tolerance*10d0).or.
59+ $ (mod(ret_code,10).eq.7))
60 endif
61 if (tolerance.lt.0.0d0) then
62 cpol = .false.
63
64=== modified file 'Template/NLO/SubProcesses/check_poles.f'
65--- Template/NLO/SubProcesses/check_poles.f 2016-03-02 09:31:23 +0000
66+++ Template/NLO/SubProcesses/check_poles.f 2016-07-02 20:37:49 +0000
67@@ -116,6 +116,8 @@
68 c Make sure that stability checks are always used by MadLoop, even for
69 c initialization
70 CALL FORCE_STABILITY_CHECK(.TRUE.)
71+ CALL COLLIER_COMPUTE_UV_POLES(.TRUE.)
72+ CALL COLLIER_COMPUTE_IR_POLES(.TRUE.)
73
74 200 continue
75 calculatedborn = .false.
76
77=== modified file 'Template/NLO/SubProcesses/makefile_loop.inc'
78--- Template/NLO/SubProcesses/makefile_loop.inc 2016-03-02 03:03:20 +0000
79+++ Template/NLO/SubProcesses/makefile_loop.inc 2016-07-02 20:37:49 +0000
80@@ -24,6 +24,7 @@
81 $(patsubst %(dotf)s,%(doto)s,$(wildcard mp_coef_construction_*.f)) \
82 $(patsubst %(dotf)s,%(doto)s,$(wildcard TIR_interface.f)) \
83 $(patsubst %(dotf)s,%(doto)s,$(wildcard GOLEM_interface.f)) \
84+ $(patsubst %(dotf)s,%(doto)s,$(wildcard COLLIER_interface.f)) \
85 $(patsubst %(dotf)s,%(doto)s,$(wildcard compute_color_flows.f))
86
87 # This is the core of madloop computationally wise, so make sure to turn optimizations on and bound checks off.
88
89=== modified file 'Template/loop_material/StandAlone/Cards/MadLoopParams.dat'
90--- Template/loop_material/StandAlone/Cards/MadLoopParams.dat 2016-04-06 10:19:13 +0000
91+++ Template/loop_material/StandAlone/Cards/MadLoopParams.dat 2016-07-02 20:37:49 +0000
92@@ -4,8 +4,8 @@
93
94 !
95 #MLReductionLib
96-!6|1|2
97-! Default :: 6|1|2
98+!6|7|1
99+! Default :: 6|7|1
100 ! The tensor integral reduction library.The current choices are:
101 ! 1 | CutTools
102 ! 2 | PJFry++
103@@ -13,6 +13,7 @@
104 ! 4 | Golem95
105 ! 5 | Samurai
106 ! 6 | Ninja
107+! 7 | COLLIER
108 ! One can use the combinations to reduce integral,e.g.
109 ! 1|2|3 means first use CutTools, if it is not stable, use PJFry++,
110 ! if it is still unstable, use IREGI. If it failed, use QP of CutTools.
111@@ -22,15 +23,15 @@
112 ! When using quadruple precision with Ninja or CutTools, the reduction will
113 ! always be done in quadruple precision, but the parameters below allow you to
114 ! chose if you want to also recompute the *integrand* in quadruple precision.
115-! Doing so is slow and typically does not improve the accuracy for Ninja, so it
116-! is disabled by default in this case.
117+! Doing so is slow but might improve the accuracy in some situation.
118 #UseQPIntegrandForCutTools
119 !.TRUE.
120 ! Default :: .TRUE.
121 #UseQPIntegrandForNinja
122-!.FALSE.
123-! Default :: .FALSE.
124+!.TRUE.
125+! Default :: .TRUE.
126 !
127+
128 ! =================================================================================
129 ! The parameters below set the parameters for IREGI
130 ! =================================================================================
131@@ -38,9 +39,9 @@
132 #IREGIMODE
133 !2
134 ! Default :: 2
135-! IMODE=0, IBP reduction
136-! IMODE=1, PaVe reduction
137-! IMODE=2, PaVe reduction with stablility improved by IBP reduction
138+! IREGIMODE=0, IBP reduction
139+! IREGIMODE=1, PaVe reduction
140+! IREGIMODE=2, PaVe reduction with stablility improved by IBP reduction
141
142 #IREGIRECY
143 !.TRUE.
144@@ -59,7 +60,7 @@
145 ! 2 | Double precision, loops reduced with propagator with reversed order
146 ! 4 | Quadruple precision, loops reduced with propagator in original order
147 ! 5 | Quadruple precision, loops reduced with propagator with reversed order
148-! -1 |  Exhaustive automated numerical stability checks. See below for details.
149+! -1 | Exhaustive automated numerical stability checks. See below for details.
150 !
151 ! Due to the architecture of the program, you are better off
152 ! rerunning the full PS point in quadruple precision than just a single loop
153@@ -84,8 +85,8 @@
154 ! Below you can chose if you want to use zero, one or two rotations of the PS point
155 ! in QP.
156 #NRotations_DP
157-!1
158-! Default :: 1
159+!0
160+! Default :: 0
161 #NRotations_QP
162 !0
163 ! Default :: 0
164@@ -114,6 +115,7 @@
165 #ImprovePSPoint
166 !2
167 ! Default :: 2
168+
169 ! =================================================================================
170 ! The parameters below set two CutTools internal parameters accessible to the user.
171 ! =================================================================================
172@@ -226,4 +228,71 @@
173 !.FALSE.
174 ! Default :: .FALSE.
175
176+! =================================================================================
177+! The parameters below set the main parameters for COLLIER
178+! To edit more specific technical COLLIER parameters, modify directly the content
179+! of the subroutine 'INITCOLLIER' in the file 'MadLoopCommons.f'
180+! =================================================================================
181+
182+! Decide if COLLIER must be computed multiple times to evaluate the UV pole residues
183+! (Withing a Monte-Carlo performed in MG5aMC, this is automatically disabled internally)
184+#COLLIERComputeUVpoles
185+!.TRUE.
186+! Default :: .TRUE.
187+
188+! Decide if COLLIER must be computed multiple times to evaluate the IR pole residues
189+! (Withing a Monte-Carlo performed in MG5aMC, this is automatically disabled internally)
190+#COLLIERComputeIRpoles
191+!.TRUE.
192+! Default :: .TRUE.
193+
194+! Decide if COLLIER must be computed multiple times to evaluate the IR pole residues
195+#COLLIERRequiredAccuracy
196+!1.0d-8
197+! Default :: 1.0d-8
198+! A value of -1.0d0 means that it will be automatically set from MLStabThres.
199+! The default value of 1.0d-8 corresponds to the value for which COLLIER's authors
200+! have optimized the library.
201+
202+! Decide whether to use COLLIER's internal stability test or the loop-direction
203+! switch test instead.
204+#COLLIERUseInternalStabilityTest
205+!.TRUE.
206+! Default :: .TRUE.
207+! COLLIER's internal stability test is at no extra cost but not as reliable
208+! as the loop-direction switch test, which however doubles the reduction time.
209+! This parameter is only relevant when running MadLoop with CTModeRun=-1.
210+! If you find a large number of unstable points with COLLIER for complicated
211+! processes, set this parameter to .FALSE. to make sure the PS points flagged
212+! as unstable with COLLIER really are so.
213+
214+! Set up to which N-loop to use the COLLIER global caching system.
215+#COLLIERGlobalCache
216+!-1
217+! Default :: -1
218+! -1 : Enable the global cache for all loops
219+! 0 : Disable the global cache alltogether
220+! N : Enable the global cache but only for up to N-loops
221+
222+! Use the global cache when evaluating the poles as well (more memory consuming)
223+! During a Monte-Carlo it is typically not useful anyway, because the pole
224+! computation is automatically disabled for COLLIER, irrespectively of the value
225+! of the parameters COLLIERCompute<UV/IR>poles specified above.
226+#COLLIERUseCacheForPoles
227+!.FALSE.
228+! Default :: .FALSE.
229+
230+! Choose which branch(es) of COLLIER have to be used
231+#COLLIERMode
232+!1
233+! Default :: 1
234+! COLLIERMode=1 : COLI branch
235+! COLLIERMode=2 : DD branch
236+! COLLIERMode=3 : Both DD and COLI branch compared
237+
238+! Decide if COLLIER can output its information in a log directory.
239+#COLLIERCanOutput
240+!.FALSE.
241+! Default :: .FALSE.
242+
243 /* End of param file */
244
245=== modified file 'Template/loop_material/StandAlone/SubProcesses/MadLoopCommons.inc'
246--- Template/loop_material/StandAlone/SubProcesses/MadLoopCommons.inc 2016-02-08 23:58:00 +0000
247+++ Template/loop_material/StandAlone/SubProcesses/MadLoopCommons.inc 2016-07-02 20:37:49 +0000
248@@ -30,6 +30,86 @@
249
250 end
251
252+
253+## if(collier_available){
254+ SUBROUTINE INITCOLLIER()
255+C
256+C INITIALISATION OF COLLIER
257+C
258+C
259+C MODULE
260+C
261+ USE COLLIER
262+C
263+C CONSTANTS
264+C
265+ character(len=*) no_folder
266+ parameter (no_folder='')
267+ character(len=*) folderOutput
268+ parameter (folderOutput='COLLIER_output')
269+
270+C Force COLLIER to completely reset from scratch
271+ logical noreset
272+ parameter (noreset=.FALSE.)
273+C
274+C LOCAL VARIABLES
275+C
276+ INTEGER N_CACHES
277+C
278+C GLOBAL VARIABLES
279+C
280+ include 'MadLoopParams.inc'
281+C Now obtain the overall maximum rank, maximum external lines
282+C and maximal number of processes.
283+ include 'global_specs.inc'
284+
285+C ----------
286+C BEGIN CODE
287+C ----------
288+
289+C Initialize Collier
290+ IF (.NOT.COLLIERCanOutput) THEN
291+ CALL Init_cll(MAXNEXTERNAL,OVERALLMAXRANK,no_folder,noreset)
292+ ELSE
293+ CALL Init_cll(MAXNEXTERNAL,OVERALLMAXRANK,folderOutput,noreset)
294+ ENDIF
295+
296+C Set target accuracy, be conservative w.r.t user request
297+C Keep in mind that COLLIER has been optimized for 1d-8.
298+ IF (COLLIERRequiredAccuracy.eq.-1.0d0) THEN
299+ CALL SetReqAcc_cll(MLStabThres*1.0d-3)
300+ ELSE
301+ CALL SetReqAcc_cll(COLLIERRequiredAccuracy)
302+ ENDIF
303+
304+C Set COLLIER mode
305+ CALL SetMode_cll(COLLIERMode)
306+
307+C Set the global cache strategy
308+C If we use the caches for the poles as well, then it is a total of
309+C 4 caches per process.
310+ IF (COLLIERUseCacheForPoles) THEN
311+ N_CACHES =4*NPROCS
312+ ELSE
313+ N_CACHES =NPROCS
314+ ENDIF
315+ IF (COLLIERGlobalCache.eq.-1) THEN
316+ CALL InitCacheSystem_cll(N_CACHES,MAXNEXTERNAL)
317+ ELSEIF(COLLIERGlobalCache.gt.0) THEN
318+ CALL InitCacheSystem_cll(N_CACHES,COLLIERGlobalCache)
319+ ENDIF
320+
321+C Make sure to start by first switching off all cache
322+ IF (COLLIERGlobalCache.ne.0) THEN
323+ call SwitchOffCacheSystem_cll()
324+ ENDIF
325+
326+C Specify below your other custom COLLIER parameter settings
327+C [user_specific_COLLIER_settings]
328+
329+ END
330+## }
331+
332 SUBROUTINE SET_FORBID_HEL_DOUBLECHECK(ONOFF)
333 C
334 C Give the possibility to overwrite the value of MadLoopParams.dat
335@@ -67,9 +147,10 @@
336 DATA ML_INIT/.TRUE./
337 common/ML_INIT/ML_INIT
338
339- LOGICAL CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT
340- DATA CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT/.TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE./
341- COMMON/REDUCTIONCODEINIT/CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT
342+ LOGICAL CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT,COLLIERINIT
343+ DATA CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT,COLLIERINIT/.TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE./
344+ COMMON/REDUCTIONCODEINIT/CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT, COLLIERINIT
345+
346
347 character(512) MLPath
348 data MLPath/'[[NA]]'/
349@@ -163,6 +244,8 @@
350 C Stable with Samurai.
351 C U == 6
352 C Stable with Ninja in double precision.
353+C U == 7
354+C Stable with COLLIER.
355 C U == 8
356 C Stable with Ninja in quadruple precision.
357 C U == 9
358@@ -201,10 +284,10 @@
359 STOP 'Only CutTools and Ninja can use quardruple precision'
360 ENDIF
361 ENDIF
362- IF(MLRed.GE.1.AND.MLRed.LE.6)THEN
363+ IF(MLRed.GE.1.AND.MLRed.LE.7)THEN
364 SET_RET_CODE_U=MLRed
365 ELSE
366- STOP 'Only CutTools, PJFry++, IREGI, Golem95, Samurai and Ninja are available'
367+ STOP 'Only CutTools, PJFry++, IREGI, Golem95, Samurai, Ninja and COLLIER are available'
368 ENDIF
369 END
370
371@@ -249,8 +332,11 @@
372 ELSEIF(LIBNUM.EQ.6)THEN
373 C Ninja
374 CALL DETECT_NINJA(NLOOPLINE,RANK,complex_mass,LPASS)
375+ ELSEIF(LIBNUM.EQ.7)THEN
376+C Collier
377+ CALL DETECT_COLLIER(NLOOPLINE,RANK,complex_mass,LPASS)
378 ELSE
379- STOP 'ONLY CUTTOOLS,PJFry++,IREGI,Golem95 and Samurai are available'
380+ STOP 'Only CutTools, PJFry++, IREGI, Golem95, Samurai, Ninja and COLLIER are available'
381 ENDIF
382 RETURN
383 END
384@@ -358,6 +444,65 @@
385 RETURN
386 END
387
388+## if(collier_available){
389+ SUBROUTINE DETECT_COLLIER(NLOOPLINE,RANK,complex_mass,LPASS)
390+C
391+C Detect whether Collier can be used or not
392+C
393+ USE COLLIER
394+ IMPLICIT NONE
395+C
396+C CONSTANTS
397+C
398+C
399+C ARGUMENTS
400+C
401+ INTEGER NLOOPLINE,RANK
402+ LOGICAL complex_mass,LPASS
403+C
404+C LOCAL VARIABLES
405+C
406+ INTEGER CURRENT_COLLIERMODE
407+C
408+C GLOBAL VARIABLES
409+C
410+ LOGICAL CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT,COLLIERINIT
411+ COMMON/REDUCTIONCODEINIT/CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT, COLLIERINIT
412+ include 'MadLoopParams.inc'
413+C ----------
414+C BEGIN CODE
415+C ----------
416+ if (.NOT.COLLIERINIT) THEN
417+ CALL GETMODE_CLL(CURRENT_COLLIERMODE)
418+ ELSE
419+ CURRENT_COLLIERMODE = COLLIERMODE
420+ ENDIF
421+ LPASS=.TRUE.
422+ IF (CURRENT_COLLIERMODE.NE.1) THEN
423+C The DD branch is used and it has limitations
424+ IF((NLOOPLINE.GT.6).OR.(RANK.GT.NLOOPLINE)) then
425+ LPASS=.FALSE.
426+ endif
427+ ELSE
428+C Limitations of the COLI branch are academic.
429+ LPASS=.TRUE.
430+ ENDIF
431+ RETURN
432+ END
433+## }else{
434+ SUBROUTINE DETECT_COLLIER(NLOOPLINE,RANK,complex_mass,LPASS)
435+C
436+C ARGUMENTS
437+C
438+ INTEGER NLOOPLINE,RANK
439+ LOGICAL complex_mass,LPASS
440+C
441+C COLLIER is not available in this output. This subroutine is dummy.
442+C
443+ LPASS=.True.
444+ END
445+## }
446+
447 SUBROUTINE DETECT_PJFRY(NLOOPLINE,RANK,complex_mass,LPASS)
448 C
449 C DETECT whether PJFRY++ CAN BE USED OR NOT
450
451=== modified file 'Template/loop_material/StandAlone/SubProcesses/MadLoopParamReader.f'
452--- Template/loop_material/StandAlone/SubProcesses/MadLoopParamReader.f 2016-02-18 11:42:56 +0000
453+++ Template/loop_material/StandAlone/SubProcesses/MadLoopParamReader.f 2016-07-02 20:37:49 +0000
454@@ -33,6 +33,12 @@
455 stop 'CTModeRun must be >= -1 and <=6.'
456 endif
457
458+ else if (buff .eq. '#COLLIERGlobalCache') then
459+ read(666,*,end=999) COLLIERGlobalCache
460+ if (COLLIERGlobalCache .lt. -1) then
461+ stop 'COLLIERGlobalCache must be >= -1'
462+ endif
463+
464 else if (buff .eq. '#NRotations_DP') then
465 read(666,*,end=999) NRotations_DP
466 if (NRotations_DP .lt. 0 .or.
467@@ -52,7 +58,14 @@
468 if (MLStabThres.lt.0.0d0) then
469 stop 'MLStabThres must be >= 0'
470 endif
471-
472+
473+ else if (buff .eq. '#COLLIERRequiredAccuracy') then
474+ read(666,*,end=999) COLLIERRequiredAccuracy
475+ if (COLLIERRequiredAccuracy.le.0.0d0.and.
476+ & COLLIERRequiredAccuracy.ne.-1.0d0) then
477+ stop 'COLLIERRequiredAccuracy must be > 0 or = -1.0'
478+ endif
479+
480 else if (buff .eq. '#CTLoopLibrary') then
481 read(666,*,end=999) CTLoopLibrary
482 if (CTLoopLibrary.lt.2 .or.
483@@ -90,6 +103,21 @@
484 stop 'MaxAttempts must be >= 1'
485 endif
486
487+ else if (buff .eq. '#COLLIERComputeUVpoles') then
488+ read(666,*,end=999) COLLIERComputeUVpoles
489+
490+ else if (buff .eq. '#COLLIERComputeIRpoles') then
491+ read(666,*,end=999) COLLIERComputeIRpoles
492+
493+ else if (buff .eq. '#COLLIERUseInternalStabilityTest') then
494+ read(666,*,end=999) COLLIERUseInternalStabilityTest
495+
496+ else if (buff .eq. '#COLLIERUseCacheForPoles') then
497+ read(666,*,end=999) COLLIERUseCacheForPoles
498+
499+ else if (buff .eq. '#COLLIERCanOutput') then
500+ read(666,*,end=999) COLLIERCanOutput
501+
502 else if (buff .eq. '#UseLoopFilter') then
503 read(666,*,end=999) UseLoopFilter
504
505@@ -127,7 +155,7 @@
506
507 else if (buff .eq. '#MLReductionLib') then
508 read(666,*,end=999) MLReductionLib_str
509- MLReductionLib(1:6)=0
510+ MLReductionLib(1:7)=0
511 MLReductionLib_str_save=MLReductionLib_str
512 j=0
513 DO
514@@ -149,6 +177,8 @@
515 MLRed=5
516 ELSEIF(MLReductionLib_char.EQ.'6 ')THEN
517 MLRed=6
518+ ELSEIF(MLReductionLib_char.EQ.'7 ')THEN
519+ MLRed=7
520 ELSE
521 PRINT *, 'MLReductionLib is wrong: '//
522 $ TRIM(MLReductionLib_str_save)
523@@ -171,6 +201,12 @@
524 MLReductionLib_str=MLReductionLib_str(i+1:)
525 ENDIF
526 ENDDO
527+ else if (buff .eq. '#COLLIERMode') then
528+ read(666,*,end=999) COLLIERMode
529+ if (COLLIERMode .lt. 1 .or.
530+ & COLLIERMode .gt.3) then
531+ stop 'COLLIERMode must be >=1 and <=3.'
532+ endif
533 else if (buff .eq. '#IREGIRECY') then
534 read(666,*,end=999) IREGIRECY
535 else if (buff .eq. '#IREGIMODE') then
536@@ -218,8 +254,6 @@
537 & '==============================================================='
538 write(*,*) ' > MLReductionLib = '
539 $ //TRIM(MLReductionLib_str_save)
540- write(*,*) ' > IREGIMODE = ',IREGIMODE
541- write(*,*) ' > IREGIRECY = ',IREGIRECY
542 write(*,*) ' > CTModeRun = ',CTModeRun
543 write(*,*) ' > MLStabThres = ',MLStabThres
544 write(*,*) ' > NRotations_DP = ',NRotations_DP
545@@ -243,6 +277,19 @@
546 &UseQPIntegrandForNinja
547 write(*,*) ' > UseQPIntegrandForCutTools = ',
548 &UseQPIntegrandForCutTools
549+ write(*,*) ' > IREGIMODE = ',IREGIMODE
550+ write(*,*) ' > IREGIRECY = ',IREGIRECY
551+ write(*,*) ' > COLLIERMode = ',COLLIERMode
552+ write(*,*) ' > COLLIERRequiredAccuracy = ',
553+ $COLLIERRequiredAccuracy
554+ write(*,*) ' > COLLIERCanOutput = ',COLLIERCanOutput
555+ write(*,*) ' > COLLIERComputeUVpoles = ',COLLIERComputeUVpoles
556+ write(*,*) ' > COLLIERComputeIRpoles = ',COLLIERComputeIRpoles
557+ write(*,*) ' > COLLIERGlobalCache = ',COLLIERGlobalCache
558+ write(*,*) ' > COLLIERUseCacheForPoles = ',
559+ &COLLIERUseCacheForPoles
560+ write(*,*) ' > COLLIERUseInternalStabilityTest = ',
561+ &COLLIERUseInternalStabilityTest
562 write(*,*)
563 & '==============================================================='
564 paramPrinted=.TRUE.
565@@ -259,12 +306,22 @@
566 include "MadLoopParams.inc"
567
568 MLReductionLib(1)=6
569- MLReductionLib(2:6)=0
570+ MLReductionLib(2)=7
571+ MLReductionLib(3)=1
572+ MLReductionLib(4:7)=0
573 IREGIMODE=2
574 IREGIRECY=.TRUE.
575+ COLLIERComputeIRpoles = .TRUE.
576+ COLLIERComputeUVpoles = .TRUE.
577+ COLLIERUseCacheForPoles = .FALSE.
578+ COLLIERCanOutput = .FALSE.
579+ COLLIERGlobalCache = -1
580+ COLLIERMode=1
581+ COLLIERRequiredAccuracy=1.0d-8
582+ COLLIERUseInternalStabilityTest = .TRUE.
583 CTModeInit=0
584 CTModeRun=-1
585- NRotations_DP=1
586+ NRotations_DP=0
587 NRotations_QP=0
588 MLStabThres=1.0d-3
589 CTStabThres=1.0d-2
590@@ -281,6 +338,6 @@
591 OSThres=1.0d-13
592 ImprovePSPoint=2
593 UseQPIntegrandForCutTools=.True.
594- UseQPIntegrandForNinja=.False.
595+ UseQPIntegrandForNinja=.True.
596
597 end
598
599=== modified file 'Template/loop_material/StandAlone/SubProcesses/MadLoopParams.inc'
600--- Template/loop_material/StandAlone/SubProcesses/MadLoopParams.inc 2016-02-18 11:42:56 +0000
601+++ Template/loop_material/StandAlone/SubProcesses/MadLoopParams.inc 2016-07-02 20:37:49 +0000
602@@ -7,17 +7,24 @@
603 !
604 integer CTModeInit,CTModeRun,CheckCycle,MaxAttempts,
605 &CTLoopLibrary,NRotations_DP,NRotations_QP,ImprovePSPoint,
606- &MLReductionLib(7),IREGIMODE,HelicityFilterLevel
607-
608- real*8 MLStabThres,CTStabThres,ZeroThres,OSThres
609-
610- logical UseLoopFilter,LoopInitStartOver,DoubleCheckHelicityFilter
611+ &MLReductionLib(8),IREGIMODE,HelicityFilterLevel,COLLIERMode,
612+ &COLLIERGlobalCache
613+
614+ real*8 MLStabThres,CTStabThres,ZeroThres,OSThres,COLLIERRequiredAccuracy
615+
616+ logical UseLoopFilter,LoopInitStartOver,DoubleCheckHelicityFilter,
617+ &COLLIERComputeIRpoles,COLLIERComputeUVpoles,COLLIERCanOutput
618 logical HelInitStartOver,IREGIRECY,WriteOutFilters
619 logical UseQPIntegrandForNinja, UseQPIntegrandForCutTools
620+ logical COLLIERUseCacheForPoles,COLLIERUseInternalStabilityTest
621
622 common /MADLOOP/CTModeInit,CTModeRun,NRotations_DP,NRotations_QP,
623+ &COLLIERMode,COLLIERGlobalCache,
624 &ImprovePSPoint,CheckCycle, MaxAttempts,UseLoopFilter,MLStabThres,
625+ &COLLIERRequiredAccuracy,
626 &CTStabThres,CTLoopLibrary,LoopInitStartOver,
627+ &COLLIERComputeIRpoles,COLLIERComputeUVpoles,COLLIERCanOutput,
628+ &COLLIERUseCacheForPoles,COLLIERUseInternalStabilityTest,
629 &DoubleCheckHelicityFilter,ZeroThres,OSThres,HelInitStartOver,
630 &MLReductionLib,IREGIMODE,HelicityFilterLevel,IREGIRECY,
631 &WriteOutFilters,UseQPIntegrandForNinja,UseQPIntegrandForCutTools
632
633=== modified file 'Template/loop_material/StandAlone/SubProcesses/makefile'
634--- Template/loop_material/StandAlone/SubProcesses/makefile 2016-05-26 23:36:59 +0000
635+++ Template/loop_material/StandAlone/SubProcesses/makefile 2016-07-02 20:37:49 +0000
636@@ -45,6 +45,7 @@
637 $(patsubst $(DOTF),$(DOTO),$(wildcard mp_coef_construction_*.f)) \
638 $(patsubst $(DOTF),$(DOTO),$(wildcard TIR_interface.f)) \
639 $(patsubst $(DOTF),$(DOTO),$(wildcard GOLEM_interface.f)) \
640+ $(patsubst $(DOTF),$(DOTO),$(wildcard COLLIER_interface.f)) \
641 $(patsubst $(DOTF),$(DOTO),$(wildcard compute_color_flows.f))
642
643 OLP_PROCESS= MadLoopParamReader.o MadLoopCommons.o \
644@@ -64,6 +65,7 @@
645 $(patsubst $(DOTF),$(DOTO),$(wildcard $(LOOP_PREFIX)*/mp_coef_construction_*.f)) \
646 $(patsubst $(DOTF),$(DOTO),$(wildcard $(LOOP_PREFIX)*/TIR_interface.f)) \
647 $(patsubst $(DOTF),$(DOTO),$(wildcard $(LOOP_PREFIX)*/GOLEM_interface.f)) \
648+ $(patsubst $(DOTF),$(DOTO),$(wildcard $(LOOP_PREFIX)*/COLLIER_interface.f)) \
649 $(patsubst $(DOTF),$(DOTO),$(wildcard $(LOOP_PREFIX)*/compute_color_flows.f))
650
651 $(PROG): check_sa.o $(PROCESS) makefile $(LIBS)
652
653=== modified file 'input/.mg5_configuration_default.txt'
654--- input/.mg5_configuration_default.txt 2016-04-28 19:07:40 +0000
655+++ input/.mg5_configuration_default.txt 2016-07-02 20:37:49 +0000
656@@ -180,12 +180,17 @@
657 #! if samurai=/PATH/TO/samurai/lib: use that specific installation path for samurai
658 # samurai = None
659
660-#! Set the samurai directory containing ninja's library
661-#! if auto: try to find it automatically on the system (default)
662+#! Set the Ninja directory containing ninja's library
663 #! if '' or None: disabling ninja
664 #! if ninja=/PATH/TO/ninja/lib: use that specific installation path for ninja
665 # ninja = ./HEPTools/lib
666
667+#! Set the COLLIER directory containing COLLIER's library
668+#! if '' or None: disabling COLLIER
669+#! if ninja=/PATH/TO/ninja/lib: use that specific installation path for COLLIER
670+# Note that it is necessary that you have generated a static library for COLLIER
671+# collier = ./HEPTools/lib
672+
673 #! Set how MadLoop dependencies (such as CutTools) should be handled
674 #! > external : ML5 places a link to the MG5_aMC-wide libraries
675 #! > internal : ML5 copies all dependencies in the output so that it is independent
676
677=== modified file 'madgraph/interface/amcatnlo_run_interface.py'
678--- madgraph/interface/amcatnlo_run_interface.py 2016-07-02 10:13:48 +0000
679+++ madgraph/interface/amcatnlo_run_interface.py 2016-07-02 20:37:49 +0000
680@@ -1964,7 +1964,6 @@
681 else:
682 logger.info('The results of this run' + \
683 ' have been saved in %s' % pjoin(self.me_dir, 'Events', self.run_name))
684- devnull.close()
685
686 def combine_plots_HwU(self,jobs,out,normalisation=None):
687 """Sums all the plots in the HwU format."""
688@@ -2402,6 +2401,7 @@
689 4 : 'Golem95',
690 5 : 'Samurai',
691 6 : 'Ninja (double precision)',
692+ 7 : 'COLLIER',
693 8 : 'Ninja (quadruple precision)',
694 9 : 'CutTools (quadruple precision)'}
695 RetUnit_finder =re.compile(
696
697=== modified file 'madgraph/interface/loop_interface.py'
698--- madgraph/interface/loop_interface.py 2016-05-24 09:52:16 +0000
699+++ madgraph/interface/loop_interface.py 2016-07-02 20:37:49 +0000
700@@ -538,10 +538,11 @@
701
702 # Fortran MadGraph5_aMC@NLO Standalone
703 if self._export_format in self.supported_ML_format:
704- for me in matrix_elements:
705+ for unique_id, me in enumerate(matrix_elements):
706 calls = calls + \
707 self._curr_exporter.generate_subprocess_directory_v4(\
708- me, self._curr_fortran_model)
709+ me, self._curr_fortran_model, (unique_id+1))
710+ self._curr_exporter.write_global_specs(matrix_elements)
711 # If all ME's do not share the same maximum loop vertex rank and the
712 # same loop maximum wavefunction size, we need to set the maximum
713 # in coef_specs.inc of the HELAS Source. The SubProcesses/P* directory
714@@ -554,6 +555,7 @@
715 if len(set(max_lwfspins))>1 or len(set(max_loop_vert_ranks))>1:
716 self._curr_exporter.fix_coef_specs(max(max_lwfspins),\
717 max(max_loop_vert_ranks))
718+ self._curr_exporter.write_global_specs(matrix_elements)
719
720 # Just the matrix.f files
721 if self._export_format == 'matrix':
722
723=== modified file 'madgraph/interface/madevent_interface.py'
724--- madgraph/interface/madevent_interface.py 2016-06-28 11:12:01 +0000
725+++ madgraph/interface/madevent_interface.py 2016-07-02 20:37:49 +0000
726@@ -2540,7 +2540,7 @@
727 # helicity filters.
728 self.MadLoopparam.set('CheckCycle',4, ifnotdefault=False)
729
730- # For now it is tricky to have eahc channel performing the helicity
731+ # For now it is tricky to have each channel performing the helicity
732 # double check. What we will end up doing is probably some kind
733 # of new initialization round at the beginning of each launch
734 # command, to reset the filters.
735@@ -2548,7 +2548,7 @@
736 ifnotdefault=False)
737
738 # Thanks to TIR recycling, TIR is typically much faster for Loop-induced
739- # processes, so that we place OPP last.
740+ # processes when not doing MC over helicities, so that we place OPP last.
741 if not hasattr(self, 'run_card'):
742 run_card = banner_mod.RunCard(opt['run_card'])
743 else:
744@@ -2561,7 +2561,7 @@
745 """You chose to set the preferred reduction technique in MadLoop to be OPP (see parameter MLReductionLib).
746 Beware that this can bring significant slowdown; the optimal choice --when not MC over helicity-- being to first start with TIR reduction.""")
747 # We do not include GOLEM for now since it cannot recycle TIR coefs yet.
748- self.MadLoopparam.set('MLReductionLib','2|6|1', ifnotdefault=False)
749+ self.MadLoopparam.set('MLReductionLib','7|6|1', ifnotdefault=False)
750 else:
751 if 'MLReductionLib' in self.MadLoopparam.user_set and \
752 not (self.MadLoopparam.get('MLReductionLib').startswith('1') or
753@@ -2569,7 +2569,7 @@
754 logger.warning(
755 """You chose to set the preferred reduction technique in MadLoop to be different than OPP (see parameter MLReductionLib).
756 Beware that this can bring significant slowdown; the optimal choice --when MC over helicity-- being to first start with OPP reduction.""")
757- self.MadLoopparam.set('MLReductionLib','6|1|2', ifnotdefault=False)
758+ self.MadLoopparam.set('MLReductionLib','6|7|1', ifnotdefault=False)
759
760 # Also TIR cache will only work when NRotations_DP=0 (but only matters
761 # when not MC-ing over helicities) so it will be hard-reset by MadLoop
762
763=== modified file 'madgraph/interface/madgraph_interface.py'
764--- madgraph/interface/madgraph_interface.py 2016-06-28 11:12:01 +0000
765+++ madgraph/interface/madgraph_interface.py 2016-07-02 20:37:49 +0000
766@@ -910,8 +910,11 @@
767
768 user_options = {'--energy':'1000','--split_orders':'-1',
769 '--reduction':'1|2|3|4|5|6','--CTModeRun':'-1',
770- '--helicity':'-1','--seed':'-1'}
771-
772+ '--helicity':'-1','--seed':'-1','--collier_cache':'-1',
773+ '--collier_req_acc':'auto',
774+ '--collier_internal_stability_test':'False',
775+ '--collier_mode':'1'}
776+
777 if args[0] in ['cms'] or args[0].lower()=='cmsoptions':
778 # increase the default energy to 5000
779 user_options['--energy']='5000'
780@@ -2638,7 +2641,7 @@
781 'update', 'Delphes2', 'SysCalc', 'Golem95', 'PJFry',
782 'QCDLoop']
783 # The targets below are installed using the HEPToolsInstaller.py script
784- _advanced_install_opts = ['ninja']
785+ _advanced_install_opts = ['ninja','collier']
786
787 # The options below are commented for now but already available
788 # _advanced_install_opts += ['pythia8','zlib','boost','lhapdf6','lhapdf5','hepmc','mg5amc_py8_interface','oneloop']
789@@ -2693,6 +2696,7 @@
790 'golem':'auto',
791 'samurai':None,
792 'ninja':'./HEPTools/lib',
793+ 'collier':'./HEPTools/lib',
794 'lhapdf':'lhapdf-config',
795 'applgrid':'applgrid-config',
796 'amcfast':'amcfast-config',
797@@ -3535,6 +3539,15 @@
798 " must be an integer, not %s."%option[1])
799 elif option[0]=='--reduction':
800 MLoptions['MLReductionLib']=[int(ir) for ir in option[1].split('|')]
801+ elif option[0]=='--collier_mode':
802+ MLoptions['COLLIERMode']=int(option[1])
803+ elif option[0]=='--collier_cache':
804+ MLoptions['COLLIERGlobalCache']=int(option[1])
805+ elif option[0]=='--collier_req_acc':
806+ if option[1]!='auto':
807+ MLoptions['COLLIERRequiredAccuracy']=float(option[1])
808+ elif option[0]=='--collier_internal_stability_test':
809+ MLoptions['COLLIERUseInternalStabilityTest']=eval(option[1])
810 elif option[0]=='--CTModeRun':
811 try:
812 MLoptions['CTModeRun']=int(option[1])
813@@ -3899,6 +3912,14 @@
814 logger_check.warning('Samurai not available on your system; it will be skipped.')
815 MLoptions["MLReductionLib"].remove(5)
816
817+ if 'collier' in self.options and isinstance(self.options['collier'],str):
818+ TIR_dir['collier_dir']=self.options['collier']
819+ else:
820+ if "MLReductionLib" in MLoptions:
821+ if 7 in MLoptions["MLReductionLib"]:
822+ logger_check.warning('Collier not available on your system; it will be skipped.')
823+ MLoptions["MLReductionLib"].remove(7)
824+
825 if 'ninja' in self.options and isinstance(self.options['ninja'],str):
826 TIR_dir['ninja_dir']=self.options['ninja']
827 else:
828@@ -5398,7 +5419,9 @@
829 self.options['mg5amc_py8_interface_path'] = \
830 pjoin(MG5DIR,'HEPTools','MG5aMC_PY8_interface')
831 self.exec_cmd('save options')
832-
833+ elif tool == 'collier':
834+ self.options['collier'] = pjoin(os.curdir,'HEPTools','lib')
835+ self.exec_cmd('save options')
836 elif tool == 'ninja':
837 if not misc.get_ninja_quad_prec_support(pjoin(
838 MG5DIR,'HEPTools','ninja','lib')):
839@@ -5497,6 +5520,7 @@
840 'hepmc':['CPC 134 (2001) 41-46'],
841 'mg5amc_py8_interface':['arXiv:1410.3012','arXiv:XXXX.YYYYY'],
842 'ninja':['arXiv:1203.0291','arXiv:1403.1229','arXiv:1604.01363'],
843+ 'collier':['arXiv:1604.06792'],
844 'oneloop':['arXiv:1007.4716']}
845
846 if args[0] in advertisements:
847@@ -6867,8 +6891,8 @@
848 logger.info('set fastjet to %s' % args[1])
849 self.options[args[0]] = args[1]
850
851- elif args[0] in ['pjfry','golem','samurai','ninja'] and \
852- not (args[0]=='ninja' and args[1]=='./HEPTools/lib'):
853+ elif args[0] in ['pjfry','golem','samurai','ninja','collier'] and \
854+ not (args[0] in ['ninja','collier'] and args[1]=='./HEPTools/lib'):
855 if args[1] in ['None',"''",'""']:
856 self.options[args[0]] = None
857 else:
858@@ -7268,6 +7292,8 @@
859 if self._export_format == 'madevent':
860 calls += self._curr_exporter.export_processes(self._curr_matrix_elements,
861 self._curr_fortran_model)
862+ self._curr_exporter.write_global_specs(
863+ self._curr_matrix_elements.get_matrix_elements())
864
865 # Write the procdef_mg5.dat file with process info
866 card_path = pjoin(path, os.path.pardir, 'SubProcesses', \
867
868=== modified file 'madgraph/iolibs/export_fks.py'
869--- madgraph/iolibs/export_fks.py 2016-05-12 10:46:19 +0000
870+++ madgraph/iolibs/export_fks.py 2016-07-02 20:37:49 +0000
871@@ -187,7 +187,8 @@
872 writer = writers.FortranWriter(os.path.join(self.dir_path,
873 "SubProcesses","MadLoopCommons.f"))
874 writer.writelines(MadLoopCommon%{
875- 'print_banner_commands':self.MadLoop_banner})
876+ 'print_banner_commands':self.MadLoop_banner},
877+ context={'collier_available':False})
878 writer.close()
879
880 # Write the cts_mpc.h and cts_mprec.h files imported from CutTools
881@@ -1573,12 +1574,19 @@
882 matrix_element.get('processes')[0].nice_string(print_weighted=False))
883 plot.draw()
884
885+ # We also need to write the overall maximum quantities for this group
886+ # of processes in 'global_specs.inc'. In aMCatNLO, there is always
887+ # only one process, so this is trivial
888+ self.write_global_specs(matrix_element)
889+ open('unique_id.inc','w').write(
890+""" integer UNIQUE_ID
891+ parameter(UNIQUE_ID=1)""")
892+
893 linkfiles = ['coupl.inc', 'mp_coupl.inc', 'mp_coupl_same_name.inc',
894 'cts_mprec.h', 'cts_mpc.h', 'MadLoopParamReader.f',
895- 'MadLoopCommons.f','MadLoopParams.inc']
896+ 'MadLoopCommons.f','MadLoopParams.inc','global_specs.inc']
897
898 # We should move to MadLoop5_resources directory from the SubProcesses
899-
900 ln(pjoin(os.path.pardir,os.path.pardir,'MadLoopParams.dat'),
901 pjoin('..','MadLoop5_resources'))
902
903@@ -3090,17 +3098,31 @@
904 libpath,"lib%s.a"%tir,tir_name=tir)
905 setattr(self,tir_dir,libpath)
906 if libpath != "":
907- if tir in ['pjfry','ninja','golem', 'samurai']:
908+ if tir in ['pjfry','ninja','golem', 'samurai','collier']:
909 # We should link dynamically when possible, so we use the original
910 # location of these libraries.
911 link_tir_libs.append('-L%s/ -l%s'%(libpath,tir))
912 tir_libs.append('%s/lib%s.$(libext)'%(libpath,tir))
913- # We must add the corresponding includes for golem, samurai
914- # and ninja
915- if tir in ['golem','samurai','ninja']:
916+ # For Ninja, we must also link against OneLoop.
917+ if tir in ['ninja']:
918+ if not any(os.path.isfile(pjoin(libpath,'libavh_olo.%s'%ext))
919+ for ext in ['a','dylib','so']):
920+ raise MadGraph5Error(
921+"The OneLOop library 'libavh_olo.(a|dylib|so)' could no be found in path '%s'. Please place a symlink to it there."%libpath)
922+ link_tir_libs.append('-L%s/ -l%s'%(libpath,'avh_olo'))
923+ tir_libs.append('%s/lib%s.$(libext)'%(libpath,'avh_olo'))
924+ # We must add the corresponding includes for these TIR
925+ if tir in ['golem','samurai','ninja','collier']:
926 trg_path = pjoin(os.path.dirname(libpath),'include')
927- to_include = misc.find_includes_path(trg_path,
928+ if os.path.isdir(trg_path):
929+ to_include = misc.find_includes_path(trg_path,
930 self.include_names[tir])
931+ else:
932+ to_include = None
933+ # Special possible location for collier
934+ if to_include is None and tir=='collier':
935+ to_include = misc.find_includes_path(
936+ pjoin(libpath,'modules'),self.include_names[tir])
937 if to_include is None:
938 logger.error(
939 'Could not find the include directory for %s, looking in %s.\n' % (tir ,str(trg_path))+
940@@ -3170,7 +3192,8 @@
941 writer = writers.FortranWriter(os.path.join(self.dir_path,
942 "SubProcesses","MadLoopCommons.f"))
943 writer.writelines(MadLoopCommon%{
944- 'print_banner_commands':self.MadLoop_banner})
945+ 'print_banner_commands':self.MadLoop_banner},
946+ context={'collier_available':self.tir_available_dict['collier']})
947 writer.close()
948
949 # link the files from the MODEL
950@@ -3280,14 +3303,21 @@
951 print_weighted=False))
952 plot.draw()
953
954+ # We also need to write the overall maximum quantities for this group
955+ # of processes in 'global_specs.inc'. In aMCatNLO, there is always
956+ # only one process, so this is trivial
957+ self.write_global_specs(matrix_element)
958+ open('unique_id.inc','w').write(
959+""" integer UNIQUE_ID
960+ parameter(UNIQUE_ID=1)""")
961+
962 linkfiles = ['coupl.inc', 'mp_coupl.inc', 'mp_coupl_same_name.inc',
963 'cts_mprec.h', 'cts_mpc.h', 'MadLoopParamReader.f',
964- 'MadLoopParams.inc','MadLoopCommons.f']
965+ 'MadLoopParams.inc','MadLoopCommons.f','global_specs.inc']
966
967 for file in linkfiles:
968 ln('../../%s' % file)
969-
970-
971+
972 os.system("ln -s ../../makefile_loop makefile")
973
974 # We should move to MadLoop5_resources directory from the SubProcesses
975
976=== modified file 'madgraph/iolibs/export_v4.py'
977--- madgraph/iolibs/export_v4.py 2016-04-16 23:51:09 +0000
978+++ madgraph/iolibs/export_v4.py 2016-07-02 20:37:49 +0000
979@@ -102,9 +102,11 @@
980
981 calls = 0
982 if isinstance(matrix_elements, group_subprocs.SubProcessGroupList):
983+ unique_id=1
984 for (group_number, me_group) in enumerate(matrix_elements):
985 calls = calls + self.generate_subprocess_directory_v4(\
986- me_group, fortran_model, group_number)
987+ me_group, fortran_model, group_number, unique_id=unique_id)
988+ unique_id += len(me_group.get('matrix_elements'))
989 else:
990 for me_number, me in enumerate(matrix_elements.get_matrix_elements()):
991 calls = calls + self.generate_subprocess_directory_v4(\
992@@ -112,7 +114,16 @@
993
994 return calls
995
996-
997+ #===========================================================================
998+ # Generate an include file with global quantities about all ME's output.
999+ #===========================================================================
1000+ def write_global_specs(self, matrix_elements):
1001+ """ Writes the file global_specs.inc which contains general information
1002+ about *all* the ME's output in this directory."""
1003+
1004+ # Do nothing here, but daughter classes such as LoopOptimizedExporterFortran
1005+ # overwrites this.
1006+ pass
1007
1008 #===========================================================================
1009 # create the run_card
1010@@ -4462,10 +4473,12 @@
1011 #===========================================================================
1012 def generate_subprocess_directory_v4(self, subproc_group,
1013 fortran_model,
1014- group_number):
1015+ group_number,
1016+ unique_id=None):
1017 """Generate the Pn directory for a subprocess group in MadEvent,
1018 including the necessary matrix_N.f files, configs.inc and various
1019- other helper files"""
1020+ other helper files. Unique_id is dummy here, but not in
1021+ LoopInducedExporterMEGroup, so it must be kept."""
1022
1023 assert isinstance(subproc_group, group_subprocs.SubProcessGroup), \
1024 "subproc_group object not SubProcessGroup"
1025@@ -6261,34 +6274,58 @@
1026 else:
1027 curr_proc = None
1028
1029- requires_ninja = opt['loop_optimized_output'] and (not curr_proc is None) and \
1030- (curr_proc.get('perturbation_couplings') != [] and \
1031- not curr_proc.get('NLO_mode') in [None,'real','tree','LO','LOonly'])
1032+ requires_reduction_tool = opt['loop_optimized_output'] and \
1033+ (not curr_proc is None) and \
1034+ (curr_proc.get('perturbation_couplings') != [] and \
1035+ not curr_proc.get('NLO_mode') in [None,'real','tree','LO','LOonly'])
1036 # An installation is required then, but only if the specified path is the
1037 # default local one and that the Ninja library appears missing.
1038- if requires_ninja and (not opt['ninja'] is None) and\
1039+ if requires_reduction_tool:
1040+ if (not opt['ninja'] is None) and\
1041 os.path.abspath(opt['ninja'])==pjoin(MG5DIR,'HEPTools','lib') and\
1042 not os.path.isfile(pjoin(MG5DIR,'HEPTools','lib','libninja.a')):
1043- # Then install Ninja here from the tarballs in the vendor
1044- # directory so that it would work offline too.
1045- logger.info(
1046+ # Then install Ninja here from the tarballs in the vendor
1047+ # directory so that it would work offline too.
1048+ logger.info(
1049 """MG5aMC will now install the loop reduction tool 'Ninja' from the local offline installer.
1050 Use the command 'install ninja' if you want to update to the latest online version.
1051 This installation can take some time but only needs to be performed once.""",'$MG:color:GREEN')
1052- try:
1053- cmd.do_install('ninja',paths={'HEPToolsInstaller':
1054+ try:
1055+ cmd.do_install('ninja',paths={'HEPToolsInstaller':
1056 pjoin(MG5DIR,'vendor','OfflineHEPToolsInstaller.tar.gz')},
1057- additional_options=[
1058+ additional_options=[
1059 '--ninja_tarball=%s'%pjoin(MG5DIR,'vendor','ninja.tar.gz'),
1060 '--oneloop_tarball=%s'%pjoin(MG5DIR,'vendor','oneloop.tar.gz')])
1061- except InvalidCmd:
1062+ except InvalidCmd:
1063 logger.warning(
1064 """The offline installation of Ninja was unsuccessful, and MG5aMC disabled it.
1065 In the future, if you want to reactivate Ninja, you can do so by re-attempting
1066 its online installation with the command 'install ninja' or install it on your
1067 own and set the path to its library in the MG5aMC option 'ninja'.""")
1068 cmd.exec_cmd("set ninja ''")
1069- cmd.exec_cmd('save options')
1070+ cmd.exec_cmd('save options')
1071+ if (not opt['collier'] is None) and\
1072+ os.path.abspath(opt['collier'])==pjoin(MG5DIR,'HEPTools','lib') and\
1073+ not os.path.isfile(pjoin(MG5DIR,'HEPTools','lib','libcollier.a')):
1074+ # Then install Collier here from the tarballs in the vendor
1075+ # directory so that it would work offline too.
1076+ logger.info(
1077+"""MG5aMC will now install the loop reduction tool 'COLLIER' from the local offline installer.
1078+Use the command 'install collier' if you want to update to the latest online version.
1079+This installation can take some time but only needs to be performed once.""",'$MG:color:GREEN')
1080+ try:
1081+ cmd.do_install('collier',paths={'HEPToolsInstaller':
1082+ pjoin(MG5DIR,'vendor','OfflineHEPToolsInstaller.tar.gz')},
1083+ additional_options=[
1084+ '--collier_tarball=%s'%pjoin(MG5DIR,'vendor','collier.tar.gz')])
1085+ except InvalidCmd:
1086+ logger.warning(
1087+"""The offline installation of COLLIER was unsuccessful, and MG5aMC disabled it.
1088+In the future, if you want to reactivate COLLIER, you can do so by re-attempting
1089+its online installation with the command 'install collier' or install it on your
1090+own and set the path to its library in the MG5aMC option 'collier'.""")
1091+ cmd.exec_cmd("set collier ''")
1092+ cmd.exec_cmd('save options')
1093
1094
1095 # ==========================================================================
1096@@ -6304,6 +6341,7 @@
1097 'golem_dir':cmd.options['golem'],
1098 'samurai_dir':cmd.options['samurai'],
1099 'ninja_dir':cmd.options['ninja'],
1100+ 'collier_dir':cmd.options['collier'],
1101 'fortran_compiler':cmd.options['fortran_compiler'],
1102 'f2py_compiler':cmd.options['f2py_compiler'],
1103 'output_dependencies':cmd.options['output_dependencies'],
1104@@ -6431,10 +6469,12 @@
1105 #===========================================================================
1106 def generate_subprocess_directory_v4(self, subproc_group,
1107 fortran_model,
1108- group_number):
1109+ group_number,
1110+ unique_id=None):
1111 """Generate the Pn directory for a subprocess group in MadEvent,
1112 including the necessary matrix_N.f files, configs.inc and various
1113- other helper files"""
1114+ other helper files. Unique_id is dummy here, but not in
1115+ LoopInducedExporterMEGroup, so it must be kept."""
1116
1117 if not isinstance(subproc_group, group_subprocs.SubProcessGroup):
1118 raise base_objects.PhysicsObject.PhysicsObjectError,\
1119
1120=== modified file 'madgraph/iolibs/template_files/loop/check_sa.inc'
1121--- madgraph/iolibs/template_files/loop/check_sa.inc 2016-02-17 21:24:01 +0000
1122+++ madgraph/iolibs/template_files/loop/check_sa.inc 2016-07-02 20:37:49 +0000
1123@@ -262,6 +262,7 @@
1124 write(*,*) 'Estimated accuracy could not be computed for an unknown reason.'
1125 endif
1126 endif
1127+ Write (*,'(1x,a23,3x,i3)') 'MadLoop return code =',RETURNCODE
1128 write (*,*) "---------------------------------"
1129 IF (NBORNCHOSEN.EQ.0) THEN
1130 write (*,*) "No Born contribution satisfied the squared order constraints."
1131
1132=== modified file 'madgraph/iolibs/template_files/loop/check_sa_loop_induced.inc'
1133--- madgraph/iolibs/template_files/loop/check_sa_loop_induced.inc 2016-02-17 21:24:01 +0000
1134+++ madgraph/iolibs/template_files/loop/check_sa_loop_induced.inc 2016-07-02 20:37:49 +0000
1135@@ -241,6 +241,7 @@
1136 write(*,*) 'Estimated accuracy could not be computed for an unknown reason.'
1137 endif
1138 endif
1139+ Write (*,'(1x,a23,3x,i3)') 'MadLoop return code =',RETURNCODE
1140 write (*,*) "---------------------------------"
1141 IF (NLOOPCHOSEN.ne.NSQUAREDSO) THEN
1142 write (*,*) "Selected squared coupling orders combination for the loop summed result below:"
1143
1144=== added file 'madgraph/iolibs/template_files/loop_optimized/COLLIER_interface.inc'
1145--- madgraph/iolibs/template_files/loop_optimized/COLLIER_interface.inc 1970-01-01 00:00:00 +0000
1146+++ madgraph/iolibs/template_files/loop_optimized/COLLIER_interface.inc 2016-07-02 20:37:49 +0000
1147@@ -0,0 +1,646 @@
1148+ SUBROUTINE %(proc_prefix)sCOLLIERLOOP(CTMODE, NLOOPLINE,RANK,PL,PDEN,M2L,TIRCOEFS,TIRCOEFSERRORS)
1149+C
1150+%(info_lines)s
1151+C
1152+C Interface between MG5 and COLLIER.
1153+C It supports any rank when 1 < NLOOPLINE < 7.
1154+C
1155+%(process_lines)s
1156+C
1157+C
1158+C MODULES
1159+C
1160+ USE COLLIER
1161+ IMPLICIT NONE
1162+C
1163+C CONSTANTS
1164+C
1165+ LOGICAL checkPConservation
1166+ PARAMETER (checkPConservation=.TRUE.)
1167+ %(real_dp_format)s PIVALUE
1168+ PARAMETER(PIVALUE=3.14159265358979323846D0)
1169+ integer MAXRANK
1170+ parameter (MAXRANK=%(maxrank)d)
1171+ INTEGER NLOOPGROUPS
1172+ PARAMETER (NLOOPGROUPS=%(nloop_groups)d)
1173+ include 'loop_max_coefs.inc'
1174+C
1175+C ARGUMENTS
1176+C
1177+ INTEGER NLOOPLINE, RANK, CTMODE
1178+ %(real_dp_format)s PL(0:3,NLOOPLINE)
1179+ %(real_dp_format)s PDEN(0:3,NLOOPLINE-1)
1180+ %(mass_dp_format)s M2L(NLOOPLINE)
1181+ %(complex_dp_format)s RES(3)
1182+ %(complex_dp_format)s TIRCOEFS(0:LOOPMAXCOEFS-1,3)
1183+ %(complex_dp_format)s TIRCOEFSERRORS(0:LOOPMAXCOEFS-1,3)
1184+
1185+C
1186+C LOCAL VARIABLES
1187+C
1188+ INTEGER N, I, J, K, L
1189+ INTEGER C0,C1,C2,C3
1190+ INTEGER N_CACHES
1191+ INTEGER CURR_RANK, SGN
1192+ INTEGER CURR_INDEX
1193+ INTEGER CURR_MAXCOEF
1194+ %(real_dp_format)s RBUFF(0:3)
1195+
1196+ INTEGER COEFMAP_ZERO(0:LOOPMAXCOEFS-1)
1197+ INTEGER COEFMAP_ONE(0:LOOPMAXCOEFS-1)
1198+ INTEGER COEFMAP_TWO(0:LOOPMAXCOEFS-1)
1199+ INTEGER COEFMAP_THREE(0:LOOPMAXCOEFS-1)
1200+ %(collier_coefmap)s
1201+
1202+ %(real_dp_format)s REF_NORMALIZATION
1203+
1204+ double complex M2LCOLLIER(0:NLOOPLINE-1)
1205+ double complex MomVec(0:3,NLOOPLINE-1)
1206+ double complex MomInv((NLOOPLINE*(NLOOPLINE-1))/2)
1207+
1208+ double complex TNten(0:RANK,0:RANK,0:RANK,0:RANK)
1209+ double complex TNtenuv(0:RANK,0:RANK,0:RANK,0:RANK)
1210+ double precision TNtenerr(0:RANK)
1211+
1212+ %(real_dp_format)s MaxCoefForRank(0:RANK)
1213+
1214+C These quantities are for the pole evaluation
1215+ double complex TNten_UV(0:RANK,0:RANK,0:RANK,0:RANK)
1216+ double complex TNtenuv_UV(0:RANK,0:RANK,0:RANK,0:RANK)
1217+ double precision TNtenerr_UV(0:RANK)
1218+ double complex TNten_IR1(0:RANK,0:RANK,0:RANK,0:RANK)
1219+ double complex TNtenuv_IR1(0:RANK,0:RANK,0:RANK,0:RANK)
1220+ double precision TNtenerr_IR1(0:RANK)
1221+ double complex TNten_IR2(0:RANK,0:RANK,0:RANK,0:RANK)
1222+ double complex TNtenuv_IR2(0:RANK,0:RANK,0:RANK,0:RANK)
1223+ double precision TNtenerr_IR2(0:RANK)
1224+C
1225+C GLOBAL VARIABLES
1226+C
1227+ include 'coupl.inc'
1228+ include 'MadLoopParams.inc'
1229+ include 'unique_id.inc'
1230+ include 'global_specs.inc'
1231+
1232+## if(not AmplitudeReduction) {
1233+ INTEGER ID,SQSOINDEX,R
1234+ common/%(proc_prefix)sLOOP/ID,SQSOINDEX,R
1235+## }else{
1236+ INTEGER ID,R
1237+ common/%(proc_prefix)sLOOP/ID,R
1238+## }
1239+
1240+C
1241+C These global variables cache the coefficients already computed by COLLIER
1242+C so that they can be reused. In particular, in CTMODE 2, the cached ERROR
1243+C quantities for eahc rank will be used to make use of COLLIER's internal
1244+C assessment of the numerical accuracy.
1245+C
1246+ logical LOOP_ID_DONE(NLOOPGROUPS)
1247+ DATA LOOP_ID_DONE/NLOOPGROUPS*.FALSE./
1248+ %(complex_dp_format)s TIR_COEFS_DIRECT_MODE(0:LOOPMAXCOEFS-1,3,NLOOPGROUPS)
1249+ %(real_dp_format)s TIR_COEFS_ERROR(0:MAXRANK,NLOOPGROUPS)
1250+ common/%(proc_prefix)sCOLLIER_TIR_COEFS/TIR_COEFS_DIRECT_MODE,TIR_COEFS_ERROR,LOOP_ID_DONE
1251+
1252+ INTEGER COLLIER_CACHE_ACTIVE, NCALLS_IN_CACHE(4), NCOLLIERCALLS(4)
1253+ LOGICAL MUST_INIT_EVENT
1254+ COMMON/%(proc_prefix)sCOLLIER_CACHE_STATUS/COLLIER_CACHE_ACTIVE,NCALLS_IN_CACHE, NCOLLIERCALLS,MUST_INIT_EVENT
1255+
1256+ LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT, COLLIERINIT
1257+ COMMON/REDUCTIONCODEINIT/CTINIT, TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT, COLLIERINIT
1258+
1259+C ----------
1260+C BEGIN CODE
1261+C ----------
1262+
1263+ IF (COLLIERUseCacheForPoles) THEN
1264+ N_CACHES = 4
1265+ ELSE
1266+ N_CACHES =1
1267+ ENDIF
1268+
1269+C Initialize COLLIER if needed
1270+ IF (COLLIERINIT) THEN
1271+ COLLIERINIT=.FALSE.
1272+ CALL INITCOLLIER()
1273+ ENDIF
1274+
1275+C Initialize the event if it is the first time collier is called on this PS point
1276+ IF(MUST_INIT_EVENT) THEN
1277+ MUST_INIT_EVENT = .False.
1278+ IF (COLLIERGlobalCache.eq.0) THEN
1279+ CALL InitEvent_cll()
1280+ ELSE
1281+ DO I=1,N_CACHES
1282+C Record how many events where put in the cache. On the first PS point.
1283+ IF (NCALLS_IN_CACHE(I).eq.-1.AND.NCOLLIERCALLS(I).gt.0) THEN
1284+ NCALLS_IN_CACHE(I) = NCOLLIERCALLS(I)
1285+ ENDIF
1286+ ENDDO
1287+ DO I=1,N_CACHES
1288+C Now apply a safety check that our last event had as many calls as the cache is setup for.
1289+C The only case for now when it can be half of the calls when we are doing the true loop-direction test with also the computation of a rotated PS point (which is computed for one mode only).
1290+ IF (NCALLS_IN_CACHE(I).ne.-1.and..NOT. ( NCOLLIERCALLS(I).eq.NCALLS_IN_CACHE(I).or. ( CTModeRun.eq.-1.and..not.COLLIERUseInternalStabilityTest.and.NRotations_DP.gt.0.and.MOD(NCALLS_IN_CACHE(I),2).eq.0.and.(NCALLS_IN_CACHE(I)/2).eq.NCOLLIERCALLS(I) ) ) ) then
1291+ WRITE(*,*) 'WARNING: A consistency check in MadLoop failed and, for safety, forced MadLoop to reinitialize the global cache of COLLIER. Report this to MadLoop authors. The problematic cache was number ',I
1292+ IF (COLLIERGLOBALCACHE.EQ.-1) THEN
1293+ CALL INITCACHESYSTEM_CLL(N_CACHES*NPROCS,MAXNEXTERNAL)
1294+ ELSE
1295+ CALL INITCACHESYSTEM_CLL(N_CACHES*NPROCS,COLLIERGLOBALCACHE)
1296+ ENDIF
1297+C Make sure all caches are switched off at first.
1298+ call SwitchOffCacheSystem_cll()
1299+C Reset the cache design property
1300+ NCALLS_IN_CACHE(:) = -1
1301+ NCOLLIERCALLS(:) = 0
1302+ IF (COLLIER_CACHE_ACTIVE.eq.1) THEN
1303+ CALL SwitchOnCache_cll((unique_id-1)*N_CACHES+1)
1304+ ENDIF
1305+C No need to check the other caches since we already had to reset here.
1306+ EXIT
1307+ ENDIF
1308+ ENDDO
1309+ CALL InitEvent_cll((UNIQUE_ID-1)*N_CACHES+1)
1310+ NCOLLIERCALLS(1) = 0
1311+ IF(COLLIERComputeUVpoles.and.COLLIERUseCacheForPoles) THEN
1312+ CALL InitEvent_cll((UNIQUE_ID-1)*N_CACHES+2)
1313+ NCOLLIERCALLS(2) = 0
1314+ ENDIF
1315+ IF(COLLIERComputeIRpoles.and.COLLIERUseCacheForPoles) THEN
1316+ CALL InitEvent_cll((UNIQUE_ID-1)*N_CACHES+3)
1317+ NCOLLIERCALLS(3) = 0
1318+ CALL InitEvent_cll((UNIQUE_ID-1)*N_CACHES+4)
1319+ NCOLLIERCALLS(4) = 0
1320+ ENDIF
1321+ ENDIF
1322+ CALL SetDeltaIR_cll(0.0d0,(PIVALUE**2)/6.0d0)
1323+ CALL SetDeltaUV_cll(0.0d0)
1324+ CALL SetMuIR2_cll(mu_r**2)
1325+ CALL SetMuUV2_cll(mu_r**2)
1326+ ENDIF
1327+
1328+C Now really start the reduction with COLLIER
1329+
1330+C Number of coefficients for the current rank
1331+ CURR_MAXCOEF = 0
1332+ DO I=0,RANK
1333+ CURR_MAXCOEF=CURR_MAXCOEF+(3+I)*(2+I)*(1+I)/6
1334+ ENDDO
1335+
1336+ IF (CTMODE.ne.1.and.CTMODE.ne.2) THEN
1337+ WRITE(*,*) 'ERROR: COLLIER only support the computational mode CTMODE equal to 1 or 2, not',CTMODE
1338+ stop 'Incorrect computational mode specified to the COLLIER MG5aMC interface.'
1339+ ENDIF
1340+
1341+ DO I=0,CURR_MAXCOEF-1
1342+ DO K=1,3
1343+ TIRCOEFSERRORS(I,K)=DCMPLX(0.0d0,0.0d0)
1344+ ENDDO
1345+ ENDDO
1346+
1347+ IF (COLLIERUseInternalStabilityTest) THEN
1348+C Use MADLOOP internal cache dedicated to COLLIER that emulates the CTMODE 2
1349+ IF (LOOP_ID_DONE(ID)) THEN
1350+ DO I=0,CURR_MAXCOEF-1
1351+ DO K=1,3
1352+ TIRCOEFS(I,K)=TIR_COEFS_DIRECT_MODE(I,K,ID)
1353+ ENDDO
1354+ ENDDO
1355+ DO I=0,RANK
1356+ MaxCoefForRank(I) = 0.0d0
1357+ ENDDO
1358+ DO I=0,CURR_MAXCOEF-1
1359+ CURR_RANK = COEFMAP_ZERO(I)+COEFMAP_ONE(I)+COEFMAP_TWO(I)+COEFMAP_THREE(I)
1360+ MaxCoefForRank(CURR_RANK)=max(MaxCoefForRank(CURR_RANK),abs(TIR_COEFS_DIRECT_MODE(I,1,ID)))
1361+ ENDDO
1362+ DO I=0,CURR_MAXCOEF-1
1363+ CURR_RANK = COEFMAP_ZERO(I)+COEFMAP_ONE(I)+COEFMAP_TWO(I)+COEFMAP_THREE(I)
1364+ IF (MaxCoefForRank(CURR_RANK).ne.0.0d0) THEN
1365+ DO K=1,3
1366+C The expression below is like taking the absolute value when summing errors linearly
1367+C TIRCOEFSERRORS(I,K)=(TIR_COEFS_ERROR(CURR_RANK,ID)/MaxCoefForRank(CURR_RANK))*DCMPLX( ABS(DBLE(TIRCOEFS(I,K))),ABS(DIMAG(TIRCOEFS(I,K))) )
1368+C But empirically, I observed that retaining the original complex phase leads to slightly more accurate estimates
1369+ TIRCOEFSERRORS(I,K)=(TIR_COEFS_ERROR(CURR_RANK,ID)/MaxCoefForRank(CURR_RANK))*TIRCOEFS(I,K)
1370+ ENDDO
1371+ ENDIF
1372+ ENDDO
1373+ RETURN
1374+ ENDIF
1375+ ELSE
1376+C Apply the loop-direction switching here.
1377+ CALL %(proc_prefix)sSWITCH_ORDER(CTMODE,NLOOPLINE,PL,PDEN,M2L)
1378+ ENDIF
1379+
1380+C Make sure masses are complex
1381+ do I=1,NLOOPLINE
1382+ M2LCOLLIER(I-1)=DCMPLX(M2L(I))
1383+ ENDDO
1384+
1385+C Now convert the loop offset momenta to COLLIER conventions
1386+ DO i=0,3
1387+ DO j=1,NLOOPLINE-1
1388+ MomVec(i,j)=DCMPLX(PDEN(i,j),0.0d0)
1389+ ENDDO
1390+ ENDDO
1391+
1392+C This first do loop spans over 'N' in '\foreach_N \foreach_i(k_i+k_{i+1}+..+k_{i+N})^2'
1393+ CURR_INDEX = 0
1394+ DO N=0,NLOOPLINE-1
1395+C We stop whenever we reached the target number of invariants
1396+ IF (CURR_INDEX.GE.((NLOOPLINE*(NLOOPLINE-1))/2)) THEN
1397+ EXIT
1398+ ENDIF
1399+C This do loop spans over 'i' in the expression above.
1400+ DO I=1,NLOOPLINE
1401+ IF (CURR_INDEX.GE.((NLOOPLINE*(NLOOPLINE-1))/2)) THEN
1402+ EXIT
1403+ ENDIF
1404+
1405+ CURR_INDEX = CURR_INDEX+1
1406+ RBUFF(:) = 0.0D0
1407+ DO J=I,I+N
1408+ RBUFF(:) = RBUFF(:) + PL(:,MOD(J-1,NLOOPLINE)+1)
1409+ ENDDO
1410+ MomInv(CURR_INDEX) = DCMPLX(RBUFF(0)**2-RBUFF(1)**2-RBUFF(2)**2-RBUFF(3)**2,0.0d0)
1411+
1412+C Now regularize the onshell behavior of the kinematic invarients
1413+C All loop masses are tested, but that might be a bit too inclusive.
1414+ DO K=1,NLOOPLINE
1415+ IF(ABS(M2L(K)).NE.0.0d0) THEN
1416+ IF(ABS((MomInv(CURR_INDEX)-M2L(K))/M2L(K)).LT.OSTHRES) THEN
1417+ MomInv(CURR_INDEX)=DCMPLX(M2L(K))
1418+ ENDIF
1419+ ENDIF
1420+ ENDDO
1421+C For the massless onshell-case, we base the threshold only on the energy component
1422+ REF_NORMALIZATION=0.0D0
1423+ DO L=0,0
1424+ REF_NORMALIZATION = REF_NORMALIZATION + ABS(RBUFF(L))
1425+ ENDDO
1426+ REF_NORMALIZATION = (REF_NORMALIZATION/(N+1))**2
1427+ IF(REF_NORMALIZATION.NE.0.0D0)THEN
1428+ IF(ABS(MomInv(CURR_INDEX)/REF_NORMALIZATION).LT.OSTHRES)THEN
1429+ MomInv(CURR_INDEX)=DCMPLX(0.0d0,0.0d0)
1430+ ENDIF
1431+ ENDIF
1432+
1433+ ENDDO
1434+ ENDDO
1435+
1436+C We can now call COLLIER
1437+ IF (NLOOPLINE.ne.1) THEN
1438+ CALL TNten_cll(TNten, TNtenuv, MomVec, MomInv, M2LCOLLIER, NLOOPLINE, RANK, TNtenerr)
1439+ ELSE
1440+ CALL TNten_cll(TNten, TNtenuv, M2LCOLLIER, NLOOPLINE, RANK, TNtenerr)
1441+ ENDIF
1442+ IF (COLLIER_CACHE_ACTIVE.eq.1) THEN
1443+ NCOLLIERCALLS(1) = NCOLLIERCALLS(1)+1
1444+ ENDIF
1445+
1446+C Now compute the UV poles if asked for
1447+ IF (COLLIERComputeUVpoles) THEN
1448+ IF(COLLIER_CACHE_ACTIVE.eq.1) THEN
1449+ CALL SwitchOffCache_cll((unique_id-1)*N_CACHES+1)
1450+ IF(COLLIERUseCacheForPoles) THEN
1451+ CALL SwitchOnCache_cll((unique_id-1)*N_CACHES+2)
1452+ ENDIF
1453+ ENDIF
1454+ CALL SetDeltaUV_cll(1.0d0)
1455+ IF (NLOOPLINE.ne.1) THEN
1456+ CALL TNten_cll(TNten_UV, TNtenuv_UV, MomVec, MomInv, M2LCOLLIER, NLOOPLINE, RANK, TNtenerr_UV)
1457+ ELSE
1458+ CALL TNten_cll(TNten_UV, TNtenuv_UV, M2LCOLLIER, NLOOPLINE, RANK, TNtenerr_UV)
1459+ ENDIF
1460+ IF (COLLIER_CACHE_ACTIVE.eq.1) THEN
1461+ NCOLLIERCALLS(2) = NCOLLIERCALLS(2)+1
1462+ ENDIF
1463+ IF(COLLIER_CACHE_ACTIVE.eq.1) THEN
1464+ IF(COLLIERUseCacheForPoles) THEN
1465+ CALL SwitchOffCache_cll((unique_id-1)*N_CACHES+2)
1466+ ENDIF
1467+ CALL SwitchOnCache_cll((unique_id-1)*N_CACHES+1)
1468+ ENDIF
1469+ CALL SetDeltaUV_cll(0.0d0)
1470+ ENDIF
1471+
1472+C Now compute the IR poles if asked for
1473+ IF (COLLIERComputeIRpoles) THEN
1474+ IF(COLLIER_CACHE_ACTIVE.eq.1) THEN
1475+ CALL SwitchOffCache_cll((unique_id-1)*N_CACHES+1)
1476+ IF(COLLIERUseCacheForPoles) THEN
1477+ CALL SwitchOnCache_cll((unique_id-1)*N_CACHES+3)
1478+ ENDIF
1479+ ENDIF
1480+ CALL SetDeltaIR_cll(1.0d0,(PIVALUE**2)/6.0d0)
1481+ IF (NLOOPLINE.ne.1) THEN
1482+ CALL TNten_cll(TNten_IR1, TNtenuv_IR1, MomVec, MomInv, M2LCOLLIER, NLOOPLINE, RANK, TNtenerr_IR1)
1483+ ELSE
1484+ CALL TNten_cll(TNten_IR1, TNtenuv_IR1, M2LCOLLIER, NLOOPLINE, RANK, TNtenerr_IR1)
1485+ ENDIF
1486+ IF (COLLIER_CACHE_ACTIVE.eq.1) THEN
1487+ NCOLLIERCALLS(3) = NCOLLIERCALLS(3)+1
1488+ ENDIF
1489+ IF(COLLIER_CACHE_ACTIVE.eq.1.AND.COLLIERUseCacheForPoles) THEN
1490+ CALL SwitchOffCache_cll((unique_id-1)*N_CACHES+3)
1491+ CALL SwitchOnCache_cll((unique_id-1)*N_CACHES+4)
1492+ ENDIF
1493+ CALL SetDeltaIR_cll(0.0d0,1.0d0+(PIVALUE**2)/6.0d0)
1494+ IF (NLOOPLINE.ne.1) THEN
1495+ CALL TNten_cll(TNten_IR2, TNtenuv_IR2, MomVec, MomInv, M2LCOLLIER, NLOOPLINE, RANK, TNtenerr_IR2)
1496+ ELSE
1497+ CALL TNten_cll(TNten_IR2, TNtenuv_IR2, M2LCOLLIER, NLOOPLINE, RANK, TNtenerr_IR2)
1498+ ENDIF
1499+ IF (COLLIER_CACHE_ACTIVE.eq.1) THEN
1500+ NCOLLIERCALLS(4) = NCOLLIERCALLS(4)+1
1501+ ENDIF
1502+ IF(COLLIER_CACHE_ACTIVE.eq.1) THEN
1503+ IF(COLLIERUseCacheForPoles) THEN
1504+ CALL SwitchOffCache_cll((unique_id-1)*N_CACHES+4)
1505+ ENDIF
1506+ CALL SwitchOnCache_cll((unique_id-1)*N_CACHES+1)
1507+ ENDIF
1508+ CALL SetDeltaIR_cll(0.0d0,(PIVALUE**2)/6.0d0)
1509+ ENDIF
1510+
1511+ DO I=0,(CURR_MAXCOEF-1)
1512+ C0 = COEFMAP_ZERO(I)
1513+ C1 = COEFMAP_ONE(I)
1514+ C2 = COEFMAP_TWO(I)
1515+ C3 = COEFMAP_THREE(I)
1516+ CURR_RANK = C0+C1+C2+C3
1517+C Because we must set q -> -q, we apply a minus sign to coefs of odd rank
1518+ IF (MOD(CURR_RANK,2).eq.1) THEN
1519+ SGN = -1
1520+ ELSE
1521+ SGN = 1
1522+ ENDIF
1523+ TIRCOEFS(I,1) = SGN*TNten(C0,C1,C2,C3)
1524+ IF (COLLIERComputeUVpoles) THEN
1525+ TIRCOEFS(I,2) = SGN*( TNten_UV(C0,C1,C2,C3)-TNten(C0,C1,C2,C3) )
1526+ ELSE
1527+ TIRCOEFS(I,2) = DCMPLX(0.0d0,0.0d0)
1528+ ENDIF
1529+ IF (COLLIERComputeIRpoles) THEN
1530+ TIRCOEFS(I,2) = TIRCOEFS(I,2) + SGN*( TNten_IR1(C0,C1,C2,C3)-TNten(C0,C1,C2,C3) )
1531+ TIRCOEFS(I,3) = SGN*( TNten_IR2(C0,C1,C2,C3)-TNten(C0,C1,C2,C3) )
1532+ ELSE
1533+ TIRCOEFS(I,3) = DCMPLX(0.0d0,0.0d0)
1534+ ENDIF
1535+ ENDDO
1536+
1537+ IF (COLLIERUseInternalStabilityTest) THEN
1538+c Finish by caching the coefficients and error just computed
1539+ LOOP_ID_DONE(ID) = .TRUE.
1540+ DO J=0,CURR_MAXCOEF-1
1541+ DO K=1,3
1542+ TIR_COEFS_DIRECT_MODE(J,K,ID) = TIRCOEFS(J,K)
1543+ ENDDO
1544+ ENDDO
1545+ DO J=0,RANK
1546+ TIR_COEFS_ERROR(J,ID)=TNtenerr(J)
1547+ ENDDO
1548+
1549+C Now compute the errors on each coefficient
1550+ DO I=0,RANK
1551+ MaxCoefForRank(I) = 0.0d0
1552+ ENDDO
1553+ DO I=0,CURR_MAXCOEF-1
1554+ CURR_RANK = COEFMAP_ZERO(I)+COEFMAP_ONE(I)+COEFMAP_TWO(I)+COEFMAP_THREE(I)
1555+ MaxCoefForRank(CURR_RANK)=max(MaxCoefForRank(CURR_RANK),abs(TIRCOEFS(I,1)))
1556+ ENDDO
1557+ DO I=0,CURR_MAXCOEF-1
1558+ CURR_RANK = COEFMAP_ZERO(I)+COEFMAP_ONE(I)+COEFMAP_TWO(I)+COEFMAP_THREE(I)
1559+ IF (MaxCoefForRank(CURR_RANK).ne.0.0d0) THEN
1560+ DO K=1,3
1561+C The expression below is like taking the absolute value when summing errors linearly
1562+C TIRCOEFSERRORS(I,K)=(TNtenerr(CURR_RANK)/MaxCoefForRank(CURR_RANK))*DCMPLX( ABS(DBLE(TIRCOEFS(I,K))),ABS(DIMAG(TIRCOEFS(I,K))) )
1563+C But empirically, I observed that retaining the original complex phase leads to slightly more accurate estimates
1564+ TIRCOEFSERRORS(I,K)=(TNtenerr(CURR_RANK)/MaxCoefForRank(CURR_RANK))*TIRCOEFS(I,K)
1565+ ENDDO
1566+ ENDIF
1567+ ENDDO
1568+
1569+ ENDIF
1570+
1571+ END SUBROUTINE %(proc_prefix)sCOLLIERLOOP
1572+
1573+ SUBROUTINE %(proc_prefix)sCLEAR_COLLIER_CACHE()
1574+
1575+ USE COLLIER
1576+
1577+ include 'loop_max_coefs.inc'
1578+ INTEGER NLOOPGROUPS
1579+ PARAMETER (NLOOPGROUPS=%(nloop_groups)d)
1580+ integer MAXRANK
1581+ parameter (MAXRANK=%(maxrank)d)
1582+
1583+ integer I,J,K
1584+
1585+ include 'MadLoopParams.inc'
1586+
1587+ logical LOOP_ID_DONE(NLOOPGROUPS)
1588+ %(complex_dp_format)s TIR_COEFS_DIRECT_MODE(0:LOOPMAXCOEFS-1,3,NLOOPGROUPS)
1589+ %(complex_dp_format)s TIR_COEFS_ERROR(0:MAXRANK,NLOOPGROUPS)
1590+ common/%(proc_prefix)sCOLLIER_TIR_COEFS/TIR_COEFS_DIRECT_MODE,TIR_COEFS_ERROR,LOOP_ID_DONE
1591+
1592+ INTEGER COLLIER_CACHE_ACTIVE, NCALLS_IN_CACHE(4), NCOLLIERCALLS(4)
1593+ LOGICAL MUST_INIT_EVENT
1594+ COMMON/%(proc_prefix)sCOLLIER_CACHE_STATUS/COLLIER_CACHE_ACTIVE,NCALLS_IN_CACHE, NCOLLIERCALLS,MUST_INIT_EVENT
1595+
1596+C Make sure that next time the COLLIER Subroutine is called it will call the subroutine initEvent of Collier.
1597+ MUST_INIT_EVENT = .True.
1598+
1599+C Reinitialize the ML cache for COLLIER
1600+ DO I=1,NLOOPGROUPS
1601+ LOOP_ID_DONE(I) = .FALSE.
1602+ DO J=0,LOOPMAXCOEFS-1
1603+ DO K=1,3
1604+ TIR_COEFS_DIRECT_MODE(J,K,I) = DCMPLX(0.0d0,0.0d0)
1605+ ENDDO
1606+ ENDDO
1607+ DO J=0,MAXRANK
1608+ TIR_COEFS_ERROR(J,I)=0.0d0
1609+ ENDDO
1610+ ENDDO
1611+
1612+ END
1613+
1614+ SUBROUTINE %(proc_prefix)sSET_COLLIER_GLOBAL_CACHE(ONOFF)
1615+C
1616+C This routine is used by loop_matrix.f to turn on the global
1617+C cache of COLLIER when it the main SLOOP subroutine starts and
1618+C turn it off when it ends.
1619+C However several checks are performed to verify that it is safe
1620+C to turn it on and to reinitialize it if necessary.
1621+C
1622+C MODULES
1623+C
1624+ USE COLLIER
1625+ implicit none
1626+C
1627+C ARGUMENTS
1628+C
1629+ LOGICAL ONOFF
1630+C
1631+C LOCAL VARIABLES
1632+C
1633+ LOGICAL NEED_REINITIALIZATION
1634+ INTEGER N_CACHES
1635+C
1636+C GLOBAL VARIABLES
1637+C
1638+C
1639+C This common blocks saves the relevant ML parameters when activating the
1640+C global cache of COLLIER so that we know when we must reinitialize it.
1641+C COLLIER_CACHE_ACTIVE is set to -1 when it has never been turned on yet and
1642+C to 1 for 'Active' and 0 for 'Inactive'.
1643+C The integer NCALLS_IN_CACHE saves how many calls the cache is setup for, for each of the up to four caches.
1644+C When it is the first PS points, it is set to -1.
1645+ INTEGER COLLIER_CACHE_ACTIVE, NCALLS_IN_CACHE(4), NCOLLIERCALLS(4)
1646+ DATA COLLIER_CACHE_ACTIVE/-1/
1647+ DATA NCALLS_IN_CACHE/-1,-1,-1,-1/
1648+ DATA NCOLLIERCALLS/0,0,0,0/
1649+C This is a flag to tell the COLLIER subroutine that it must init the event when called.
1650+ LOGICAL MUST_INIT_EVENT
1651+ DATA MUST_INIT_EVENT/.TRUE./
1652+ COMMON/%(proc_prefix)sCOLLIER_CACHE_STATUS/COLLIER_CACHE_ACTIVE, NCALLS_IN_CACHE, NCOLLIERCALLS,MUST_INIT_EVENT
1653+
1654+ LOGICAL COLLIERUseInternalStabilityTest_BU
1655+ INTEGER USERHEL_BU, SQSO_TARGET_BU, COLLIERMode_BU,CTModeRun_BU
1656+ COMMON/%(proc_prefix)sCOLLIER_CACHE_RELEVANT_PARAMS/USERHEL_BU,SQSO_TARGET_BU,COLLIERMode_BU,CTModeRun_BU,COLLIERUseInternalStabilityTest_BU
1657+
1658+C The common blocks below are to retrieve the necessary information about
1659+C MadLoop running mode and store it in the sCOLLIER_CACHE_RELEVANT_PARAMS common block.
1660+
1661+ include 'MadLoopParams.inc'
1662+ include 'unique_id.inc'
1663+ include 'global_specs.inc'
1664+
1665+ LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT, COLLIERINIT
1666+ COMMON/REDUCTIONCODEINIT/CTINIT, TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT, COLLIERINIT
1667+
1668+ LOGICAL CHECKPHASE
1669+ LOGICAL HELDOUBLECHECKED
1670+ common/%(proc_prefix)sINIT/CHECKPHASE, HELDOUBLECHECKED
1671+
1672+ INTEGER USERHEL
1673+ common/%(proc_prefix)sUSERCHOICE/USERHEL
1674+
1675+ INTEGER SQSO_TARGET
1676+ common/%(proc_prefix)sSOCHOICE/SQSO_TARGET
1677+
1678+C
1679+C BEGIN CODE
1680+C
1681+
1682+ IF (COLLIERUseCacheForPoles) THEN
1683+ N_CACHES = 4
1684+ ELSE
1685+ N_CACHES =1
1686+ ENDIF
1687+
1688+C Do nothing if COLLIER still has to be initialized or if global caches are disabled
1689+ IF(COLLIERINIT.OR.COLLIERGlobalCache.eq.0) THEN
1690+ RETURN
1691+ ENDIF
1692+
1693+C Never activate anything in the checkphase
1694+ IF (ONOFF.AND.CHECKPHASE) THEN
1695+ RETURN
1696+ ENDIF
1697+
1698+C Handle the request of turning off the caching
1699+ IF (.NOT.ONOFF) THEN
1700+ IF (COLLIER_CACHE_ACTIVE.eq.1) THEN
1701+ CALL SwitchOffCache_cll((unique_id-1)*4+1)
1702+ COLLIER_CACHE_ACTIVE = 0
1703+ ENDIF
1704+C If we were asked to turn the cache off but it was already so, then do nothing
1705+ RETURN
1706+ ENDIF
1707+
1708+C Handle the request of turning on the caching
1709+
1710+C If asked to activate it but already active, then do nothing
1711+ IF (ONOFF.AND.COLLIER_CACHE_ACTIVE.eq.1) THEN
1712+ RETURN
1713+ ENDIF
1714+
1715+C We are now in the position where we are asked to activate the global cache but it was *not* already active.
1716+
1717+C If we activate it for the first time, make sure to store the value of the relevant parameters, activate and return.
1718+ IF (COLLIER_CACHE_ACTIVE.eq.-1) THEN
1719+ USERHEL_BU = USERHEL
1720+ SQSO_TARGET_BU = SQSO_TARGET
1721+ COLLIERMode_BU = COLLIERMode
1722+ COLLIERUseInternalStabilityTest_BU = COLLIERUseInternalStabilityTest
1723+ CTModeRun_BU = CTModeRun
1724+ CALL SwitchOnCache_cll((unique_id-1)*4+1)
1725+ COLLIER_CACHE_ACTIVE = 1
1726+ RETURN
1727+ ENDIF
1728+
1729+C Now perform sanity check before the activation to decide if we need to reinitialize the cache system first.
1730+ NEED_REINITIALIZATION = .FALSE.
1731+
1732+ IF (SQSO_TARGET.NE.SQSO_TARGET_BU) THEN
1733+ NEED_REINITIALIZATION = .TRUE.
1734+ ENDIF
1735+
1736+ IF (COLLIERMode.NE.COLLIERMode_BU) THEN
1737+ NEED_REINITIALIZATION = .TRUE.
1738+ ENDIF
1739+
1740+ IF (COLLIERUseInternalStabilityTest.NEQV.COLLIERUseInternalStabilityTest_BU) THEN
1741+ NEED_REINITIALIZATION = .TRUE.
1742+ ENDIF
1743+
1744+ IF (CTModeRun_BU.ne.CTModeRun.and.(.not.COLLIERUseInternalStabilityTest)) THEN
1745+ NEED_REINITIALIZATION = .TRUE.
1746+ ENDIF
1747+
1748+## if(AmplitudeReduction){
1749+C When doing amplitude reduction, the parameter USERHEL impacts the number of COLLIER calls/order if
1750+C it involves a different number of helicity configurations or always if the Loop filter is on, which
1751+C it should almost never be by now.
1752+ IF(UseLoopFilter.and.(USERHEL.ne.USERHEL_BU)) THEN
1753+ NEED_REINITIALIZATION = .TRUE.
1754+ ENDIF
1755+ IF((USERHEL.eq.-1).and.(USERHEL_BU.ne.-1)) THEN
1756+ NEED_REINITIALIZATION = .TRUE.
1757+ ENDIF
1758+ IF((USERHEL.ne.-1).and.(USERHEL_BU.eq.-1)) THEN
1759+ NEED_REINITIALIZATION = .TRUE.
1760+ ENDIF
1761+## }else{
1762+C When doing amplitude reduction the parameter USERHEL does not impact the number/order of COLLIER calls
1763+C except if the LoopFilter is ON which really shouldn't be the case anymore.
1764+ IF(UseLoopFilter.and.(USERHEL.ne.USERHEL_BU)) THEN
1765+ NEED_REINITIALIZATION = .TRUE.
1766+ ENDIF
1767+## }
1768+
1769+ IF(NEED_REINITIALIZATION) THEN
1770+C Log the event because if it happens a lot of time and floods the screen, the user must see it
1771+C and either change its usage of MadLoop or turnoff COLLIER cache
1772+ WRITE(*,*) 'INFO: MadLoop detected that the global cache of COLLIER had to be reset because of a change in your use of MadLoop. This should not happend for each event.'
1773+ USERHEL_BU = USERHEL
1774+ SQSO_TARGET_BU = SQSO_TARGET
1775+ COLLIERMode_BU = COLLIERMode
1776+ COLLIERUseInternalStabilityTest_BU = COLLIERUseInternalStabilityTest
1777+ CTModeRun_BU = CTModeRun
1778+ IF (COLLIERGLOBALCACHE.EQ.-1) THEN
1779+ CALL INITCACHESYSTEM_CLL(N_CACHES*NPROCS,MAXNEXTERNAL)
1780+ ELSE
1781+ CALL INITCACHESYSTEM_CLL(N_CACHES*NPROCS,COLLIERGLOBALCACHE)
1782+ ENDIF
1783+ NCOLLIERCALLS(:) = 0
1784+ NCALLS_IN_CACHE(:) = -1
1785+C Make sure all caches are switched off at first.
1786+ call SwitchOffCacheSystem_cll()
1787+ ENDIF
1788+
1789+C Now we can finally activate the cache
1790+ CALL SwitchOnCache_cll((unique_id-1)*4+1)
1791+ COLLIER_CACHE_ACTIVE = 1
1792+
1793+ END
1794
1795=== modified file 'madgraph/iolibs/template_files/loop_optimized/CT_interface.inc'
1796--- madgraph/iolibs/template_files/loop_optimized/CT_interface.inc 2016-04-28 23:52:58 +0000
1797+++ madgraph/iolibs/template_files/loop_optimized/CT_interface.inc 2016-07-02 20:37:49 +0000
1798@@ -34,8 +34,8 @@
1799 C
1800 %(complex_dp_format)s R1, ACC
1801 INTEGER I, J, K
1802- LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT
1803- COMMON/REDUCTIONCODEINIT/CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT
1804+ LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT,COLLIERINIT
1805+ COMMON/REDUCTIONCODEINIT/CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT,COLLIERINIT
1806 C
1807 C EXTERNAL FUNCTIONS
1808 C
1809@@ -351,8 +351,8 @@
1810 %(complex_dp_format)s R1, ACC
1811 INTEGER I, J, K
1812 %(real_dp_format)s PDEN_DUMMY(0:3,NLOOPLINE-1)
1813- LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT
1814- COMMON/REDUCTIONCODEINIT/CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT
1815+ LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT,COLLIERINIT
1816+ COMMON/REDUCTIONCODEINIT/CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT,COLLIERINIT
1817 C
1818 C EXTERNAL FUNCTIONS
1819 C
1820@@ -649,8 +649,8 @@
1821 C
1822 include 'coupl.inc'
1823
1824- LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT
1825- COMMON/REDUCTIONCODEINIT/CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT
1826+ LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT,COLLIERINIT
1827+ COMMON/REDUCTIONCODEINIT/CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT,COLLIERINIT
1828
1829 %(real_dp_format)s LSCALE
1830 INTEGER CTMODE
1831@@ -875,8 +875,8 @@
1832 C
1833 include 'coupl.inc'
1834
1835- LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT
1836- COMMON/REDUCTIONCODEINIT/CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT
1837+ LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT,COLLIERINIT
1838+ COMMON/REDUCTIONCODEINIT/CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT,COLLIERINIT
1839
1840 %(real_dp_format)s LSCALE
1841 INTEGER CTMODE
1842
1843=== modified file 'madgraph/iolibs/template_files/loop_optimized/GOLEM_interface.inc'
1844--- madgraph/iolibs/template_files/loop_optimized/GOLEM_interface.inc 2016-03-10 00:23:21 +0000
1845+++ madgraph/iolibs/template_files/loop_optimized/GOLEM_interface.inc 2016-07-02 20:37:49 +0000
1846@@ -103,8 +103,8 @@
1847 common/%(proc_prefix)sLOOP/ID,R
1848 ## }
1849
1850- LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT
1851- COMMON/REDUCTIONCODEINIT/CTINIT, TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT
1852+ LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT,COLLIERINIT
1853+ COMMON/REDUCTIONCODEINIT/CTINIT, TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT,COLLIERINIT
1854
1855 INTEGER NLOOPGROUPS
1856 PARAMETER (NLOOPGROUPS=%(nloop_groups)d)
1857
1858=== modified file 'madgraph/iolibs/template_files/loop_optimized/TIR_interface.inc'
1859--- madgraph/iolibs/template_files/loop_optimized/TIR_interface.inc 2016-03-10 00:23:21 +0000
1860+++ madgraph/iolibs/template_files/loop_optimized/TIR_interface.inc 2016-07-02 20:37:49 +0000
1861@@ -43,14 +43,14 @@
1862 C
1863 INTEGER I, J, K
1864 INTEGER NLOOPCOEFS
1865- LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT
1866- COMMON/REDUCTIONCODEINIT/CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT
1867+ LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT,COLLIERINIT
1868+ COMMON/REDUCTIONCODEINIT/CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT,COLLIERINIT
1869
1870 c This variable will be used to detect changes in the TIR library used so as to force the reset of the TIR filter.
1871 INTEGER LAST_LIB_USED
1872 DATA LAST_LIB_USED/-1/
1873
1874- %(complex_dp_format)s TIRCOEFS(0:LOOPMAXCOEFS-1,3)
1875+ %(complex_dp_format)s TIRCOEFS(0:LOOPMAXCOEFS-1,3),TIRCOEFSERRORS(0:LOOPMAXCOEFS-1,3)
1876 %(complex_dp_format)s PJCOEFS(0:LOOPMAXCOEFS-1,3)
1877 ## if(TIRCaching){
1878 integer TIR_CACHE_INDEX
1879@@ -72,9 +72,13 @@
1880 %(real_dp_format)s LSCALE
1881 common/%(proc_prefix)sCT/LSCALE,CTMODE
1882
1883-C The variables below are just for monitoring purposes.
1884+## if(not AmplitudeReduction) {
1885 INTEGER ID,SQSOINDEX,R
1886- COMMON/%(proc_prefix)sLOOP/ID,SQSOINDEX,R
1887+ common/%(proc_prefix)sLOOP/ID,SQSOINDEX,R
1888+## }else{
1889+ INTEGER ID,R
1890+ common/%(proc_prefix)sLOOP/ID,R
1891+## }
1892
1893 c The argument ILIB is the TIR library to be used for that specific library.
1894 INTEGER LIBINDEX
1895@@ -178,9 +182,9 @@
1896 enddo
1897
1898 do I=0,3
1899- do J=1,(NLOOPLINE-1)
1900- PDEN(I,J)=PCT(I,J)
1901- enddo
1902+ do J=1,(NLOOPLINE-1)
1903+ PDEN(I,J)=PCT(I,J)
1904+ enddo
1905 enddo
1906 C NUMBER OF INDEPEDENT LOOPCOEFS FOR RANK=RANK
1907 NLOOPCOEFS=0
1908@@ -220,6 +224,23 @@
1909 WRITE(*,*) 'ERROR:: IREGI is not interfaced.'
1910 STOP
1911 ## }
1912+ CASE(7)
1913+C COLLIER
1914+## if(collier_available){
1915+ CALL %(proc_prefix)sCOLLIERLOOP(CTMODE,NLOOPLINE,RANK,PL,PDEN,M2L,TIRCOEFS,TIRCOEFSERRORS)
1916+C Shift the TIR coefficients by the corresponding COLLIER error if in CTMODE 2.
1917+ if (COLLIERUseInternalStabilityTest.and.CTMODE.eq.2) THEN
1918+C We add here the numerical inaccuracies linearly to be conservative
1919+ DO I=1,3
1920+ DO J=0,NLOOPCOEFS-1
1921+ TIRCOEFS(J,I)=TIRCOEFS(J,I)+TIRCOEFSERRORS(J,I)
1922+ ENDDO
1923+ ENDDO
1924+ ENDIF
1925+## } else {
1926+ WRITE(*,*) 'ERROR:: COLLIER is not interfaced.'
1927+ STOP
1928+## }
1929 END SELECT
1930 ## if(TIRCaching){
1931 C The zero index is dummy and means no caching at all since TIR_CACHE_SIZE=0.
1932@@ -262,6 +283,8 @@
1933 C WRITE(*,*) 'PJFry: Loop ID',ID,' =',RES(1),RES(2),RES(3)
1934 C ELSEIF(MLReductionLib(I_LIB).EQ.3) THEN
1935 C WRITE(*,*) 'Iregi: Loop ID',ID,' =',RES(1),RES(2),RES(3)
1936+C ELSEIF(MLReductionLib(I_LIB).EQ.7) THEN
1937+C WRITE(*,*) 'COLLIER: Loop ID',ID,' =',RES(1),RES(2),RES(3)
1938 C ENDIF
1939 END
1940
1941@@ -385,8 +408,8 @@
1942 C GLOBAL VARIABLES
1943 C
1944 include 'MadLoopParams.inc'
1945- LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT
1946- COMMON/REDUCTIONCODEINIT/CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT
1947+ LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT,COLLIERINIT
1948+ COMMON/REDUCTIONCODEINIT/CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT,NINJAINIT,COLLIERINIT
1949
1950 C ----------
1951 C BEGIN CODE
1952@@ -428,7 +451,7 @@
1953 C CONSTANTS
1954 C
1955 INTEGER NLOOPLIB
1956- PARAMETER (NLOOPLIB=4)
1957+ PARAMETER (NLOOPLIB=7)
1958 INTEGER QP_NLOOPLIB
1959 ## if(ninja_supports_quad_prec) {
1960 PARAMETER (QP_NLOOPLIB=2)
1961@@ -479,8 +502,8 @@
1962 ENDIF
1963 ENDDO
1964 IF(J_LIB.EQ.0)THEN
1965- SELECT_LIBINDEX=SELECT_LIBINDEX+1
1966- IF(SELECT_LIBINDEX.GT.NLOOPLIB.OR.MLReductionLib(SELECT_LIBINDEX).EQ.0)SELECT_LIBINDEX=1
1967+ SELECT_LIBINDEX=SELECT_LIBINDEX+1
1968+ IF(SELECT_LIBINDEX.GT.NLOOPLIB.OR.MLReductionLib(SELECT_LIBINDEX).EQ.0)SELECT_LIBINDEX=1
1969 ENDIF
1970 ENDDO
1971 I=J_LIB
1972
1973=== modified file 'madgraph/iolibs/template_files/loop_optimized/loop_matrix_standalone.inc'
1974--- madgraph/iolibs/template_files/loop_optimized/loop_matrix_standalone.inc 2016-04-05 23:57:17 +0000
1975+++ madgraph/iolibs/template_files/loop_optimized/loop_matrix_standalone.inc 2016-07-02 20:37:49 +0000
1976@@ -97,9 +97,9 @@
1977 INTEGER NSQUAREDSOP1
1978 PARAMETER (NSQUAREDSOP1=NSQUAREDSO+1)
1979 C The total number of loop reduction libraries
1980-C At present, there are only CutTools,PJFry++,IREGI,Golem95,Samurai and Ninja
1981+C At present, there are only CutTools,PJFry++,IREGI,Golem95,Samurai, Ninja and COLLIER
1982 INTEGER NLOOPLIB
1983- PARAMETER (NLOOPLIB=6)
1984+ PARAMETER (NLOOPLIB=7)
1985 C Only CutTools or possibly Ninja (if installed with qp support) provide QP
1986 INTEGER QP_NLOOPLIB
1987 ## if(ninja_supports_quad_prec) {
1988@@ -235,6 +235,7 @@
1989 C GLOBAL VARIABLES
1990 C
1991 include 'process_info.inc'
1992+ include 'unique_id.inc'
1993 include 'coupl.inc'
1994 include 'mp_coupl.inc'
1995 include 'MadLoopParams.inc'
1996@@ -267,20 +268,20 @@
1997 DATA MP_DONE/.FALSE./
1998 common/%(proc_prefix)sMP_DONE/MP_DONE
1999 C A FLAG TO DENOTE WHETHER THE CORRESPONDING LOOPLIBS ARE AVAILABLE OR NOT
2000- LOGICAL LOOPLIBS_AVAILABLE(6)
2001+ LOGICAL LOOPLIBS_AVAILABLE(NLOOPLIB)
2002 DATA LOOPLIBS_AVAILABLE/%(data_looplibs_av)s/
2003 common/%(proc_prefix)sLOOPLIBS_AV/ LOOPLIBS_AVAILABLE
2004 C A FLAG TO DENOTE WHETHER THE CORRESPONDING DIRECTION TESTS AVAILABLE OR NOT IN THE LOOPLIBS
2005- LOGICAL LOOPLIBS_DIRECTEST(6)
2006- DATA LOOPLIBS_DIRECTEST /.TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE./
2007+ LOGICAL LOOPLIBS_DIRECTEST(NLOOPLIB)
2008+ DATA LOOPLIBS_DIRECTEST /.TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE./
2009 C Specifying for which reduction tool quadruple precision is available.
2010 C The index 0 is dummy and simply means that the corresponding loop_library is not available
2011 C in which case neither is its quadruple precision version.
2012- LOGICAL LOOPLIBS_QPAVAILABLE(0:6)
2013+ LOGICAL LOOPLIBS_QPAVAILABLE(0:7)
2014 ## if(ninja_supports_quad_prec) {
2015- DATA LOOPLIBS_QPAVAILABLE /.FALSE.,.TRUE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,.TRUE./
2016+ DATA LOOPLIBS_QPAVAILABLE /.FALSE.,.TRUE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,.TRUE.,.FALSE./
2017 ## } else {
2018- DATA LOOPLIBS_QPAVAILABLE /.FALSE.,.TRUE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE./
2019+ DATA LOOPLIBS_QPAVAILABLE /.FALSE.,.TRUE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE./
2020 ## }
2021 C PS CAN POSSIBILY BE PASSED THROUGH IMPROVE_PS BUT IS NOT MODIFIED FOR THE PURPOSE OF THE STABILITY TEST
2022 C EVEN THOUGH THEY ARE PUT IN COMMON BLOCK, FOR NOW THEY ARE NOT USED ANYWHERE ELSE
2023@@ -329,7 +330,7 @@
2024 DATA CT_REQ_SO_DONE/.FALSE./
2025 DATA MP_CT_REQ_SO_DONE/.FALSE./
2026 DATA LOOP_REQ_SO_DONE/.FALSE./
2027- DATA MP_LOOP_REQ_SO_DONE/.FALSE./
2028+ DATA MP_LOOP_REQ_SO_DONE/.FALSE./
2029 DATA CTCALL_REQ_SO_DONE/.FALSE./
2030 DATA FILTER_SO/.FALSE./
2031 common/%(proc_prefix)sSO_REQS/UVCT_REQ_SO_DONE,MP_UVCT_REQ_SO_DONE,CT_REQ_SO_DONE,MP_CT_REQ_SO_DONE,LOOP_REQ_SO_DONE,MP_LOOP_REQ_SO_DONE,CTCALL_REQ_SO_DONE,FILTER_SO
2032@@ -345,11 +346,10 @@
2033 integer I_LIB
2034 DATA I_LIB/1/
2035 common/%(proc_prefix)sI_LIB/I_LIB
2036-C UTIL NOW, ONLY CUTTOOLS PROVIDE QP
2037- LOGICAL QP_TOOLS_AVAILABLE
2038- DATA QP_TOOLS_AVAILABLE/.FALSE./
2039- INTEGER INDEX_QP_TOOLS(QP_NLOOPLIB+1)
2040- common/%(proc_prefix)sLOOP_TOOLS/QP_TOOLS_AVAILABLE,INDEX_QP_TOOLS
2041+ LOGICAL QP_TOOLS_AVAILABLE
2042+ DATA QP_TOOLS_AVAILABLE/.FALSE./
2043+ INTEGER INDEX_QP_TOOLS(QP_NLOOPLIB+1)
2044+ common/%(proc_prefix)sLOOP_TOOLS/QP_TOOLS_AVAILABLE,INDEX_QP_TOOLS
2045
2046 ## if(not LoopInduced) {
2047 %(complex_dp_format)s AMP(NBORNAMPS)
2048@@ -420,9 +420,16 @@
2049 DATA MP_DONE_ONCE/.FALSE./
2050 common/%(proc_prefix)sMP_DONE_ONCE/MP_DONE_ONCE
2051
2052- character(512) MLPath
2053+ character(512) MLPath
2054 common/MLPATH/MLPath
2055
2056+C This is just so that if the user disabled the computation of poles by COLLIER
2057+C using the MadLoop subroutine, we don't overwrite his choice when reading the parameters
2058+ LOGICAL FORCED_CHOICE_OF_COLLIER_UV_POLE_COMPUTATION, FORCED_CHOICE_OF_COLLIER_IR_POLE_COMPUTATION
2059+ LOGICAL COLLIER_UV_POLE_COMPUTATION_CHOICE, COLLIER_IR_POLE_COMPUTATION_CHOICE
2060+ DATA FORCED_CHOICE_OF_COLLIER_UV_POLE_COMPUTATION,FORCED_CHOICE_OF_COLLIER_IR_POLE_COMPUTATION/.FALSE.,.FALSE./
2061+ COMMON/%(proc_prefix)sCOLLIERPOLESFORCEDCHOICE/FORCED_CHOICE_OF_COLLIER_UV_POLE_COMPUTATION, FORCED_CHOICE_OF_COLLIER_IR_POLE_COMPUTATION,COLLIER_UV_POLE_COMPUTATION_CHOICE,COLLIER_IR_POLE_COMPUTATION_CHOICE
2062+
2063 C This variable controls the general initialization which is *common* between all MadLoop SubProcesses.
2064 C For example setting the MadLoopPath or reading the ML runtime parameters.
2065 LOGICAL ML_INIT
2066@@ -440,6 +447,7 @@
2067 LOGICAL FPE_IN_DP_REDUCTION, FPE_IN_QP_REDUCTION
2068 data FPE_IN_DP_REDUCTION, FPE_IN_QP_REDUCTION/.FALSE.,.FALSE./
2069 COMMON/%(proc_prefix)sFPE_IN_REDUCTION/FPE_IN_DP_REDUCTION, FPE_IN_QP_REDUCTION
2070+
2071 C ----------
2072 C BEGIN CODE
2073 C ----------
2074@@ -451,6 +459,12 @@
2075 CALL setMadLoopPath(TMP)
2076 CALL JOINPATH(MLPATH,PARAMFNAME,PARAMFN)
2077 CALL MADLOOPPARAMREADER(PARAMFN,.TRUE.)
2078+ IF (FORCED_CHOICE_OF_COLLIER_UV_POLE_COMPUTATION) THEN
2079+ COLLIERComputeUVpoles = COLLIER_UV_POLE_COMPUTATION_CHOICE
2080+ ENDIF
2081+ IF (FORCED_CHOICE_OF_COLLIER_IR_POLE_COMPUTATION) THEN
2082+ COLLIERComputeIRpoles = COLLIER_IR_POLE_COMPUTATION_CHOICE
2083+ ENDIF
2084 IF (FORBID_HEL_DOUBLECHECK) THEN
2085 DoubleCheckHelicityFilter = .False.
2086 ENDIF
2087@@ -801,6 +815,11 @@
2088 CALL %(proc_prefix)sCLEAR_CACHES()
2089 ENDIF
2090
2091+## if(collier_available){
2092+C Now make sure to turn on the global COLLIER cache if applicable
2093+CALL %(proc_prefix)sSET_COLLIER_GLOBAL_CACHE(.TRUE.)
2094+## }
2095+
2096 IF (ImprovePSPoint.ge.0) THEN
2097 C Make the input PS more precise (exact onshell and energy-momentum conservation)
2098 CALL %(proc_prefix)sIMPROVE_PS_POINT_PRECISION(PS)
2099@@ -1812,14 +1831,27 @@
2100 IF (AUTOMATIC_CACHE_CLEARING) THEN
2101 CALL %(proc_prefix)sCLEAR_CACHES()
2102 ENDIF
2103+
2104+## if(collier_available){
2105+C Now make sure to turn off the global COLLIER cache if applicable
2106+CALL %(proc_prefix)sSET_COLLIER_GLOBAL_CACHE(.FALSE.)
2107+## }
2108+
2109 END
2110
2111 SUBROUTINE %(proc_prefix)sCLEAR_CACHES()
2112-C Clears all the caches used at some point in MadLoop
2113+C
2114+C This routine can be called directly from the user if
2115+C AUTOMATIC_CACHE_CLEARING is set to False. It must then be called after
2116+C ech event
2117+C
2118 CALL %(proc_prefix)sCLEAR_TIR_CACHE()
2119 ## if(ninja_available){
2120 call ninja_clear_integral_cache()
2121 ## }
2122+## if(collier_available){
2123+ call %(proc_prefix)sCLEAR_COLLIER_CACHE()
2124+## }
2125 END
2126
2127 C --=========================================--
2128@@ -1952,6 +1984,13 @@
2129 real*8 accuracies(3)
2130 real*8 list(maxstabilitylength)
2131
2132+C
2133+C GLOBAL VARIABLES
2134+C
2135+ integer I_LIB
2136+ common/%(proc_prefix)sI_LIB/I_LIB
2137+ include 'MadLoopParams.inc'
2138+
2139 C ----------
2140 C BEGIN CODE
2141 C ----------
2142@@ -1998,6 +2037,13 @@
2143 if (avg.ne.0.0d0) then
2144 acc(k) = acc(k) / ( ABS(AVG) / 3.0d0)
2145 endif
2146+
2147+C When using COLLIER with the internal stability test, the first evaluation is typically more reliable so we do not want to use the average but rather the first evaluation.
2148+ IF (MLREDUCTIONLIB(I_LIB).eq.7.and.COLLIERUseInternalStabilityTest) THEN
2149+ DO I=1,3
2150+ estimate(i,k) = fulllist(i,k,1)
2151+ ENDDO
2152+ ENDIF
2153
2154 enddo
2155
2156@@ -2326,6 +2372,46 @@
2157 C Definition of additional access routines
2158 C --=========================================--
2159
2160+ SUBROUTINE %(proc_prefix)sCOLLIER_COMPUTE_UV_POLES(ONOFF)
2161+C
2162+C This function can be called by the MadLoop user so as to chose to have COLLIER
2163+C compute the UV pole or not (it costs more time).
2164+C
2165+ LOGICAL ONOFF
2166+
2167+ include 'MadLoopParams.inc'
2168+
2169+ LOGICAL FORCED_CHOICE_OF_COLLIER_UV_POLE_COMPUTATION, FORCED_CHOICE_OF_COLLIER_IR_POLE_COMPUTATION
2170+ LOGICAL COLLIER_UV_POLE_COMPUTATION_CHOICE, COLLIER_IR_POLE_COMPUTATION_CHOICE
2171+ COMMON/%(proc_prefix)sCOLLIERPOLESFORCEDCHOICE/FORCED_CHOICE_OF_COLLIER_UV_POLE_COMPUTATION, FORCED_CHOICE_OF_COLLIER_IR_POLE_COMPUTATION,COLLIER_UV_POLE_COMPUTATION_CHOICE,COLLIER_IR_POLE_COMPUTATION_CHOICE
2172+
2173+ COLLIERComputeUVpoles = ONOFF
2174+C This is just so that if we read the param again, we don't overwrite the choice made here
2175+ FORCED_CHOICE_OF_COLLIER_UV_POLE_COMPUTATION = .TRUE.
2176+ COLLIER_UV_POLE_COMPUTATION_CHOICE = ONOFF
2177+
2178+ END SUBROUTINE
2179+
2180+ SUBROUTINE %(proc_prefix)sCOLLIER_COMPUTE_IR_POLES(ONOFF)
2181+C
2182+C This function can be called by the MadLoop user so as to chose to have COLLIER
2183+C compute the IR pole or not (it costs more time).
2184+C
2185+ LOGICAL ONOFF
2186+
2187+ include 'MadLoopParams.inc'
2188+
2189+ LOGICAL FORCED_CHOICE_OF_COLLIER_UV_POLE_COMPUTATION, FORCED_CHOICE_OF_COLLIER_IR_POLE_COMPUTATION
2190+ LOGICAL COLLIER_UV_POLE_COMPUTATION_CHOICE, COLLIER_IR_POLE_COMPUTATION_CHOICE
2191+ COMMON/%(proc_prefix)sCOLLIERPOLESFORCEDCHOICE/FORCED_CHOICE_OF_COLLIER_UV_POLE_COMPUTATION, FORCED_CHOICE_OF_COLLIER_IR_POLE_COMPUTATION,COLLIER_UV_POLE_COMPUTATION_CHOICE,COLLIER_IR_POLE_COMPUTATION_CHOICE
2192+
2193+ COLLIERComputeIRpoles = ONOFF
2194+C This is just so that if we read the param again, we don't overwrite the choice made here
2195+ FORCED_CHOICE_OF_COLLIER_IR_POLE_COMPUTATION = .TRUE.
2196+ COLLIER_IR_POLE_COMPUTATION_CHOICE = ONOFF
2197+
2198+ END SUBROUTINE
2199+
2200 SUBROUTINE %(proc_prefix)sFORCE_STABILITY_CHECK(ONOFF)
2201 C
2202 C This function can be called by the MadLoop user so as to always have stability
2203
2204=== modified file 'madgraph/iolibs/template_files/matrix_loop_induced_madevent.inc'
2205--- madgraph/iolibs/template_files/matrix_loop_induced_madevent.inc 2016-02-18 03:09:50 +0000
2206+++ madgraph/iolibs/template_files/matrix_loop_induced_madevent.inc 2016-07-02 20:37:49 +0000
2207@@ -125,6 +125,9 @@
2208
2209 IF(.NOT.INIT_MADLOOP) THEN
2210 INIT_MADLOOP = .TRUE.
2211+C We don't use the poles, so let's not compute them with COLLIER
2212+ CALL %(ml_prefix)sCOLLIER_COMPUTE_UV_POLES(.False.)
2213+ CALL %(ml_prefix)sCOLLIER_COMPUTE_IR_POLES(.False.)
2214 C Unless this is the first iteration, make sure to never double check the helicity filter again
2215 IF (read_grid_file) THEN
2216 CALL SET_FORBID_HEL_DOUBLECHECK(.True.)
2217@@ -392,7 +395,7 @@
2218 return
2219 endif
2220
2221- IF (((OneEps+TwoEps)/finite).gt.(1000d0*PREC).AND.(((OneEps+TwoEps)/finite).gt.1.0d-5)) THEN
2222+ IF (U.NE.7.AND.((OneEps+TwoEps)/finite).gt.(1000d0*PREC).AND.(((OneEps+TwoEps)/finite).gt.1.0d-5)) THEN
2223 WARNING_COUNTERS(2) = WARNING_COUNTERS(2) + 1
2224 IF (WARNING_COUNTERS(2).le.10) THEN
2225 WRITE(*,*) "WARNING : The residue of the single and double pole of the loop matrix element being integrated does not seem to vanish."
2226
2227=== modified file 'madgraph/iolibs/template_files/matrix_loop_induced_madevent_group.inc'
2228--- madgraph/iolibs/template_files/matrix_loop_induced_madevent_group.inc 2016-02-18 03:09:50 +0000
2229+++ madgraph/iolibs/template_files/matrix_loop_induced_madevent_group.inc 2016-07-02 20:37:49 +0000
2230@@ -133,6 +133,9 @@
2231
2232 IF(.NOT.INIT_MADLOOP) THEN
2233 INIT_MADLOOP = .TRUE.
2234+C We don't use the poles, so let's not compute them with COLLIER
2235+ CALL %(ml_prefix)sCOLLIER_COMPUTE_UV_POLES(.False.)
2236+ CALL %(ml_prefix)sCOLLIER_COMPUTE_IR_POLES(.False.)
2237 C Unless this is the first iteration, make sure to never double check the helicity filter again
2238 IF (read_grid_file) THEN
2239 CALL SET_FORBID_HEL_DOUBLECHECK(.True.)
2240@@ -405,7 +408,7 @@
2241 return
2242 endif
2243
2244- IF (((OneEps+TwoEps)/finite).gt.(1000d0*PREC).AND.(((OneEps+TwoEps)/finite).gt.1.0d-5)) THEN
2245+ IF (U.NE.7.and.((OneEps+TwoEps)/finite).gt.(1000d0*PREC).AND.(((OneEps+TwoEps)/finite).gt.1.0d-5)) THEN
2246 WARNING_COUNTERS(2) = WARNING_COUNTERS(2) + 1
2247 IF (WARNING_COUNTERS(2).le.10) THEN
2248 WRITE(*,*) "WARNING : The residue of the single and double pole of the loop matrix element being integrated does not seem to vanish."
2249
2250=== modified file 'madgraph/loop/loop_exporters.py'
2251--- madgraph/loop/loop_exporters.py 2016-05-11 21:44:52 +0000
2252+++ madgraph/loop/loop_exporters.py 2016-07-02 20:37:49 +0000
2253@@ -90,7 +90,8 @@
2254
2255 include_names = {'ninja' : 'mninja.mod',
2256 'golem' : 'generic_function_1p.mod',
2257- 'samurai':'msamurai.mod'}
2258+ 'samurai':'msamurai.mod',
2259+ 'collier': 'collier.mod'}
2260
2261 def __init__(self, mgme_dir="", dir_path = "", opt=None):
2262 """Initiate the LoopExporterFortran with directory information on where
2263@@ -263,17 +264,18 @@
2264 calls = self.write_loop_makefile_definitions(
2265 writers.MakefileWriter(filePath),link_tir_libs,tir_libs)
2266
2267-
2268 # We need minimal editing of MadLoopCommons.f
2269+ # For the optimized output, this file will be overwritten once the
2270+ # availability of COLLIER has been determined.
2271 MadLoopCommon = open(os.path.join(self.loop_dir,'StandAlone',
2272 "SubProcesses","MadLoopCommons.inc")).read()
2273 writer = writers.FortranWriter(os.path.join(self.dir_path,
2274 "SubProcesses","MadLoopCommons.f"))
2275 writer.writelines(MadLoopCommon%{
2276- 'print_banner_commands':self.MadLoop_banner})
2277+ 'print_banner_commands':self.MadLoop_banner}, context={
2278+ 'collier_available':False})
2279 writer.close()
2280
2281-
2282 # Copy the whole MadLoop5_resources directory (empty at this stage)
2283 if not os.path.exists(pjoin(self.dir_path,'SubProcesses',
2284 'MadLoop5_resources')):
2285@@ -678,7 +680,7 @@
2286 # generate_subprocess_directory_v4
2287 #===========================================================================
2288 def generate_loop_subprocess(self, matrix_element, fortran_model,
2289- group_number = None, proc_id = None, config_map=None):
2290+ group_number = None, proc_id = None, config_map=None, unique_id=None):
2291 """Generate the Pxxxxx directory for a loop subprocess in MG4 standalone,
2292 including the necessary loop_matrix.f, born_matrix.f and include files.
2293 Notice that this is too different from generate_subprocess_directory_v4
2294@@ -705,6 +707,14 @@
2295
2296 logger.info('Creating files in directory %s' % dirpath)
2297
2298+ if unique_id is None:
2299+ raise MadGraph5Error, 'A unique id must be provided to the function'+\
2300+ 'generate_loop_subprocess of LoopProcessExporterFortranSA.'
2301+ # Create an include with the unique consecutive ID assigned
2302+ open('unique_id.inc','w').write(
2303+""" integer UNIQUE_ID
2304+ parameter(UNIQUE_ID=%d)"""%unique_id)
2305+
2306 # Extract number of external particles
2307 (nexternal, ninitial) = matrix_element.get_nexternal_ninitial()
2308
2309@@ -778,7 +788,7 @@
2310 'cts_mprec.h', 'cts_mpc.h', 'mp_coupl.inc',
2311 'mp_coupl_same_name.inc',
2312 'MadLoopParamReader.f','MadLoopCommons.f',
2313- 'MadLoopParams.inc']
2314+ 'MadLoopParams.inc','global_specs.inc']
2315
2316 for file in linkfiles:
2317 ln('../%s' % file)
2318@@ -1014,11 +1024,13 @@
2319
2320 writer.writelines(proc_include)
2321
2322- def generate_subprocess_directory_v4(self, matrix_element, fortran_model):
2323+ def generate_subprocess_directory_v4(self, matrix_element, fortran_model,
2324+ unique_id):
2325 """ To overload the default name for this function such that the correct
2326 function is used when called from the command interface """
2327
2328- return self.generate_loop_subprocess(matrix_element,fortran_model)
2329+ return self.generate_loop_subprocess(matrix_element,fortran_model,
2330+ unique_id=unique_id)
2331
2332 def write_check_sa(self, writer, matrix_element):
2333 """Writes out the steering code check_sa. In the optimized output mode,
2334@@ -1576,7 +1588,7 @@
2335 # make sure that ninja appears first in the list of -L because
2336 # it is the tool for which the user is most susceptible of
2337 # using a standalone verison independent of gosam_contrib
2338- all_tir=['pjfry','iregi','ninja','golem','samurai']
2339+ all_tir=['pjfry','iregi','ninja','golem','samurai','collier']
2340
2341 def __init__(self, mgme_dir="", dir_path = "", opt=None):
2342 """Initiate the LoopProcessOptimizedExporterFortranSA with directory
2343@@ -1588,7 +1600,7 @@
2344
2345 # TIR available ones
2346 self.tir_available_dict={'pjfry':True,'iregi':True,'golem':True,
2347- 'samurai':True,'ninja':True}
2348+ 'samurai':True,'ninja':True,'collier':True}
2349
2350 for tir in self.all_tir:
2351 tir_dir="%s_dir"%tir
2352@@ -1627,7 +1639,7 @@
2353 for tir in self.all_tir:
2354 context['%s_available'%tir]=self.tir_available_dict[tir]
2355 # safety check
2356- if tir not in ['golem','pjfry','iregi','samurai','ninja']:
2357+ if tir not in ['golem','pjfry','iregi','samurai','ninja','collier']:
2358 raise MadGraph5Error,"%s was not a TIR currently interfaced."%tir_name
2359
2360 return context
2361@@ -1648,16 +1660,30 @@
2362 tir_name=tir
2363 libpath = self.link_TIR(os.path.join(self.dir_path, 'lib'),
2364 libpath,libname,tir_name=tir_name)
2365- setattr(self,tir_dir,libpath)
2366 if libpath != "":
2367- if tir in ['ninja','pjfry','golem','samurai']:
2368+ if tir in ['ninja','pjfry','golem','samurai','collier']:
2369 # It is cleaner to use the original location of the libraries
2370 link_tir_libs.append('-L%s/ -l%s'%(libpath,tir))
2371 tir_libs.append('%s/lib%s.$(libext)'%(libpath,tir))
2372- if tir in ['ninja','golem', 'samurai']:
2373+ # For Ninja, we must also link against OneLoop.
2374+ if tir in ['ninja']:
2375+ if not any(os.path.isfile(pjoin(libpath,'libavh_olo.%s'%ext))
2376+ for ext in ['a','dylib','so']):
2377+ raise MadGraph5Error(
2378+"The OneLOop library 'libavh_olo.(a|dylib|so)' could no be found in path '%s'. Please place a symlink to it there."%libpath)
2379+ link_tir_libs.append('-L%s/ -l%s'%(libpath,'avh_olo'))
2380+ tir_libs.append('%s/lib%s.$(libext)'%(libpath,'avh_olo'))
2381+ if tir in ['ninja','golem', 'samurai','collier']:
2382 trgt_path = pjoin(os.path.dirname(libpath),'include')
2383- to_include = misc.find_includes_path(trgt_path,
2384+ if os.path.isdir(trgt_path):
2385+ to_include = misc.find_includes_path(trgt_path,
2386 self.include_names[tir])
2387+ else:
2388+ to_include = None
2389+ # Special possible location for collier
2390+ if to_include is None and tir=='collier':
2391+ to_include = misc.find_includes_path(
2392+ pjoin(libpath,'modules'),self.include_names[tir])
2393 if to_include is None:
2394 logger.error(
2395 'Could not find the include directory for %s, looking in %s.\n' % (tir, str(trgt_path))+
2396@@ -1669,7 +1695,7 @@
2397 # (such as what is done with the Sherpa interface), we
2398 # place here an easy handle on the golem includes
2399 name_map = {'golem':'golem95','samurai':'samurai',
2400- 'ninja':'ninja'}
2401+ 'ninja':'ninja','collier':'collier'}
2402 ln(to_include, starting_dir=pjoin(self.dir_path,'lib'),
2403 name='%s_include'%name_map[tir],abspath=True)
2404 ln(libpath, starting_dir=pjoin(self.dir_path,'lib'),
2405@@ -1687,6 +1713,17 @@
2406 writers.MakefileWriter(MadLoop_makefile_definitions),
2407 link_tir_libs,tir_libs, tir_include=tir_include)
2408
2409+ # Finally overwrite MadLoopCommons.f now that we know the availibility of
2410+ # COLLIER.
2411+ MadLoopCommon = open(os.path.join(self.loop_dir,'StandAlone',
2412+ "SubProcesses","MadLoopCommons.inc")).read()
2413+ writer = writers.FortranWriter(os.path.join(self.dir_path,
2414+ "SubProcesses","MadLoopCommons.f"))
2415+ writer.writelines(MadLoopCommon%{
2416+ 'print_banner_commands':self.MadLoop_banner}, context={
2417+ 'collier_available':self.tir_available_dict['collier']})
2418+ writer.close()
2419+
2420 def link_files_from_Subprocesses(self,proc_name):
2421 """ Does the same as the mother routine except that it also links
2422 coef_specs.inc in the HELAS folder."""
2423@@ -1704,7 +1741,7 @@
2424 """Link the TIR source directory inside the target path given
2425 in argument"""
2426
2427- if tir_name in ['pjfry','golem','samurai','ninja']:
2428+ if tir_name in ['pjfry','golem','samurai','ninja','collier']:
2429 # not self-contained libraries
2430 if (not isinstance(libpath,str)) or (not os.path.exists(libpath)) \
2431 or (not os.path.isfile(pjoin(libpath,libname))):
2432@@ -1742,7 +1779,7 @@
2433 return ""
2434
2435 if self.dependencies=='internal':
2436- if tir_name in ['pjfry','golem','samurai','ninja']:
2437+ if tir_name in ['pjfry','golem','samurai','ninja','collier']:
2438 self.tir_available_dict[tir_name]=False
2439 logger.info("When using the 'output_dependencies=internal' "+\
2440 " MG5_aMC option, the (optional) reduction library %s cannot be employed because"%tir_name+\
2441@@ -1793,7 +1830,7 @@
2442 self.tir_available_dict[tir_name]=False
2443 return ""
2444 # We link the tools below directly to the lib directory of the output
2445- if not tir_name in ['pjfry','golem','samurai','ninja']:
2446+ if not tir_name in ['pjfry','golem','samurai','ninja','collier']:
2447 ln(os.path.join(libpath,libname),targetPath,abspath=True)
2448
2449 elif self.dependencies=='environment_paths':
2450@@ -1804,7 +1841,7 @@
2451 logger.info('MG5_aMC is using %s installation found at %s.'%\
2452 (tir_name,newlibpath))
2453 # We link the tools below directly to directly where the library is detected
2454- if not tir_name in ['pjfry','golem','samurai','ninja']:
2455+ if not tir_name in ['pjfry','golem','samurai','ninja','collier']:
2456 ln(newlibpath,targetPath,abspath=True)
2457 self.tir_available_dict[tir_name]=True
2458 return os.path.dirname(newlibpath)
2459@@ -1911,6 +1948,11 @@
2460 self.write_GOLEM_interface(writers.FortranWriter(filename),
2461 matrix_element)
2462
2463+ if 'collier' in self.tir_available_dict and self.tir_available_dict['collier']:
2464+ filename = 'COLLIER_interface.f'
2465+ self.write_COLLIER_interface(writers.FortranWriter(filename),
2466+ matrix_element)
2467+
2468 filename = 'loop_num.f'
2469 self.write_loop_num(writers.FortranWriter(filename),\
2470 matrix_element,OptimizedFortranModel)
2471@@ -2042,6 +2084,40 @@
2472 else:
2473 return file
2474
2475+ def write_COLLIER_interface(self, writer, matrix_element):
2476+ """ Create the file COLLIER_interface.f"""
2477+
2478+ # First write GOLEM_interface which interfaces MG5 with TIR.
2479+ replace_dict=copy.copy(matrix_element.rep_dict)
2480+
2481+ file = open(os.path.join(self.template_dir,'COLLIER_interface.inc')).read()
2482+
2483+ FPR = q_polynomial.FortranPolynomialRoutines(replace_dict['maxrank'],\
2484+ coef_format=replace_dict['complex_dp_format'],\
2485+ sub_prefix=replace_dict['proc_prefix'])
2486+ map_definition = []
2487+ collier_map = FPR.get_COLLIER_mapping()
2488+
2489+ chunk_size = 10
2490+ for map_name, indices_list in \
2491+ [('COEFMAP_ZERO',[c[0] for c in collier_map]),
2492+ ('COEFMAP_ONE',[c[1] for c in collier_map]),
2493+ ('COEFMAP_TWO',[c[2] for c in collier_map]),
2494+ ('COEFMAP_THREE',[c[3] for c in collier_map])]:
2495+ for k in xrange(0, len(indices_list), chunk_size):
2496+ map_definition.append("DATA (%s(I),I=%3r,%3r) /%s/" % \
2497+ (map_name,k, min(k + chunk_size, len(indices_list))-1,
2498+ ','.join('%2r'%ind for ind in indices_list[k:k + chunk_size])))
2499+
2500+ replace_dict['collier_coefmap'] = '\n'.join(map_definition)
2501+
2502+ file = file % replace_dict
2503+
2504+ if writer:
2505+ writer.writelines(file,context=self.get_context(matrix_element))
2506+ else:
2507+ return file
2508+
2509 def write_GOLEM_interface(self, writer, matrix_element):
2510 """ Create the file GOLEM_interface.f which does NOT contain the subroutine
2511 defining the loop HELAS-like calls along with the general interfacing
2512@@ -2371,6 +2447,27 @@
2513
2514 writer.writelines(file,context=self.get_context(matrix_element))
2515
2516+ def write_global_specs(self, matrix_element_list):
2517+ """ From the list of matrix element, or the single matrix element, derive
2518+ the global quantities to write in global_coef_specs.inc"""
2519+
2520+ if isinstance(matrix_element_list, list):
2521+ me_list = matrix_element_list
2522+ else:
2523+ me_list = [matrix_element_list]
2524+
2525+ open(pjoin(self.dir_path,'SubProcesses','global_specs.inc'),'w').write(
2526+""" integer MAXNEXTERNAL
2527+ parameter(MAXNEXTERNAL=%d)
2528+ integer OVERALLMAXRANK
2529+ parameter(OVERALLMAXRANK=%d)
2530+ integer NPROCS
2531+ parameter(NPROCS=%d)"""%(
2532+ max(me.get_nexternal_ninitial()[0] for me in me_list),
2533+ max(me.get_max_loop_rank() for me in me_list),
2534+ len(me_list)))
2535+
2536+
2537 def fix_coef_specs(self, overall_max_lwf_spin, overall_max_loop_vert_rank):
2538 """ If processes with different maximum loop wavefunction size or
2539 different maximum loop vertex rank have to be output together, then
2540@@ -2572,7 +2669,7 @@
2541 looplibs_av=['.TRUE.']
2542 # one should be careful about the order in the following as it must match
2543 # the ordering in MadLoopParamsCard.
2544- for tir_lib in ['pjfry','iregi','golem','samurai','ninja']:
2545+ for tir_lib in ['pjfry','iregi','golem','samurai','ninja','collier']:
2546 looplibs_av.append('.TRUE.' if tir_lib in self.all_tir and \
2547 self.tir_available_dict[tir_lib] else '.FALSE.')
2548 replace_dict['data_looplibs_av']=','.join(looplibs_av)
2549@@ -2944,11 +3041,15 @@
2550 LoopInducedExporterME.finalize_v4_directory(self,*args,**opts)
2551
2552 def generate_subprocess_directory_v4(self, subproc_group,
2553- fortran_model,group_number):
2554+ fortran_model,group_number, unique_id=None):
2555 """Generate the Pn directory for a subprocess group in MadEvent,
2556 including the necessary matrix_N.f files, configs.inc and various
2557 other helper files"""
2558-
2559+
2560+ if unique_id is None:
2561+ raise MadGraph5Error, 'A unique_id must be provided to '+\
2562+ 'generate_subprocess_directory_v4 in LoopInducedExporterMEGroup.'
2563+
2564 # Generate the MadLoop files
2565 calls = 0
2566 matrix_elements = subproc_group.get('matrix_elements')
2567@@ -2956,7 +3057,8 @@
2568 calls += self.generate_loop_subprocess(matrix_element,fortran_model,
2569 group_number = group_number, proc_id = str(ime+1),
2570 # group_number = str(subproc_group.get('number')), proc_id = str(ime+1),
2571- config_map = subproc_group.get('diagram_maps')[ime])
2572+ config_map = subproc_group.get('diagram_maps')[ime],
2573+ unique_id=unique_id+ime)
2574
2575 # Then generate the MadEvent files
2576 export_v4.ProcessExporterFortranMEGroup.generate_subprocess_directory_v4(
2577@@ -3107,14 +3209,15 @@
2578 # care of MadLoop virtuals initialization
2579 LoopInducedExporterME.finalize_v4_directory(self,*args,**opts)
2580
2581- def generate_subprocess_directory_v4(self, matrix_element, fortran_model, me_number):
2582+ def generate_subprocess_directory_v4(self, matrix_element, fortran_model,
2583+ me_number):
2584 """Generate the Pn directory for a subprocess group in MadEvent,
2585 including the necessary matrix_N.f files, configs.inc and various
2586 other helper files"""
2587
2588 # Then generate the MadLoop files
2589 calls = self.generate_loop_subprocess(matrix_element,fortran_model,
2590- group_number = me_number)
2591+ group_number = me_number, unique_id=me_number)
2592
2593
2594 # First generate the MadEvent files
2595
2596=== modified file 'madgraph/madevent/sum_html.py'
2597--- madgraph/madevent/sum_html.py 2016-06-28 15:36:47 +0000
2598+++ madgraph/madevent/sum_html.py 2016-07-02 20:37:49 +0000
2599@@ -57,6 +57,7 @@
2600 'Samurai_usage' : 0,
2601 'Ninja_usage' : 0,
2602 'Ninja_QP_usage' : 0,
2603+ 'COLLIER_usage' : 0,
2604 'max_precision' : 1.0e99,
2605 'min_precision' : 0.0,
2606 'averaged_timing' : 0.0,
2607@@ -119,6 +120,7 @@
2608 self['Golem_usage'] = u_codes[4]
2609 self['Samurai_usage'] = u_codes[5]
2610 self['Ninja_usage'] = u_codes[6]
2611+ self['COLLIER_usage'] = u_codes[7]
2612 self['Ninja_QP_usage'] = u_codes[8]
2613 self['CutTools_QP_usage'] = u_codes[9]
2614 t_return_code = xml_node.getElementsByTagName('t_return_code')
2615@@ -177,6 +179,7 @@
2616 ('Golem',float(self['Golem_usage'])/self['n_madloop_calls']),
2617 ('IREGI',float(self['IREGI_usage'])/self['n_madloop_calls']),
2618 ('Samurai',float(self['Samurai_usage'])/self['n_madloop_calls']),
2619+ ('COLLIER',float(self['COLLIER_usage'])/self['n_madloop_calls']),
2620 ('Ninja_DP',float(self['Ninja_usage'])/self['n_madloop_calls']),
2621 ('Ninja_QP',float(self['Ninja_QP_usage'])/self['n_madloop_calls'])]
2622
2623
2624=== modified file 'madgraph/various/banner.py'
2625--- madgraph/various/banner.py 2016-06-28 12:22:14 +0000
2626+++ madgraph/various/banner.py 2016-07-02 20:37:49 +0000
2627@@ -2189,17 +2189,23 @@
2628 contains a parser to read it, facilities to write a new file,...
2629 """
2630
2631-
2632-
2633+ _ID_reduction_tool_map = {1:'CutTools',
2634+ 2:'PJFry++',
2635+ 3:'IREGI',
2636+ 4:'Golem95',
2637+ 5:'Samurai',
2638+ 6:'Ninja',
2639+ 7:'COLLIER'}
2640+
2641 def default_setup(self):
2642 """initialize the directory to the default value"""
2643
2644- self.add_param("MLReductionLib", "6|1|2")
2645+ self.add_param("MLReductionLib", "6|7|1")
2646 self.add_param("IREGIMODE", 2)
2647 self.add_param("IREGIRECY", True)
2648 self.add_param("CTModeRun", -1)
2649 self.add_param("MLStabThres", 1e-3)
2650- self.add_param("NRotations_DP", 1)
2651+ self.add_param("NRotations_DP", 0)
2652 self.add_param("NRotations_QP", 0)
2653 self.add_param("ImprovePSPoint", 2)
2654 self.add_param("CTLoopLibrary", 2)
2655@@ -2215,8 +2221,16 @@
2656 self.add_param("HelicityFilterLevel", 2)
2657 self.add_param("LoopInitStartOver", False)
2658 self.add_param("HelInitStartOver", False)
2659- self.add_param("UseQPIntegrandForNinja", False)
2660+ self.add_param("UseQPIntegrandForNinja", True)
2661 self.add_param("UseQPIntegrandForCutTools", True)
2662+ self.add_param("COLLIERMode", 1)
2663+ self.add_param("COLLIERComputeUVpoles", True)
2664+ self.add_param("COLLIERComputeIRpoles", True)
2665+ self.add_param("COLLIERRequiredAccuracy", 1.0e-8)
2666+ self.add_param("COLLIERCanOutput",False)
2667+ self.add_param("COLLIERGlobalCache",-1)
2668+ self.add_param("COLLIERUseCacheForPoles",False)
2669+ self.add_param("COLLIERUseInternalStabilityTest",True)
2670
2671 def read(self, finput):
2672 """Read the input file, this can be a path to a file,
2673
2674=== modified file 'madgraph/various/misc.py'
2675--- madgraph/various/misc.py 2016-05-18 14:36:57 +0000
2676+++ madgraph/various/misc.py 2016-07-02 20:37:49 +0000
2677@@ -308,7 +308,7 @@
2678 log(msg)
2679
2680
2681- if dependency in ['pjfry','golem','samurai','ninja']:
2682+ if dependency in ['pjfry','golem','samurai','ninja','collier']:
2683 if cmd.options[dependency] not in ['None',None,'']:
2684 tell("Deactivating MG5_aMC dependency '%s'"%dependency)
2685 cmd.options[dependency] = None
2686@@ -350,6 +350,13 @@
2687 tell("Installing ninja...")
2688 cmd.do_install('ninja')
2689
2690+ if dependency=='collier':
2691+ if cmd.options['collier'] in ['None',None,''] or\
2692+ (cmd.options['collier'] == 'auto' and which_lib('libcollier.a') is None) or\
2693+ which_lib(pjoin(cmd.options['collier'],'libcollier.a')) is None:
2694+ tell("Installing COLLIER...")
2695+ cmd.do_install('collier')
2696+
2697 #===============================================================================
2698 # find a library
2699 #===============================================================================
2700
2701=== modified file 'madgraph/various/process_checks.py'
2702--- madgraph/various/process_checks.py 2016-04-15 11:14:25 +0000
2703+++ madgraph/various/process_checks.py 2016-07-02 20:37:49 +0000
2704@@ -613,7 +613,8 @@
2705 self.mg_root, export_dir, MLoptions)
2706 FortranModel = helas_call_writers.FortranUFOHelasCallWriter(model)
2707 FortranExporter.copy_v4template(modelname=model.get('name'))
2708- FortranExporter.generate_subprocess_directory_v4(matrix_element, FortranModel)
2709+ FortranExporter.generate_subprocess_directory_v4(matrix_element, FortranModel, 1)
2710+ FortranExporter.write_global_specs(matrix_element)
2711 wanted_lorentz = list(set(matrix_element.get_used_lorentz()))
2712 wanted_couplings = list(set([c for l in matrix_element.get_used_couplings() \
2713 for c in l]))
2714@@ -1155,7 +1156,8 @@
2715 FortranExporter = exporter_class(self.mg_root, export_dir, MLoptions)
2716 FortranModel = helas_call_writers.FortranUFOHelasCallWriter(model)
2717 FortranExporter.copy_v4template(modelname=model.get('name'))
2718- FortranExporter.generate_subprocess_directory_v4(matrix_element, FortranModel)
2719+ FortranExporter.generate_subprocess_directory_v4(matrix_element, FortranModel, 1)
2720+ FortranExporter.write_global_specs(matrix_element)
2721 wanted_lorentz = list(set(matrix_element.get_used_lorentz()))
2722 wanted_couplings = list(set([c for l in matrix_element.get_used_couplings() \
2723 for c in l]))
2724@@ -1470,8 +1472,8 @@
2725 tools=list(set(tools)) # remove the duplication ones
2726
2727 # not self-contained tir libraries
2728- tool_var={'pjfry':2,'golem':4,'samurai':5,'ninja':6}
2729- for tool in ['pjfry','golem','samurai','ninja']:
2730+ tool_var={'pjfry':2,'golem':4,'samurai':5,'ninja':6,'collier':7}
2731+ for tool in ['pjfry','golem','samurai','ninja','collier']:
2732 tool_dir='%s_dir'%tool
2733 if not tool_dir in self.tir_dir:
2734 continue
2735@@ -1493,8 +1495,8 @@
2736 export_dir=pjoin(self.mg_root,("SAVED" if keep_folder else "")+\
2737 temp_dir_prefix+"_%s"%proc_name)
2738
2739- tools_name={1:'CutTools',2:'PJFry++',3:'IREGI',4:'Golem95',5:'Samurai',
2740- 6:'Ninja'}
2741+ tools_name=bannermod.MadLoopParam._ID_reduction_tool_map
2742+
2743 return_dict={}
2744 return_dict['Stability']={}
2745 infos_save={'Process_output': None,
2746@@ -1517,7 +1519,7 @@
2747 # The exceptional PS points are those which stay unstable in quad prec.
2748 Exceptional_PS_points = []
2749
2750- MLoptions={}
2751+ MLoptions=MLOptions
2752 MLoptions["MLReductionLib"]=tool
2753 clean = (tool==tools[0]) and not nPoints==0
2754 if infos_IN==None or (tool_name not in infos_IN):
2755@@ -1606,7 +1608,7 @@
2756 str(datetime.timedelta(seconds=sec_needed)),\
2757 datetime.datetime.now().strftime("%d-%m-%Y %H:%M")))
2758 if logger.getEffectiveLevel()<logging.WARNING and \
2759- (sec_needed>5 or (reusing and infos['Initialization'] == None)):
2760+ (sec_needed>5 or infos['Initialization'] == None):
2761 widgets = ['Stability check:', pbar.Percentage(), ' ',
2762 pbar.Bar(),' ', pbar.ETA(), ' ']
2763 progress_bar = pbar.ProgressBar(widgets=widgets, maxval=nPoints,
2764@@ -2125,8 +2127,10 @@
2765
2766 timing2 = myProfiler.time_matrix_element(matrix_element, reusing,
2767 param_card, keep_folder=keep_folder,options=options,
2768- MLOptions = MLoptions)
2769+ MLOptions = MLoptions)
2770
2771+ timing2['reduction_tool'] = MLoptions['MLReductionLib'][0]
2772+
2773 if timing2 == None:
2774 return None, None
2775
2776@@ -2172,6 +2176,22 @@
2777 MLoptions = {}
2778 else:
2779 MLoptions = MLOptions
2780+ # Make sure that the poles computation is disabled for COLLIER
2781+ if 'COLLIERComputeUVpoles' not in MLoptions:
2782+ MLoptions['COLLIERComputeUVpoles']=False
2783+ if 'COLLIERComputeIRpoles' not in MLoptions:
2784+ MLoptions['COLLIERComputeIRpoles']=False
2785+ # Use high required accuracy in COLLIER's requirement if not specified
2786+ if 'COLLIERRequiredAccuracy' not in MLoptions:
2787+ MLoptions['COLLIERRequiredAccuracy']=1e-13
2788+ # Use loop-direction switching as stability test if not specifed (more reliable)
2789+ if 'COLLIERUseInternalStabilityTest' not in MLoptions:
2790+ MLoptions['COLLIERUseInternalStabilityTest']=False
2791+ # Finally we *must* forbid the use of COLLIER global cache here, because it
2792+ # does not work with the way we call independently CTMODERun 1 and 2
2793+ # with the StabilityChecker.
2794+ MLoptions['COLLIERGlobalCache'] = 0
2795+
2796 if "MLReductionLib" not in MLOptions:
2797 MLoptions["MLReductionLib"] = []
2798 if cuttools:
2799@@ -2186,6 +2206,8 @@
2800 MLoptions["MLReductionLib"].extend([5])
2801 if "ninja_dir" in tir:
2802 MLoptions["MLReductionLib"].extend([6])
2803+ if "collier_dir" in tir:
2804+ MLoptions["MLReductionLib"].extend([7])
2805
2806 stability = myStabilityChecker.check_matrix_element_stability(matrix_element,
2807 options=options,param_card=param_card,
2808@@ -2223,6 +2245,19 @@
2809 MLoptions = {}
2810 else:
2811 MLoptions = MLOptions
2812+ # Make sure that the poles computation is disabled for COLLIER
2813+ if 'COLLIERComputeUVpoles' not in MLoptions:
2814+ MLoptions['COLLIERComputeUVpoles']=False
2815+ if 'COLLIERComputeIRpoles' not in MLoptions:
2816+ MLoptions['COLLIERComputeIRpoles']=False
2817+ # And the COLLIER global cache is active, if not specified
2818+ if 'COLLIERGlobalCache' not in MLoptions:
2819+ MLoptions['COLLIERGlobalCache']=-1
2820+ # And time NINJA by default if not specified:
2821+ if 'MLReductionLib' not in MLoptions or \
2822+ len(MLoptions['MLReductionLib'])==0:
2823+ MLoptions['MLReductionLib'] = [6]
2824+
2825 timing2 = myTimer.time_matrix_element(matrix_element, reusing, param_card,
2826 keep_folder = keep_folder, options=options,
2827 MLOptions = MLoptions)
2828@@ -2233,6 +2268,7 @@
2829 # Return the merged two dictionaries
2830 res = dict(timing1.items()+timing2.items())
2831 res['loop_optimized_output']=myTimer.loop_optimized_output
2832+ res['reduction_tool'] = MLoptions['MLReductionLib'][0]
2833 return res
2834
2835 #===============================================================================
2836@@ -2678,7 +2714,8 @@
2837 # Use nicer name for the XML tag in the log file
2838 xml_toolname = {'GOLEM95':'GOLEM','IREGI':'IREGI',
2839 'CUTTOOLS':'CUTTOOLS','PJFRY++':'PJFRY',
2840- 'NINJA':'NINJA','SAMURAI':'SAMURAI'}[toolname.upper()]
2841+ 'NINJA':'NINJA','SAMURAI':'SAMURAI',
2842+ 'COLLIER':'COLLIER'}[toolname.upper()]
2843 if len(UPS)>0:
2844 res_str_i = "\nDetails of the %d/%d UPS encountered by %s\n"\
2845 %(len(UPS),nPS,toolname)
2846@@ -2819,7 +2856,7 @@
2847
2848 try:
2849 import matplotlib.pyplot as plt
2850- colorlist=['b','r','g','y','m','c']
2851+ colorlist=['b','r','g','y','m','c','k']
2852 for i,key in enumerate(data_plot_dict.keys()):
2853 color=colorlist[i]
2854 data_plot=data_plot_dict[key]
2855@@ -2860,6 +2897,8 @@
2856 # Define shortcut
2857 f = format_output
2858 loop_optimized_output = timings['loop_optimized_output']
2859+ reduction_tool = bannermod.MadLoopParam._ID_reduction_tool_map[
2860+ timings['reduction_tool']]
2861
2862 res_str = "%s \n"%process.nice_string()
2863 try:
2864@@ -2885,6 +2924,7 @@
2865 res_str += "|= Initialization............ %s\n"\
2866 %f(timings['Initialization'],'%.3gs')
2867
2868+ res_str += "\n= Reduction tool tested...... %s\n"%reduction_tool
2869 res_str += "\n= Helicity sum time / PSpoint ========== %.3gms\n"\
2870 %(timings['run_unpolarized_total']*1000.0)
2871 if loop_optimized_output:
2872@@ -2894,7 +2934,7 @@
2873 total=coef_time+loop_time
2874 res_str += "|= Coefs. computation time... %.3gms (%d%%)\n"\
2875 %(coef_time,int(round(100.0*coef_time/total)))
2876- res_str += "|= Loop evaluation (OPP) time %.3gms (%d%%)\n"\
2877+ res_str += "|= Loop evaluation time...... %.3gms (%d%%)\n"\
2878 %(loop_time,int(round(100.0*loop_time/total)))
2879 res_str += "\n= One helicity time / PSpoint ========== %.3gms\n"\
2880 %(timings['run_polarized_total']*1000.0)
2881@@ -2905,7 +2945,7 @@
2882 total=coef_time+loop_time
2883 res_str += "|= Coefs. computation time... %.3gms (%d%%)\n"\
2884 %(coef_time,int(round(100.0*coef_time/total)))
2885- res_str += "|= Loop evaluation (OPP) time %.3gms (%d%%)\n"\
2886+ res_str += "|= Loop evaluation time...... %.3gms (%d%%)\n"\
2887 %(loop_time,int(round(100.0*loop_time/total)))
2888 res_str += "\n= Miscellaneous ========================\n"
2889 res_str += "|= Number of hel. computed... %s/%s\n"\
2890
2891=== modified file 'madgraph/various/q_polynomial.py'
2892--- madgraph/various/q_polynomial.py 2016-06-09 00:59:23 +0000
2893+++ madgraph/various/q_polynomial.py 2016-07-02 20:37:49 +0000
2894@@ -362,6 +362,20 @@
2895
2896 return '\n'.join(lines)
2897
2898+ def get_COLLIER_mapping(self):
2899+ """ Returns a list of tuples of the form:
2900+ [ (COLLIER_ind0, COLLIER_ind1, COLLIER_ind2, COLLIER_ind3), ]
2901+ where the position in the list is the coef_ID in MadLoop ordering.
2902+ """
2903+ res = []
2904+ for coef_pos in range(0,get_number_of_coefs_for_rank(self.pq.rank)):
2905+ indices_list = self.pq.get_coef_at_position(coef_pos)
2906+ res.append((indices_list.count(0),
2907+ indices_list.count(1),
2908+ indices_list.count(2),
2909+ indices_list.count(3)))
2910+ return res
2911+
2912 def write_golem95_mapping(self):
2913 """ Returns a fortran subroutine which fills in the array of tensorial
2914 coefficients following golem95 standards using MadLoop coefficients."""
2915
2916=== modified file 'tests/IOTests.py'
2917--- tests/IOTests.py 2015-10-01 16:00:08 +0000
2918+++ tests/IOTests.py 2016-07-02 20:37:49 +0000
2919@@ -155,7 +155,7 @@
2920 myloopamp,optimized_output=isOptimized)
2921
2922 self.exporter.copy_v4template(model.get('name'))
2923- self.exporter.generate_loop_subprocess(hel_amp, self.helasModel)
2924+ self.exporter.generate_loop_subprocess(hel_amp, self.helasModel,unique_id=1)
2925 wanted_lorentz = hel_amp.get_used_lorentz()
2926 wanted_couplings = list(set(sum(hel_amp.get_used_couplings(),[])))
2927 self.exporter.convert_model_to_mg4(model,wanted_lorentz,wanted_couplings)
2928
2929=== modified file 'tests/acceptance_tests/test_cmd.py'
2930--- tests/acceptance_tests/test_cmd.py 2016-05-11 21:07:38 +0000
2931+++ tests/acceptance_tests/test_cmd.py 2016-07-02 20:37:49 +0000
2932@@ -189,6 +189,7 @@
2933 'f2py_compiler':None,
2934 'cluster_retry_wait': 300,
2935 'syscalc_path':'./SysCalc',
2936+ 'collier':'./HEPTools/lib',
2937 'hepmc_path': './hepmc',
2938 'hwpp_path': './herwigPP',
2939 'thepeg_path': './thepeg',
2940
2941=== modified file 'tests/acceptance_tests/test_histograms.py'
2942--- tests/acceptance_tests/test_histograms.py 2016-06-09 00:59:23 +0000
2943+++ tests/acceptance_tests/test_histograms.py 2016-07-02 20:37:49 +0000
2944@@ -47,6 +47,5 @@
2945 histo_list.output(pjoin('%s','HistoOut'), format = 'gnuplot');
2946 ''' % (sys.path, _file_path, self.IOpath)
2947
2948- import os
2949 os.system('echo "%s" | python' % line)
2950
2951
2952=== added file 'tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%COLLIER_interface.f'
2953--- tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%COLLIER_interface.f 1970-01-01 00:00:00 +0000
2954+++ tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%COLLIER_interface.f 2016-07-02 20:37:49 +0000
2955@@ -0,0 +1,732 @@
2956+ SUBROUTINE COLLIERLOOP(CTMODE, NLOOPLINE,RANK,PL,PDEN,M2L
2957+ $ ,TIRCOEFS,TIRCOEFSERRORS)
2958+C
2959+C Generated by MadGraph5_aMC@NLO v. %(version)s, %(date)s
2960+C By the MadGraph5_aMC@NLO Development Team
2961+C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch
2962+C
2963+C Interface between MG5 and COLLIER.
2964+C It supports any rank when 1 < NLOOPLINE < 7.
2965+C
2966+C Process: d~ u > w+ WEIGHTED<=2 QED<=1 [ all = QCD ]
2967+C Process: s~ c > w+ WEIGHTED<=2 QED<=1 [ all = QCD ]
2968+C
2969+C
2970+C MODULES
2971+C
2972+ USE COLLIER
2973+ IMPLICIT NONE
2974+C
2975+C CONSTANTS
2976+C
2977+ LOGICAL CHECKPCONSERVATION
2978+ PARAMETER (CHECKPCONSERVATION=.TRUE.)
2979+ REAL*8 PIVALUE
2980+ PARAMETER(PIVALUE=3.14159265358979323846D0)
2981+ INTEGER MAXRANK
2982+ PARAMETER (MAXRANK=2)
2983+ INTEGER NLOOPGROUPS
2984+ PARAMETER (NLOOPGROUPS=1)
2985+ INCLUDE 'loop_max_coefs.inc'
2986+C
2987+C ARGUMENTS
2988+C
2989+ INTEGER NLOOPLINE, RANK, CTMODE
2990+ REAL*8 PL(0:3,NLOOPLINE)
2991+ REAL*8 PDEN(0:3,NLOOPLINE-1)
2992+ COMPLEX*16 M2L(NLOOPLINE)
2993+ COMPLEX*16 RES(3)
2994+ COMPLEX*16 TIRCOEFS(0:LOOPMAXCOEFS-1,3)
2995+ COMPLEX*16 TIRCOEFSERRORS(0:LOOPMAXCOEFS-1,3)
2996+
2997+C
2998+C LOCAL VARIABLES
2999+C
3000+ INTEGER N, I, J, K, L
3001+ INTEGER C0,C1,C2,C3
3002+ INTEGER N_CACHES
3003+ INTEGER CURR_RANK, SGN
3004+ INTEGER CURR_INDEX
3005+ INTEGER CURR_MAXCOEF
3006+ REAL*8 RBUFF(0:3)
3007+
3008+ INTEGER COEFMAP_ZERO(0:LOOPMAXCOEFS-1)
3009+ INTEGER COEFMAP_ONE(0:LOOPMAXCOEFS-1)
3010+ INTEGER COEFMAP_TWO(0:LOOPMAXCOEFS-1)
3011+ INTEGER COEFMAP_THREE(0:LOOPMAXCOEFS-1)
3012+ DATA (COEFMAP_ZERO(I),I= 0, 9) / 0, 1, 0, 0, 0, 2, 1, 0, 1, 0/
3013+ DATA (COEFMAP_ZERO(I),I= 10, 14) / 0, 1, 0, 0, 0/
3014+ DATA (COEFMAP_ONE(I),I= 0, 9) / 0, 0, 1, 0, 0, 0, 1, 2, 0, 1/
3015+ DATA (COEFMAP_ONE(I),I= 10, 14) / 0, 0, 1, 0, 0/
3016+ DATA (COEFMAP_TWO(I),I= 0, 9) / 0, 0, 0, 1, 0, 0, 0, 0, 1, 1/
3017+ DATA (COEFMAP_TWO(I),I= 10, 14) / 2, 0, 0, 1, 0/
3018+ DATA (COEFMAP_THREE(I),I= 0, 9) / 0, 0, 0, 0, 1, 0, 0, 0, 0, 0/
3019+ DATA (COEFMAP_THREE(I),I= 10, 14) / 0, 1, 1, 1, 2/
3020+
3021+ REAL*8 REF_NORMALIZATION
3022+
3023+ DOUBLE COMPLEX M2LCOLLIER(0:NLOOPLINE-1)
3024+ DOUBLE COMPLEX MOMVEC(0:3,NLOOPLINE-1)
3025+ DOUBLE COMPLEX MOMINV((NLOOPLINE*(NLOOPLINE-1))/2)
3026+
3027+ DOUBLE COMPLEX TNTEN(0:RANK,0:RANK,0:RANK,0:RANK)
3028+ DOUBLE COMPLEX TNTENUV(0:RANK,0:RANK,0:RANK,0:RANK)
3029+ DOUBLE PRECISION TNTENERR(0:RANK)
3030+
3031+ REAL*8 MAXCOEFFORRANK(0:RANK)
3032+
3033+C These quantities are for the pole evaluation
3034+ DOUBLE COMPLEX TNTEN_UV(0:RANK,0:RANK,0:RANK,0:RANK)
3035+ DOUBLE COMPLEX TNTENUV_UV(0:RANK,0:RANK,0:RANK,0:RANK)
3036+ DOUBLE PRECISION TNTENERR_UV(0:RANK)
3037+ DOUBLE COMPLEX TNTEN_IR1(0:RANK,0:RANK,0:RANK,0:RANK)
3038+ DOUBLE COMPLEX TNTENUV_IR1(0:RANK,0:RANK,0:RANK,0:RANK)
3039+ DOUBLE PRECISION TNTENERR_IR1(0:RANK)
3040+ DOUBLE COMPLEX TNTEN_IR2(0:RANK,0:RANK,0:RANK,0:RANK)
3041+ DOUBLE COMPLEX TNTENUV_IR2(0:RANK,0:RANK,0:RANK,0:RANK)
3042+ DOUBLE PRECISION TNTENERR_IR2(0:RANK)
3043+C
3044+C GLOBAL VARIABLES
3045+C
3046+ INCLUDE 'coupl.inc'
3047+ INCLUDE 'MadLoopParams.inc'
3048+ INCLUDE 'unique_id.inc'
3049+ INCLUDE 'global_specs.inc'
3050+
3051+ INTEGER ID,SQSOINDEX,R
3052+ COMMON/LOOP/ID,SQSOINDEX,R
3053+
3054+C
3055+C These global variables cache the coefficients already computed
3056+C by COLLIER
3057+C so that they can be reused. In particular, in CTMODE 2, the
3058+C cached ERROR
3059+C quantities for eahc rank will be used to make use of COLLIER's
3060+C internal
3061+C assessment of the numerical accuracy.
3062+C
3063+ LOGICAL LOOP_ID_DONE(NLOOPGROUPS)
3064+ DATA LOOP_ID_DONE/NLOOPGROUPS*.FALSE./
3065+ COMPLEX*16 TIR_COEFS_DIRECT_MODE(0:LOOPMAXCOEFS-1,3,NLOOPGROUPS)
3066+ REAL*8 TIR_COEFS_ERROR(0:MAXRANK,NLOOPGROUPS)
3067+ COMMON/COLLIER_TIR_COEFS/TIR_COEFS_DIRECT_MODE,TIR_COEFS_ERROR
3068+ $ ,LOOP_ID_DONE
3069+
3070+ INTEGER COLLIER_CACHE_ACTIVE, NCALLS_IN_CACHE(4),
3071+ $ NCOLLIERCALLS(4)
3072+ LOGICAL MUST_INIT_EVENT
3073+ COMMON/COLLIER_CACHE_STATUS/COLLIER_CACHE_ACTIVE,NCALLS_IN_CACHE
3074+ $ , NCOLLIERCALLS,MUST_INIT_EVENT
3075+
3076+ LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT,
3077+ $ COLLIERINIT
3078+ COMMON/REDUCTIONCODEINIT/CTINIT, TIRINIT,GOLEMINIT,SAMURAIINIT
3079+ $ ,NINJAINIT, COLLIERINIT
3080+
3081+C ----------
3082+C BEGIN CODE
3083+C ----------
3084+
3085+ IF (COLLIERUSECACHEFORPOLES) THEN
3086+ N_CACHES = 4
3087+ ELSE
3088+ N_CACHES =1
3089+ ENDIF
3090+
3091+C Initialize COLLIER if needed
3092+ IF (COLLIERINIT) THEN
3093+ COLLIERINIT=.FALSE.
3094+ CALL INITCOLLIER()
3095+ ENDIF
3096+
3097+C Initialize the event if it is the first time collier is called
3098+C on this PS point
3099+ IF(MUST_INIT_EVENT) THEN
3100+ MUST_INIT_EVENT = .FALSE.
3101+ IF (COLLIERGLOBALCACHE.EQ.0) THEN
3102+ CALL INITEVENT_CLL()
3103+ ELSE
3104+ DO I=1,N_CACHES
3105+C Record how many events where put in the cache. On the
3106+C first PS point.
3107+ IF (NCALLS_IN_CACHE(I).EQ.-1.AND.NCOLLIERCALLS(I).GT.0)
3108+ $ THEN
3109+ NCALLS_IN_CACHE(I) = NCOLLIERCALLS(I)
3110+ ENDIF
3111+ ENDDO
3112+ DO I=1,N_CACHES
3113+C Now apply a safety check that our last event had as many
3114+C calls as the cache is setup for.
3115+C The only case for now when it can be half of the calls
3116+C when we are doing the true loop-direction test with also
3117+C the computation of a rotated PS point (which is computed
3118+C for one mode only).
3119+ IF (NCALLS_IN_CACHE(I).NE.-1.AND..NOT. ( NCOLLIERCALLS(I)
3120+ $ .EQ.NCALLS_IN_CACHE(I).OR. ( CTMODERUN.EQ.
3121+ $ -1.AND..NOT.COLLIERUSEINTERNALSTABILITYTEST.AND.NROTATIONS
3122+ $_DP.GT.0.AND.MOD(NCALLS_IN_CACHE(I),2).EQ.0.AND.(NCALLS_IN_CACHE(
3123+ $I)/2).EQ.NCOLLIERCALLS(I) ) ) ) THEN
3124+ WRITE(*,*) 'WARNING: A consistency check in MadLoop'
3125+ $ //' failed and, for safety, forced MadLoop to'
3126+ $ //' reinitialize the global cache of COLLIER. Report'
3127+ $ //' this to MadLoop authors. The problematic cache was'
3128+ $ //' number ',I
3129+ IF (COLLIERGLOBALCACHE.EQ.-1) THEN
3130+ CALL INITCACHESYSTEM_CLL(N_CACHES*NPROCS,MAXNEXTERNAL)
3131+ ELSE
3132+ CALL INITCACHESYSTEM_CLL(N_CACHES*NPROCS
3133+ $ ,COLLIERGLOBALCACHE)
3134+ ENDIF
3135+C Make sure all caches are switched off at first.
3136+ CALL SWITCHOFFCACHESYSTEM_CLL()
3137+C Reset the cache design property
3138+ NCALLS_IN_CACHE(:) = -1
3139+ NCOLLIERCALLS(:) = 0
3140+ IF (COLLIER_CACHE_ACTIVE.EQ.1) THEN
3141+ CALL SWITCHONCACHE_CLL((UNIQUE_ID-1)*N_CACHES+1)
3142+ ENDIF
3143+C No need to check the other caches since we already had
3144+C to reset here.
3145+ EXIT
3146+ ENDIF
3147+ ENDDO
3148+ CALL INITEVENT_CLL((UNIQUE_ID-1)*N_CACHES+1)
3149+ NCOLLIERCALLS(1) = 0
3150+ IF(COLLIERCOMPUTEUVPOLES.AND.COLLIERUSECACHEFORPOLES) THEN
3151+ CALL INITEVENT_CLL((UNIQUE_ID-1)*N_CACHES+2)
3152+ NCOLLIERCALLS(2) = 0
3153+ ENDIF
3154+ IF(COLLIERCOMPUTEIRPOLES.AND.COLLIERUSECACHEFORPOLES) THEN
3155+ CALL INITEVENT_CLL((UNIQUE_ID-1)*N_CACHES+3)
3156+ NCOLLIERCALLS(3) = 0
3157+ CALL INITEVENT_CLL((UNIQUE_ID-1)*N_CACHES+4)
3158+ NCOLLIERCALLS(4) = 0
3159+ ENDIF
3160+ ENDIF
3161+ CALL SETDELTAIR_CLL(0.0D0,(PIVALUE**2)/6.0D0)
3162+ CALL SETDELTAUV_CLL(0.0D0)
3163+ CALL SETMUIR2_CLL(MU_R**2)
3164+ CALL SETMUUV2_CLL(MU_R**2)
3165+ ENDIF
3166+
3167+C Now really start the reduction with COLLIER
3168+
3169+C Number of coefficients for the current rank
3170+ CURR_MAXCOEF = 0
3171+ DO I=0,RANK
3172+ CURR_MAXCOEF=CURR_MAXCOEF+(3+I)*(2+I)*(1+I)/6
3173+ ENDDO
3174+
3175+ IF (CTMODE.NE.1.AND.CTMODE.NE.2) THEN
3176+ WRITE(*,*) 'ERROR: COLLIER only support the computational mode'
3177+ $ //' CTMODE equal to 1 or 2, not',CTMODE
3178+ STOP 'Incorrect computational mode specified to the COLLIER'
3179+ $ //' MG5aMC interface.'
3180+ ENDIF
3181+
3182+ DO I=0,CURR_MAXCOEF-1
3183+ DO K=1,3
3184+ TIRCOEFSERRORS(I,K)=DCMPLX(0.0D0,0.0D0)
3185+ ENDDO
3186+ ENDDO
3187+
3188+ IF (COLLIERUSEINTERNALSTABILITYTEST) THEN
3189+C Use MADLOOP internal cache dedicated to COLLIER that emulates
3190+C the CTMODE 2
3191+ IF (LOOP_ID_DONE(ID)) THEN
3192+ DO I=0,CURR_MAXCOEF-1
3193+ DO K=1,3
3194+ TIRCOEFS(I,K)=TIR_COEFS_DIRECT_MODE(I,K,ID)
3195+ ENDDO
3196+ ENDDO
3197+ DO I=0,RANK
3198+ MAXCOEFFORRANK(I) = 0.0D0
3199+ ENDDO
3200+ DO I=0,CURR_MAXCOEF-1
3201+ CURR_RANK = COEFMAP_ZERO(I)+COEFMAP_ONE(I)+COEFMAP_TWO(I)
3202+ $ +COEFMAP_THREE(I)
3203+ MAXCOEFFORRANK(CURR_RANK)=MAX(MAXCOEFFORRANK(CURR_RANK)
3204+ $ ,ABS(TIR_COEFS_DIRECT_MODE(I,1,ID)))
3205+ ENDDO
3206+ DO I=0,CURR_MAXCOEF-1
3207+ CURR_RANK = COEFMAP_ZERO(I)+COEFMAP_ONE(I)+COEFMAP_TWO(I)
3208+ $ +COEFMAP_THREE(I)
3209+ IF (MAXCOEFFORRANK(CURR_RANK).NE.0.0D0) THEN
3210+ DO K=1,3
3211+C The expression below is like taking the absolute value
3212+C when summing errors linearly
3213+C TIRCOEFSERRORS(I,K)=(TIR_COEFS_ERROR(CURR_RANK,ID)/MaxC
3214+C oefForRank(CURR_RANK))*DCMPLX( ABS(DBLE(TIRCOEFS(I,K)))
3215+C ,ABS(DIMAG(TIRCOEFS(I,K))) )
3216+C But empirically, I observed that retaining the
3217+C original complex phase leads to slightly more
3218+C accurate estimates
3219+ TIRCOEFSERRORS(I,K)=(TIR_COEFS_ERROR(CURR_RANK,ID)
3220+ $ /MAXCOEFFORRANK(CURR_RANK))*TIRCOEFS(I,K)
3221+ ENDDO
3222+ ENDIF
3223+ ENDDO
3224+ RETURN
3225+ ENDIF
3226+ ELSE
3227+C Apply the loop-direction switching here.
3228+ CALL SWITCH_ORDER(CTMODE,NLOOPLINE,PL,PDEN,M2L)
3229+ ENDIF
3230+
3231+C Make sure masses are complex
3232+ DO I=1,NLOOPLINE
3233+ M2LCOLLIER(I-1)=DCMPLX(M2L(I))
3234+ ENDDO
3235+
3236+C Now convert the loop offset momenta to COLLIER conventions
3237+ DO I=0,3
3238+ DO J=1,NLOOPLINE-1
3239+ MOMVEC(I,J)=DCMPLX(PDEN(I,J),0.0D0)
3240+ ENDDO
3241+ ENDDO
3242+
3243+C This first do loop spans over 'N' in '\foreach_N'
3244+C //' \foreach_i(k_i+k_{i+1}+..+k_{i+N})^2'
3245+ CURR_INDEX = 0
3246+ DO N=0,NLOOPLINE-1
3247+C We stop whenever we reached the target number of invariants
3248+ IF (CURR_INDEX.GE.((NLOOPLINE*(NLOOPLINE-1))/2)) THEN
3249+ EXIT
3250+ ENDIF
3251+C This do loop spans over 'i' in the expression above.
3252+ DO I=1,NLOOPLINE
3253+ IF (CURR_INDEX.GE.((NLOOPLINE*(NLOOPLINE-1))/2)) THEN
3254+ EXIT
3255+ ENDIF
3256+
3257+ CURR_INDEX = CURR_INDEX+1
3258+ RBUFF(:) = 0.0D0
3259+ DO J=I,I+N
3260+ RBUFF(:) = RBUFF(:) + PL(:,MOD(J-1,NLOOPLINE)+1)
3261+ ENDDO
3262+ MOMINV(CURR_INDEX) = DCMPLX(RBUFF(0)**2-RBUFF(1)**2-RBUFF(2)
3263+ $ **2-RBUFF(3)**2,0.0D0)
3264+
3265+C Now regularize the onshell behavior of the kinematic
3266+C invarients
3267+C All loop masses are tested, but that might be a bit too
3268+C inclusive.
3269+ DO K=1,NLOOPLINE
3270+ IF(ABS(M2L(K)).NE.0.0D0) THEN
3271+ IF(ABS((MOMINV(CURR_INDEX)-M2L(K))/M2L(K)).LT.OSTHRES)
3272+ $ THEN
3273+ MOMINV(CURR_INDEX)=DCMPLX(M2L(K))
3274+ ENDIF
3275+ ENDIF
3276+ ENDDO
3277+C For the massless onshell-case, we base the threshold only on
3278+C the energy component
3279+ REF_NORMALIZATION=0.0D0
3280+ DO L=0,0
3281+ REF_NORMALIZATION = REF_NORMALIZATION + ABS(RBUFF(L))
3282+ ENDDO
3283+ REF_NORMALIZATION = (REF_NORMALIZATION/(N+1))**2
3284+ IF(REF_NORMALIZATION.NE.0.0D0)THEN
3285+ IF(ABS(MOMINV(CURR_INDEX)/REF_NORMALIZATION).LT.OSTHRES)
3286+ $ THEN
3287+ MOMINV(CURR_INDEX)=DCMPLX(0.0D0,0.0D0)
3288+ ENDIF
3289+ ENDIF
3290+
3291+ ENDDO
3292+ ENDDO
3293+
3294+C We can now call COLLIER
3295+ IF (NLOOPLINE.NE.1) THEN
3296+ CALL TNTEN_CLL(TNTEN, TNTENUV, MOMVEC, MOMINV, M2LCOLLIER,
3297+ $ NLOOPLINE, RANK, TNTENERR)
3298+ ELSE
3299+ CALL TNTEN_CLL(TNTEN, TNTENUV, M2LCOLLIER, NLOOPLINE, RANK,
3300+ $ TNTENERR)
3301+ ENDIF
3302+ IF (COLLIER_CACHE_ACTIVE.EQ.1) THEN
3303+ NCOLLIERCALLS(1) = NCOLLIERCALLS(1)+1
3304+ ENDIF
3305+
3306+C Now compute the UV poles if asked for
3307+ IF (COLLIERCOMPUTEUVPOLES) THEN
3308+ IF(COLLIER_CACHE_ACTIVE.EQ.1) THEN
3309+ CALL SWITCHOFFCACHE_CLL((UNIQUE_ID-1)*N_CACHES+1)
3310+ IF(COLLIERUSECACHEFORPOLES) THEN
3311+ CALL SWITCHONCACHE_CLL((UNIQUE_ID-1)*N_CACHES+2)
3312+ ENDIF
3313+ ENDIF
3314+ CALL SETDELTAUV_CLL(1.0D0)
3315+ IF (NLOOPLINE.NE.1) THEN
3316+ CALL TNTEN_CLL(TNTEN_UV, TNTENUV_UV, MOMVEC, MOMINV,
3317+ $ M2LCOLLIER, NLOOPLINE, RANK, TNTENERR_UV)
3318+ ELSE
3319+ CALL TNTEN_CLL(TNTEN_UV, TNTENUV_UV, M2LCOLLIER, NLOOPLINE,
3320+ $ RANK, TNTENERR_UV)
3321+ ENDIF
3322+ IF (COLLIER_CACHE_ACTIVE.EQ.1) THEN
3323+ NCOLLIERCALLS(2) = NCOLLIERCALLS(2)+1
3324+ ENDIF
3325+ IF(COLLIER_CACHE_ACTIVE.EQ.1) THEN
3326+ IF(COLLIERUSECACHEFORPOLES) THEN
3327+ CALL SWITCHOFFCACHE_CLL((UNIQUE_ID-1)*N_CACHES+2)
3328+ ENDIF
3329+ CALL SWITCHONCACHE_CLL((UNIQUE_ID-1)*N_CACHES+1)
3330+ ENDIF
3331+ CALL SETDELTAUV_CLL(0.0D0)
3332+ ENDIF
3333+
3334+C Now compute the IR poles if asked for
3335+ IF (COLLIERCOMPUTEIRPOLES) THEN
3336+ IF(COLLIER_CACHE_ACTIVE.EQ.1) THEN
3337+ CALL SWITCHOFFCACHE_CLL((UNIQUE_ID-1)*N_CACHES+1)
3338+ IF(COLLIERUSECACHEFORPOLES) THEN
3339+ CALL SWITCHONCACHE_CLL((UNIQUE_ID-1)*N_CACHES+3)
3340+ ENDIF
3341+ ENDIF
3342+ CALL SETDELTAIR_CLL(1.0D0,(PIVALUE**2)/6.0D0)
3343+ IF (NLOOPLINE.NE.1) THEN
3344+ CALL TNTEN_CLL(TNTEN_IR1, TNTENUV_IR1, MOMVEC, MOMINV,
3345+ $ M2LCOLLIER, NLOOPLINE, RANK, TNTENERR_IR1)
3346+ ELSE
3347+ CALL TNTEN_CLL(TNTEN_IR1, TNTENUV_IR1, M2LCOLLIER, NLOOPLINE
3348+ $ , RANK, TNTENERR_IR1)
3349+ ENDIF
3350+ IF (COLLIER_CACHE_ACTIVE.EQ.1) THEN
3351+ NCOLLIERCALLS(3) = NCOLLIERCALLS(3)+1
3352+ ENDIF
3353+ IF(COLLIER_CACHE_ACTIVE.EQ.1.AND.COLLIERUSECACHEFORPOLES) THEN
3354+ CALL SWITCHOFFCACHE_CLL((UNIQUE_ID-1)*N_CACHES+3)
3355+ CALL SWITCHONCACHE_CLL((UNIQUE_ID-1)*N_CACHES+4)
3356+ ENDIF
3357+ CALL SETDELTAIR_CLL(0.0D0,1.0D0+(PIVALUE**2)/6.0D0)
3358+ IF (NLOOPLINE.NE.1) THEN
3359+ CALL TNTEN_CLL(TNTEN_IR2, TNTENUV_IR2, MOMVEC, MOMINV,
3360+ $ M2LCOLLIER, NLOOPLINE, RANK, TNTENERR_IR2)
3361+ ELSE
3362+ CALL TNTEN_CLL(TNTEN_IR2, TNTENUV_IR2, M2LCOLLIER, NLOOPLINE
3363+ $ , RANK, TNTENERR_IR2)
3364+ ENDIF
3365+ IF (COLLIER_CACHE_ACTIVE.EQ.1) THEN
3366+ NCOLLIERCALLS(4) = NCOLLIERCALLS(4)+1
3367+ ENDIF
3368+ IF(COLLIER_CACHE_ACTIVE.EQ.1) THEN
3369+ IF(COLLIERUSECACHEFORPOLES) THEN
3370+ CALL SWITCHOFFCACHE_CLL((UNIQUE_ID-1)*N_CACHES+4)
3371+ ENDIF
3372+ CALL SWITCHONCACHE_CLL((UNIQUE_ID-1)*N_CACHES+1)
3373+ ENDIF
3374+ CALL SETDELTAIR_CLL(0.0D0,(PIVALUE**2)/6.0D0)
3375+ ENDIF
3376+
3377+ DO I=0,(CURR_MAXCOEF-1)
3378+ C0 = COEFMAP_ZERO(I)
3379+ C1 = COEFMAP_ONE(I)
3380+ C2 = COEFMAP_TWO(I)
3381+ C3 = COEFMAP_THREE(I)
3382+ CURR_RANK = C0+C1+C2+C3
3383+C Because we must set q -> -q, we apply a minus sign to coefs of
3384+C odd rank
3385+ IF (MOD(CURR_RANK,2).EQ.1) THEN
3386+ SGN = -1
3387+ ELSE
3388+ SGN = 1
3389+ ENDIF
3390+ TIRCOEFS(I,1) = SGN*TNTEN(C0,C1,C2,C3)
3391+ IF (COLLIERCOMPUTEUVPOLES) THEN
3392+ TIRCOEFS(I,2) = SGN*( TNTEN_UV(C0,C1,C2,C3)-TNTEN(C0,C1,C2
3393+ $ ,C3) )
3394+ ELSE
3395+ TIRCOEFS(I,2) = DCMPLX(0.0D0,0.0D0)
3396+ ENDIF
3397+ IF (COLLIERCOMPUTEIRPOLES) THEN
3398+ TIRCOEFS(I,2) = TIRCOEFS(I,2) + SGN*( TNTEN_IR1(C0,C1,C2,C3)
3399+ $ -TNTEN(C0,C1,C2,C3) )
3400+ TIRCOEFS(I,3) = SGN*( TNTEN_IR2(C0,C1,C2,C3)-TNTEN(C0,C1,C2
3401+ $ ,C3) )
3402+ ELSE
3403+ TIRCOEFS(I,3) = DCMPLX(0.0D0,0.0D0)
3404+ ENDIF
3405+ ENDDO
3406+
3407+ IF (COLLIERUSEINTERNALSTABILITYTEST) THEN
3408+C Finish by caching the coefficients and error just computed
3409+ LOOP_ID_DONE(ID) = .TRUE.
3410+ DO J=0,CURR_MAXCOEF-1
3411+ DO K=1,3
3412+ TIR_COEFS_DIRECT_MODE(J,K,ID) = TIRCOEFS(J,K)
3413+ ENDDO
3414+ ENDDO
3415+ DO J=0,RANK
3416+ TIR_COEFS_ERROR(J,ID)=TNTENERR(J)
3417+ ENDDO
3418+
3419+C Now compute the errors on each coefficient
3420+ DO I=0,RANK
3421+ MAXCOEFFORRANK(I) = 0.0D0
3422+ ENDDO
3423+ DO I=0,CURR_MAXCOEF-1
3424+ CURR_RANK = COEFMAP_ZERO(I)+COEFMAP_ONE(I)+COEFMAP_TWO(I)
3425+ $ +COEFMAP_THREE(I)
3426+ MAXCOEFFORRANK(CURR_RANK)=MAX(MAXCOEFFORRANK(CURR_RANK)
3427+ $ ,ABS(TIRCOEFS(I,1)))
3428+ ENDDO
3429+ DO I=0,CURR_MAXCOEF-1
3430+ CURR_RANK = COEFMAP_ZERO(I)+COEFMAP_ONE(I)+COEFMAP_TWO(I)
3431+ $ +COEFMAP_THREE(I)
3432+ IF (MAXCOEFFORRANK(CURR_RANK).NE.0.0D0) THEN
3433+ DO K=1,3
3434+C The expression below is like taking the absolute value
3435+C when summing errors linearly
3436+C TIRCOEFSERRORS(I,K)=(TNtenerr(CURR_RANK)/MaxCoefForRank(C
3437+C URR_RANK))*DCMPLX( ABS(DBLE(TIRCOEFS(I,K))),ABS(DIMAG(TIR
3438+C COEFS(I,K))) )
3439+C But empirically, I observed that retaining the original
3440+C complex phase leads to slightly more accurate estimates
3441+ TIRCOEFSERRORS(I,K)=(TNTENERR(CURR_RANK)
3442+ $ /MAXCOEFFORRANK(CURR_RANK))*TIRCOEFS(I,K)
3443+ ENDDO
3444+ ENDIF
3445+ ENDDO
3446+
3447+ ENDIF
3448+
3449+ END SUBROUTINE COLLIERLOOP
3450+
3451+ SUBROUTINE CLEAR_COLLIER_CACHE()
3452+
3453+ USE COLLIER
3454+
3455+ INCLUDE 'loop_max_coefs.inc'
3456+ INTEGER NLOOPGROUPS
3457+ PARAMETER (NLOOPGROUPS=1)
3458+ INTEGER MAXRANK
3459+ PARAMETER (MAXRANK=2)
3460+
3461+ INTEGER I,J,K
3462+
3463+ INCLUDE 'MadLoopParams.inc'
3464+
3465+ LOGICAL LOOP_ID_DONE(NLOOPGROUPS)
3466+ COMPLEX*16 TIR_COEFS_DIRECT_MODE(0:LOOPMAXCOEFS-1,3,NLOOPGROUPS)
3467+ COMPLEX*16 TIR_COEFS_ERROR(0:MAXRANK,NLOOPGROUPS)
3468+ COMMON/COLLIER_TIR_COEFS/TIR_COEFS_DIRECT_MODE,TIR_COEFS_ERROR
3469+ $ ,LOOP_ID_DONE
3470+
3471+ INTEGER COLLIER_CACHE_ACTIVE, NCALLS_IN_CACHE(4),
3472+ $ NCOLLIERCALLS(4)
3473+ LOGICAL MUST_INIT_EVENT
3474+ COMMON/COLLIER_CACHE_STATUS/COLLIER_CACHE_ACTIVE,NCALLS_IN_CACHE
3475+ $ , NCOLLIERCALLS,MUST_INIT_EVENT
3476+
3477+C Make sure that next time the COLLIER Subroutine is called it
3478+C will call the subroutine initEvent of Collier.
3479+ MUST_INIT_EVENT = .TRUE.
3480+
3481+C Reinitialize the ML cache for COLLIER
3482+ DO I=1,NLOOPGROUPS
3483+ LOOP_ID_DONE(I) = .FALSE.
3484+ DO J=0,LOOPMAXCOEFS-1
3485+ DO K=1,3
3486+ TIR_COEFS_DIRECT_MODE(J,K,I) = DCMPLX(0.0D0,0.0D0)
3487+ ENDDO
3488+ ENDDO
3489+ DO J=0,MAXRANK
3490+ TIR_COEFS_ERROR(J,I)=0.0D0
3491+ ENDDO
3492+ ENDDO
3493+
3494+ END
3495+
3496+ SUBROUTINE SET_COLLIER_GLOBAL_CACHE(ONOFF)
3497+C
3498+C This routine is used by loop_matrix.f to turn on the global
3499+C cache of COLLIER when it the main SLOOP subroutine starts and
3500+C turn it off when it ends.
3501+C However several checks are performed to verify that it is safe
3502+C to turn it on and to reinitialize it if necessary.
3503+C
3504+C MODULES
3505+C
3506+ USE COLLIER
3507+ IMPLICIT NONE
3508+C
3509+C ARGUMENTS
3510+C
3511+ LOGICAL ONOFF
3512+C
3513+C LOCAL VARIABLES
3514+C
3515+ LOGICAL NEED_REINITIALIZATION
3516+ INTEGER N_CACHES
3517+C
3518+C GLOBAL VARIABLES
3519+C
3520+C
3521+C This common blocks saves the relevant ML parameters when
3522+C activating the
3523+C global cache of COLLIER so that we know when we must
3524+C reinitialize it.
3525+C COLLIER_CACHE_ACTIVE is set to -1 when it has never been turned
3526+C on yet and
3527+C to 1 for 'Active' and 0 for 'Inactive'.
3528+C The integer NCALLS_IN_CACHE saves how many calls the cache is
3529+C setup for, for each of the up to four caches.
3530+C When it is the first PS points, it is set to -1.
3531+ INTEGER COLLIER_CACHE_ACTIVE, NCALLS_IN_CACHE(4),
3532+ $ NCOLLIERCALLS(4)
3533+ DATA COLLIER_CACHE_ACTIVE/-1/
3534+ DATA NCALLS_IN_CACHE/-1,-1,-1,-1/
3535+ DATA NCOLLIERCALLS/0,0,0,0/
3536+C This is a flag to tell the COLLIER subroutine that it must init
3537+C the event when called.
3538+ LOGICAL MUST_INIT_EVENT
3539+ DATA MUST_INIT_EVENT/.TRUE./
3540+ COMMON/COLLIER_CACHE_STATUS/COLLIER_CACHE_ACTIVE,
3541+ $ NCALLS_IN_CACHE, NCOLLIERCALLS,MUST_INIT_EVENT
3542+
3543+ LOGICAL COLLIERUSEINTERNALSTABILITYTEST_BU
3544+ INTEGER USERHEL_BU, SQSO_TARGET_BU, COLLIERMODE_BU,CTMODERUN_BU
3545+ COMMON/COLLIER_CACHE_RELEVANT_PARAMS/USERHEL_BU,SQSO_TARGET_BU
3546+ $ ,COLLIERMODE_BU,CTMODERUN_BU,COLLIERUSEINTERNALSTABILITYTEST_BU
3547+
3548+C The common blocks below are to retrieve the necessary
3549+C information about
3550+C MadLoop running mode and store it in the sCOLLIER_CACHE_RELEVANT_
3551+C PARAMS common block.
3552+
3553+ INCLUDE 'MadLoopParams.inc'
3554+ INCLUDE 'unique_id.inc'
3555+ INCLUDE 'global_specs.inc'
3556+
3557+ LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT,
3558+ $ COLLIERINIT
3559+ COMMON/REDUCTIONCODEINIT/CTINIT, TIRINIT,GOLEMINIT,SAMURAIINIT
3560+ $ ,NINJAINIT, COLLIERINIT
3561+
3562+ LOGICAL CHECKPHASE
3563+ LOGICAL HELDOUBLECHECKED
3564+ COMMON/INIT/CHECKPHASE, HELDOUBLECHECKED
3565+
3566+ INTEGER USERHEL
3567+ COMMON/USERCHOICE/USERHEL
3568+
3569+ INTEGER SQSO_TARGET
3570+ COMMON/SOCHOICE/SQSO_TARGET
3571+
3572+C
3573+C BEGIN CODE
3574+C
3575+
3576+ IF (COLLIERUSECACHEFORPOLES) THEN
3577+ N_CACHES = 4
3578+ ELSE
3579+ N_CACHES =1
3580+ ENDIF
3581+
3582+C Do nothing if COLLIER still has to be initialized or if global
3583+C caches are disabled
3584+ IF(COLLIERINIT.OR.COLLIERGLOBALCACHE.EQ.0) THEN
3585+ RETURN
3586+ ENDIF
3587+
3588+C Never activate anything in the checkphase
3589+ IF (ONOFF.AND.CHECKPHASE) THEN
3590+ RETURN
3591+ ENDIF
3592+
3593+C Handle the request of turning off the caching
3594+ IF (.NOT.ONOFF) THEN
3595+ IF (COLLIER_CACHE_ACTIVE.EQ.1) THEN
3596+ CALL SWITCHOFFCACHE_CLL((UNIQUE_ID-1)*4+1)
3597+ COLLIER_CACHE_ACTIVE = 0
3598+ ENDIF
3599+C If we were asked to turn the cache off but it was already so,
3600+C then do nothing
3601+ RETURN
3602+ ENDIF
3603+
3604+C Handle the request of turning on the caching
3605+
3606+C If asked to activate it but already active, then do nothing
3607+ IF (ONOFF.AND.COLLIER_CACHE_ACTIVE.EQ.1) THEN
3608+ RETURN
3609+ ENDIF
3610+
3611+C We are now in the position where we are asked to activate the
3612+C global cache but it was *not* already active.
3613+
3614+C If we activate it for the first time, make sure to store the
3615+C value of the relevant parameters, activate and return.
3616+ IF (COLLIER_CACHE_ACTIVE.EQ.-1) THEN
3617+ USERHEL_BU = USERHEL
3618+ SQSO_TARGET_BU = SQSO_TARGET
3619+ COLLIERMODE_BU = COLLIERMODE
3620+ COLLIERUSEINTERNALSTABILITYTEST_BU = COLLIERUSEINTERNALSTABILIT
3621+ $YTEST
3622+ CTMODERUN_BU = CTMODERUN
3623+ CALL SWITCHONCACHE_CLL((UNIQUE_ID-1)*4+1)
3624+ COLLIER_CACHE_ACTIVE = 1
3625+ RETURN
3626+ ENDIF
3627+
3628+C Now perform sanity check before the activation to decide if we
3629+C need to reinitialize the cache system first.
3630+ NEED_REINITIALIZATION = .FALSE.
3631+
3632+ IF (SQSO_TARGET.NE.SQSO_TARGET_BU) THEN
3633+ NEED_REINITIALIZATION = .TRUE.
3634+ ENDIF
3635+
3636+ IF (COLLIERMODE.NE.COLLIERMODE_BU) THEN
3637+ NEED_REINITIALIZATION = .TRUE.
3638+ ENDIF
3639+
3640+ IF (COLLIERUSEINTERNALSTABILITYTEST.NEQV.COLLIERUSEINTERNALSTABIL
3641+ $ITYTEST_BU) THEN
3642+ NEED_REINITIALIZATION = .TRUE.
3643+ ENDIF
3644+
3645+ IF (CTMODERUN_BU.NE.CTMODERUN.AND.(.NOT.COLLIERUSEINTERNALSTABILI
3646+ $TYTEST)) THEN
3647+ NEED_REINITIALIZATION = .TRUE.
3648+ ENDIF
3649+
3650+C When doing amplitude reduction the parameter USERHEL does not
3651+C impact the number/order of COLLIER calls
3652+C except if the LoopFilter is ON which really shouldn't be the
3653+C case anymore.
3654+ IF(USELOOPFILTER.AND.(USERHEL.NE.USERHEL_BU)) THEN
3655+ NEED_REINITIALIZATION = .TRUE.
3656+ ENDIF
3657+
3658+ IF(NEED_REINITIALIZATION) THEN
3659+C Log the event because if it happens a lot of time and floods
3660+C the screen, the user must see it
3661+C and either change its usage of MadLoop or turnoff COLLIER cache
3662+ WRITE(*,*) 'INFO: MadLoop detected that the global cache of'
3663+ $ //' COLLIER had to be reset because of a change in your use'
3664+ $ //' of MadLoop. This should not happend for each event.'
3665+ USERHEL_BU = USERHEL
3666+ SQSO_TARGET_BU = SQSO_TARGET
3667+ COLLIERMODE_BU = COLLIERMODE
3668+ COLLIERUSEINTERNALSTABILITYTEST_BU = COLLIERUSEINTERNALSTABILIT
3669+ $YTEST
3670+ CTMODERUN_BU = CTMODERUN
3671+ IF (COLLIERGLOBALCACHE.EQ.-1) THEN
3672+ CALL INITCACHESYSTEM_CLL(N_CACHES*NPROCS,MAXNEXTERNAL)
3673+ ELSE
3674+ CALL INITCACHESYSTEM_CLL(N_CACHES*NPROCS,COLLIERGLOBALCACHE)
3675+ ENDIF
3676+ NCOLLIERCALLS(:) = 0
3677+ NCALLS_IN_CACHE(:) = -1
3678+C Make sure all caches are switched off at first.
3679+ CALL SWITCHOFFCACHESYSTEM_CLL()
3680+ ENDIF
3681+
3682+C Now we can finally activate the cache
3683+ CALL SWITCHONCACHE_CLL((UNIQUE_ID-1)*4+1)
3684+ COLLIER_CACHE_ACTIVE = 1
3685+
3686+ END
3687+
3688
3689=== modified file 'tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%CT_interface.f'
3690--- tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%CT_interface.f 2016-05-06 09:08:11 +0000
3691+++ tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%CT_interface.f 2016-07-02 20:37:49 +0000
3692@@ -39,8 +39,9 @@
3693 COMPLEX*16 R1, ACC
3694 INTEGER I, J, K
3695 LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT
3696+ $ ,COLLIERINIT
3697 COMMON/REDUCTIONCODEINIT/CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT
3698- $ ,NINJAINIT
3699+ $ ,NINJAINIT,COLLIERINIT
3700 C
3701 C EXTERNAL FUNCTIONS
3702 C
3703@@ -392,8 +393,9 @@
3704 INCLUDE 'coupl.inc'
3705
3706 LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT
3707+ $ ,COLLIERINIT
3708 COMMON/REDUCTIONCODEINIT/CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT
3709- $ ,NINJAINIT
3710+ $ ,NINJAINIT,COLLIERINIT
3711
3712 REAL*8 LSCALE
3713 INTEGER CTMODE
3714@@ -542,267 +544,9 @@
3715 END
3716
3717 C
3718-C Quadruple precision version of loop_ninja
3719-C
3720- SUBROUTINE MP_NINJA_LOOP(NLOOPLINE,PL,M2L,RANK,RES,STABLE)
3721-C
3722-C Module used
3723-C
3724- USE MNINJA
3725-C
3726-C Generated by MadGraph5_aMC@NLO v. %(version)s, %(date)s
3727-C By the MadGraph5_aMC@NLO Development Team
3728-C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch
3729-C
3730-C Interface between MG5 and Ninja.
3731-C
3732-C Process: d~ u > w+ WEIGHTED<=2 QED<=1 [ all = QCD ]
3733-C Process: s~ c > w+ WEIGHTED<=2 QED<=1 [ all = QCD ]
3734-C
3735-C
3736-C CONSTANTS
3737-C
3738- INTEGER NEXTERNAL
3739- PARAMETER (NEXTERNAL=3)
3740- LOGICAL CHECKPCONSERVATION
3741- PARAMETER (CHECKPCONSERVATION=.TRUE.)
3742- REAL*8 NORMALIZATION
3743- PARAMETER (NORMALIZATION = 1.D0/(16.D0*3.14159265358979323846D0*
3744- $ *2))
3745- INTEGER NLOOPGROUPS
3746- PARAMETER (NLOOPGROUPS=1)
3747-C These are constants related to the split orders
3748- INTEGER NSQUAREDSO
3749- PARAMETER (NSQUAREDSO=1)
3750- INCLUDE 'loop_max_coefs.inc'
3751-C
3752-C ARGUMENTS
3753-C
3754- INTEGER NLOOPLINE, RANK
3755- REAL*16 PL(0:3,NLOOPLINE)
3756- COMPLEX*16 M2L(NLOOPLINE)
3757- COMPLEX*16 RES(3)
3758- LOGICAL STABLE
3759-C
3760-C LOCAL VARIABLES
3761-C
3762- REAL*16 NINJA_SCALE
3763- REAL*16 P_TMP(0:3,0:NLOOPLINE-1), ABSP_TMP(0:3)
3764- REAL*8 REF_P
3765- REAL(KI_QNIN) MP_P_NINJA(0:3,NLOOPLINE)
3766- REAL*16 MP_P(0:3,NLOOPLINE)
3767- REAL*16 P_S_MAT(NLOOPLINE,0:3)
3768- COMPLEX*32 MP_M2L(NLOOPLINE)
3769- COMPLEX(KI_QNIN) MP_M2L_NINJA(NLOOPLINE)
3770- COMPLEX(KI_QNIN) NINJA_RES(0:2)
3771- COMPLEX(KI_QNIN) NINJA_R1
3772- COMPLEX*16 R1
3773- COMPLEX*16 DP_RES(0:2)
3774- INTEGER NINJA_STATUS
3775- INTEGER I, J, K
3776- REAL*16 PDEN_DUMMY(0:3,NLOOPLINE-1)
3777-
3778- COMPLEX*32 MP_S_MAT(NLOOPLINE,NLOOPLINE)
3779- REAL*16 MP_REAL_S_MAT(NLOOPLINE,NLOOPLINE)
3780- REAL(KI_QNIN) MP_REAL_S_MAT_NINJA(NLOOPLINE,NLOOPLINE)
3781-
3782- INTEGER CURR_MAXCOEF
3783- COMPLEX*32, ALLOCATABLE :: MP_TENSORCOEFS(:)
3784- COMPLEX(KI_QNIN), ALLOCATABLE :: MP_NINJA_TENSORCOEFS(:)
3785-
3786-C
3787-C GLOBAL VARIABLES
3788-C
3789- INCLUDE 'coupl.inc'
3790-
3791- LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT
3792- COMMON/REDUCTIONCODEINIT/CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT
3793- $ ,NINJAINIT
3794-
3795- REAL*8 LSCALE
3796- INTEGER CTMODE
3797- COMMON/CT/LSCALE,CTMODE
3798-
3799- INTEGER ID,SQSOINDEX,R
3800- COMMON/LOOP/ID,SQSOINDEX,R
3801- COMPLEX*32 MP_LOOPCOEFS(0:LOOPMAXCOEFS-1,NSQUAREDSO,NLOOPGROUPS)
3802- COMMON/MP_LCOEFS/MP_LOOPCOEFS
3803-
3804- LOGICAL FPE_IN_DP_REDUCTION, FPE_IN_QP_REDUCTION
3805- COMMON/FPE_IN_REDUCTION/FPE_IN_DP_REDUCTION, FPE_IN_QP_REDUCTION
3806-
3807-C ----------
3808-C BEGIN CODE
3809-C ----------
3810-
3811-C Cast the masses in complex quadruple precision
3812- DO I=1,NLOOPLINE
3813- MP_M2L(I) = CMPLX(M2L(I),KIND=16)
3814- ENDDO
3815-
3816-C For the direction test, we must switch the direction in which
3817-C the loop is read for CTMode equal to 2 or 4.
3818- CALL MP_SWITCH_ORDER(CTMODE,NLOOPLINE,PL,PDEN_DUMMY,MP_M2L)
3819-
3820-C The CT initialization is also performed here if not done already
3821-C because it calls MPINIT of OneLOop which is necessary on some
3822-C system
3823- IF (CTINIT) THEN
3824- CTINIT=.FALSE.
3825- CALL INITCT()
3826- ENDIF
3827-
3828-C INITIALIZE NINJA IF NEEDED
3829- IF (NINJAINIT) THEN
3830- NINJAINIT=.FALSE.
3831- CALL INITNINJA()
3832- ENDIF
3833-
3834-C CONVERT THE MOMENTA FLOWING IN THE LOOP LINES TO NINJA
3835-C CONVENTIONS
3836- DO I=0,3
3837- ABSP_TMP(I)=0.E0+0_16
3838- DO J=0,(NLOOPLINE-1)
3839- P_TMP(I,J)=0.E0+0_16
3840- ENDDO
3841- ENDDO
3842- DO I=0,3
3843- DO J=1,NLOOPLINE
3844- P_TMP(I,0)=P_TMP(I,0)+PL(I,J)
3845- ABSP_TMP(I)=ABSP_TMP(I)+ABS(PL(I,J))
3846- ENDDO
3847- ENDDO
3848- REF_P = MAX(ABSP_TMP(0), ABSP_TMP(1),ABSP_TMP(2),ABSP_TMP(3))
3849- DO I=0,3
3850- ABSP_TMP(I) = MAX(REF_P*1E-6, ABSP_TMP(I))
3851- ENDDO
3852- IF (CHECKPCONSERVATION.AND.REF_P.GT.1.E-8_16) THEN
3853- IF ((P_TMP(0,0)/ABSP_TMP(0)).GT.1.E-6_16) THEN
3854- WRITE(*,*) 'energy is not conserved (flag:CT968)'
3855- $ ,DBLE(P_TMP(0,0))
3856- STOP 'energy is not conserved (flag:CT968)'
3857- ELSEIF ((P_TMP(1,0)/ABSP_TMP(1)).GT.1.E-6_16) THEN
3858- WRITE(*,*) 'px is not conserved (flag:CT968)',DBLE(P_TMP(1,0)
3859- $ )
3860- STOP 'px is not conserved (flag:CT968)'
3861- ELSEIF ((P_TMP(2,0)/ABSP_TMP(2)).GT.1.E-6_16) THEN
3862- WRITE(*,*) 'py is not conserved (flag:CT968)',DBLE(P_TMP(2,0)
3863- $ )
3864- STOP 'py is not conserved (flag:CT968)'
3865- ELSEIF ((P_TMP(3,0)/ABSP_TMP(3)).GT.1.E-6_16) THEN
3866- WRITE(*,*) 'pz is not conserved (flag:CT968)',DBLE(P_TMP(3,0)
3867- $ )
3868- STOP 'pz is not conserved (flag:CT968)'
3869- ENDIF
3870- ENDIF
3871- DO I=0,3
3872- DO J=1,(NLOOPLINE-1)
3873- DO K=1,J
3874- P_TMP(I,J)=P_TMP(I,J)+PL(I,K)
3875- ENDDO
3876- ENDDO
3877- ENDDO
3878-C In Ninja, the loop line index starts at 1
3879- DO I=0,NLOOPLINE-1
3880- MP_P(0,I+1) = P_TMP(0,I)
3881- MP_P(1,I+1) = P_TMP(1,I)
3882- MP_P(2,I+1) = P_TMP(2,I)
3883- MP_P(3,I+1) = P_TMP(3,I)
3884- ENDDO
3885-
3886-C Number of coefficients for the current rank
3887- CURR_MAXCOEF = 0
3888- DO I=0,RANK
3889- CURR_MAXCOEF=CURR_MAXCOEF+(3+I)*(2+I)*(1+I)/6
3890- ENDDO
3891-C Now write the tensor coefficients for Ninja
3892-C It should never be allocated at this stage
3893- IF (.NOT. ALLOCATED(MP_TENSORCOEFS)) THEN
3894- ALLOCATE(MP_TENSORCOEFS(0:CURR_MAXCOEF-1))
3895- ENDIF
3896- IF (.NOT. ALLOCATED(MP_NINJA_TENSORCOEFS)) THEN
3897- ALLOCATE(MP_NINJA_TENSORCOEFS(0:CURR_MAXCOEF-1))
3898- ENDIF
3899- DO I=0,CURR_MAXCOEF-1
3900- MP_TENSORCOEFS(I) = MP_LOOPCOEFS(I,SQSOINDEX,ID)
3901- ENDDO
3902-C The loop momentum is in fact q_loop -> -q_loop, so that the
3903-C coefficients must be changed accordingly
3904- CALL MP_INVERT_MOMENTA_IN_POLYNOMIAL(CURR_MAXCOEF,MP_TENSORCOEFS)
3905-
3906-C Compute the kinematic matrix
3907- DO J=1,NLOOPLINE
3908- DO I=0,3
3909- P_S_MAT(J,I)=MP_P(I,J)
3910- ENDDO
3911- ENDDO
3912- CALL MP_BUILD_KINEMATIC_MATRIX(NLOOPLINE,P_S_MAT,MP_M2L,MP_S_MAT)
3913-
3914- DO I=1,NLOOPLINE
3915- DO J=1,NLOOPLINE
3916- MP_REAL_S_MAT(I,J) = REAL(MP_S_MAT(I,J)+MP_M2L(I)+MP_M2L(J)
3917- $ ,KIND=16)
3918- ENDDO
3919- ENDDO
3920-
3921-C Now typecast to Ninja's quadruple precision format
3922- DO I=0,CURR_MAXCOEF-1
3923- MP_NINJA_TENSORCOEFS(I)=CMPLX(MP_TENSORCOEFS(I),KIND=KI_QNIN)
3924- ENDDO
3925- DO I=1,NLOOPLINE
3926- DO J=1,NLOOPLINE
3927- MP_REAL_S_MAT_NINJA(I,J) = REAL(MP_REAL_S_MAT(I,J)
3928- $ ,KIND=KI_QNIN)
3929- ENDDO
3930- ENDDO
3931- DO I=1,NLOOPLINE
3932- MP_M2L_NINJA(I)=CMPLX(MP_M2L(I),KIND=KI_QNIN)
3933- ENDDO
3934- DO I=1,NLOOPLINE
3935- MP_P_NINJA(0,I) = REAL(MP_P(0,I),KIND=KI_QNIN)
3936- MP_P_NINJA(1,I) = REAL(MP_P(1,I),KIND=KI_QNIN)
3937- MP_P_NINJA(2,I) = REAL(MP_P(2,I),KIND=KI_QNIN)
3938- MP_P_NINJA(3,I) = REAL(MP_P(3,I),KIND=KI_QNIN)
3939- ENDDO
3940- NINJA_SCALE = REAL(MU_R**2,KIND=KI_QNIN)
3941-
3942-
3943-C Below is the call specifying the kinematic matrix
3944- CALL NINJA_TENSOR_EVALUATE(MP_NINJA_TENSORCOEFS,NLOOPLINE,RANK
3945- $ ,MP_REAL_S_MAT_NINJA,MP_P_NINJA,MP_M2L_NINJA,NINJA_SCALE
3946- $ ,NINJA_RES,NINJA_R1,NINJA_STATUS)
3947-C Below is the call without specification of the kinematic matrix
3948-C call ninja_tensor_evaluate(MP_NINJA_TENSORCOEFS,NLOOPLINE,RANK,MP
3949-C _P_NINJA,MP_M2L_NINJA,NINJA_SCALE,NINJA_RES,NINJA_R1,NINJA_STATUS)
3950-C
3951-
3952-C If a floating point exception was found in Ninja (e.g. exactly
3953-C zero gram. det.)
3954-C Then warn loop_matrix.f so that it will flag this kinematic
3955-C point as unstable no matter what.
3956- IF (NINJA_STATUS.EQ.NINJA_UNSTABLE_KINEMATICS) THEN
3957- FPE_IN_QP_REDUCTION = .TRUE.
3958- ENDIF
3959-
3960-C Typecast the result back
3961- R1 = DCMPLX(R1)
3962- DO I=0,2
3963- DP_RES(I)=DCMPLX(NINJA_RES(I))
3964- ENDDO
3965-
3966-C Make sure to deallocate the tensor of coefficients
3967- IF (ALLOCATED(MP_TENSORCOEFS)) THEN
3968- DEALLOCATE(MP_TENSORCOEFS)
3969- ENDIF
3970- IF (ALLOCATED(MP_NINJA_TENSORCOEFS)) THEN
3971- DEALLOCATE(MP_NINJA_TENSORCOEFS)
3972- ENDIF
3973-
3974- RES(1)=NORMALIZATION*2.0D0*DBLE(DP_RES(0))
3975- RES(2)=NORMALIZATION*2.0D0*DBLE(DP_RES(1))
3976- RES(3)=NORMALIZATION*2.0D0*DBLE(DP_RES(2))
3977-C WRITE(*,*) 'QP Ninja: Loop ID',ID,' =',RES(1),RES(2),RES(3)
3978- END
3979+C The Ninja version installed does not support quadruple precision
3980+C so that the corresponding subroutines are not output.
3981+C
3982
3983 SUBROUTINE INITNINJA()
3984 C
3985@@ -975,8 +719,10 @@
3986 CALL NINJA_LOOP(NLOOPLINE,PL,M2L,RANK,LOOPRES(1
3987 $ ,SQUAREDSOINDEX,LOOPNUM),S(SQUAREDSOINDEX,LOOPNUM))
3988 ELSE
3989- CALL MP_NINJA_LOOP(NLOOPLINE,MP_PL,M2L,RANK,LOOPRES(1
3990- $ ,SQUAREDSOINDEX,LOOPNUM),S(SQUAREDSOINDEX,LOOPNUM))
3991+ WRITE(*,*) 'ERROR: Ninja should not be called in quadruple'
3992+ $ //' precision since the installed version considered does'
3993+ $ //' not support it.'
3994+ STOP 9
3995 ENDIF
3996 ELSE
3997 C Tensor Integral Reduction is used
3998
3999=== modified file 'tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%GOLEM_interface.f'
4000--- tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%GOLEM_interface.f 2016-03-31 10:53:12 +0000
4001+++ tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%GOLEM_interface.f 2016-07-02 20:37:49 +0000
4002@@ -108,8 +108,9 @@
4003 COMMON/LOOP/ID,SQSOINDEX,R
4004
4005 LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT
4006+ $ ,COLLIERINIT
4007 COMMON/REDUCTIONCODEINIT/CTINIT, TIRINIT,GOLEMINIT,SAMURAIINIT
4008- $ ,NINJAINIT
4009+ $ ,NINJAINIT,COLLIERINIT
4010
4011 INTEGER NLOOPGROUPS
4012 PARAMETER (NLOOPGROUPS=1)
4013
4014=== modified file 'tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%TIR_interface.f'
4015--- tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%TIR_interface.f 2016-05-06 09:08:11 +0000
4016+++ tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%TIR_interface.f 2016-07-02 20:37:49 +0000
4017@@ -45,15 +45,17 @@
4018 INTEGER I, J, K
4019 INTEGER NLOOPCOEFS
4020 LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT
4021+ $ ,COLLIERINIT
4022 COMMON/REDUCTIONCODEINIT/CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT
4023- $ ,NINJAINIT
4024+ $ ,NINJAINIT,COLLIERINIT
4025
4026 C This variable will be used to detect changes in the TIR library
4027 C used so as to force the reset of the TIR filter.
4028 INTEGER LAST_LIB_USED
4029 DATA LAST_LIB_USED/-1/
4030
4031- COMPLEX*16 TIRCOEFS(0:LOOPMAXCOEFS-1,3)
4032+ COMPLEX*16 TIRCOEFS(0:LOOPMAXCOEFS-1,3),TIRCOEFSERRORS(0:LOOPMAXC
4033+ $OEFS-1,3)
4034 COMPLEX*16 PJCOEFS(0:LOOPMAXCOEFS-1,3)
4035 C
4036 C EXTERNAL FUNCTIONS
4037@@ -67,7 +69,6 @@
4038 REAL*8 LSCALE
4039 COMMON/CT/LSCALE,CTMODE
4040
4041-C The variables below are just for monitoring purposes.
4042 INTEGER ID,SQSOINDEX,R
4043 COMMON/LOOP/ID,SQSOINDEX,R
4044
4045@@ -184,6 +185,21 @@
4046 $ ,M2L,MU_R,PJCOEFS,STABLE)
4047 C CONVERT TO MADLOOP CONVENTION
4048 CALL CONVERT_IREGI_COEFFS(RANK,PJCOEFS,TIRCOEFS)
4049+ CASE(7)
4050+C COLLIER
4051+ CALL COLLIERLOOP(CTMODE,NLOOPLINE,RANK,PL,PDEN,M2L,TIRCOEFS
4052+ $ ,TIRCOEFSERRORS)
4053+C Shift the TIR coefficients by the corresponding COLLIER error if
4054+C in CTMODE 2.
4055+ IF (COLLIERUSEINTERNALSTABILITYTEST.AND.CTMODE.EQ.2) THEN
4056+C We add here the numerical inaccuracies linearly to be
4057+C conservative
4058+ DO I=1,3
4059+ DO J=0,NLOOPCOEFS-1
4060+ TIRCOEFS(J,I)=TIRCOEFS(J,I)+TIRCOEFSERRORS(J,I)
4061+ ENDDO
4062+ ENDDO
4063+ ENDIF
4064 END SELECT
4065 DO I=1,3
4066 RES(I)=(0.0D0,0.0D0)
4067@@ -198,6 +214,8 @@
4068 C WRITE(*,*) 'PJFry: Loop ID',ID,' =',RES(1),RES(2),RES(3)
4069 C ELSEIF(MLReductionLib(I_LIB).EQ.3) THEN
4070 C WRITE(*,*) 'Iregi: Loop ID',ID,' =',RES(1),RES(2),RES(3)
4071+C ELSEIF(MLReductionLib(I_LIB).EQ.7) THEN
4072+C WRITE(*,*) 'COLLIER: Loop ID',ID,' =',RES(1),RES(2),RES(3)
4073 C ENDIF
4074 END
4075
4076@@ -322,8 +340,9 @@
4077 C
4078 INCLUDE 'MadLoopParams.inc'
4079 LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT
4080+ $ ,COLLIERINIT
4081 COMMON/REDUCTIONCODEINIT/CTINIT,TIRINIT,GOLEMINIT,SAMURAIINIT
4082- $ ,NINJAINIT
4083+ $ ,NINJAINIT,COLLIERINIT
4084
4085 C ----------
4086 C BEGIN CODE
4087@@ -366,9 +385,9 @@
4088 C CONSTANTS
4089 C
4090 INTEGER NLOOPLIB
4091- PARAMETER (NLOOPLIB=4)
4092+ PARAMETER (NLOOPLIB=7)
4093 INTEGER QP_NLOOPLIB
4094- PARAMETER (QP_NLOOPLIB=2)
4095+ PARAMETER (QP_NLOOPLIB=1)
4096 INTEGER NLOOPGROUPS
4097 PARAMETER (NLOOPGROUPS=1)
4098 C
4099
4100=== modified file 'tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%check_sa.f'
4101--- tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%check_sa.f 2016-03-31 10:53:12 +0000
4102+++ tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%check_sa.f 2016-07-02 20:37:49 +0000
4103@@ -294,6 +294,8 @@
4104 $ //' an unknown reason.'
4105 ENDIF
4106 ENDIF
4107+ WRITE (*,'(1x,a23,3x,i3)') 'MadLoop return code ='
4108+ $ ,RETURNCODE
4109 WRITE (*,*) '---------------------------------'
4110 IF (NBORNCHOSEN.EQ.0) THEN
4111 WRITE (*,*) 'No Born contribution satisfied the squared'
4112
4113=== modified file 'tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%loop_matrix.f'
4114--- tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%loop_matrix.f 2016-05-06 09:08:11 +0000
4115+++ tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%loop_matrix.f 2016-07-02 20:37:49 +0000
4116@@ -77,13 +77,13 @@
4117 PARAMETER (NSQUAREDSOP1=NSQUAREDSO+1)
4118 C The total number of loop reduction libraries
4119 C At present, there are only CutTools,PJFry++,IREGI,Golem95,Samurai
4120-C and Ninja
4121+C , Ninja and COLLIER
4122 INTEGER NLOOPLIB
4123- PARAMETER (NLOOPLIB=6)
4124+ PARAMETER (NLOOPLIB=7)
4125 C Only CutTools or possibly Ninja (if installed with qp support)
4126 C provide QP
4127 INTEGER QP_NLOOPLIB
4128- PARAMETER (QP_NLOOPLIB=2)
4129+ PARAMETER (QP_NLOOPLIB=1)
4130 INTEGER MAXSTABILITYLENGTH
4131 DATA MAXSTABILITYLENGTH/20/
4132 COMMON/STABILITY_TESTS/MAXSTABILITYLENGTH
4133@@ -207,6 +207,7 @@
4134 C GLOBAL VARIABLES
4135 C
4136 INCLUDE 'process_info.inc'
4137+ INCLUDE 'unique_id.inc'
4138 INCLUDE 'coupl.inc'
4139 INCLUDE 'mp_coupl.inc'
4140 INCLUDE 'MadLoopParams.inc'
4141@@ -236,23 +237,23 @@
4142 COMMON/MP_DONE/MP_DONE
4143 C A FLAG TO DENOTE WHETHER THE CORRESPONDING LOOPLIBS ARE
4144 C AVAILABLE OR NOT
4145- LOGICAL LOOPLIBS_AVAILABLE(6)
4146+ LOGICAL LOOPLIBS_AVAILABLE(NLOOPLIB)
4147 DATA LOOPLIBS_AVAILABLE/.TRUE.,.TRUE.,.TRUE.,.TRUE.,.FALSE.
4148- $ ,.TRUE./
4149+ $ ,.TRUE.,.TRUE./
4150 COMMON/LOOPLIBS_AV/ LOOPLIBS_AVAILABLE
4151 C A FLAG TO DENOTE WHETHER THE CORRESPONDING DIRECTION TESTS
4152 C AVAILABLE OR NOT IN THE LOOPLIBS
4153- LOGICAL LOOPLIBS_DIRECTEST(6)
4154+ LOGICAL LOOPLIBS_DIRECTEST(NLOOPLIB)
4155 DATA LOOPLIBS_DIRECTEST /.TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE.
4156- $ ,.TRUE./
4157+ $ ,.TRUE.,.TRUE./
4158 C Specifying for which reduction tool quadruple precision is
4159 C available.
4160 C The index 0 is dummy and simply means that the corresponding
4161 C loop_library is not available
4162 C in which case neither is its quadruple precision version.
4163- LOGICAL LOOPLIBS_QPAVAILABLE(0:6)
4164+ LOGICAL LOOPLIBS_QPAVAILABLE(0:7)
4165 DATA LOOPLIBS_QPAVAILABLE /.FALSE.,.TRUE.,.FALSE.,.FALSE.
4166- $ ,.FALSE.,.FALSE.,.TRUE./
4167+ $ ,.FALSE.,.FALSE.,.FALSE.,.FALSE./
4168 C PS CAN POSSIBILY BE PASSED THROUGH IMPROVE_PS BUT IS NOT
4169 C MODIFIED FOR THE PURPOSE OF THE STABILITY TEST
4170 C EVEN THOUGH THEY ARE PUT IN COMMON BLOCK, FOR NOW THEY ARE NOT
4171@@ -333,7 +334,6 @@
4172 INTEGER I_LIB
4173 DATA I_LIB/1/
4174 COMMON/I_LIB/I_LIB
4175-C UTIL NOW, ONLY CUTTOOLS PROVIDE QP
4176 LOGICAL QP_TOOLS_AVAILABLE
4177 DATA QP_TOOLS_AVAILABLE/.FALSE./
4178 INTEGER INDEX_QP_TOOLS(QP_NLOOPLIB+1)
4179@@ -392,6 +392,21 @@
4180 CHARACTER(512) MLPATH
4181 COMMON/MLPATH/MLPATH
4182
4183+C This is just so that if the user disabled the computation of
4184+C poles by COLLIER
4185+C using the MadLoop subroutine, we don't overwrite his choice when
4186+C reading the parameters
4187+ LOGICAL FORCED_CHOICE_OF_COLLIER_UV_POLE_COMPUTATION,
4188+ $ FORCED_CHOICE_OF_COLLIER_IR_POLE_COMPUTATION
4189+ LOGICAL COLLIER_UV_POLE_COMPUTATION_CHOICE, COLLIER_IR_POLE_COMPU
4190+ $TATION_CHOICE
4191+ DATA FORCED_CHOICE_OF_COLLIER_UV_POLE_COMPUTATION
4192+ $ ,FORCED_CHOICE_OF_COLLIER_IR_POLE_COMPUTATION/.FALSE.,.FALSE./
4193+ COMMON/COLLIERPOLESFORCEDCHOICE/FORCED_CHOICE_OF_COLLIER_UV_POLE_
4194+ $COMPUTATION, FORCED_CHOICE_OF_COLLIER_IR_POLE_COMPUTATION
4195+ $ ,COLLIER_UV_POLE_COMPUTATION_CHOICE,COLLIER_IR_POLE_COMPUTATION_
4196+ $CHOICE
4197+
4198 C This variable controls the general initialization which is
4199 C *common* between all MadLoop SubProcesses.
4200 C For example setting the MadLoopPath or reading the ML runtime
4201@@ -413,6 +428,7 @@
4202 LOGICAL FPE_IN_DP_REDUCTION, FPE_IN_QP_REDUCTION
4203 DATA FPE_IN_DP_REDUCTION, FPE_IN_QP_REDUCTION/.FALSE.,.FALSE./
4204 COMMON/FPE_IN_REDUCTION/FPE_IN_DP_REDUCTION, FPE_IN_QP_REDUCTION
4205+
4206 C ----------
4207 C BEGIN CODE
4208 C ----------
4209@@ -424,6 +440,12 @@
4210 CALL SETMADLOOPPATH(TMP)
4211 CALL JOINPATH(MLPATH,PARAMFNAME,PARAMFN)
4212 CALL MADLOOPPARAMREADER(PARAMFN,.TRUE.)
4213+ IF (FORCED_CHOICE_OF_COLLIER_UV_POLE_COMPUTATION) THEN
4214+ COLLIERCOMPUTEUVPOLES = COLLIER_UV_POLE_COMPUTATION_CHOICE
4215+ ENDIF
4216+ IF (FORCED_CHOICE_OF_COLLIER_IR_POLE_COMPUTATION) THEN
4217+ COLLIERCOMPUTEIRPOLES = COLLIER_IR_POLE_COMPUTATION_CHOICE
4218+ ENDIF
4219 IF (FORBID_HEL_DOUBLECHECK) THEN
4220 DOUBLECHECKHELICITYFILTER = .FALSE.
4221 ENDIF
4222@@ -766,6 +788,9 @@
4223 CALL CLEAR_CACHES()
4224 ENDIF
4225
4226+C Now make sure to turn on the global COLLIER cache if applicable
4227+ CALL SET_COLLIER_GLOBAL_CACHE(.TRUE.)
4228+
4229 IF (IMPROVEPSPOINT.GE.0) THEN
4230 C Make the input PS more precise (exact onshell and
4231 C energy-momentum conservation)
4232@@ -1570,12 +1595,22 @@
4233 IF (AUTOMATIC_CACHE_CLEARING) THEN
4234 CALL CLEAR_CACHES()
4235 ENDIF
4236+
4237+C Now make sure to turn off the global COLLIER cache if applicable
4238+ CALL SET_COLLIER_GLOBAL_CACHE(.FALSE.)
4239+
4240 END
4241
4242 SUBROUTINE CLEAR_CACHES()
4243-C Clears all the caches used at some point in MadLoop
4244+C
4245+C This routine can be called directly from the user if
4246+C AUTOMATIC_CACHE_CLEARING is set to False. It must then be called
4247+C after
4248+C ech event
4249+C
4250 CALL CLEAR_TIR_CACHE()
4251 CALL NINJA_CLEAR_INTEGRAL_CACHE()
4252+ CALL CLEAR_COLLIER_CACHE()
4253 END
4254
4255 C --=========================================--
4256@@ -1716,6 +1751,13 @@
4257 REAL*8 ACCURACIES(3)
4258 REAL*8 LIST(MAXSTABILITYLENGTH)
4259
4260+C
4261+C GLOBAL VARIABLES
4262+C
4263+ INTEGER I_LIB
4264+ COMMON/I_LIB/I_LIB
4265+ INCLUDE 'MadLoopParams.inc'
4266+
4267 C ----------
4268 C BEGIN CODE
4269 C ----------
4270@@ -1765,6 +1807,16 @@
4271 ACC(K) = ACC(K) / ( ABS(AVG) / 3.0D0)
4272 ENDIF
4273
4274+C When using COLLIER with the internal stability test, the first
4275+C evaluation is typically more reliable so we do not want to
4276+C use the average but rather the first evaluation.
4277+ IF (MLREDUCTIONLIB(I_LIB).EQ.7.AND.COLLIERUSEINTERNALSTABILITYT
4278+ $EST) THEN
4279+ DO I=1,3
4280+ ESTIMATE(I,K) = FULLLIST(I,K,1)
4281+ ENDDO
4282+ ENDIF
4283+
4284 ENDDO
4285
4286 END
4287@@ -2119,6 +2171,60 @@
4288 C Definition of additional access routines
4289 C --=========================================--
4290
4291+ SUBROUTINE COLLIER_COMPUTE_UV_POLES(ONOFF)
4292+C
4293+C This function can be called by the MadLoop user so as to chose
4294+C to have COLLIER
4295+C compute the UV pole or not (it costs more time).
4296+C
4297+ LOGICAL ONOFF
4298+
4299+ INCLUDE 'MadLoopParams.inc'
4300+
4301+ LOGICAL FORCED_CHOICE_OF_COLLIER_UV_POLE_COMPUTATION,
4302+ $ FORCED_CHOICE_OF_COLLIER_IR_POLE_COMPUTATION
4303+ LOGICAL COLLIER_UV_POLE_COMPUTATION_CHOICE, COLLIER_IR_POLE_COMPU
4304+ $TATION_CHOICE
4305+ COMMON/COLLIERPOLESFORCEDCHOICE/FORCED_CHOICE_OF_COLLIER_UV_POLE_
4306+ $COMPUTATION, FORCED_CHOICE_OF_COLLIER_IR_POLE_COMPUTATION
4307+ $ ,COLLIER_UV_POLE_COMPUTATION_CHOICE,COLLIER_IR_POLE_COMPUTATION_
4308+ $CHOICE
4309+
4310+ COLLIERCOMPUTEUVPOLES = ONOFF
4311+C This is just so that if we read the param again, we don't
4312+C overwrite the choice made here
4313+ FORCED_CHOICE_OF_COLLIER_UV_POLE_COMPUTATION = .TRUE.
4314+ COLLIER_UV_POLE_COMPUTATION_CHOICE = ONOFF
4315+
4316+ END SUBROUTINE
4317+
4318+ SUBROUTINE COLLIER_COMPUTE_IR_POLES(ONOFF)
4319+C
4320+C This function can be called by the MadLoop user so as to chose
4321+C to have COLLIER
4322+C compute the IR pole or not (it costs more time).
4323+C
4324+ LOGICAL ONOFF
4325+
4326+ INCLUDE 'MadLoopParams.inc'
4327+
4328+ LOGICAL FORCED_CHOICE_OF_COLLIER_UV_POLE_COMPUTATION,
4329+ $ FORCED_CHOICE_OF_COLLIER_IR_POLE_COMPUTATION
4330+ LOGICAL COLLIER_UV_POLE_COMPUTATION_CHOICE, COLLIER_IR_POLE_COMPU
4331+ $TATION_CHOICE
4332+ COMMON/COLLIERPOLESFORCEDCHOICE/FORCED_CHOICE_OF_COLLIER_UV_POLE_
4333+ $COMPUTATION, FORCED_CHOICE_OF_COLLIER_IR_POLE_COMPUTATION
4334+ $ ,COLLIER_UV_POLE_COMPUTATION_CHOICE,COLLIER_IR_POLE_COMPUTATION_
4335+ $CHOICE
4336+
4337+ COLLIERCOMPUTEIRPOLES = ONOFF
4338+C This is just so that if we read the param again, we don't
4339+C overwrite the choice made here
4340+ FORCED_CHOICE_OF_COLLIER_IR_POLE_COMPUTATION = .TRUE.
4341+ COLLIER_IR_POLE_COMPUTATION_CHOICE = ONOFF
4342+
4343+ END SUBROUTINE
4344+
4345 SUBROUTINE FORCE_STABILITY_CHECK(ONOFF)
4346 C
4347 C This function can be called by the MadLoop user so as to always
4348
4349=== modified file 'tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%mp_compute_loop_coefs.f'
4350--- tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%mp_compute_loop_coefs.f 2016-04-06 18:45:52 +0000
4351+++ tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%mp_compute_loop_coefs.f 2016-07-02 20:37:49 +0000
4352@@ -250,9 +250,15 @@
4353 NHEL(I)=HELC(I,H)
4354 ENDDO
4355
4356- MP_UVCT_REQ_SO_DONE=.FALSE.
4357- MP_CT_REQ_SO_DONE=.FALSE.
4358- MP_LOOP_REQ_SO_DONE=.FALSE.
4359+ IF (COMPUTE_INTEGRAND_IN_QP) THEN
4360+ MP_UVCT_REQ_SO_DONE=.FALSE.
4361+ MP_CT_REQ_SO_DONE=.FALSE.
4362+ MP_LOOP_REQ_SO_DONE=.FALSE.
4363+ ELSE
4364+ UVCT_REQ_SO_DONE=.FALSE.
4365+ CT_REQ_SO_DONE=.FALSE.
4366+ LOOP_REQ_SO_DONE=.FALSE.
4367+ ENDIF
4368
4369 IF (.NOT.CHECKPHASE.AND.HELDOUBLECHECKED.AND.HELPICKED.EQ.-1)
4370 $ THEN
4371@@ -264,8 +270,10 @@
4372
4373 IF (COMPUTE_INTEGRAND_IN_QP) THEN
4374 CALL MP_HELAS_CALLS_AMPB_1(MP_P,NHEL,H,IC)
4375+ CONTINUE
4376 ELSE
4377 CALL HELAS_CALLS_AMPB_1(P,NHEL,H,IC)
4378+ CONTINUE
4379 ENDIF
4380
4381 2000 CONTINUE
4382@@ -273,8 +281,10 @@
4383
4384 IF (COMPUTE_INTEGRAND_IN_QP) THEN
4385
4386+ CONTINUE
4387 ELSE
4388
4389+ CONTINUE
4390 ENDIF
4391
4392 IF (.NOT.COMPUTE_INTEGRAND_IN_QP) THEN
4393
4394=== added file 'tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%unique_id.inc'
4395--- tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%unique_id.inc 1970-01-01 00:00:00 +0000
4396+++ tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%unique_id.inc 2016-07-02 20:37:49 +0000
4397@@ -0,0 +1,2 @@
4398+ integer UNIQUE_ID
4399+ parameter(UNIQUE_ID=1)
4400\ No newline at end of file
4401
4402=== added file 'tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%COLLIER_interface.f'
4403--- tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%COLLIER_interface.f 1970-01-01 00:00:00 +0000
4404+++ tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%COLLIER_interface.f 2016-07-02 20:37:49 +0000
4405@@ -0,0 +1,732 @@
4406+ SUBROUTINE COLLIERLOOP(CTMODE, NLOOPLINE,RANK,PL,PDEN,M2L
4407+ $ ,TIRCOEFS,TIRCOEFSERRORS)
4408+C
4409+C Generated by MadGraph5_aMC@NLO v. %(version)s, %(date)s
4410+C By the MadGraph5_aMC@NLO Development Team
4411+C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch
4412+C
4413+C Interface between MG5 and COLLIER.
4414+C It supports any rank when 1 < NLOOPLINE < 7.
4415+C
4416+C Process: u d~ > w+ WEIGHTED<=2 QED<=1 [ all = QCD ]
4417+C Process: c s~ > w+ WEIGHTED<=2 QED<=1 [ all = QCD ]
4418+C
4419+C
4420+C MODULES
4421+C
4422+ USE COLLIER
4423+ IMPLICIT NONE
4424+C
4425+C CONSTANTS
4426+C
4427+ LOGICAL CHECKPCONSERVATION
4428+ PARAMETER (CHECKPCONSERVATION=.TRUE.)
4429+ REAL*8 PIVALUE
4430+ PARAMETER(PIVALUE=3.14159265358979323846D0)
4431+ INTEGER MAXRANK
4432+ PARAMETER (MAXRANK=2)
4433+ INTEGER NLOOPGROUPS
4434+ PARAMETER (NLOOPGROUPS=1)
4435+ INCLUDE 'loop_max_coefs.inc'
4436+C
4437+C ARGUMENTS
4438+C
4439+ INTEGER NLOOPLINE, RANK, CTMODE
4440+ REAL*8 PL(0:3,NLOOPLINE)
4441+ REAL*8 PDEN(0:3,NLOOPLINE-1)
4442+ COMPLEX*16 M2L(NLOOPLINE)
4443+ COMPLEX*16 RES(3)
4444+ COMPLEX*16 TIRCOEFS(0:LOOPMAXCOEFS-1,3)
4445+ COMPLEX*16 TIRCOEFSERRORS(0:LOOPMAXCOEFS-1,3)
4446+
4447+C
4448+C LOCAL VARIABLES
4449+C
4450+ INTEGER N, I, J, K, L
4451+ INTEGER C0,C1,C2,C3
4452+ INTEGER N_CACHES
4453+ INTEGER CURR_RANK, SGN
4454+ INTEGER CURR_INDEX
4455+ INTEGER CURR_MAXCOEF
4456+ REAL*8 RBUFF(0:3)
4457+
4458+ INTEGER COEFMAP_ZERO(0:LOOPMAXCOEFS-1)
4459+ INTEGER COEFMAP_ONE(0:LOOPMAXCOEFS-1)
4460+ INTEGER COEFMAP_TWO(0:LOOPMAXCOEFS-1)
4461+ INTEGER COEFMAP_THREE(0:LOOPMAXCOEFS-1)
4462+ DATA (COEFMAP_ZERO(I),I= 0, 9) / 0, 1, 0, 0, 0, 2, 1, 0, 1, 0/
4463+ DATA (COEFMAP_ZERO(I),I= 10, 14) / 0, 1, 0, 0, 0/
4464+ DATA (COEFMAP_ONE(I),I= 0, 9) / 0, 0, 1, 0, 0, 0, 1, 2, 0, 1/
4465+ DATA (COEFMAP_ONE(I),I= 10, 14) / 0, 0, 1, 0, 0/
4466+ DATA (COEFMAP_TWO(I),I= 0, 9) / 0, 0, 0, 1, 0, 0, 0, 0, 1, 1/
4467+ DATA (COEFMAP_TWO(I),I= 10, 14) / 2, 0, 0, 1, 0/
4468+ DATA (COEFMAP_THREE(I),I= 0, 9) / 0, 0, 0, 0, 1, 0, 0, 0, 0, 0/
4469+ DATA (COEFMAP_THREE(I),I= 10, 14) / 0, 1, 1, 1, 2/
4470+
4471+ REAL*8 REF_NORMALIZATION
4472+
4473+ DOUBLE COMPLEX M2LCOLLIER(0:NLOOPLINE-1)
4474+ DOUBLE COMPLEX MOMVEC(0:3,NLOOPLINE-1)
4475+ DOUBLE COMPLEX MOMINV((NLOOPLINE*(NLOOPLINE-1))/2)
4476+
4477+ DOUBLE COMPLEX TNTEN(0:RANK,0:RANK,0:RANK,0:RANK)
4478+ DOUBLE COMPLEX TNTENUV(0:RANK,0:RANK,0:RANK,0:RANK)
4479+ DOUBLE PRECISION TNTENERR(0:RANK)
4480+
4481+ REAL*8 MAXCOEFFORRANK(0:RANK)
4482+
4483+C These quantities are for the pole evaluation
4484+ DOUBLE COMPLEX TNTEN_UV(0:RANK,0:RANK,0:RANK,0:RANK)
4485+ DOUBLE COMPLEX TNTENUV_UV(0:RANK,0:RANK,0:RANK,0:RANK)
4486+ DOUBLE PRECISION TNTENERR_UV(0:RANK)
4487+ DOUBLE COMPLEX TNTEN_IR1(0:RANK,0:RANK,0:RANK,0:RANK)
4488+ DOUBLE COMPLEX TNTENUV_IR1(0:RANK,0:RANK,0:RANK,0:RANK)
4489+ DOUBLE PRECISION TNTENERR_IR1(0:RANK)
4490+ DOUBLE COMPLEX TNTEN_IR2(0:RANK,0:RANK,0:RANK,0:RANK)
4491+ DOUBLE COMPLEX TNTENUV_IR2(0:RANK,0:RANK,0:RANK,0:RANK)
4492+ DOUBLE PRECISION TNTENERR_IR2(0:RANK)
4493+C
4494+C GLOBAL VARIABLES
4495+C
4496+ INCLUDE 'coupl.inc'
4497+ INCLUDE 'MadLoopParams.inc'
4498+ INCLUDE 'unique_id.inc'
4499+ INCLUDE 'global_specs.inc'
4500+
4501+ INTEGER ID,SQSOINDEX,R
4502+ COMMON/LOOP/ID,SQSOINDEX,R
4503+
4504+C
4505+C These global variables cache the coefficients already computed
4506+C by COLLIER
4507+C so that they can be reused. In particular, in CTMODE 2, the
4508+C cached ERROR
4509+C quantities for eahc rank will be used to make use of COLLIER's
4510+C internal
4511+C assessment of the numerical accuracy.
4512+C
4513+ LOGICAL LOOP_ID_DONE(NLOOPGROUPS)
4514+ DATA LOOP_ID_DONE/NLOOPGROUPS*.FALSE./
4515+ COMPLEX*16 TIR_COEFS_DIRECT_MODE(0:LOOPMAXCOEFS-1,3,NLOOPGROUPS)
4516+ REAL*8 TIR_COEFS_ERROR(0:MAXRANK,NLOOPGROUPS)
4517+ COMMON/COLLIER_TIR_COEFS/TIR_COEFS_DIRECT_MODE,TIR_COEFS_ERROR
4518+ $ ,LOOP_ID_DONE
4519+
4520+ INTEGER COLLIER_CACHE_ACTIVE, NCALLS_IN_CACHE(4),
4521+ $ NCOLLIERCALLS(4)
4522+ LOGICAL MUST_INIT_EVENT
4523+ COMMON/COLLIER_CACHE_STATUS/COLLIER_CACHE_ACTIVE,NCALLS_IN_CACHE
4524+ $ , NCOLLIERCALLS,MUST_INIT_EVENT
4525+
4526+ LOGICAL CTINIT, TIRINIT, GOLEMINIT, SAMURAIINIT, NINJAINIT,
4527+ $ COLLIERINIT
4528+ COMMON/REDUCTIONCODEINIT/CTINIT, TIRINIT,GOLEMINIT,SAMURAIINIT
4529+ $ ,NINJAINIT, COLLIERINIT
4530+
4531+C ----------
4532+C BEGIN CODE
4533+C ----------
4534+
4535+ IF (COLLIERUSECACHEFORPOLES) THEN
4536+ N_CACHES = 4
4537+ ELSE
4538+ N_CACHES =1
4539+ ENDIF
4540+
4541+C Initialize COLLIER if needed
4542+ IF (COLLIERINIT) THEN
4543+ COLLIERINIT=.FALSE.
4544+ CALL INITCOLLIER()
4545+ ENDIF
4546+
4547+C Initialize the event if it is the first time collier is called
4548+C on this PS point
4549+ IF(MUST_INIT_EVENT) THEN
4550+ MUST_INIT_EVENT = .FALSE.
4551+ IF (COLLIERGLOBALCACHE.EQ.0) THEN
4552+ CALL INITEVENT_CLL()
4553+ ELSE
4554+ DO I=1,N_CACHES
4555+C Record how many events where put in the cache. On the
4556+C first PS point.
4557+ IF (NCALLS_IN_CACHE(I).EQ.-1.AND.NCOLLIERCALLS(I).GT.0)
4558+ $ THEN
4559+ NCALLS_IN_CACHE(I) = NCOLLIERCALLS(I)
4560+ ENDIF
4561+ ENDDO
4562+ DO I=1,N_CACHES
4563+C Now apply a safety check that our last event had as many
4564+C calls as the cache is setup for.
4565+C The only case for now when it can be half of the calls
4566+C when we are doing the true loop-direction test with also
4567+C the computation of a rotated PS point (which is computed
4568+C for one mode only).
4569+ IF (NCALLS_IN_CACHE(I).NE.-1.AND..NOT. ( NCOLLIERCALLS(I)
4570+ $ .EQ.NCALLS_IN_CACHE(I).OR. ( CTMODERUN.EQ.
4571+ $ -1.AND..NOT.COLLIERUSEINTERNALSTABILITYTEST.AND.NROTATIONS
4572+ $_DP.GT.0.AND.MOD(NCALLS_IN_CACHE(I),2).EQ.0.AND.(NCALLS_IN_CACHE(
4573+ $I)/2).EQ.NCOLLIERCALLS(I) ) ) ) THEN
4574+ WRITE(*,*) 'WARNING: A consistency check in MadLoop'
4575+ $ //' failed and, for safety, forced MadLoop to'
4576+ $ //' reinitialize the global cache of COLLIER. Report'
4577+ $ //' this to MadLoop authors. The problematic cache was'
4578+ $ //' number ',I
4579+ IF (COLLIERGLOBALCACHE.EQ.-1) THEN
4580+ CALL INITCACHESYSTEM_CLL(N_CACHES*NPROCS,MAXNEXTERNAL)
4581+ ELSE
4582+ CALL INITCACHESYSTEM_CLL(N_CACHES*NPROCS
4583+ $ ,COLLIERGLOBALCACHE)
4584+ ENDIF
4585+C Make sure all caches are switched off at first.
4586+ CALL SWITCHOFFCACHESYSTEM_CLL()
4587+C Reset the cache design property
4588+ NCALLS_IN_CACHE(:) = -1
4589+ NCOLLIERCALLS(:) = 0
4590+ IF (COLLIER_CACHE_ACTIVE.EQ.1) THEN
4591+ CALL SWITCHONCACHE_CLL((UNIQUE_ID-1)*N_CACHES+1)
4592+ ENDIF
4593+C No need to check the other caches since we already had
4594+C to reset here.
4595+ EXIT
4596+ ENDIF
4597+ ENDDO
4598+ CALL INITEVENT_CLL((UNIQUE_ID-1)*N_CACHES+1)
4599+ NCOLLIERCALLS(1) = 0
4600+ IF(COLLIERCOMPUTEUVPOLES.AND.COLLIERUSECACHEFORPOLES) THEN
4601+ CALL INITEVENT_CLL((UNIQUE_ID-1)*N_CACHES+2)
4602+ NCOLLIERCALLS(2) = 0
4603+ ENDIF
4604+ IF(COLLIERCOMPUTEIRPOLES.AND.COLLIERUSECACHEFORPOLES) THEN
4605+ CALL INITEVENT_CLL((UNIQUE_ID-1)*N_CACHES+3)
4606+ NCOLLIERCALLS(3) = 0
4607+ CALL INITEVENT_CLL((UNIQUE_ID-1)*N_CACHES+4)
4608+ NCOLLIERCALLS(4) = 0
4609+ ENDIF
4610+ ENDIF
4611+ CALL SETDELTAIR_CLL(0.0D0,(PIVALUE**2)/6.0D0)
4612+ CALL SETDELTAUV_CLL(0.0D0)
4613+ CALL SETMUIR2_CLL(MU_R**2)
4614+ CALL SETMUUV2_CLL(MU_R**2)
4615+ ENDIF
4616+
4617+C Now really start the reduction with COLLIER
4618+
4619+C Number of coefficients for the current rank
4620+ CURR_MAXCOEF = 0
4621+ DO I=0,RANK
4622+ CURR_MAXCOEF=CURR_MAXCOEF+(3+I)*(2+I)*(1+I)/6
4623+ ENDDO
4624+
4625+ IF (CTMODE.NE.1.AND.CTMODE.NE.2) THEN
4626+ WRITE(*,*) 'ERROR: COLLIER only support the computational mode'
4627+ $ //' CTMODE equal to 1 or 2, not',CTMODE
4628+ STOP 'Incorrect computational mode specified to the COLLIER'
4629+ $ //' MG5aMC interface.'
4630+ ENDIF
4631+
4632+ DO I=0,CURR_MAXCOEF-1
4633+ DO K=1,3
4634+ TIRCOEFSERRORS(I,K)=DCMPLX(0.0D0,0.0D0)
4635+ ENDDO
4636+ ENDDO
4637+
4638+ IF (COLLIERUSEINTERNALSTABILITYTEST) THEN
4639+C Use MADLOOP internal cache dedicated to COLLIER that emulates
4640+C the CTMODE 2
4641+ IF (LOOP_ID_DONE(ID)) THEN
4642+ DO I=0,CURR_MAXCOEF-1
4643+ DO K=1,3
4644+ TIRCOEFS(I,K)=TIR_COEFS_DIRECT_MODE(I,K,ID)
4645+ ENDDO
4646+ ENDDO
4647+ DO I=0,RANK
4648+ MAXCOEFFORRANK(I) = 0.0D0
4649+ ENDDO
4650+ DO I=0,CURR_MAXCOEF-1
4651+ CURR_RANK = COEFMAP_ZERO(I)+COEFMAP_ONE(I)+COEFMAP_TWO(I)
4652+ $ +COEFMAP_THREE(I)
4653+ MAXCOEFFORRANK(CURR_RANK)=MAX(MAXCOEFFORRANK(CURR_RANK)
4654+ $ ,ABS(TIR_COEFS_DIRECT_MODE(I,1,ID)))
4655+ ENDDO
4656+ DO I=0,CURR_MAXCOEF-1
4657+ CURR_RANK = COEFMAP_ZERO(I)+COEFMAP_ONE(I)+COEFMAP_TWO(I)
4658+ $ +COEFMAP_THREE(I)
4659+ IF (MAXCOEFFORRANK(CURR_RANK).NE.0.0D0) THEN
4660+ DO K=1,3
4661+C The expression below is like taking the absolute value
4662+C when summing errors linearly
4663+C TIRCOEFSERRORS(I,K)=(TIR_COEFS_ERROR(CURR_RANK,ID)/MaxC
4664+C oefForRank(CURR_RANK))*DCMPLX( ABS(DBLE(TIRCOEFS(I,K)))
4665+C ,ABS(DIMAG(TIRCOEFS(I,K))) )
4666+C But empirically, I observed that retaining the
4667+C original complex phase leads to slightly more
4668+C accurate estimates
4669+ TIRCOEFSERRORS(I,K)=(TIR_COEFS_ERROR(CURR_RANK,ID)
4670+ $ /MAXCOEFFORRANK(CURR_RANK))*TIRCOEFS(I,K)
4671+ ENDDO
4672+ ENDIF
4673+ ENDDO
4674+ RETURN
4675+ ENDIF
4676+ ELSE
4677+C Apply the loop-direction switching here.
4678+ CALL SWITCH_ORDER(CTMODE,NLOOPLINE,PL,PDEN,M2L)
4679+ ENDIF
4680+
4681+C Make sure masses are complex
4682+ DO I=1,NLOOPLINE
4683+ M2LCOLLIER(I-1)=DCMPLX(M2L(I))
4684+ ENDDO
4685+
4686+C Now convert the loop offset momenta to COLLIER conventions
4687+ DO I=0,3
4688+ DO J=1,NLOOPLINE-1
4689+ MOMVEC(I,J)=DCMPLX(PDEN(I,J),0.0D0)
4690+ ENDDO
4691+ ENDDO
4692+
4693+C This first do loop spans over 'N' in '\foreach_N'
4694+C //' \foreach_i(k_i+k_{i+1}+..+k_{i+N})^2'
4695+ CURR_INDEX = 0
4696+ DO N=0,NLOOPLINE-1
4697+C We stop whenever we reached the target number of invariants
4698+ IF (CURR_INDEX.GE.((NLOOPLINE*(NLOOPLINE-1))/2)) THEN
4699+ EXIT
4700+ ENDIF
4701+C This do loop spans over 'i' in the expression above.
4702+ DO I=1,NLOOPLINE
4703+ IF (CURR_INDEX.GE.((NLOOPLINE*(NLOOPLINE-1))/2)) THEN
4704+ EXIT
4705+ ENDIF
4706+
4707+ CURR_INDEX = CURR_INDEX+1
4708+ RBUFF(:) = 0.0D0
4709+ DO J=I,I+N
4710+ RBUFF(:) = RBUFF(:) + PL(:,MOD(J-1,NLOOPLINE)+1)
4711+ ENDDO
4712+ MOMINV(CURR_INDEX) = DCMPLX(RBUFF(0)**2-RBUFF(1)**2-RBUFF(2)
4713+ $ **2-RBUFF(3)**2,0.0D0)
4714+
4715+C Now regularize the onshell behavior of the kinematic
4716+C invarients
4717+C All loop masses are tested, but that might be a bit too
4718+C inclusive.
4719+ DO K=1,NLOOPLINE
4720+ IF(ABS(M2L(K)).NE.0.0D0) THEN
4721+ IF(ABS((MOMINV(CURR_INDEX)-M2L(K))/M2L(K)).LT.OSTHRES)
4722+ $ THEN
4723+ MOMINV(CURR_INDEX)=DCMPLX(M2L(K))
4724+ ENDIF
4725+ ENDIF
4726+ ENDDO
4727+C For the massless onshell-case, we base the threshold only on
4728+C the energy component
4729+ REF_NORMALIZATION=0.0D0
4730+ DO L=0,0
4731+ REF_NORMALIZATION = REF_NORMALIZATION + ABS(RBUFF(L))
4732+ ENDDO
4733+ REF_NORMALIZATION = (REF_NORMALIZATION/(N+1))**2
4734+ IF(REF_NORMALIZATION.NE.0.0D0)THEN
4735+ IF(ABS(MOMINV(CURR_INDEX)/REF_NORMALIZATION).LT.OSTHRES)
4736+ $ THEN
4737+ MOMINV(CURR_INDEX)=DCMPLX(0.0D0,0.0D0)
4738+ ENDIF
4739+ ENDIF
4740+
4741+ ENDDO
4742+ ENDDO
4743+
4744+C We can now call COLLIER
4745+ IF (NLOOPLINE.NE.1) THEN
4746+ CALL TNTEN_CLL(TNTEN, TNTENUV, MOMVEC, MOMINV, M2LCOLLIER,
4747+ $ NLOOPLINE, RANK, TNTENERR)
4748+ ELSE
4749+ CALL TNTEN_CLL(TNTEN, TNTENUV, M2LCOLLIER, NLOOPLINE, RANK,
4750+ $ TNTENERR)
4751+ ENDIF
4752+ IF (COLLIER_CACHE_ACTIVE.EQ.1) THEN
4753+ NCOLLIERCALLS(1) = NCOLLIERCALLS(1)+1
4754+ ENDIF
4755+
4756+C Now compute the UV poles if asked for
4757+ IF (COLLIERCOMPUTEUVPOLES) THEN
4758+ IF(COLLIER_CACHE_ACTIVE.EQ.1) THEN
4759+ CALL SWITCHOFFCACHE_CLL((UNIQUE_ID-1)*N_CACHES+1)
4760+ IF(COLLIERUSECACHEFORPOLES) THEN
4761+ CALL SWITCHONCACHE_CLL((UNIQUE_ID-1)*N_CACHES+2)
4762+ ENDIF
4763+ ENDIF
4764+ CALL SETDELTAUV_CLL(1.0D0)
4765+ IF (NLOOPLINE.NE.1) THEN
4766+ CALL TNTEN_CLL(TNTEN_UV, TNTENUV_UV, MOMVEC, MOMINV,
4767+ $ M2LCOLLIER, NLOOPLINE, RANK, TNTENERR_UV)
4768+ ELSE
4769+ CALL TNTEN_CLL(TNTEN_UV, TNTENUV_UV, M2LCOLLIER, NLOOPLINE,
4770+ $ RANK, TNTENERR_UV)
4771+ ENDIF
4772+ IF (COLLIER_CACHE_ACTIVE.EQ.1) THEN
4773+ NCOLLIERCALLS(2) = NCOLLIERCALLS(2)+1
4774+ ENDIF
4775+ IF(COLLIER_CACHE_ACTIVE.EQ.1) THEN
4776+ IF(COLLIERUSECACHEFORPOLES) THEN
4777+ CALL SWITCHOFFCACHE_CLL((UNIQUE_ID-1)*N_CACHES+2)
4778+ ENDIF
4779+ CALL SWITCHONCACHE_CLL((UNIQUE_ID-1)*N_CACHES+1)
4780+ ENDIF
4781+ CALL SETDELTAUV_CLL(0.0D0)
4782+ ENDIF
4783+
4784+C Now compute the IR poles if asked for
4785+ IF (COLLIERCOMPUTEIRPOLES) THEN
4786+ IF(COLLIER_CACHE_ACTIVE.EQ.1) THEN
4787+ CALL SWITCHOFFCACHE_CLL((UNIQUE_ID-1)*N_CACHES+1)
4788+ IF(COLLIERUSECACHEFORPOLES) THEN
4789+ CALL SWITCHONCACHE_CLL((UNIQUE_ID-1)*N_CACHES+3)
4790+ ENDIF
4791+ ENDIF
4792+ CALL SETDELTAIR_CLL(1.0D0,(PIVALUE**2)/6.0D0)
4793+ IF (NLOOPLINE.NE.1) THEN
4794+ CALL TNTEN_CLL(TNTEN_IR1, TNTENUV_IR1, MOMVEC, MOMINV,
4795+ $ M2LCOLLIER, NLOOPLINE, RANK, TNTENERR_IR1)
4796+ ELSE
4797+ CALL TNTEN_CLL(TNTEN_IR1, TNTENUV_IR1, M2LCOLLIER, NLOOPLINE
4798+ $ , RANK, TNTENERR_IR1)
4799+ ENDIF
4800+ IF (COLLIER_CACHE_ACTIVE.EQ.1) THEN
4801+ NCOLLIERCALLS(3) = NCOLLIERCALLS(3)+1
4802+ ENDIF
4803+ IF(COLLIER_CACHE_ACTIVE.EQ.1.AND.COLLIERUSECACHEFORPOLES) THEN
4804+ CALL SWITCHOFFCACHE_CLL((UNIQUE_ID-1)*N_CACHES+3)
4805+ CALL SWITCHONCACHE_CLL((UNIQUE_ID-1)*N_CACHES+4)
4806+ ENDIF
4807+ CALL SETDELTAIR_CLL(0.0D0,1.0D0+(PIVALUE**2)/6.0D0)
4808+ IF (NLOOPLINE.NE.1) THEN
4809+ CALL TNTEN_CLL(TNTEN_IR2, TNTENUV_IR2, MOMVEC, MOMINV,
4810+ $ M2LCOLLIER, NLOOPLINE, RANK, TNTENERR_IR2)
4811+ ELSE
4812+ CALL TNTEN_CLL(TNTEN_IR2, TNTENUV_IR2, M2LCOLLIER, NLOOPLINE
4813+ $ , RANK, TNTENERR_IR2)
4814+ ENDIF
4815+ IF (COLLIER_CACHE_ACTIVE.EQ.1) THEN
4816+ NCOLLIERCALLS(4) = NCOLLIERCALLS(4)+1
4817+ ENDIF
4818+ IF(COLLIER_CACHE_ACTIVE.EQ.1) THEN
4819+ IF(COLLIERUSECACHEFORPOLES) THEN
4820+ CALL SWITCHOFFCACHE_CLL((UNIQUE_ID-1)*N_CACHES+4)
4821+ ENDIF
4822+ CALL SWITCHONCACHE_CLL((UNIQUE_ID-1)*N_CACHES+1)
4823+ ENDIF
4824+ CALL SETDELTAIR_CLL(0.0D0,(PIVALUE**2)/6.0D0)
4825+ ENDIF
4826+
4827+ DO I=0,(CURR_MAXCOEF-1)
4828+ C0 = COEFMAP_ZERO(I)
4829+ C1 = COEFMAP_ONE(I)
4830+ C2 = COEFMAP_TWO(I)
4831+ C3 = COEFMAP_THREE(I)
4832+ CURR_RANK = C0+C1+C2+C3
4833+C Because we must set q -> -q, we apply a minus sign to coefs of
4834+C odd rank
4835+ IF (MOD(CURR_RANK,2).EQ.1) THEN
4836+ SGN = -1
4837+ ELSE
4838+ SGN = 1
4839+ ENDIF
4840+ TIRCOEFS(I,1) = SGN*TNTEN(C0,C1,C2,C3)
4841+ IF (COLLIERCOMPUTEUVPOLES) THEN
4842+ TIRCOEFS(I,2) = SGN*( TNTEN_UV(C0,C1,C2,C3)-TNTEN(C0,C1,C2
4843+ $ ,C3) )
4844+ ELSE
4845+ TIRCOEFS(I,2) = DCMPLX(0.0D0,0.0D0)
4846+ ENDIF
4847+ IF (COLLIERCOMPUTEIRPOLES) THEN
4848+ TIRCOEFS(I,2) = TIRCOEFS(I,2) + SGN*( TNTEN_IR1(C0,C1,C2,C3)
4849+ $ -TNTEN(C0,C1,C2,C3) )
4850+ TIRCOEFS(I,3) = SGN*( TNTEN_IR2(C0,C1,C2,C3)-TNTEN(C0,C1,C2
4851+ $ ,C3) )
4852+ ELSE
4853+ TIRCOEFS(I,3) = DCMPLX(0.0D0,0.0D0)
4854+ ENDIF
4855+ ENDDO
4856+
4857+ IF (COLLIERUSEINTERNALSTABILITYTEST) THEN
4858+C Finish by caching the coefficients and error just computed
4859+ LOOP_ID_DONE(ID) = .TRUE.
4860+ DO J=0,CURR_MAXCOEF-1
4861+ DO K=1,3
4862+ TIR_COEFS_DIRECT_MODE(J,K,ID) = TIRCOEFS(J,K)
4863+ ENDDO
4864+ ENDDO
4865+ DO J=0,RANK
4866+ TIR_COEFS_ERROR(J,ID)=TNTENERR(J)
4867+ ENDDO
4868+
4869+C Now compute the errors on each coefficient
4870+ DO I=0,RANK
4871+ MAXCOEFFORRANK(I) = 0.0D0
4872+ ENDDO
4873+ DO I=0,CURR_MAXCOEF-1
4874+ CURR_RANK = COEFMAP_ZERO(I)+COEFMAP_ONE(I)+COEFMAP_TWO(I)
4875+ $ +COEFMAP_THREE(I)
4876+ MAXCOEFFORRANK(CURR_RANK)=MAX(MAXCOEFFORRANK(CURR_RANK)
4877+ $ ,ABS(TIRCOEFS(I,1)))
4878+ ENDDO
4879+ DO I=0,CURR_MAXCOEF-1
4880+ CURR_RANK = COEFMAP_ZERO(I)+COEFMAP_ONE(I)+COEFMAP_TWO(I)
4881+ $ +COEFMAP_THREE(I)
4882+ IF (MAXCOEFFORRANK(CURR_RANK).NE.0.0D0) THEN
4883+ DO K=1,3
4884+C The expression below is like taking the absolute value
4885+C when summing errors linearly
4886+C TIRCOEFSERRORS(I,K)=(TNtenerr(CURR_RANK)/MaxCoefForRank(C
4887+C URR_RANK))*DCMPLX( ABS(DBLE(TIRCOEFS(I,K))),ABS(DIMAG(TIR
4888+C COEFS(I,K))) )
4889+C But empirically, I observed that retaining the original
4890+C complex phase leads to slightly more accurate estimates
4891+ TIRCOEFSERRORS(I,K)=(TNTENERR(CURR_RANK)
4892+ $ /MAXCOEFFORRANK(CURR_RANK))*TIRCOEFS(I,K)
4893+ ENDDO
4894+ ENDIF
4895+ ENDDO
4896+
4897+ ENDIF
4898+
4899+ END SUBROUTINE COLLIERLOOP
4900+
4901+ SUBROUTINE CLEAR_COLLIER_CACHE()
4902+
4903+ USE COLLIER
4904+
4905+ INCLUDE 'loop_max_coefs.inc'
4906+ INTEGER NLOOPGROUPS
4907+ PARAMETER (NLOOPGROUPS=1)
4908+ INTEGER MAXRANK
4909+ PARAMETER (MAXRANK=2)
4910+
4911+ INTEGER I,J,K
4912+
4913+ INCLUDE 'MadLoopParams.inc'
4914+
4915+ LOGICAL LOOP_ID_DONE(NLOOPGROUPS)
4916+ COMPLEX*16 TIR_COEFS_DIRECT_MODE(0:LOOPMAXCOEFS-1,3,NLOOPGROUPS)
4917+ COMPLEX*16 TIR_COEFS_ERROR(0:MAXRANK,NLOOPGROUPS)
4918+ COMMON/COLLIER_TIR_COEFS/TIR_COEFS_DIRECT_MODE,TIR_COEFS_ERROR
4919+ $ ,LOOP_ID_DONE
4920+
4921+ INTEGER COLLIER_CACHE_ACTIVE, NCALLS_IN_CACHE(4),
4922+ $ NCOLLIERCALLS(4)
4923+ LOGICAL MUST_INIT_EVENT
4924+ COMMON/COLLIER_CACHE_STATUS/COLLIER_CACHE_ACTIVE,NCALLS_IN_CACHE
4925+ $ , NCOLLIERCALLS,MUST_INIT_EVENT
4926+
4927+C Make sure that next time the COLLIER Subroutine is called it
4928+C will call the subroutine initEvent of Collier.
4929+ MUST_INIT_EVENT = .TRUE.
4930+
4931+C Reinitialize the ML cache for COLLIER
4932+ DO I=1,NLOOPGROUPS
4933+ LOOP_ID_DONE(I) = .FALSE.
4934+ DO J=0,LOOPMAXCOEFS-1
4935+ DO K=1,3
4936+ TIR_COEFS_DIRECT_MODE(J,K,I) = DCMPLX(0.0D0,0.0D0)
4937+ ENDDO
4938+ ENDDO
4939+ DO J=0,MAXRANK
4940+ TIR_COEFS_ERROR(J,I)=0.0D0
4941+ ENDDO
4942+ ENDDO
4943+
4944+ END
4945+
4946+ SUBROUTINE SET_COLLIER_GLOBAL_CACHE(ONOFF)
4947+C
4948+C This routine is used by loop_matrix.f to turn on the global
4949+C cache of COLLIER when it the main SLOOP subroutine starts and
4950+C turn it off when it ends.
4951+C However several checks are performed to verify that it is safe
4952+C to turn it on and to reinitialize it if necessary.
4953+C
4954+C MODULES
4955+C
4956+ USE COLLIER
4957+ IMPLICIT NONE
4958+C
4959+C ARGUMENTS
4960+C
4961+ LOGICAL ONOFF
4962+C
4963+C LOCAL VARIABLES
4964+C
4965+ LOGICAL NEED_REINITIALIZATION
4966+ INTEGER N_CACHES
4967+C
4968+C GLOBAL VARIABLES
4969+C
4970+C
4971+C This common blocks saves the relevant ML parameters when
4972+C activating the
4973+C global cache of COLLIER so that we know when we must
4974+C reinitialize it.
4975+C COLLIER_CACHE_ACTIVE is set to -1 when it has never been turned
4976+C on yet and
4977+C to 1 for 'Active' and 0 for 'Inactive'.
4978+C The integer NCALLS_IN_CACHE saves how many calls the cache is
4979+C setup for, for each of the up to four caches.
4980+C When it is the first PS points, it is set to -1.
4981+ INTEGER COLLIER_CACHE_ACTIVE, NCALLS_IN_CACHE(4),
4982+ $ NCOLLIERCALLS(4)
4983+ DATA COLLIER_CACHE_ACTIVE/-1/
4984+ DATA NCALLS_IN_CACHE/-1,-1,-1,-1/
4985+ DATA NCOLLIERCALLS/0,0,0,0/
4986+C This is a flag to tell the COLLIER subroutine that it must init
4987+C the event when called.
4988+ LOGICAL MUST_INIT_EVENT
4989+ DATA MUST_INIT_EVENT/.TRUE./
4990+ COMMON/COLLIER_CACHE_STATUS/COLLIER_CACHE_ACTIVE,
4991+ $ NCALLS_IN_CACHE, NCOLLIERCALLS,MUST_INIT_EVENT
4992+
4993+ LOGICAL COLLIERUSEINTERNALSTABILITYTEST_BU
4994+ INTEGER USERHEL_BU, SQSO_TARGET_BU, COLLIERMODE_BU,CTMODERUN_BU
4995+ COMMON/COLLIER_CACHE_RELEVANT_PARAMS/USERHEL_BU,SQSO_TARGET_BU
4996+ $ ,COLLIERMODE_BU,CTMODERUN_BU,COLLIERUSEINTERNALSTABILITYTEST_BU
4997+
4998+C The common blocks below are to retrieve the necessary
4999+C information about
5000+C MadLoop running mode and store it in the sCOLLIER_CACHE_RELEVANT_
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: