Merge lp:~maddevelopers/mg5amcnlo/2.3.4-low-memory into lp:~maddevelopers/mg5amcnlo/2.3.4

Proposed by marco zaro
Status: Merged
Merged at revision: 344
Proposed branch: lp:~maddevelopers/mg5amcnlo/2.3.4-low-memory
Merge into: lp:~maddevelopers/mg5amcnlo/2.3.4
Diff against target: 20865 lines (+19155/-274)
106 files modified
UpdateNotes.txt (+6/-0)
madgraph/fks/fks_base.py (+79/-60)
madgraph/fks/fks_helas_objects.py (+449/-45)
madgraph/interface/amcatnlo_interface.py (+171/-49)
madgraph/interface/madgraph_interface.py (+6/-3)
madgraph/iolibs/export_fks.py (+38/-42)
madgraph/iolibs/template_files/loop_optimized/compute_color_flows.inc (+11/-11)
madgraph/loop/loop_exporters.py (+8/-3)
madgraph/various/banner.py (+1/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%CT_interface.f (+278/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%GOLEM_interface.f (+760/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%TIR_interface.f (+423/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%born_matrix.f (+540/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%check_sa.f (+756/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%check_sa_born_splitOrders.f (+524/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%coef_specs.inc (+6/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%improve_ps.f (+981/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%loop_matrix.f (+2267/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%loop_num.f (+131/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%mp_compute_loop_coefs.f (+296/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%nexternal.inc (+4/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%ngraphs.inc (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%nsqso_born.inc (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%nsquaredSO.inc (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%pmass.inc (+3/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%polynomial.f (+455/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%b_sf_001.f (+153/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%born.f (+292/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%born_conf.inc (+4/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%born_hel.f (+151/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%born_leshouche.inc (+8/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%born_maxamps.inc (+3/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%born_ngraphs.inc (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%born_nhel.inc (+3/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%coloramps.inc (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%config_subproc_map.inc (+1/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%configs_and_props_decl.inc (+12/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%fks_info.inc (+53/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%get_color.f (+48/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%leshouche_decl.inc (+7/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%matrix_1.f (+172/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%matrix_2.f (+172/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%matrix_3.f (+172/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%nFKSconfigs.inc (+4/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%ncombs.inc (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%nexternal.inc (+4/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%ngraphs.inc (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%parton_lum_1.f (+112/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%parton_lum_2.f (+110/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%parton_lum_3.f (+110/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%parton_lum_chooser.f (+23/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%pmass.inc (+4/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%real_from_born_configs.inc (+6/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%real_me_chooser.f (+22/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%sborn_sf.f (+17/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%sborn_sf_dum.f (+13/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%CT_interface.f (+278/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%GOLEM_interface.f (+760/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%TIR_interface.f (+423/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%born_matrix.f (+540/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%check_sa.f (+756/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%check_sa_born_splitOrders.f (+524/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%coef_specs.inc (+6/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%improve_ps.f (+981/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%loop_matrix.f (+2267/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%loop_num.f (+131/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%mp_compute_loop_coefs.f (+296/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%nexternal.inc (+4/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%ngraphs.inc (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%nsqso_born.inc (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%nsquaredSO.inc (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%pmass.inc (+3/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%polynomial.f (+455/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%b_sf_001.f (+153/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%born.f (+292/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%born_conf.inc (+4/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%born_hel.f (+151/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%born_leshouche.inc (+8/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%born_maxamps.inc (+3/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%born_ngraphs.inc (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%born_nhel.inc (+3/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%coloramps.inc (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%config_subproc_map.inc (+1/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%configs_and_props_decl.inc (+12/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%fks_info.inc (+53/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%get_color.f (+48/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%leshouche_decl.inc (+7/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%matrix_1.f (+172/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%matrix_2.f (+172/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%matrix_3.f (+172/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%nFKSconfigs.inc (+4/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%ncombs.inc (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%nexternal.inc (+4/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%ngraphs.inc (+2/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%parton_lum_1.f (+112/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%parton_lum_2.f (+110/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%parton_lum_3.f (+110/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%parton_lum_chooser.f (+23/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%pmass.inc (+4/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%real_from_born_configs.inc (+6/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%real_me_chooser.f (+22/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%sborn_sf.f (+17/-0)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%sborn_sf_dum.f (+13/-0)
tests/time_db (+59/-57)
tests/unit_tests/iolibs/test_export_fks.py (+93/-0)
tests/unit_tests/iolibs/test_export_fks_EW.py (+6/-3)
To merge this branch: bzr merge lp:~maddevelopers/mg5amcnlo/2.3.4-low-memory
Reviewer Review Type Date Requested Status
Valentin Hirschi Approve
Olivier Mattelaer Approve
Rikkert Frederix Approve
Stefano Frixione Pending
MadDevelopers Pending
Review via email: mp+286337@code.launchpad.net

Description of the change

A new generation mode at NLO has been implemented, in order to spread the generation on all available CPUs and to use less memory (writing partial results to disk). The new generation mode can be triggered with
set new_nlo_generation True from the interface.
It can really be amazingly faster and more memory-efficient than before (Rikkert generated ttjj@NLO in 10 -ten- minutes on a 20-core cluster node), so that we can try generating higher multiplicities and look what the new bottlenecks are.
 The output should be identical (I have added an unit test to check this, yet for a very simple process : pp>w+)

As many threads start together, the logging is not as nice as the old one.

I have to thank Josh Bendavid for having provided the code for this.

Thanks for having a look and send comments...
Cheers,

Marco

To post a comment you must log in.
Revision history for this message
marco zaro (marco-zaro) wrote :

just to be clear, we are speaking about code generation (not event generation, unfortunately...)

Revision history for this message
Rikkert Frederix (frederix) wrote :

Hi Marco,

I would rename the option "new_nlo_generation" to something like "low_memory_multicore_nlo_generation" (or something shorter/better).

It seems like Ctrl-C doesn't work correctly during the 'output' of the process.

Cheers,
Rik

review: Needs Fixing
Revision history for this message
marco zaro (marco-zaro) wrote :

Hi Rik
On 18 Feb 2016, at 09:29, Rikkert Frederix <email address hidden> wrote:

> Review: Needs Fixing
>
> Hi Marco,
>
> I would rename the option "new_nlo_generation" to something like "low_memory_multicore_nlo_generation" (or something shorter/better).
>
I did not think much about the name

> It seems like Ctrl-C doesn't work correctly during the 'output' of the process.
>
argh, that was something we have already seen when we used the same multicore threading for compiling…
I will have a look and let you know…
Cheers,

Marco

> Cheers,
> Rik
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/2.3.4-low-memory/+merge/286337
> Your team MadDevelopers is requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/2.3.4-low-memory into lp:~maddevelopers/mg5amcnlo/2.3.4.

311. By marco zaro

ctrl+c should be caught now

Revision history for this message
marco zaro (marco-zaro) wrote :

Ciao Rik,
catching ctrl+c should be ok now.
Another thing i have noticed, is that by default all available cores are used… The nb_core option should be used instead for that, i will fix also this issue
Ciao,

Marco
On 18 Feb 2016, at 10:33, marco zaro <email address hidden> wrote:

> Hi Rik
> On 18 Feb 2016, at 09:29, Rikkert Frederix <email address hidden> wrote:
>
>> Review: Needs Fixing
>>
>> Hi Marco,
>>
>> I would rename the option "new_nlo_generation" to something like "low_memory_multicore_nlo_generation" (or something shorter/better).
>>
> I did not think much about the name
>
>> It seems like Ctrl-C doesn't work correctly during the 'output' of the process.
>>
> argh, that was something we have already seen when we used the same multicore threading for compiling…
> I will have a look and let you know…
> Cheers,
>
> Marco
>
>> Cheers,
>> Rik
>>
>> --
>> https://code.launchpad.net/~maddevelopers/mg5amcnlo/2.3.4-low-memory/+merge/286337
>> Your team MadDevelopers is requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/2.3.4-low-memory into lp:~maddevelopers/mg5amcnlo/2.3.4.
>
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/2.3.4-low-memory/+merge/286337
> Your team MadDevelopers is requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/2.3.4-low-memory into lp:~maddevelopers/mg5amcnlo/2.3.4.

312. By marco zaro

changed the name of the option (new_nlo_generation -> low_mem_multicore_nlo_generation).
Now if nb_core is set, the number of used cores is determined by that

Revision history for this message
marco zaro (marco-zaro) wrote :

Hi,
I have changed the name of the option (low_mem_multicore_nlo_generation). Also the number of cores is dictated by nb_cores (if set)
cheers,

Marco
On 18 Feb 2016, at 12:24, marco zaro <email address hidden> wrote:

> Ciao Rik,
> catching ctrl+c should be ok now.
> Another thing i have noticed, is that by default all available cores are used… The nb_core option should be used instead for that, i will fix also this issue
> Ciao,
>
> Marco
> On 18 Feb 2016, at 10:33, marco zaro <email address hidden> wrote:
>
>> Hi Rik
>> On 18 Feb 2016, at 09:29, Rikkert Frederix <email address hidden> wrote:
>>
>>> Review: Needs Fixing
>>>
>>> Hi Marco,
>>>
>>> I would rename the option "new_nlo_generation" to something like "low_memory_multicore_nlo_generation" (or something shorter/better).
>>>
>> I did not think much about the name
>>
>>> It seems like Ctrl-C doesn't work correctly during the 'output' of the process.
>>>
>> argh, that was something we have already seen when we used the same multicore threading for compiling…
>> I will have a look and let you know…
>> Cheers,
>>
>> Marco
>>
>>> Cheers,
>>> Rik
>>>
>>> --
>>> https://code.launchpad.net/~maddevelopers/mg5amcnlo/2.3.4-low-memory/+merge/286337
>>> Your team MadDevelopers is requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/2.3.4-low-memory into lp:~maddevelopers/mg5amcnlo/2.3.4.
>>
>>
>> --
>> https://code.launchpad.net/~maddevelopers/mg5amcnlo/2.3.4-low-memory/+merge/286337
>> Your team MadDevelopers is requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/2.3.4-low-memory into lp:~maddevelopers/mg5amcnlo/2.3.4.
>
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/2.3.4-low-memory/+merge/286337
> Your team MadDevelopers is requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/2.3.4-low-memory into lp:~maddevelopers/mg5amcnlo/2.3.4.

Revision history for this message
Rikkert Frederix (frederix) :
review: Approve
Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

Hi Marco,

That's so cool, I missed the fact that a library was allowing to evade the GIL limitation.
This is so much nicer than using the Threading library (like the multi-core option of MG).
I guess that we should think to change the multi-core options of MG to move to this multiprocessing library.

1) Is there any reason why this mode is not set as default?
2) It should be indicated in the UpdateNotes how to use it.
3) concerning the ncores options, would not be better to pass to the class the self.options of the interface? Such that we do not have to multiply the optional argument when we to have access to any of the options define in that dictionary (this should have been done for OLP)
4)can you check why you set self['has_loops'] = False (line 466 of the diff) around line 220 of madgraph/fks/fks_helas_objects.py
6) Would not be better to not write the data on a file (via pickle), but add them in a multiprocessing.queue object that can be used by the main process? Or do you see a problem with that?
7) in madgraph/interface/amcatnlo_interface.py you define glob_directories_map
Defining a non static global is always annoying and creates troubles very often ( I have to apologize to have done it in aloha). Is it really necessary? and is it thread safe?

8) Is it possible to have a printout when the last process is generated and that you collect the info (I guess that you do that) since it hangs on one core on a line of type:
INFO: Generating born process: s~ s > t t t~ t~ [ all = QCD ]
I guess he is doing something else actually.

So this is very very nice. Nice work!!

Cheers,

Olivier

review: Needs Information
313. By Valentin Hirschi

1. Fixed function 'fix_coef_specs'

Revision history for this message
Valentin Hirschi (valentin-hirschi) wrote :
Download full text (5.6 KiB)

Hi Marco,

Awesome job, really.

On the testing side, I noticed the following:

a) Doing a full comparison of p p > t t~ j [QCD] generated in single and multicore, I noticed that the file 'SubProcesses/proc_characteristics' was incorrect in mutlicore, since it contains:
 ninitial = 0
 nexternal = 0

b) This implementation broke process generation with another OLP than MadLoop (i.e. Gosam).
When selecting Gosam as OLP, the generation crashes at:

FKSProcessError : Wrong type of argument for matrix_elements in function write_lh_order.

from

[...]
  File "/Users/valentin/Documents/Work/MG5/2.3.4-low-memory/madgraph/iolibs/export_fks.py", line 1355, in generate_virtuals_from_OLP
    self.write_lh_order(filename, FKSHMultiproc.get('matrix_elements'),OLP)
  File "/Users/valentin/Documents/Work/MG5/2.3.4-low-memory/madgraph/iolibs/export_fks.py", line 1623, in write_lh_order
    'matrix_elements in function write_lh_order.')

Of course we don't want to have any sort of parallelization on behalf of GoSam, but normally here the only thing that is done is the writing of the leshouches order. The actual generation with GoSam should take place at the very end, basically after that the process is generated and the parallelization is done. So if this is not too difficult to fix, I think it would be worth doing so. Otherwise, explicitly forbid this mode when OLP is not MadLoop, but that would be weird because there is no reason for doing so.
Note that you don't need to have GoSam installed to test this I think, because it crashes when writing the leshouches order file, so before actually calling GoSam.

c) This is a problem which was not introduced by this branch but that I realized now and needs to be fixed. It showed up because I saw that you had to play around with the overall 'max_loop_coefs' value for different FKSHelasMatrixElements.
So imagine you do the following:

MG5_aMC>import model HC_NLO_X0_UFO-heft
MG5_aMC>generate g g > x0 [virt=QCD]
MG5_aMC>add process g g > z [virt=QCD]
MG5_aMC>output MyTest

Then you will see the message:
"""
ML5 has just output processes which do not share the same maximum loop wavefunction size or the same maximum loop vertex rank. This is potentially dangerous. Please prefer to output them separately.
"""

This is because if you look at the different coef_specs.inc, you will find:

> cat MyTest/SubProcesses/P0_gg_x0/coef_specs.inc
      INTEGER MAXLWFSIZE
      PARAMETER (MAXLWFSIZE=4)
      INTEGER LOOP_MAXCOEFS
      PARAMETER (LOOP_MAXCOEFS=70)
      INTEGER VERTEXMAXCOEFS
      PARAMETER (VERTEXMAXCOEFS=15)

> cat MyTest/SubProcesses/P1_gg_z/coef_specs.inc
      INTEGER MAXLWFSIZE
      PARAMETER (MAXLWFSIZE=4)
      INTEGER LOOP_MAXCOEFS
      PARAMETER (LOOP_MAXCOEFS=35)
      INTEGER VERTEXMAXCOEFS
      PARAMETER (VERTEXMAXCOEFS=5)

But then you see that in Source/DHELAS you have:

> cat MyTest/Source/DHELAS/coef_specs.inc
      INTEGER MAXLWFSIZE
      PARAMETER (MAXLWFSIZE=4)
      INTEGER VERTEXMAXCOEFS
      PARAMETER (VERTEXMAXCOEFS=15)

The tricky thing here is that DHELAS, which is used by both subprocesses, depends on VERTEXMAXCOEFS which is different for both subprocesses.
It is actually fine but *...

Read more...

review: Needs Fixing
Revision history for this message
marco zaro (marco-zaro) wrote :

Ciao Olivier,
thanks for the review
On 18 Feb 2016, at 20:44, Olivier Mattelaer <email address hidden> wrote:

> Review: Needs Information
>
> Hi Marco,
>
> That's so cool, I missed the fact that a library was allowing to evade the GIL limitation.
> This is so much nicer than using the Threading library (like the multi-core option of MG).
> I guess that we should think to change the multi-core options of MG to move to this multiprocessing library.
>
>
> 1) Is there any reason why this mode is not set as default?
for simple processes, the old mode works OK, and has a more detailed logging (number of diagrams, etc).
> 2) It should be indicated in the UpdateNotes how to use it.
done
> 3) concerning the ncores options, would not be better to pass to the class the self.options of the interface? Such that we do not have to multiply the optional argument when we to have access to any of the options define in that dictionary (this should have been done for OLP)
i don’t know… many of the interface options do not make sense for the amplitude generation, and will therefore have to be removed…

> 4)can you check why you set self['has_loops'] = False (line 466 of the diff) around line 220 of madgraph/fks/fks_helas_objects.py
it starts with false, but then, after the calls to
async_generate_born
it is updated
                has_loops = bornout[2]
                self['has_loops'] = self['has_loops'] or has_loops

> 6) Would not be better to not write the data on a file (via pickle), but add them in a multiprocessing.queue object that can be used by the main process? Or do you see a problem with that?
 The main reason to use pkl files is to keep the RAM as free as possible
> 7) in madgraph/interface/amcatnlo_interface.py you define glob_directories_map
> Defining a non static global is always annoying and creates troubles very often ( I have to apologize to have done it in aloha). Is it really necessary? and is it thread safe?
It can be put as global. Josh said that this is related to memory/cpu performance. I think it is thread safe
> 8) Is it possible to have a printout when the last process is generated and that you collect the info (I guess that you do that) since it hangs on one core on a line of type:
> INFO: Generating born process: s~ s > t t t~ t~ [ all = QCD ]
> I guess he is doing something else actually.
i have added some logging
>
> So this is very very nice. Nice work!!
>
I have pushed the changes, now I’ll look at valentin’s comments…

Cheers,

Marco

> Cheers,
>
> Olivier
>
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/2.3.4-low-memory/+merge/286337
> Your team MadDevelopers is requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/2.3.4-low-memory into lp:~maddevelopers/mg5amcnlo/2.3.4.

314. By marco zaro

update with olivier's comments

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :
Download full text (4.0 KiB)

Thanks,

>> 3) concerning the ncores options, would not be better to pass to the class the self.options of the interface? Such that we do not have to multiply the optional argument when we to have access to any of the options define in that dictionary (this should have been done for OLP)
> i don’t know… many of the interface options do not make sense for the amplitude generation, and will therefore have to be removed…

No just keep self.options and do not touch to it
such that this is just a pointer to the one of the interface
This will not use any memory (just a pointer in term of memory), actually less that what you do right now. (since you store two additional value if we count OLP)
So yes you will have access to pointless information but I do not see the problem.

Thanks a lot for the rest.

Cheers,

Olivier

> On Feb 19, 2016, at 09:33, marco zaro <email address hidden> wrote:
>
> Ciao Olivier,
> thanks for the review
> On 18 Feb 2016, at 20:44, Olivier Mattelaer <email address hidden> wrote:
>
>> Review: Needs Information
>>
>> Hi Marco,
>>
>> That's so cool, I missed the fact that a library was allowing to evade the GIL limitation.
>> This is so much nicer than using the Threading library (like the multi-core option of MG).
>> I guess that we should think to change the multi-core options of MG to move to this multiprocessing library.
>>
>>
>> 1) Is there any reason why this mode is not set as default?
> for simple processes, the old mode works OK, and has a more detailed logging (number of diagrams, etc).
>> 2) It should be indicated in the UpdateNotes how to use it.
> done
>> 3) concerning the ncores options, would not be better to pass to the class the self.options of the interface? Such that we do not have to multiply the optional argument when we to have access to any of the options define in that dictionary (this should have been done for OLP)
> i don’t know… many of the interface options do not make sense for the amplitude generation, and will therefore have to be removed…
>
>> 4)can you check why you set self['has_loops'] = False (line 466 of the diff) around line 220 of madgraph/fks/fks_helas_objects.py
> it starts with false, but then, after the calls to
> async_generate_born
> it is updated
> has_loops = bornout[2]
> self['has_loops'] = self['has_loops'] or has_loops
>
>> 6) Would not be better to not write the data on a file (via pickle), but add them in a multiprocessing.queue object that can be used by the main process? Or do you see a problem with that?
> The main reason to use pkl files is to keep the RAM as free as possible
>> 7) in madgraph/interface/amcatnlo_interface.py you define glob_directories_map
>> Defining a non static global is always annoying and creates troubles very often ( I have to apologize to have done it in aloha). Is it really necessary? and is it thread safe?
> It can be put as global. Josh said that this is related to memory/cpu performance. I think it is thread safe
>> 8) Is it possible to have a printout when the last process is generated and that you collect the info (I guess that you do that) sinc...

Read more...

315. By marco zaro

nexternal and ninitial are correctly written in proc_characteristics

316. By marco zaro

fixed bug occurring with write_lh_order for OLP!=MadLoop

Revision history for this message
marco zaro (marco-zaro) wrote :
Download full text (7.2 KiB)

Ciao Valentin,
thanks for your review, so:

On 18 Feb 2016, at 23:48, Valentin Hirschi <email address hidden> wrote:

> Review: Needs Fixing
>
> Hi Marco,
>
> Awesome job, really.
>
> On the testing side, I noticed the following:
>
> a) Doing a full comparison of p p > t t~ j [QCD] generated in single and multicore, I noticed that the file 'SubProcesses/proc_characteristics' was incorrect in mutlicore, since it contains:
> ninitial = 0
> nexternal = 0
hmm right, i was not checking this file with the unit test. I have added it to the test, it should be fixed now (rev 315)
>
> b) This implementation broke process generation with another OLP than MadLoop (i.e. Gosam).
> When selecting Gosam as OLP, the generation crashes at:
>
> FKSProcessError : Wrong type of argument for matrix_elements in function write_lh_order.
>
> from
>
> [...]
> File "/Users/valentin/Documents/Work/MG5/2.3.4-low-memory/madgraph/iolibs/export_fks.py", line 1355, in generate_virtuals_from_OLP
> self.write_lh_order(filename, FKSHMultiproc.get('matrix_elements'),OLP)
> File "/Users/valentin/Documents/Work/MG5/2.3.4-low-memory/madgraph/iolibs/export_fks.py", line 1623, in write_lh_order
> 'matrix_elements in function write_lh_order.’)
>
> Of course we don't want to have any sort of parallelization on behalf of GoSam, but normally here the only thing that is done is the writing of the leshouches order. The actual generation with GoSam should take place at the very end, basically after that the process is generated and the parallelization is done. So if this is not too difficult to fix, I think it would be worth doing so. Otherwise, explicitly forbid this mode when OLP is not MadLoop, but that would be weird because there is no reason for doing so.
> Note that you don't need to have GoSam installed to test this I think, because it crashes when writing the leshouches order file, so before actually calling GoSam.
>
I have added a unit test also for this and reproduced your error. It should be fixed now (rev 316), please check that i did not screw anything, as some modifications to the code were needed (the unit tests pass after trival fixes)

> c) This is a problem which was not introduced by this branch but that I realized now and needs to be fixed. It showed up because I saw that you had to play around with the overall 'max_loop_coefs' value for different FKSHelasMatrixElements.
> So imagine you do the following:
>
> MG5_aMC>import model HC_NLO_X0_UFO-heft
> MG5_aMC>generate g g > x0 [virt=QCD]
> MG5_aMC>add process g g > z [virt=QCD]
> MG5_aMC>output MyTest
>
> Then you will see the message:
> """
> ML5 has just output processes which do not share the same maximum loop wavefunction size or the same maximum loop vertex rank. This is potentially dangerous. Please prefer to output them separately.
> """
>
> This is because if you look at the different coef_specs.inc, you will find:
>
>> cat MyTest/SubProcesses/P0_gg_x0/coef_specs.inc
> INTEGER MAXLWFSIZE
> PARAMETER (MAXLWFSIZE=4)
> INTEGER LOOP_MAXCOEFS
> PARAMETER (LOOP_MAXCOEFS=70)
> INTEGER VERTEXMAXCOEFS
> PARAMETER (VERTEXMAXCOEFS=15)
>
>> cat MyTest/SubProcess...

Read more...

317. By Valentin Hirschi

1. Fixed an issue of the FKS output when the MG option loop_color_flow is set to True.

Revision history for this message
Valentin Hirschi (valentin-hirschi) wrote :
Download full text (9.3 KiB)

Hi Marco,

One more thing, please check how you defined the possible values for the option 'low_mem_multicore_nlo_generation' that you have introduced because the auto completion to 'True False default' does not work.

> Ciao Valentin,
> thanks for your review, so:

> On 18 Feb 2016, at 23:48, Valentin Hirschi <email address hidden> wrote:
>
> > Review: Needs Fixing
> >
> > Hi Marco,
> >
> > Awesome job, really.
> >
> > On the testing side, I noticed the following:
> >
> > a) Doing a full comparison of p p > t t~ j [QCD] generated in single and
> multicore, I noticed that the file 'SubProcesses/proc_characteristics' was
> incorrect in mutlicore, since it contains:
> > ninitial = 0
> > nexternal = 0
> hmm right, i was not checking this file with the unit test. I have added it to
> the test, it should be fixed now (rev 315)
> >
> > b) This implementation broke process generation with another OLP than
> MadLoop (i.e. Gosam).
> > When selecting Gosam as OLP, the generation crashes at:
> >
> > FKSProcessError : Wrong type of argument for matrix_elements in function
> write_lh_order.
> >
> > from
> >
> > [...]
> > File "/Users/valentin/Documents/Work/MG5/2.3.4-low-
> memory/madgraph/iolibs/export_fks.py", line 1355, in
> generate_virtuals_from_OLP
> > self.write_lh_order(filename, FKSHMultiproc.get('matrix_elements'),OLP)
> > File "/Users/valentin/Documents/Work/MG5/2.3.4-low-
> memory/madgraph/iolibs/export_fks.py", line 1623, in write_lh_order
> > 'matrix_elements in function write_lh_order.’)
> >
> > Of course we don't want to have any sort of parallelization on behalf of
> GoSam, but normally here the only thing that is done is the writing of the
> leshouches order. The actual generation with GoSam should take place at the
> very end, basically after that the process is generated and the
> parallelization is done. So if this is not too difficult to fix, I think it
> would be worth doing so. Otherwise, explicitly forbid this mode when OLP is
> not MadLoop, but that would be weird because there is no reason for doing so.
> > Note that you don't need to have GoSam installed to test this I think,
> because it crashes when writing the leshouches order file, so before actually
> calling GoSam.
> >
> I have added a unit test also for this and reproduced your error. It should be
> fixed now (rev 316), please check that i did not screw anything, as some
> modifications to the code were needed (the unit tests pass after trival fixes)

So when not using the low-mem option, now OLP = GoSam crashes with:

AttributeError : 'MasterCmd' object has no attribute 'born_processes_for_olp'

at

[...]
  File "/Users/valentin/Documents/Work/MG5/2.3.4-low-memory/madgraph/interface/amcatnlo_interface.py", line 557, in do_output
    self.born_processes_for_olp,self._export_dir,self.options['OLP'])
AttributeError: 'MasterCmd' object has no attribute 'born_processes_for_olp'

And when doing it with the new option turned on, it goes through but crashes at the compilation because apparently you still linking the version of 'BinothLHA.f' for MadLoop and not the one for GoSam as it is done when not using the new option.

>
> > c) This is a problem which was n...

Read more...

318. By marco zaro

fixed autocompletion, behaviour with gosam and [real=QCD]

Revision history for this message
marco zaro (marco-zaro) wrote :
Download full text (10.0 KiB)

Ciao Valentin,
Thanks for the review…
I should have addressed all points now, see below…
cheers,

Marco
On 19 Feb 2016, at 21:04, Valentin Hirschi <email address hidden> wrote:

> Hi Marco,
>
> One more thing, please check how you defined the possible values for the option 'low_mem_multicore_nlo_generation' that you have introduced because the auto completion to 'True False default' does not work.

fixed
>
>> Ciao Valentin,
>> thanks for your review, so:
>
>> On 18 Feb 2016, at 23:48, Valentin Hirschi <email address hidden> wrote:
>>
>>> Review: Needs Fixing
>>>
>>> Hi Marco,
>>>
>>> Awesome job, really.
>>>
>>> On the testing side, I noticed the following:
>>>
>>> a) Doing a full comparison of p p > t t~ j [QCD] generated in single and
>> multicore, I noticed that the file 'SubProcesses/proc_characteristics' was
>> incorrect in mutlicore, since it contains:
>>> ninitial = 0
>>> nexternal = 0
>> hmm right, i was not checking this file with the unit test. I have added it to
>> the test, it should be fixed now (rev 315)
>>>
>>> b) This implementation broke process generation with another OLP than
>> MadLoop (i.e. Gosam).
>>> When selecting Gosam as OLP, the generation crashes at:
>>>
>>> FKSProcessError : Wrong type of argument for matrix_elements in function
>> write_lh_order.
>>>
>>> from
>>>
>>> [...]
>>> File "/Users/valentin/Documents/Work/MG5/2.3.4-low-
>> memory/madgraph/iolibs/export_fks.py", line 1355, in
>> generate_virtuals_from_OLP
>>> self.write_lh_order(filename, FKSHMultiproc.get('matrix_elements'),OLP)
>>> File "/Users/valentin/Documents/Work/MG5/2.3.4-low-
>> memory/madgraph/iolibs/export_fks.py", line 1623, in write_lh_order
>>> 'matrix_elements in function write_lh_order.’)
>>>
>>> Of course we don't want to have any sort of parallelization on behalf of
>> GoSam, but normally here the only thing that is done is the writing of the
>> leshouches order. The actual generation with GoSam should take place at the
>> very end, basically after that the process is generated and the
>> parallelization is done. So if this is not too difficult to fix, I think it
>> would be worth doing so. Otherwise, explicitly forbid this mode when OLP is
>> not MadLoop, but that would be weird because there is no reason for doing so.
>>> Note that you don't need to have GoSam installed to test this I think,
>> because it crashes when writing the leshouches order file, so before actually
>> calling GoSam.
>>>
>> I have added a unit test also for this and reproduced your error. It should be
>> fixed now (rev 316), please check that i did not screw anything, as some
>> modifications to the code were needed (the unit tests pass after trival fixes)
>
> So when not using the low-mem option, now OLP = GoSam crashes with:
>
> AttributeError : 'MasterCmd' object has no attribute ‘born_processes_for_olp'

>
> at
>
> [...]
> File "/Users/valentin/Documents/Work/MG5/2.3.4-low-memory/madgraph/interface/amcatnlo_interface.py", line 557, in do_output
> self.born_processes_for_olp,self._export_dir,self.options['OLP'])
> AttributeError: 'MasterCmd' object has no attribute ‘born_processes_for_olp’
that should be ok now, please chec...

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

Hi Marco,

I will accept the merge even without the fix associate to this:

>> 3) concerning the ncores options, would not be better to pass to the class the self.options of the interface? Such that we do not have to multiply the optional argument when we to have access to any of the options define in that dictionary (this should have been done for OLP)

But please do like that next time, since it is easier if we have access to the full user options rather that duplicate the information.

Cheers,

Olivier

review: Approve
319. By marco zaro

changed the arguments passed to FKSMultiProcess to options

Revision history for this message
marco zaro (marco-zaro) wrote :

Hi Olivier,
I have changed the arguments to options, please have a look. I have also removed a chunk of code from fks_base (10 lines starting with #check limitations of FKS) which did not make any sense and was never used.

Let me know if this is fine…
Cheers,

Marco
On 24 Feb 2016, at 13:31, Olivier Mattelaer <email address hidden> wrote:

> Review: Approve
>
> Hi Marco,
>
> I will accept the merge even without the fix associate to this:
>
>>> 3) concerning the ncores options, would not be better to pass to the class the self.options of the interface? Such that we do not have to multiply the optional argument when we to have access to any of the options define in that dictionary (this should have been done for OLP)
>
> But please do like that next time, since it is easier if we have access to the full user options rather that duplicate the information.
>
> Cheers,
>
> Olivier
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/2.3.4-low-memory/+merge/286337
> Your team MadDevelopers is requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/2.3.4-low-memory into lp:~maddevelopers/mg5amcnlo/2.3.4.

320. By marco zaro

imerged with latest 2.3.4

Revision history for this message
Valentin Hirschi (valentin-hirschi) wrote :

Hi Marco,

I tested the OLP=GoSam behavior and a couple other things and everything went smooth.

So please just confirm that you checked that there couldn't be any border effect on the modification of the function 'RunCardNLO.create_default_for_process(' from other parts of the code that might use it and also the fact that no deepcopy at all is used in the new low-mem mode.

Anyway, I assume that the above is indeed the case so that I already give my green light.

Great work,

Cheers

review: Approve
Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

> Hi Olivier,
> I have changed the arguments to options, please have a look. I have also
> removed a chunk of code from fks_base (10 lines starting with #check
> limitations of FKS) which did not make any sense and was never used.

That's already much nicer. Thanks.

Actually my argument was to avoid to use the full options of MadGraph:
and therefore have instead of
self._fks_multi_proc = fks_base.FKSMultiProcess(myprocdef,fks_options)
the following line:
self._fks_multi_proc = fks_base.FKSMultiProcess(myprocdef,self.options)

Obviously, this force to have a slightly different behavior for
ncores_for_proc_gen
since that one is not part of the self.options dictionary.
The two advantages: all the configuration options are available and less memory consumption (since you have one less dictionary in memory).

But this is already so much nicer that I'm more than happy with your nice change.
So this comment was just to clarify my point and not to encourage you to perform any changes.

Thanks,

Olivier

Olivier

Revision history for this message
marco zaro (marco-zaro) wrote :

Ciao Olivier,
thanks for the comment
On 29 Feb 2016, at 11:50, Olivier Mattelaer <email address hidden> wrote:

>> Hi Olivier,
>> I have changed the arguments to options, please have a look. I have also
>> removed a chunk of code from fks_base (10 lines starting with #check
>> limitations of FKS) which did not make any sense and was never used.
>
> That's already much nicer. Thanks.
>
> Actually my argument was to avoid to use the full options of MadGraph:
> and therefore have instead of
> self._fks_multi_proc = fks_base.FKSMultiProcess(myprocdef,fks_options)
> the following line:
> self._fks_multi_proc = fks_base.FKSMultiProcess(myprocdef,self.options)
anyway the same options will have to be passed to the MultiProcess Instance, and many of them are not valid.
So sooner or later one has to create a new dictionary…
I will proceed with the merge

Cheers,

Marco
>
> Obviously, this force to have a slightly different behavior for
> ncores_for_proc_gen
> since that one is not part of the self.options dictionary.
> The two advantages: all the configuration options are available and less memory consumption (since you have one less dictionary in memory).
>
> But this is already so much nicer that I'm more than happy with your nice change.
> So this comment was just to clarify my point and not to encourage you to perform any changes.
>
> Thanks,
>
> Olivier
>
> Olivier
>
> --
> https://code.launchpad.net/~maddevelopers/mg5amcnlo/2.3.4-low-memory/+merge/286337
> Your team MadDevelopers is requested to review the proposed merge of lp:~maddevelopers/mg5amcnlo/2.3.4-low-memory into lp:~maddevelopers/mg5amcnlo/2.3.4.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'UpdateNotes.txt'
2--- UpdateNotes.txt 2016-02-23 22:55:27 +0000
3+++ UpdateNotes.txt 2016-02-24 13:54:50 +0000
4@@ -1,6 +1,12 @@
5 Update notes for MadGraph5_aMC@NLO (in reverse time order)
6
7 2.4.0(XX/XX/XX)
8+ MZ: new NLO generation mode. It is more efficient from the memory and CPU point of
9+ view, in particular for high-multiplicity processes.
10+ Many thanks to Josh Bendavid for his fundamental contribution for this.
11+ The mode can be enabled with
12+ > set low_mem_multicore_nlo_generation True
13+ before generating the process.
14 VH: Interfaced MadLoop to Samurai and Ninja (the latter is now the default)
15 OM: Adding the possibility to use new syntax for tree-level processes:
16 QED==2 and QCD>2: The first allows to select exactly a power of the coupling (at amplitude level
17
18=== modified file 'madgraph/fks/fks_base.py'
19--- madgraph/fks/fks_base.py 2015-10-20 10:56:04 +0000
20+++ madgraph/fks/fks_base.py 2016-02-24 13:54:50 +0000
21@@ -44,15 +44,18 @@
22 def default_setup(self):
23 """Default values for all properties"""
24 super(FKSMultiProcess, self).default_setup()
25+ self['real_amplitudes'] = diagram_generation.AmplitudeList()
26+ self['pdgs'] = []
27 self['born_processes'] = FKSProcessList()
28 if not 'OLP' in self.keys():
29 self['OLP'] = 'MadLoop'
30+ self['ncores_for_proc_gen'] = 0
31
32 def get_sorted_keys(self):
33 """Return particle property names as a nicely sorted list."""
34 keys = super(FKSMultiProcess, self).get_sorted_keys()
35 keys += ['born_processes', 'real_amplitudes', 'real_pdgs', 'has_isr',
36- 'has_fsr', 'OLP']
37+ 'has_fsr', 'OLP', 'ncores_for_proc_gen']
38 return keys
39
40 def filter(self, name, value):
41@@ -77,10 +80,15 @@
42 if not isinstance(value,str):
43 raise self.PhysicsObjectError, \
44 "%s is not a valid string for OLP " % str(value)
45+
46+ if name == 'ncores_for_proc_gen':
47+ if not isinstance(value,int):
48+ raise self.PhysicsObjectError, \
49+ "%s is not a valid value for ncores_for_proc_gen " % str(value)
50
51 return super(FKSMultiProcess,self).filter(name, value)
52
53- def __init__(self, *arguments, **options):
54+ def __init__(self, procdef=None, options={}):
55 """Initializes the original multiprocess, then generates the amps for the
56 borns, then generate the born processes and the reals.
57 Real amplitudes are stored in real_amplitudes according on the pdgs of their
58@@ -94,17 +102,25 @@
59 for logg in loggers_off:
60 logg.setLevel(logging.WARNING)
61
62- self['real_amplitudes'] = diagram_generation.AmplitudeList()
63- self['pdgs'] = []
64-
65+ # OLP option
66+ olp='MadLoop'
67 if 'OLP' in options.keys():
68- self['OLP']=options['OLP']
69+ olp = options['OLP']
70 del options['OLP']
71
72+ ncores_for_proc_gen = 0
73+ # ncores_for_proc_gen has the following meaning
74+ # 0 : do things the old way
75+ # > 0 use ncores_for_proc_gen
76+ # -1 : use all cores
77+ if 'ncores_for_proc_gen' in options.keys():
78+ ncores_for_proc_gen = options['ncores_for_proc_gen']
79+ del options['ncores_for_proc_gen']
80
81 try:
82 # Now generating the borns for the first time.
83- super(FKSMultiProcess, self).__init__(*arguments,**options)
84+ super(FKSMultiProcess, self).__init__(procdef, **options)
85+
86 except diagram_generation.NoDiagramException as error:
87 # If no born, then this process most likely does not have any.
88 raise NoBornException, "Born diagrams could not be generated for the "+\
89@@ -113,17 +129,9 @@
90 " processes yet, but you can still use MadLoop if you want to "+\
91 "only generate them."+\
92 " For this, use the 'virt=' mode, without multiparticle labels."
93-
94- #check limitation of FKS
95- if arguments and isinstance(arguments, MG.Process):
96- myprocdef = arguments[0]
97- misc.sprint( myprocdef.keys())
98- if myprocdef['perturbation_couplings']!=['QCD']:
99- raise InvalidCmd("FKS for reals only available in QCD for now, you asked %s" \
100- % ', '.join(myprocdef['perturbation_couplings']))
101- elif myprocdef.get_ninitial()==1:
102- raise InvalidCmd("At this stage aMC@NLO cannot handle decay process.\n"+\
103- " Only Leading Order (loop-induced and tree level) decay are supported.")
104+
105+ self['OLP'] = olp
106+ self['ncores_for_proc_gen'] = ncores_for_proc_gen
107
108 #check process definition(s):
109 # a process such as g g > g g will lead to real emissions
110@@ -164,58 +172,63 @@
111 'Process', ''),
112 i + 1, len(amps)))
113
114- born = FKSProcess(amp)
115+ born = FKSProcess(amp, ncores_for_proc_gen = self['ncores_for_proc_gen'])
116 self['born_processes'].append(born)
117 born.generate_reals(self['pdgs'], self['real_amplitudes'])
118
119- born_pdg_list = [[l['id'] for l in born.born_proc['legs']] \
120- for born in self['born_processes'] ]
121-
122- for born in self['born_processes']:
123- for real in born.real_amps:
124- real.find_fks_j_from_i(born_pdg_list)
125-
126- if amps:
127- if self['process_definitions'][0].get('NLO_mode') == 'all':
128- self.generate_virtuals()
129-
130- elif not self['process_definitions'][0].get('NLO_mode') in ['all', 'real','LOonly']:
131- raise fks_common.FKSProcessError(\
132- "Not a valid NLO_mode for a FKSMultiProcess: %s" % \
133- self['process_definitions'][0].get('NLO_mode'))
134-
135- # now get the total number of diagrams
136- n_diag_born = sum([len(amp.get('diagrams'))
137- for amp in self.get_born_amplitudes()])
138- n_diag_real = sum([len(amp.get('diagrams'))
139- for amp in self.get_real_amplitudes()])
140- n_diag_virt = sum([len(amp.get('loop_diagrams'))
141- for amp in self.get_virt_amplitudes()])
142-
143- if n_diag_virt == 0 and n_diag_real ==0 and \
144- not self['process_definitions'][0].get('NLO_mode') == 'LOonly':
145- raise fks_common.FKSProcessError(
146- 'This process does not have any correction up to NLO in %s'\
147- %','.join(perturbation))
148-
149- logger.info(('Generated %d subprocesses with %d real emission diagrams, ' + \
150- '%d born diagrams and %d virtual diagrams') % \
151- (len(self['born_processes']), n_diag_real, n_diag_born, n_diag_virt))
152-
153- for i, logg in enumerate(loggers_off):
154- logg.setLevel(old_levels[i])
155+ if not self['ncores_for_proc_gen']:
156+ # old generation mode
157+
158+ born_pdg_list = [[l['id'] for l in born.born_proc['legs']] \
159+ for born in self['born_processes'] ]
160+
161+ for born in self['born_processes']:
162+ for real in born.real_amps:
163+ real.find_fks_j_from_i(born_pdg_list)
164+ if amps:
165+ if self['process_definitions'][0].get('NLO_mode') == 'all':
166+ self.generate_virtuals()
167+
168+ elif not self['process_definitions'][0].get('NLO_mode') in ['all', 'real','LOonly']:
169+ raise fks_common.FKSProcessError(\
170+ "Not a valid NLO_mode for a FKSMultiProcess: %s" % \
171+ self['process_definitions'][0].get('NLO_mode'))
172+
173+ # now get the total number of diagrams
174+ n_diag_born = sum([len(amp.get('diagrams'))
175+ for amp in self.get_born_amplitudes()])
176+ n_diag_real = sum([len(amp.get('diagrams'))
177+ for amp in self.get_real_amplitudes()])
178+ n_diag_virt = sum([len(amp.get('loop_diagrams'))
179+ for amp in self.get_virt_amplitudes()])
180+
181+ if n_diag_virt == 0 and n_diag_real ==0 and \
182+ not self['process_definitions'][0].get('NLO_mode') == 'LOonly':
183+ raise fks_common.FKSProcessError(
184+ 'This process does not have any correction up to NLO in %s'\
185+ %','.join(perturbation))
186+
187+ logger.info(('Generated %d subprocesses with %d real emission diagrams, ' + \
188+ '%d born diagrams and %d virtual diagrams') % \
189+ (len(self['born_processes']), n_diag_real, n_diag_born, n_diag_virt))
190+
191+ for i, logg in enumerate(loggers_off):
192+ logg.setLevel(old_levels[i])
193
194 self['has_isr'] = any([proc.isr for proc in self['born_processes']])
195 self['has_fsr'] = any([proc.fsr for proc in self['born_processes']])
196
197 def add(self, other):
198 """combines self and other, extending the lists of born/real amplitudes"""
199+ self['process_definitions'].extend(other['process_definitions'])
200+ self['amplitudes'].extend(other['amplitudes'])
201 self['born_processes'].extend(other['born_processes'])
202 self['real_amplitudes'].extend(other['real_amplitudes'])
203 self['pdgs'].extend(other['pdgs'])
204 self['has_isr'] = self['has_isr'] or other['has_isr']
205 self['has_fsr'] = self['has_fsr'] or other['has_fsr']
206 self['OLP'] = other['OLP']
207+ self['ncores_for_proc_gen'] = other['ncores_for_proc_gen']
208
209 def get_born_amplitudes(self):
210 """return an amplitudelist with the born amplitudes"""
211@@ -394,11 +407,16 @@
212 """The class for a FKS process. Starts from the born process and finds
213 all the possible splittings."""
214
215- def __init__(self, start_proc = None, remove_reals = True):
216+ def __init__(self, start_proc = None, remove_reals = True, ncores_for_proc_gen=0):
217 """initialization: starts either from an amplitude or a process,
218 then init the needed variables.
219 remove_borns tells if the borns not needed for integration will be removed
220- from the born list (mainly used for testing)"""
221+ from the born list (mainly used for testing)
222+ ncores_for_proc_gen has the following meaning
223+ 0 : do things the old way
224+ > 0 use ncores_for_proc_gen
225+ -1 : use all cores
226+ """
227
228 self.splittings = {}
229 self.reals = []
230@@ -416,6 +434,7 @@
231 self.nincoming = 0
232 self.virt_amp = None
233 self.perturbation = 'QCD'
234+ self.ncores_for_proc_gen = ncores_for_proc_gen
235
236 if not remove_reals in [True, False]:
237 raise fks_common.FKSProcessError(\
238@@ -509,7 +528,6 @@
239 self.real_amps = real_amps
240
241
242-
243 def generate_reals(self, pdg_list, real_amp_list, combine=True): #test written
244 """For all the possible splittings, creates an FKSRealProcess.
245 It removes double counted configorations from the ones to integrates and
246@@ -534,8 +552,9 @@
247 self.find_reals_to_integrate()
248 if combine:
249 self.combine_real_amplitudes()
250- self.generate_real_amplitudes(pdg_list, real_amp_list)
251- self.link_born_reals()
252+ if not self.ncores_for_proc_gen:
253+ self.generate_real_amplitudes(pdg_list, real_amp_list)
254+ self.link_born_reals()
255
256
257 def link_born_reals(self):
258
259=== modified file 'madgraph/fks/fks_helas_objects.py'
260--- madgraph/fks/fks_helas_objects.py 2015-10-01 16:00:08 +0000
261+++ madgraph/fks/fks_helas_objects.py 2016-02-24 13:54:50 +0000
262@@ -25,20 +25,183 @@
263 import madgraph.fks.fks_base as fks_base
264 import madgraph.fks.fks_common as fks_common
265 import madgraph.loop.loop_helas_objects as loop_helas_objects
266+import madgraph.loop.loop_diagram_generation as loop_diagram_generation
267 import copy
268 import logging
269 import array
270+import multiprocessing
271+import signal
272+import tempfile
273+import cPickle
274+import itertools
275+import os
276
277 logger = logging.getLogger('madgraph.fks_helas_objects')
278
279
280+#functions to be used in the ncores_for_proc_gen mode
281+def async_generate_real(args):
282+ i = args[0]
283+ real_amp = args[1]
284+
285+ #amplitude generation
286+ amplitude = real_amp.generate_real_amplitude()
287+ helasreal = helas_objects.HelasMatrixElement(amplitude)
288+ logger.info('Generating real %s' % \
289+ real_amp.process.nice_string(print_weighted=False).replace('Process', 'process'))
290+
291+ # Keep track of already generated color objects, to reuse as
292+ # much as possible
293+ list_colorize = []
294+ list_color_basis = []
295+ list_color_matrices = []
296+
297+ # Now this keeps track of the color matrices created from the loop-born
298+ # color basis. Keys are 2-tuple with the index of the loop and born basis
299+ # in the list above and the value is the resulting matrix.
300+ dict_loopborn_matrices = {}
301+ # The dictionary below is simply a container for convenience to be
302+ # passed to the function process_color.
303+ color_information = { 'list_colorize' : list_colorize,
304+ 'list_color_basis' : list_color_basis,
305+ 'list_color_matrices' : list_color_matrices,
306+ 'dict_loopborn_matrices' : dict_loopborn_matrices}
307+
308+ helas_objects.HelasMultiProcess.process_color(helasreal,color_information)
309+
310+ outdata = [amplitude,helasreal]
311+
312+ output = tempfile.NamedTemporaryFile(delete = False)
313+ cPickle.dump(outdata,output,protocol=2)
314+ output.close()
315+
316+ return [output.name,helasreal.get_num_configs(),helasreal.get_nexternal_ninitial()[0]]
317+
318+
319+def async_generate_born(args):
320+ i = args[0]
321+ born = args[1]
322+ born_pdg_list = args[2]
323+ loop_orders = args[3]
324+ pdg_list = args[4]
325+ loop_optimized = args[5]
326+ OLP = args[6]
327+ realmapout = args[7]
328+
329+ logger.info('Generating born %s' % \
330+ born.born_proc.nice_string(print_weighted=False).replace('Process', 'process'))
331+
332+ #load informations on reals from temp files
333+ helasreal_list = []
334+ for amp in born.real_amps:
335+ idx = pdg_list.index(amp.pdgs)
336+ infilename = realmapout[idx]
337+ infile = open(infilename,'rb')
338+ realdata = cPickle.load(infile)
339+ infile.close()
340+ amp.amplitude = realdata[0]
341+ helasreal_list.append(realdata[1])
342+
343+ born.link_born_reals()
344+
345+ for amp in born.real_amps:
346+ amp.find_fks_j_from_i(born_pdg_list)
347+
348+ # generate the virtuals if needed
349+ has_loops = False
350+ if born.born_proc.get('NLO_mode') == 'all' and OLP == 'MadLoop':
351+ myproc = copy.copy(born.born_proc)
352+ # take the orders that are actually used by the matrix element
353+ myproc['orders'] = loop_orders
354+ myproc['legs'] = fks_common.to_legs(copy.copy(myproc['legs']))
355+ myamp = loop_diagram_generation.LoopAmplitude(myproc)
356+ if myamp.get('diagrams'):
357+ has_loops = True
358+ born.virt_amp = myamp
359+
360+ helasfull = FKSHelasProcess(born, helasreal_list,
361+ loop_optimized = loop_optimized,
362+ decay_ids=[],
363+ gen_color=False)
364+
365+ processes = helasfull.born_matrix_element.get('processes')
366+
367+ metag = helas_objects.IdentifyMETag.create_tag(helasfull.born_matrix_element.get('base_amplitude'))
368+
369+ outdata = helasfull
370+
371+ output = tempfile.NamedTemporaryFile(delete = False)
372+ cPickle.dump(outdata,output,protocol=2)
373+ output.close()
374+
375+ return [output.name,metag,has_loops,processes]
376+
377+
378+def async_finalize_matrix_elements(args):
379+
380+ i = args[0]
381+ mefile = args[1]
382+ duplist = args[2]
383+
384+ infile = open(mefile,'rb')
385+ me = cPickle.load(infile)
386+ infile.close()
387+
388+ #set unique id based on position in unique me list
389+ me.get('processes')[0].set('uid', i)
390+
391+ # Always create an empty color basis, and the
392+ # list of raw colorize objects (before
393+ # simplification) associated with amplitude
394+ col_basis = color_amp.ColorBasis()
395+ new_amp = me.born_matrix_element.get_base_amplitude()
396+ me.born_matrix_element.set('base_amplitude', new_amp)
397+ colorize_obj = col_basis.create_color_dict_list(new_amp)
398+
399+ col_basis.build()
400+ col_matrix = color_amp.ColorMatrix(col_basis)
401+
402+ me.born_matrix_element.set('color_basis',col_basis)
403+ me.born_matrix_element.set('color_matrix',col_matrix)
404+
405+ for iother,othermefile in enumerate(duplist):
406+ infileother = open(othermefile,'rb')
407+ otherme = cPickle.load(infileother)
408+ infileother.close()
409+ me.add_process(otherme)
410+
411+ me.set_color_links()
412+
413+ initial_states=[]
414+ for fksreal in me.real_processes:
415+ # Pick out all initial state particles for the two beams
416+ initial_states.append(sorted(list(set((p.get_initial_pdg(1),p.get_initial_pdg(2)) for \
417+ p in fksreal.matrix_element.get('processes')))))
418+
419+ if me.virt_matrix_element:
420+ has_virtual = True
421+ else:
422+ has_virtual = False
423+
424+ #data to write to file
425+ outdata = me
426+
427+ output = tempfile.NamedTemporaryFile(delete = False)
428+ cPickle.dump(outdata,output,protocol=2)
429+ output.close()
430+
431+ #data to be returned to parent process (filename plus small objects only)
432+ return [output.name,initial_states,me.get_used_lorentz(),me.get_used_couplings(),has_virtual]
433+
434+
435 class FKSHelasMultiProcess(helas_objects.HelasMultiProcess):
436 """class to generate the helas calls for a FKSMultiProcess"""
437
438 def get_sorted_keys(self):
439 """Return particle property names as a nicely sorted list."""
440 keys = super(FKSHelasMultiProcess, self).get_sorted_keys()
441- keys += ['real_matrix_elements', ['has_isr'], ['has_fsr']]
442+ keys += ['real_matrix_elements', ['has_isr'], ['has_fsr'],
443+ 'used_lorentz', 'used_couplings', 'max_configs', 'max_particles', 'processes']
444 return keys
445
446 def filter(self, name, value):
447@@ -61,23 +224,190 @@
448
449 self.loop_optimized = loop_optimized
450
451- # generate the real ME's if they are needed.
452- # note that it may not be always the case, e.g. it the NLO_mode is LOonly
453- if fksmulti['real_amplitudes']:
454- logger.info('Generating real emission matrix-elements...')
455- self['real_matrix_elements'] = self.generate_matrix_elements(
456- copy.copy(fksmulti['real_amplitudes']), combine_matrix_elements = False)
457- else:
458- self['real_matrix_elements'] = helas_objects.HelasMatrixElementList()
459-
460- self['matrix_elements'] = self.generate_matrix_elements_fks(
461- fksmulti,
462- gen_color, decay_ids)
463- self['initial_states']=[]
464+ self['used_lorentz'] = []
465+ self['used_couplings'] = []
466+ self['processes'] = []
467+
468+ self['max_particles'] = -1
469+ self['max_configs'] = -1
470+
471+ if not fksmulti['ncores_for_proc_gen']:
472+ # generate the real ME's if they are needed.
473+ # note that it may not be always the case, e.g. it the NLO_mode is LOonly
474+ if fksmulti['real_amplitudes']:
475+ logger.info('Generating real emission matrix-elements...')
476+ self['real_matrix_elements'] = self.generate_matrix_elements(
477+ copy.copy(fksmulti['real_amplitudes']), combine_matrix_elements = False)
478+ else:
479+ self['real_matrix_elements'] = helas_objects.HelasMatrixElementList()
480+
481+ self['matrix_elements'] = self.generate_matrix_elements_fks(
482+ fksmulti,
483+ gen_color, decay_ids)
484+ self['initial_states']=[]
485+ self['has_loops'] = len(self.get_virt_matrix_elements()) > 0
486+
487+ else:
488+ self['has_loops'] = False
489+ #more efficient generation
490+ born_procs = fksmulti.get('born_processes')
491+ born_pdg_list = [[l['id'] for l in born.born_proc['legs']] \
492+ for born in born_procs ]
493+ loop_orders = {}
494+ for born in born_procs:
495+ for coup, val in fks_common.find_orders(born.born_amp).items():
496+ try:
497+ loop_orders[coup] = max([loop_orders[coup], val])
498+ except KeyError:
499+ loop_orders[coup] = val
500+ pdg_list = []
501+ real_amp_list = []
502+ for born in born_procs:
503+ for amp in born.real_amps:
504+ if not pdg_list.count(amp.pdgs):
505+ pdg_list.append(amp.pdgs)
506+ real_amp_list.append(amp)
507+
508+ #generating and store in tmp files all output corresponding to each real_amplitude
509+ real_out_list = []
510+ realmapin = []
511+ for i,real_amp in enumerate(real_amp_list):
512+ realmapin.append([i,real_amp])
513+
514+ # start the pool instance with a signal instance to catch ctr+c
515+ original_sigint_handler = signal.signal(signal.SIGINT, signal.SIG_IGN)
516+ if fksmulti['ncores_for_proc_gen'] < 0: # use all cores
517+ pool = multiprocessing.Pool(maxtasksperchild=1)
518+ else:
519+ pool = multiprocessing.Pool(processes=fksmulti['ncores_for_proc_gen'],maxtasksperchild=1)
520+ signal.signal(signal.SIGINT, original_sigint_handler)
521+
522+ logger.info('Generating real matrix elements...')
523+ try:
524+ # the very large timeout passed to get is to be able to catch
525+ # KeyboardInterrupts
526+ realmapout = pool.map_async(async_generate_real,realmapin).get(9999999)
527+ except KeyboardInterrupt:
528+ pool.terminate()
529+ raise KeyboardInterrupt
530+
531+ realmapfiles = []
532+ for realout in realmapout:
533+ realmapfiles.append(realout[0])
534+
535+ logger.info('Generating born and virtual matrix elements...')
536+ #now loop over born and consume reals, generate virtuals
537+ bornmapin = []
538+ OLP=fksmulti['OLP']
539+ for i,born in enumerate(born_procs):
540+ bornmapin.append([i,born,born_pdg_list,loop_orders,pdg_list,loop_optimized,OLP,realmapfiles])
541+
542+ try:
543+ bornmapout = pool.map_async(async_generate_born,bornmapin).get(9999999)
544+ except KeyboardInterrupt:
545+ pool.terminate()
546+ raise KeyboardInterrupt
547+
548+ #remove real temp files
549+ for realtmp in realmapout:
550+ os.remove(realtmp[0])
551+
552+ logger.info('Collecting infos and finalizing matrix elements...')
553+ unique_me_list = []
554+ duplicate_me_lists = []
555+ for bornout in bornmapout:
556+ mefile = bornout[0]
557+ metag = bornout[1]
558+ has_loops = bornout[2]
559+ self['has_loops'] = self['has_loops'] or has_loops
560+ processes = bornout[3]
561+ self['processes'].extend(processes)
562+ unique = True
563+ for ime2,bornout2 in enumerate(unique_me_list):
564+ mefile2 = bornout2[0]
565+ metag2 = bornout2[1]
566+ if metag==metag2:
567+ duplicate_me_lists[ime2].append(mefile)
568+ unique = False
569+ break;
570+ if unique:
571+ unique_me_list.append(bornout)
572+ duplicate_me_lists.append([])
573+
574+ memapin = []
575+ for i,bornout in enumerate(unique_me_list):
576+ mefile = bornout[0]
577+ memapin.append([i,mefile, duplicate_me_lists[i]])
578+
579+ try:
580+ memapout = pool.map_async(async_finalize_matrix_elements,memapin).get(9999999)
581+ except KeyboardInterrupt:
582+ pool.terminate()
583+ raise KeyboardInterrupt
584+
585+ #remove born+virtual temp files
586+ for bornout in bornmapout:
587+ mefile = bornout[0]
588+ os.remove(mefile)
589+
590+ pool.close()
591+ pool.join()
592+
593+ #set final list of matrix elements (paths to temp files)
594+ matrix_elements = []
595+ for meout in memapout:
596+ matrix_elements.append(meout[0])
597+
598+ self['matrix_elements']=matrix_elements
599+
600+ #cache information needed for output which will not be available from
601+ #the matrix elements later
602+ initial_states = []
603+ for meout in memapout:
604+ me_initial_states = meout[1]
605+ for state in me_initial_states:
606+ initial_states.append(state)
607+
608+ # remove doubles from the list
609+ checked = []
610+ for e in initial_states:
611+ if e not in checked:
612+ checked.append(e)
613+ initial_states=checked
614+
615+ self['initial_states']=initial_states
616+
617+ helas_list = []
618+ for meout in memapout:
619+ helas_list.extend(meout[2])
620+ self['used_lorentz']=list(set(helas_list))
621+
622+ coupling_list = []
623+ for meout in memapout:
624+ coupling_list.extend([c for l in meout[3] for c in l])
625+ self['used_couplings'] = list(set(coupling_list))
626+
627+ has_virtuals = False
628+ for meout in memapout:
629+ if meout[4]:
630+ has_virtuals = True
631+ break
632+ self['has_virtuals'] = has_virtuals
633+
634+ configs_list = []
635+ for meout in realmapout:
636+ configs_list.append(meout[1])
637+ self['max_configs'] = max(configs_list)
638+
639+ nparticles_list = []
640+ for meout in realmapout:
641+ nparticles_list.append(meout[2])
642+ self['max_particles'] = max(nparticles_list)
643
644 self['has_isr'] = fksmulti['has_isr']
645 self['has_fsr'] = fksmulti['has_fsr']
646- self['has_loops'] = len(self.get_virt_matrix_elements()) > 0
647+
648+ logger.info('... Done')
649
650 for i, logg in enumerate(loggers_off):
651 logg.setLevel(old_levels[i])
652@@ -85,19 +415,66 @@
653 def get_used_lorentz(self):
654 """Return a list of (lorentz_name, conjugate, outgoing) with
655 all lorentz structures used by this HelasMultiProcess."""
656- helas_list = []
657- for me in self.get('matrix_elements'):
658- helas_list.extend(me.get_used_lorentz())
659- return list(set(helas_list))
660+
661+ if not self['used_lorentz']:
662+ helas_list = []
663+ for me in self.get('matrix_elements'):
664+ helas_list.extend(me.get_used_lorentz())
665+ self['used_lorentz'] = list(set(helas_list))
666+
667+ return self['used_lorentz']
668+
669
670 def get_used_couplings(self):
671 """Return a list with all couplings used by this
672 HelasMatrixElement."""
673- coupling_list = []
674- for me in self.get('matrix_elements'):
675- coupling_list.extend([c for l in me.get_used_couplings() for c in l])
676- return list(set(coupling_list))
677+
678+ if not self['used_couplings']:
679+ coupling_list = []
680+ for me in self.get('matrix_elements'):
681+ coupling_list.extend([c for l in me.get_used_couplings() for c in l])
682+ self['used_couplings'] = list(set(coupling_list))
683+
684+ return self['used_couplings']
685+
686+
687+ def get_processes(self):
688+ """Return a list with all couplings used by this
689+ HelasMatrixElement."""
690+
691+ if not self['processes']:
692+ process_list = []
693+ for me in self.get('matrix_elements'):
694+ process_list.extend(me.born_matrix_element.get('processes'))
695+ self['processes'] = process_list
696+
697+ return self['processes']
698+
699+
700+ def get_max_configs(self):
701+ """Return max_configs"""
702+
703+ if self['max_configs'] < 0:
704+ try:
705+ self['max_configs'] = max([me.get_num_configs() \
706+ for me in self['real_matrix_elements']])
707+ except ValueError:
708+ self['max_configs'] = max([me.born_matrix_element.get_num_configs() \
709+ for me in self['matrix_elements']])
710+
711+ return self['max_configs']
712+
713+
714+ def get_max_particles(self):
715+ """Return max_paricles"""
716+
717+ if self['max_particles'] < 0:
718+ self['max_particles'] = max([me.get_nexternal_ninitial()[0] \
719+ for me in self['matrix_elements']])
720+
721+ return self['max_particles']
722
723+
724 def get_matrix_elements(self):
725 """Extract the list of matrix elements"""
726 return self.get('matrix_elements')
727@@ -240,17 +617,32 @@
728 self.perturbation = fksproc.perturbation
729 real_amps_new = []
730 # combine for example u u~ > t t~ and d d~ > t t~
731- for proc in fksproc.real_amps:
732- fksreal_me = FKSHelasRealProcess(proc, real_me_list, real_amp_list, **opts)
733- try:
734- other = self.real_processes[self.real_processes.index(fksreal_me)]
735- other.matrix_element.get('processes').extend(\
736- fksreal_me.matrix_element.get('processes') )
737- except ValueError:
738- if fksreal_me.matrix_element.get('processes') and \
739- fksreal_me.matrix_element.get('diagrams'):
740- self.real_processes.append(fksreal_me)
741- real_amps_new.append(proc)
742+ if fksproc.ncores_for_proc_gen:
743+ # new NLO (multicore) generation mode
744+ for real_me, proc in itertools.izip(real_me_list,fksproc.real_amps):
745+ fksreal_me = FKSHelasRealProcess(proc, real_me, **opts)
746+ try:
747+ other = self.real_processes[self.real_processes.index(fksreal_me)]
748+ other.matrix_element.get('processes').extend(\
749+ fksreal_me.matrix_element.get('processes') )
750+ except ValueError:
751+ if fksreal_me.matrix_element.get('processes') and \
752+ fksreal_me.matrix_element.get('diagrams'):
753+ self.real_processes.append(fksreal_me)
754+ real_amps_new.append(proc)
755+ else:
756+ #old mode
757+ for proc in fksproc.real_amps:
758+ fksreal_me = FKSHelasRealProcess(proc, real_me_list, real_amp_list, **opts)
759+ try:
760+ other = self.real_processes[self.real_processes.index(fksreal_me)]
761+ other.matrix_element.get('processes').extend(\
762+ fksreal_me.matrix_element.get('processes') )
763+ except ValueError:
764+ if fksreal_me.matrix_element.get('processes') and \
765+ fksreal_me.matrix_element.get('diagrams'):
766+ self.real_processes.append(fksreal_me)
767+ real_amps_new.append(proc)
768 fksproc.real_amps = real_amps_new
769 if fksproc.virt_amp:
770 self.virt_matrix_element = \
771@@ -410,23 +802,35 @@
772 self.fks_infos = fksrealproc.fks_infos
773 self.is_to_integrate = fksrealproc.is_to_integrate
774
775- if len(real_me_list) != len(real_amp_list):
776+ # real_me_list is a list in the old NLO generation mode;
777+ # in the new one it is a matrix element
778+ if type(real_me_list) == list and len(real_me_list) != len(real_amp_list):
779 raise fks_common.FKSProcessError(
780 'not same number of amplitudes and matrix elements: %d, %d' % \
781 (len(real_amp_list), len(real_me_list)))
782- if real_me_list and real_amp_list:
783+ if type(real_me_list) == list and real_me_list and real_amp_list:
784 self.matrix_element = copy.deepcopy(real_me_list[real_amp_list.index(fksrealproc.amplitude)])
785 self.matrix_element['processes'] = copy.deepcopy(self.matrix_element['processes'])
786+
787+ elif type(real_me_list) == helas_objects.HelasMatrixElement:
788+ #new NLO generation mode
789+ self.matrix_element = real_me_list
790+
791 else:
792- logger.info('generating matrix element...')
793- self.matrix_element = helas_objects.HelasMatrixElement(
794- fksrealproc.amplitude, **opts)
795- #generate the color for the real
796- self.matrix_element.get('color_basis').build(
797- self.matrix_element.get('base_amplitude'))
798- self.matrix_element.set('color_matrix',
799- color_amp.ColorMatrix(
800- self.matrix_element.get('color_basis')))
801+
802+ if real_me_list and real_amp_list:
803+ self.matrix_element = copy.deepcopy(real_me_list[real_amp_list.index(fksrealproc.amplitude)])
804+ self.matrix_element['processes'] = copy.deepcopy(self.matrix_element['processes'])
805+ else:
806+ logger.info('generating matrix element...')
807+ self.matrix_element = helas_objects.HelasMatrixElement(
808+ fksrealproc.amplitude, **opts)
809+ #generate the color for the real
810+ self.matrix_element.get('color_basis').build(
811+ self.matrix_element.get('base_amplitude'))
812+ self.matrix_element.set('color_matrix',
813+ color_amp.ColorMatrix(
814+ self.matrix_element.get('color_basis')))
815 #self.fks_j_from_i = fksrealproc.find_fks_j_from_i()
816 self.fks_j_from_i = fksrealproc.fks_j_from_i
817
818
819=== modified file 'madgraph/interface/amcatnlo_interface.py'
820--- madgraph/interface/amcatnlo_interface.py 2015-10-20 14:39:50 +0000
821+++ madgraph/interface/amcatnlo_interface.py 2016-02-24 13:54:50 +0000
822@@ -24,6 +24,13 @@
823 import optparse
824 import subprocess
825 import shutil
826+import multiprocessing
827+import signal
828+import tempfile
829+import itertools
830+import os
831+import cPickle
832+
833
834 import madgraph
835 from madgraph import MG4DIR, MG5DIR, MadGraph5Error
836@@ -52,6 +59,37 @@
837 logger = logging.getLogger('cmdprint') # -> stdout
838 logger_stderr = logging.getLogger('fatalerror') # ->stderr
839
840+# a new function for the improved NLO generation
841+glob_directories_map = []
842+def generate_directories_fks_async(i):
843+
844+ arglist = glob_directories_map[i]
845+
846+ curr_exporter = arglist[0]
847+ mefile = arglist[1]
848+ curr_fortran_model = arglist[2]
849+ ime = arglist[3]
850+ nme = arglist[4]
851+ path = arglist[5]
852+ olpopts = arglist[6]
853+
854+ infile = open(mefile,'rb')
855+ me = cPickle.load(infile)
856+ infile.close()
857+
858+ calls = curr_exporter.generate_directories_fks(me, curr_fortran_model, ime, nme, path, olpopts)
859+ nexternal = curr_exporter.proc_characteristic['nexternal']
860+ ninitial = curr_exporter.proc_characteristic['ninitial']
861+ processes = me.born_matrix_element.get('processes')
862+
863+ #only available after export has been done, so has to be returned from here
864+ max_loop_vertex_rank = -99
865+ if me.virt_matrix_element:
866+ max_loop_vertex_rank = me.virt_matrix_element.get_max_loop_vertex_rank()
867+
868+ return [calls, curr_exporter.fksdirs, max_loop_vertex_rank, ninitial, nexternal, processes]
869+
870+
871 class CheckFKS(mg_interface.CheckValidForCmd):
872
873
874@@ -431,16 +469,30 @@
875 #
876 # raise self.InvalidCmd("FKS for reals only available in QCD for now, you asked %s" \
877 # % ', '.join(myprocdef['perturbation_couplings']))
878+ ##
879+
880+ # if the new nlo process generation mode is enabled, the number of cores to be
881+ # used has to be passed
882+ # ncores_for_proc_gen has the following meaning
883+ # 0 : do things the old way
884+ # > 0 use ncores_for_proc_gen
885+ # -1 : use all cores
886+ if self.options['low_mem_multicore_nlo_generation']:
887+ if self.options['nb_core']:
888+ self.ncores_for_proc_gen = int(self.options['nb_core'])
889+ else:
890+ self.ncores_for_proc_gen = -1
891+ else:
892+ self.ncores_for_proc_gen = 0
893+
894+ # this is the options dictionary to pass to the FKSMultiProcess
895+ fks_options = {'OLP': self.options['OLP'],
896+ 'ignore_six_quark_processes': self.options['ignore_six_quark_processes'],
897+ 'ncores_for_proc_gen': self.ncores_for_proc_gen}
898 try:
899- self._fks_multi_proc.add(fks_base.FKSMultiProcess(myprocdef,
900- collect_mirror_procs,
901- ignore_six_quark_processes,
902- OLP=self.options['OLP']))
903+ self._fks_multi_proc.add(fks_base.FKSMultiProcess(myprocdef,fks_options))
904 except AttributeError:
905- self._fks_multi_proc = fks_base.FKSMultiProcess(myprocdef,
906- collect_mirror_procs,
907- ignore_six_quark_processes,
908- OLP=self.options['OLP'])
909+ self._fks_multi_proc = fks_base.FKSMultiProcess(myprocdef,fks_options)
910
911
912 def do_output(self, line):
913@@ -498,7 +550,7 @@
914 # Generate the virtuals if from OLP
915 if self.options['OLP']!='MadLoop':
916 self._curr_exporter.generate_virtuals_from_OLP(
917- self._curr_matrix_elements,self._export_dir,self.options['OLP'])
918+ self.born_processes_for_olp,self._export_dir,self.options['OLP'])
919
920 # Remember that we have done export
921 self._done_export = (self._export_dir, self._export_format)
922@@ -531,41 +583,50 @@
923 self._fks_multi_proc,
924 loop_optimized= self.options['loop_optimized_output'])
925
926- ndiags = sum([len(me.get('diagrams')) for \
927- me in self._curr_matrix_elements.\
928- get_matrix_elements()])
929- # assign a unique id number to all process and
930- # generate a list of possible PDF combinations
931- uid = 0
932- initial_states=[]
933- for me in self._curr_matrix_elements.get_matrix_elements():
934- uid += 1 # update the identification number
935- me.get('processes')[0].set('uid', uid)
936- try:
937- initial_states.append(sorted(list(set((p.get_initial_pdg(1),p.get_initial_pdg(2)) for \
938- p in me.born_matrix_element.get('processes')))))
939- except IndexError:
940- initial_states.append(sorted(list(set((p.get_initial_pdg(1)) for \
941- p in me.born_matrix_element.get('processes')))))
942-
943- for fksreal in me.real_processes:
944- # Pick out all initial state particles for the two beams
945+ if not self.options['low_mem_multicore_nlo_generation']:
946+ # generate the code the old way
947+ ndiags = sum([len(me.get('diagrams')) for \
948+ me in self._curr_matrix_elements.\
949+ get_matrix_elements()])
950+ # assign a unique id number to all process and
951+ # generate a list of possible PDF combinations
952+ uid = 0
953+ initial_states=[]
954+ for me in self._curr_matrix_elements.get_matrix_elements():
955+ uid += 1 # update the identification number
956+ me.get('processes')[0].set('uid', uid)
957 try:
958 initial_states.append(sorted(list(set((p.get_initial_pdg(1),p.get_initial_pdg(2)) for \
959- p in fksreal.matrix_element.get('processes')))))
960+ p in me.born_matrix_element.get('processes')))))
961 except IndexError:
962 initial_states.append(sorted(list(set((p.get_initial_pdg(1)) for \
963- p in fksreal.matrix_element.get('processes')))))
964-
965+ p in me.born_matrix_element.get('processes')))))
966
967- # remove doubles from the list
968- checked = []
969- for e in initial_states:
970- if e not in checked:
971- checked.append(e)
972- initial_states=checked
973-
974- self._curr_matrix_elements.set('initial_states',initial_states)
975+ for fksreal in me.real_processes:
976+ # Pick out all initial state particles for the two beams
977+ try:
978+ initial_states.append(sorted(list(set((p.get_initial_pdg(1),p.get_initial_pdg(2)) for \
979+ p in fksreal.matrix_element.get('processes')))))
980+ except IndexError:
981+ initial_states.append(sorted(list(set((p.get_initial_pdg(1)) for \
982+ p in fksreal.matrix_element.get('processes')))))
983+
984+
985+ # remove doubles from the list
986+ checked = []
987+ for e in initial_states:
988+ if e not in checked:
989+ checked.append(e)
990+ initial_states=checked
991+
992+ self._curr_matrix_elements.set('initial_states',initial_states)
993+
994+ else:
995+ #new NLO generation
996+ if self._curr_matrix_elements['has_loops']:
997+ self._curr_exporter.opt['mp'] = True
998+ self._curr_exporter.model = self._curr_model
999+ ndiags = 0
1000
1001 cpu_time2 = time.time()
1002 return ndiags, cpu_time2 - cpu_time1
1003@@ -586,23 +647,84 @@
1004 for charac in ['has_isr', 'has_fsr', 'has_loops']:
1005 proc_charac[charac] = self._curr_matrix_elements[charac]
1006
1007+ # prepare for the generation
1008+ # glob_directories_map is for the new NLO generation
1009+ global glob_directories_map
1010+ glob_directories_map = []
1011
1012+ self.born_processes_for_olp = []
1013 for ime, me in \
1014 enumerate(self._curr_matrix_elements.get('matrix_elements')):
1015- #me is a FKSHelasProcessFromReals
1016- calls = calls + \
1017- self._curr_exporter.generate_directories_fks(me,
1018- self._curr_fortran_model,
1019- ime, len(self._curr_matrix_elements.get('matrix_elements')),
1020- path,self.options['OLP'])
1021- self._fks_directories.extend(self._curr_exporter.fksdirs)
1022+ if not self.options['low_mem_multicore_nlo_generation']:
1023+ #me is a FKSHelasProcessFromReals
1024+ calls = calls + \
1025+ self._curr_exporter.generate_directories_fks(me,
1026+ self._curr_fortran_model,
1027+ ime, len(self._curr_matrix_elements.get('matrix_elements')),
1028+ path,self.options['OLP'])
1029+ self._fks_directories.extend(self._curr_exporter.fksdirs)
1030+ self.born_processes_for_olp.append(me.born_matrix_element.get('processes')[0])
1031+ else:
1032+ glob_directories_map.append(\
1033+ [self._curr_exporter, me, self._curr_fortran_model,
1034+ ime, len(self._curr_matrix_elements.get('matrix_elements')),
1035+ path, self.options['OLP']])
1036+
1037+ if self.options['low_mem_multicore_nlo_generation']:
1038+ # start the pool instance with a signal instance to catch ctr+c
1039+ logger.info('Writing directories...')
1040+ original_sigint_handler = signal.signal(signal.SIGINT, signal.SIG_IGN)
1041+ if self.ncores_for_proc_gen < 0: # use all cores
1042+ pool = multiprocessing.Pool(maxtasksperchild=1)
1043+ else:
1044+ pool = multiprocessing.Pool(processes=self.ncores_for_proc_gen,maxtasksperchild=1)
1045+ signal.signal(signal.SIGINT, original_sigint_handler)
1046+ try:
1047+ # the very large timeout passed to get is to be able to catch
1048+ # KeyboardInterrupts
1049+ diroutputmap = pool.map_async(generate_directories_fks_async,
1050+ range(len(glob_directories_map))).get(9999999)
1051+ except KeyboardInterrupt:
1052+ pool.terminate()
1053+ raise KeyboardInterrupt
1054+
1055+ pool.close()
1056+ pool.join()
1057+
1058+ #clean up tmp files containing final matrix elements
1059+ for mefile in self._curr_matrix_elements.get('matrix_elements'):
1060+ os.remove(mefile)
1061+
1062+ for charac in ['nexternal', 'ninitial']:
1063+ proc_charac[charac] = self._curr_exporter.proc_characteristic[charac]
1064+ # ninitial and nexternal
1065+ proc_charac['nexternal'] = max([diroutput[4] for diroutput in diroutputmap])
1066+ ninitial_set = set([diroutput[3] for diroutput in diroutputmap])
1067+ if len(ninitial_set) != 1:
1068+ raise MadGraph5Error, ("Invalid ninitial values: %s" % ' ,'.join(list(ninitial_set)))
1069+ proc_charac['ninitial'] = list(ninitial_set)[0]
1070+
1071+ self.born_processes = []
1072+ self.born_processes_for_olp = []
1073+ max_loop_vertex_ranks = []
1074+
1075+ for diroutput in diroutputmap:
1076+ calls = calls + diroutput[0]
1077+ self._fks_directories.extend(diroutput[1])
1078+ max_loop_vertex_ranks.append(diroutput[2])
1079+ self.born_processes.extend(diroutput[5])
1080+ self.born_processes_for_olp.append(diroutput[5][0])
1081+
1082+ else:
1083+ max_loop_vertex_ranks = [me.get_max_loop_vertex_rank() for \
1084+ me in self._curr_matrix_elements.get_virt_matrix_elements()]
1085+
1086 card_path = os.path.join(path, os.path.pardir, 'SubProcesses', \
1087 'procdef_mg5.dat')
1088
1089 if self.options['loop_optimized_output'] and \
1090- len(self._curr_matrix_elements.get_virt_matrix_elements()) > 0:
1091- self._curr_exporter.write_coef_specs_file(\
1092- self._curr_matrix_elements.get_virt_matrix_elements())
1093+ len(max_loop_vertex_ranks) > 0:
1094+ self._curr_exporter.write_coef_specs_file(max_loop_vertex_ranks)
1095 if self._generate_info:
1096 self._curr_exporter.write_procdef_mg5(card_path, #
1097 self._curr_model['name'],
1098
1099=== modified file 'madgraph/interface/madgraph_interface.py'
1100--- madgraph/interface/madgraph_interface.py 2016-02-23 22:55:27 +0000
1101+++ madgraph/interface/madgraph_interface.py 2016-02-24 13:54:50 +0000
1102@@ -1332,7 +1332,8 @@
1103
1104 if len(args) == 1 and args[0] in ['complex_mass_scheme',\
1105 'loop_optimized_output',\
1106- 'loop_color_flows']:
1107+ 'loop_color_flows',\
1108+ 'low_mem_multicore_nlo_generation']:
1109 args.append('True')
1110
1111 if len(args) > 2 and '=' == args[1]:
1112@@ -1381,7 +1382,7 @@
1113 if not args[1].isdigit():
1114 raise self.InvalidCmd('%s values should be a integer' % args[0])
1115
1116- if args[0] in ['loop_optimized_output', 'loop_color_flows']:
1117+ if args[0] in ['loop_optimized_output', 'loop_color_flows', 'low_mem_multicore_nlo_generation']:
1118 try:
1119 args[1] = banner_module.ConfigFile.format_variable(args[1], bool, args[0])
1120 except Exception:
1121@@ -2381,7 +2382,8 @@
1122
1123 if len(args) == 2:
1124 if args[1] in ['group_subprocesses', 'complex_mass_scheme',\
1125- 'loop_optimized_output', 'loop_color_flows']:
1126+ 'loop_optimized_output', 'loop_color_flows',\
1127+ 'low_mem_multicore_nlo_generation']:
1128 return self.list_completion(text, ['False', 'True', 'default'])
1129 elif args[1] in ['ignore_six_quark_processes']:
1130 return self.list_completion(text, self._multiparticles.keys())
1131@@ -2698,6 +2700,7 @@
1132
1133 options_madgraph= {'group_subprocesses': 'Auto',
1134 'ignore_six_quark_processes': False,
1135+ 'low_mem_multicore_nlo_generation': False,
1136 'complex_mass_scheme': False,
1137 'gauge':'unitary',
1138 'stdout_level':None,
1139
1140=== modified file 'madgraph/iolibs/export_fks.py'
1141--- madgraph/iolibs/export_fks.py 2016-02-23 19:44:10 +0000
1142+++ madgraph/iolibs/export_fks.py 2016-02-24 13:54:50 +0000
1143@@ -55,6 +55,20 @@
1144 _file_path = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0] + '/'
1145 logger = logging.getLogger('madgraph.export_fks')
1146
1147+
1148+def make_jpeg_async(args):
1149+ Pdir = args[0]
1150+ old_pos = args[1]
1151+ dir_path = args[2]
1152+
1153+ devnull = os.open(os.devnull, os.O_RDWR)
1154+
1155+ os.chdir(Pdir)
1156+ subprocess.call([os.path.join(old_pos, dir_path, 'bin', 'internal', 'gen_jpeg-pl')],
1157+ stdout = devnull)
1158+ os.chdir(os.path.pardir)
1159+
1160+
1161 #=================================================================================
1162 # Class for used of the (non-optimized) Loop process
1163 #=================================================================================
1164@@ -294,12 +308,9 @@
1165 #===========================================================================
1166 # write_maxparticles_file
1167 #===========================================================================
1168- def write_maxparticles_file(self, writer, matrix_elements):
1169+ def write_maxparticles_file(self, writer, maxparticles):
1170 """Write the maxparticles.inc file for MadEvent"""
1171
1172- maxparticles = max([me.get_nexternal_ninitial()[0] \
1173- for me in matrix_elements['matrix_elements']])
1174-
1175 lines = "integer max_particles, max_branch\n"
1176 lines += "parameter (max_particles=%d) \n" % maxparticles
1177 lines += "parameter (max_branch=max_particles-1)"
1178@@ -313,16 +324,9 @@
1179 #===========================================================================
1180 # write_maxconfigs_file
1181 #===========================================================================
1182- def write_maxconfigs_file(self, writer, matrix_elements):
1183+ def write_maxconfigs_file(self, writer, maxconfigs):
1184 """Write the maxconfigs.inc file for MadEvent"""
1185
1186- try:
1187- maxconfigs = max([me.get_num_configs() \
1188- for me in matrix_elements['real_matrix_elements']])
1189- except ValueError:
1190- maxconfigs = max([me.born_matrix_element.get_num_configs() \
1191- for me in matrix_elements['matrix_elements']])
1192-
1193 lines = "integer lmaxconfigs\n"
1194 lines += "parameter (lmaxconfigs=%d)" % maxconfigs
1195
1196@@ -455,7 +459,7 @@
1197 # likely also generate it for each subproc.
1198 if OLP=='NJET':
1199 filename = 'OLE_order.lh'
1200- self.write_lh_order(filename, matrix_element, OLP)
1201+ self.write_lh_order(filename, [matrix_element.born_matrix_element.get('processes')[0]], OLP)
1202
1203 if matrix_element.virt_matrix_element:
1204 calls += self.generate_virt_directory( \
1205@@ -683,14 +687,11 @@
1206 #===========================================================================
1207 # create the run_card
1208 #===========================================================================
1209- def create_run_card(self, matrix_elements, history):
1210+ def create_run_card(self, processes, history):
1211 """ """
1212
1213 run_card = banner_mod.RunCardNLO()
1214
1215- processes = [me.get('processes')
1216- for me in matrix_elements['matrix_elements']]
1217-
1218 run_card.create_default_for_process(self.proc_characteristic,
1219 history,
1220 processes)
1221@@ -709,7 +710,7 @@
1222 self.proc_characteristic['grouped_matrix'] = False
1223 self.create_proc_charac()
1224
1225- self.create_run_card(matrix_elements, history)
1226+ self.create_run_card(matrix_elements.get_processes(), history)
1227 # modelname = self.model.get('name')
1228 # if modelname == 'mssm' or modelname.startswith('mssm-'):
1229 # param_card = os.path.join(self.dir_path, 'Cards','param_card.dat')
1230@@ -723,14 +724,15 @@
1231 self.write_get_mass_width_file(writers.FortranWriter(filename), makeinc, self.model)
1232
1233 # # Write maxconfigs.inc based on max of ME's/subprocess groups
1234+
1235 filename = os.path.join(self.dir_path,'Source','maxconfigs.inc')
1236 self.write_maxconfigs_file(writers.FortranWriter(filename),
1237- matrix_elements)
1238+ matrix_elements.get_max_configs())
1239
1240 # # Write maxparticles.inc based on max of ME's/subprocess groups
1241 filename = os.path.join(self.dir_path,'Source','maxparticles.inc')
1242 self.write_maxparticles_file(writers.FortranWriter(filename),
1243- matrix_elements)
1244+ matrix_elements.get_max_particles())
1245
1246 # Touch "done" file
1247 os.system('touch %s/done' % os.path.join(self.dir_path,'SubProcesses'))
1248@@ -1341,7 +1343,8 @@
1249 matrix_element, i,
1250 fortran_model)
1251
1252- def generate_virtuals_from_OLP(self,FKSHMultiproc,export_path, OLP):
1253+
1254+ def generate_virtuals_from_OLP(self,process_list,export_path, OLP):
1255 """Generates the library for computing the loop matrix elements
1256 necessary for this process using the OLP specified."""
1257
1258@@ -1350,7 +1353,7 @@
1259 if not os.path.exists(virtual_path):
1260 os.makedirs(virtual_path)
1261 filename = os.path.join(virtual_path,'OLE_order.lh')
1262- self.write_lh_order(filename, FKSHMultiproc.get('matrix_elements'),OLP)
1263+ self.write_lh_order(filename, process_list, OLP)
1264
1265 fail_msg='Generation of the virtuals with %s failed.\n'%OLP+\
1266 'Please check the virt_generation.log file in %s.'\
1267@@ -1419,20 +1422,19 @@
1268 proc_to_label = self.parse_contract_file(
1269 pjoin(virtual_path,'OLE_order.olc'))
1270
1271- self.write_BinothLHA_inc(FKSHMultiproc,proc_to_label,\
1272+ self.write_BinothLHA_inc(process_list,proc_to_label,\
1273 pjoin(export_path,'SubProcesses'))
1274
1275 # Link the contract file to within the SubProcess directory
1276 ln(pjoin(virtual_path,'OLE_order.olc'),pjoin(export_path,'SubProcesses'))
1277
1278- def write_BinothLHA_inc(self, FKSHMultiproc, proc_to_label, SubProcPath):
1279+ def write_BinothLHA_inc(self, processes, proc_to_label, SubProcPath):
1280 """ Write the file Binoth_proc.inc in each SubProcess directory so as
1281 to provide the right process_label to use in the OLP call to get the
1282 loop matrix element evaluation. The proc_to_label is the dictionary of
1283 the format of the one returned by the function parse_contract_file."""
1284
1285- for matrix_element in FKSHMultiproc.get('matrix_elements'):
1286- proc = matrix_element.get('processes')[0]
1287+ for proc in processes:
1288 name = "P%s"%proc.shell_string()
1289 proc_pdgs=(tuple([leg.get('id') for leg in proc.get('legs') if \
1290 not leg.get('state')]),
1291@@ -1608,26 +1610,19 @@
1292 # write_lh_order
1293 #===============================================================================
1294 #test written
1295- def write_lh_order(self, filename, matrix_elements, OLP='MadLoop'):
1296+ def write_lh_order(self, filename, process_list, OLP='MadLoop'):
1297 """Creates the OLE_order.lh file. This function should be edited according
1298 to the OLP which is used. For now it is generic."""
1299
1300- if isinstance(matrix_elements,fks_helas_objects.FKSHelasProcess):
1301- fksborns=fks_helas_objects.FKSHelasProcessList([matrix_elements])
1302- elif isinstance(matrix_elements,fks_helas_objects.FKSHelasProcessList):
1303- fksborns= matrix_elements
1304- else:
1305- raise fks_common.FKSProcessError('Wrong type of argument for '+\
1306- 'matrix_elements in function write_lh_order.')
1307
1308- if len(fksborns)==0:
1309+ if len(process_list)==0:
1310 raise fks_common.FKSProcessError('No matrix elements provided to '+\
1311 'the function write_lh_order.')
1312 return
1313
1314 # We assume the orders to be common to all Subprocesses
1315
1316- orders = fksborns[0].orders
1317+ orders = process_list[0].get('orders')
1318 if 'QED' in orders.keys() and 'QCD' in orders.keys():
1319 QED=orders['QED']
1320 QCD=orders['QCD']
1321@@ -1639,12 +1634,12 @@
1322 QCD=orders['QCD']
1323 else:
1324 QED, QCD = self.get_qed_qcd_orders_from_weighted(\
1325- fksborns[0].get_nexternal_ninitial()[0]-1, # -1 is because the function returns nexternal of the real emission
1326+ len(process_list[0].get('legs')),
1327 orders['WEIGHTED'])
1328
1329 replace_dict = {}
1330 replace_dict['mesq'] = 'CHaveraged'
1331- replace_dict['corr'] = ' '.join(matrix_elements[0].get('processes')[0].\
1332+ replace_dict['corr'] = ' '.join(process_list[0].\
1333 get('perturbation_couplings'))
1334 replace_dict['irreg'] = 'CDR'
1335 replace_dict['aspow'] = QCD
1336@@ -1652,8 +1647,10 @@
1337 replace_dict['modelfile'] = './param_card.dat'
1338 replace_dict['params'] = 'alpha_s'
1339 proc_lines=[]
1340- for fksborn in fksborns:
1341- proc_lines.append(fksborn.get_lh_pdg_string())
1342+ for proc in process_list:
1343+ proc_lines.append('%s -> %s' % \
1344+ (' '.join(str(l['id']) for l in proc['legs'] if not l['state']),
1345+ ' '.join(str(l['id']) for l in proc['legs'] if l['state'])))
1346 replace_dict['pdgs'] = '\n'.join(proc_lines)
1347 replace_dict['symfin'] = 'Yes'
1348 content = \
1349@@ -3300,7 +3297,7 @@
1350 #===============================================================================
1351 # write_coef_specs
1352 #===============================================================================
1353- def write_coef_specs_file(self, virt_me_list):
1354+ def write_coef_specs_file(self, max_loop_vertex_ranks):
1355 """ writes the coef_specs.inc in the DHELAS folder. Should not be called in the
1356 non-optimized mode"""
1357 filename = os.path.join(self.dir_path, 'Source', 'DHELAS', 'coef_specs.inc')
1358@@ -3308,7 +3305,6 @@
1359 replace_dict = {}
1360 replace_dict['max_lwf_size'] = 4
1361
1362- max_loop_vertex_ranks = [me.get_max_loop_vertex_rank() for me in virt_me_list]
1363 replace_dict['vertex_max_coefs'] = max(\
1364 [q_polynomial.get_number_of_coefs_for_rank(n)
1365 for n in max_loop_vertex_ranks])
1366
1367=== modified file 'madgraph/iolibs/template_files/loop_optimized/compute_color_flows.inc'
1368--- madgraph/iolibs/template_files/loop_optimized/compute_color_flows.inc 2015-07-03 00:47:03 +0000
1369+++ madgraph/iolibs/template_files/loop_optimized/compute_color_flows.inc 2016-02-24 13:54:50 +0000
1370@@ -357,7 +357,7 @@
1371 C
1372 C LOCAL VARIABLES
1373 C
1374- INTEGER I, J, M, N, K, SQSOINDEX, DOUBLEFACT
1375+ INTEGER I, J, M, N, K, ISQSO, DOUBLEFACT
1376 %(complex_dp_format)s COLOR_COEF
1377 C
1378 C FUNCTIONS
1379@@ -401,8 +401,8 @@
1380 IF (LoopColorFlowMatrix(I,I)%%Denom.LT.0) COLOR_COEF=COLOR_COEF*IMAG1
1381 DO M=1,NLOOPAMPSO
1382 DO N=M,NLOOPAMPSO
1383- SQSOINDEX = %(proc_prefix)sML5SQSOINDEX(M,N)
1384- IF(CHOSEN_SO_CONFIGS(SQSOINDEX)) THEN
1385+ ISQSO = %(proc_prefix)sML5SQSOINDEX(M,N)
1386+ IF(CHOSEN_SO_CONFIGS(ISQSO)) THEN
1387 IF(M.ne.N) THEN
1388 DOUBLEFACT=2
1389 ELSE
1390@@ -452,7 +452,7 @@
1391 C
1392 C LOCAL VARIABLES
1393 C
1394- INTEGER I, J, M, N, K, SQSOINDEX, DOUBLEFACT
1395+ INTEGER I, J, M, N, K, ISQSO, DOUBLEFACT
1396 ## if(LoopInduced) {
1397 INTEGER LOWERBOUND
1398 ## }
1399@@ -550,15 +550,15 @@
1400 CALL %(proc_prefix)sML5GET_ORDERS_FOR_AMPSOINDEX(M,ORDERS_A)
1401 CALL %(proc_prefix)sML5GET_ORDERS_FOR_AMPSOINDEX(N,ORDERS_B)
1402 C Now figure out to which SQSOINDEX these orders together correspond to *in the Born subroutine* (Notice the absence of the ML5 prefix in the functions used then)
1403- SQSOINDEX = %(proc_prefix)sSQSOINDEX(%(proc_prefix)sSOINDEX_FOR_AMPORDERS(ORDERS_A),%(proc_prefix)sSOINDEX_FOR_AMPORDERS(ORDERS_B))
1404+ ISQSO = %(proc_prefix)sSQSOINDEX(%(proc_prefix)sSOINDEX_FOR_AMPORDERS(ORDERS_A),%(proc_prefix)sSOINDEX_FOR_AMPORDERS(ORDERS_B))
1405 IF(J.ne.I) THEN
1406 DOUBLEFACT=2
1407 ELSE
1408 DOUBLEFACT=1
1409 ENDIF
1410 TEMP(1) = DOUBLEFACT*HEL_MULT*DBLE(COLOR_COEF*JAMPB(I,M)*DCONJG(JAMPB(J,N)))
1411- RES(0,SQSOINDEX) = RES(0,SQSOINDEX) + TEMP(1)
1412- IF((.not.FILTER_SO).or.SQSO_TARGET.eq.-1.or.SQSO_TARGET.eq.SQSOINDEX) THEN
1413+ RES(0,ISQSO) = RES(0,ISQSO) + TEMP(1)
1414+ IF((.not.FILTER_SO).or.SQSO_TARGET.eq.-1.or.SQSO_TARGET.eq.ISQSO) THEN
1415 RES(0,0) = RES(0,0) + TEMP(1)
1416 ENDIF
1417 ENDDO
1418@@ -591,7 +591,7 @@
1419 ENDIF
1420 DO N=LOWERBOUND,NLOOPAMPSO
1421 ## }
1422- SQSOINDEX = %(proc_prefix)sML5SQSOINDEX(M,N)
1423+ ISQSO = %(proc_prefix)sML5SQSOINDEX(M,N)
1424 ## if(LoopInduced){
1425 IF(J.ne.I) THEN
1426 DOUBLEFACT=2
1427@@ -626,14 +626,14 @@
1428 ## if(not LoopInduced){
1429 TEMP(K) = 2.0d0*HEL_MULT*DBLE(COLOR_COEF*JAMPL(K,I,M)*DCONJG(JAMPB(J,N)))
1430 ## }
1431- RES(K,SQSOINDEX) = RES(K,SQSOINDEX) + TEMP(K)
1432+ RES(K,ISQSO) = RES(K,ISQSO) + TEMP(K)
1433 ## if(LoopInduced and MadEventOutput){
1434 DO config_i=1,nconfigs
1435- AMP2_ALL(K,config_i,SQSOINDEX) = AMP2_ALL(K,config_i,SQSOINDEX) + TEMP_AMP2(K,config_i)
1436+ AMP2_ALL(K,config_i,ISQSO) = AMP2_ALL(K,config_i,ISQSO) + TEMP_AMP2(K,config_i)
1437 ENDDO
1438 ## }
1439 ENDDO
1440- IF((.NOT.FILTER_SO).OR.SQSO_TARGET.eq.-1.or.SQSO_TARGET.eq.SQSOINDEX) THEN
1441+ IF((.NOT.FILTER_SO).OR.SQSO_TARGET.eq.-1.or.SQSO_TARGET.eq.ISQSO) THEN
1442 DO K=1,3
1443 RES(K,0) = RES(K,0) + TEMP(K)
1444 ## if(LoopInduced and MadEventOutput){
1445
1446=== modified file 'madgraph/loop/loop_exporters.py'
1447--- madgraph/loop/loop_exporters.py 2016-02-23 22:55:27 +0000
1448+++ madgraph/loop/loop_exporters.py 2016-02-24 13:54:50 +0000
1449@@ -45,6 +45,7 @@
1450 import madgraph.various.diagram_symmetry as diagram_symmetry
1451 import madgraph.various.process_checks as process_checks
1452 import madgraph.various.progressbar as pbar
1453+import madgraph.various.q_polynomial as q_polynomial
1454 import madgraph.core.color_amp as color_amp
1455 import madgraph.iolibs.helas_call_writers as helas_call_writers
1456 import models.check_param_card as check_param_card
1457@@ -2314,7 +2315,7 @@
1458
1459 writer.writelines(file,context=self.get_context(matrix_element))
1460
1461- def fix_coef_specs(self, overall_max_lwf_size, overall_max_loop_vert_rank):
1462+ def fix_coef_specs(self, overall_max_lwf_spin, overall_max_loop_vert_rank):
1463 """ If processes with different maximum loop wavefunction size or
1464 different maximum loop vertex rank have to be output together, then
1465 the file 'coef.inc' in the HELAS Source folder must contain the overall
1466@@ -2325,7 +2326,11 @@
1467 coef_specs_path=os.path.join(self.dir_path,'Source','DHELAS',\
1468 'coef_specs.inc')
1469 os.remove(coef_specs_path)
1470-
1471+
1472+ spin_to_wf_size = {1:4,2:4,3:4,4:16,5:16}
1473+ overall_max_lwf_size = spin_to_wf_size[overall_max_lwf_spin]
1474+ overall_max_loop_vert_coefs = q_polynomial.get_number_of_coefs_for_rank(
1475+ overall_max_loop_vert_rank)
1476 # Replace it by the appropriate value
1477 IncWriter=writers.FortranWriter(coef_specs_path,'w')
1478 IncWriter.writelines("""INTEGER MAXLWFSIZE
1479@@ -2333,7 +2338,7 @@
1480 INTEGER VERTEXMAXCOEFS
1481 PARAMETER (VERTEXMAXCOEFS=%(vertex_max_coefs)d)"""\
1482 %{'max_lwf_size':overall_max_lwf_size,
1483- 'vertex_max_coefs':overall_max_loop_vert_rank})
1484+ 'vertex_max_coefs':overall_max_loop_vert_coefs})
1485 IncWriter.close()
1486
1487 def setup_check_sa_replacement_dictionary(self, matrix_element, \
1488
1489=== modified file 'madgraph/various/banner.py'
1490--- madgraph/various/banner.py 2016-02-18 11:42:56 +0000
1491+++ madgraph/various/banner.py 2016-02-24 13:54:50 +0000
1492@@ -1990,7 +1990,7 @@
1493 # check for beam_id
1494 beam_id = set()
1495 for proc in proc_def:
1496- for leg in proc[0]['legs']:
1497+ for leg in proc['legs']:
1498 if not leg['state']:
1499 beam_id.add(leg['id'])
1500 if any(i in beam_id for i in [1,-1,2,-2,3,-3,4,-4,5,-5,21,22]):
1501
1502=== added directory 'tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall'
1503=== added file 'tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%CT_interface.f'
1504--- tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%CT_interface.f 1970-01-01 00:00:00 +0000
1505+++ tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%CT_interface.f 2016-02-24 13:54:50 +0000
1506@@ -0,0 +1,278 @@
1507+ SUBROUTINE CTLOOP(NLOOPLINE,PL,M2L,RANK,RES,STABLE)
1508+C
1509+C Generated by MadGraph5_aMC@NLO v. %(version)s, %(date)s
1510+C By the MadGraph5_aMC@NLO Development Team
1511+C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch
1512+C
1513+C Interface between MG5 and CutTools.
1514+C
1515+C Process: d~ u > w+ WEIGHTED=2 QED=1 [ all = QCD ]
1516+C Process: s~ c > w+ WEIGHTED=2 QED=1 [ all = QCD ]
1517+C
1518+C
1519+C CONSTANTS
1520+C
1521+ INTEGER NEXTERNAL
1522+ PARAMETER (NEXTERNAL=3)
1523+ LOGICAL CHECKPCONSERVATION
1524+ PARAMETER (CHECKPCONSERVATION=.TRUE.)
1525+ REAL*8 NORMALIZATION
1526+ PARAMETER (NORMALIZATION = 1.D0/(16.D0*3.14159265358979323846D0*
1527+ $ *2))
1528+C
1529+C ARGUMENTS
1530+C
1531+ INTEGER NLOOPLINE, RANK
1532+ REAL*8 PL(0:3,NLOOPLINE)
1533+ REAL*8 PCT(0:3,0:NLOOPLINE-1)
1534+ COMPLEX*16 M2L(NLOOPLINE)
1535+ COMPLEX*16 M2LCT(0:NLOOPLINE-1)
1536+ COMPLEX*16 RES(3)
1537+ LOGICAL STABLE
1538+C
1539+C LOCAL VARIABLES
1540+C
1541+ COMPLEX*16 R1, ACC
1542+ INTEGER I, J, K
1543+ LOGICAL CTINIT, TIRINIT, GOLEMINIT
1544+ COMMON/REDUCTIONCODEINIT/CTINIT,TIRINIT,GOLEMINIT
1545+C
1546+C EXTERNAL FUNCTIONS
1547+C
1548+ EXTERNAL LOOPNUM
1549+ EXTERNAL MPLOOPNUM
1550+C
1551+C GLOBAL VARIABLES
1552+C
1553+ INCLUDE 'coupl.inc'
1554+ INTEGER CTMODE
1555+ REAL*8 LSCALE
1556+ COMMON/CT/LSCALE,CTMODE
1557+
1558+ INTEGER ID,SQSOINDEX,R
1559+ COMMON/LOOP/ID,SQSOINDEX,R
1560+
1561+C ----------
1562+C BEGIN CODE
1563+C ----------
1564+
1565+C INITIALIZE CUTTOOLS IF NEEDED
1566+ IF (CTINIT) THEN
1567+ CTINIT=.FALSE.
1568+ CALL INITCT()
1569+ ENDIF
1570+
1571+C YOU CAN FIND THE DETAILS ABOUT THE DIFFERENT CTMODE AT THE
1572+C BEGINNING OF THE FILE CTS_CUTS.F90 IN THE CUTTOOLS DISTRIBUTION
1573+
1574+C CONVERT THE MASSES TO BE COMPLEX
1575+ DO I=1,NLOOPLINE
1576+ M2LCT(I-1)=M2L(I)
1577+ ENDDO
1578+
1579+C CONVERT THE MOMENTA FLOWING IN THE LOOP LINES TO CT CONVENTIONS
1580+ DO I=0,3
1581+ DO J=0,(NLOOPLINE-1)
1582+ PCT(I,J)=0.D0
1583+ ENDDO
1584+ ENDDO
1585+ DO I=0,3
1586+ DO J=1,NLOOPLINE
1587+ PCT(I,0)=PCT(I,0)+PL(I,J)
1588+ ENDDO
1589+ ENDDO
1590+ IF (CHECKPCONSERVATION) THEN
1591+ IF (PCT(0,0).GT.1.D-6) THEN
1592+ WRITE(*,*) 'energy is not conserved ',PCT(0,0)
1593+ STOP 'energy is not conserved'
1594+ ELSEIF (PCT(1,0).GT.1.D-6) THEN
1595+ WRITE(*,*) 'px is not conserved ',PCT(1,0)
1596+ STOP 'px is not conserved'
1597+ ELSEIF (PCT(2,0).GT.1.D-6) THEN
1598+ WRITE(*,*) 'py is not conserved ',PCT(2,0)
1599+ STOP 'py is not conserved'
1600+ ELSEIF (PCT(3,0).GT.1.D-6) THEN
1601+ WRITE(*,*) 'pz is not conserved ',PCT(3,0)
1602+ STOP 'pz is not conserved'
1603+ ENDIF
1604+ ENDIF
1605+ DO I=0,3
1606+ DO J=1,(NLOOPLINE-1)
1607+ DO K=1,J
1608+ PCT(I,J)=PCT(I,J)+PL(I,K)
1609+ ENDDO
1610+ ENDDO
1611+ ENDDO
1612+
1613+ CALL CTSXCUT(CTMODE,LSCALE,MU_R,NLOOPLINE,LOOPNUM,MPLOOPNUM,RANK
1614+ $ ,PCT,M2LCT,RES,ACC,R1,STABLE)
1615+ RES(1)=NORMALIZATION*2.0D0*DBLE(RES(1))
1616+ RES(2)=NORMALIZATION*2.0D0*DBLE(RES(2))
1617+ RES(3)=NORMALIZATION*2.0D0*DBLE(RES(3))
1618+C WRITE(*,*) 'Loop ID',ID,' =',RES(1),RES(2),RES(3)
1619+ END
1620+
1621+ SUBROUTINE INITCT()
1622+C
1623+C INITIALISATION OF CUTTOOLS
1624+C
1625+C LOCAL VARIABLES
1626+C
1627+ REAL*8 THRS
1628+ LOGICAL EXT_NUM_FOR_R1
1629+C
1630+C GLOBAL VARIABLES
1631+C
1632+ INCLUDE 'MadLoopParams.inc'
1633+C ----------
1634+C BEGIN CODE
1635+C ----------
1636+
1637+C DEFAULT PARAMETERS FOR CUTTOOLS
1638+C -------------------------------
1639+C THRS1 IS THE PRECISION LIMIT BELOW WHICH THE MP ROUTINES
1640+C ACTIVATES
1641+ THRS=CTSTABTHRES
1642+C LOOPLIB SET WHAT LIBRARY CT USES
1643+C 1 -> LOOPTOOLS
1644+C 2 -> AVH
1645+C 3 -> QCDLOOP
1646+ LOOPLIB=CTLOOPLIBRARY
1647+C MADLOOP'S NUMERATOR IN THE OPEN LOOP IS MUCH FASTER THAN THE
1648+C RECONSTRUCTED ONE IN CT. SO WE BETTER USE MADLOOP ONE IN THIS
1649+C CASE.
1650+ EXT_NUM_FOR_R1=.TRUE.
1651+C -------------------------------
1652+
1653+C The initialization below is for CT v1.8.+
1654+ CALL CTSINIT(THRS,LOOPLIB,EXT_NUM_FOR_R1)
1655+C The initialization below is for the older stable CT v1.7, still
1656+C used for now in the beta release.
1657+C CALL CTSINIT(THRS,LOOPLIB)
1658+
1659+ END
1660+
1661+ SUBROUTINE LOOP_3(W1, W2, W3, M1, M2, M3, RANK, SQUAREDSOINDEX
1662+ $ , LOOPNUM)
1663+ INTEGER NEXTERNAL
1664+ PARAMETER (NEXTERNAL=3)
1665+ INTEGER NLOOPLINE
1666+ PARAMETER (NLOOPLINE=3)
1667+ INTEGER NWAVEFUNCS
1668+ PARAMETER (NWAVEFUNCS=3)
1669+ INTEGER NLOOPGROUPS
1670+ PARAMETER (NLOOPGROUPS=1)
1671+ INTEGER NCOMB
1672+ PARAMETER (NCOMB=12)
1673+C These are constants related to the split orders
1674+ INTEGER NSQUAREDSO
1675+ PARAMETER (NSQUAREDSO=1)
1676+C
1677+C ARGUMENTS
1678+C
1679+ INTEGER W1, W2, W3
1680+ COMPLEX*16 M1, M2, M3
1681+
1682+ INTEGER RANK, LSYMFACT
1683+ INTEGER LOOPNUM, SQUAREDSOINDEX
1684+C
1685+C LOCAL VARIABLES
1686+C
1687+ REAL*8 PL(0:3,NLOOPLINE)
1688+ COMPLEX*16 M2L(NLOOPLINE)
1689+ INTEGER PAIRING(NLOOPLINE),WE(3)
1690+ INTEGER I, J, K, TEMP,I_LIB
1691+ LOGICAL COMPLEX_MASS,DOING_QP
1692+C
1693+C GLOBAL VARIABLES
1694+C
1695+ INCLUDE 'MadLoopParams.inc'
1696+ INTEGER ID,SQSOINDEX,R
1697+ COMMON/LOOP/ID,SQSOINDEX,R
1698+
1699+ LOGICAL CHECKPHASE, HELDOUBLECHECKED
1700+ COMMON/INIT/CHECKPHASE, HELDOUBLECHECKED
1701+
1702+ INTEGER HELOFFSET
1703+ INTEGER GOODHEL(NCOMB)
1704+ LOGICAL GOODAMP(NSQUAREDSO,NLOOPGROUPS)
1705+ COMMON/FILTERS/GOODAMP,GOODHEL,HELOFFSET
1706+
1707+ COMPLEX*16 LOOPRES(3,NSQUAREDSO,NLOOPGROUPS)
1708+ LOGICAL S(NSQUAREDSO,NLOOPGROUPS)
1709+ COMMON/LOOPRES/LOOPRES,S
1710+
1711+
1712+ COMPLEX*16 W(20,NWAVEFUNCS)
1713+ COMMON/W/W
1714+ REAL*8 LSCALE
1715+ INTEGER CTMODE
1716+ COMMON/CT/LSCALE,CTMODE
1717+ INTEGER LIBINDEX
1718+ COMMON/I_LIB/LIBINDEX
1719+
1720+C ----------
1721+C BEGIN CODE
1722+C ----------
1723+
1724+ IF (CHECKPHASE.OR.(.NOT.HELDOUBLECHECKED).OR.GOODAMP(SQUAREDSOIND
1725+ $ EX,LOOPNUM)) THEN
1726+ WE(1)=W1
1727+ WE(2)=W2
1728+ WE(3)=W3
1729+ M2L(1)=M3**2
1730+ M2L(2)=M1**2
1731+ M2L(3)=M2**2
1732+ DO I=1,NLOOPLINE
1733+ PAIRING(I)=1
1734+ ENDDO
1735+
1736+ R=RANK
1737+ ID=LOOPNUM
1738+ SQSOINDEX=SQUAREDSOINDEX
1739+ DO I=0,3
1740+ TEMP=1
1741+ DO J=1,NLOOPLINE
1742+ PL(I,J)=0.D0
1743+ DO K=TEMP,(TEMP+PAIRING(J)-1)
1744+ PL(I,J)=PL(I,J)-DBLE(W(1+I,WE(K)))
1745+ ENDDO
1746+ TEMP=TEMP+PAIRING(J)
1747+ ENDDO
1748+ ENDDO
1749+C Determine whether the integral is with complex masses or not
1750+C since some reduction libraries, e.g.PJFry++ and IREGI, are
1751+C still
1752+C not able to deal with complex masses
1753+ COMPLEX_MASS=.FALSE.
1754+ DO I=1,NLOOPLINE
1755+ IF(DIMAG(M2L(I)).EQ.0D0)CYCLE
1756+ IF(ABS(DIMAG(M2L(I)))/MAX(ABS(M2L(I)),1D-2).GT.1D-15)THEN
1757+ COMPLEX_MASS=.TRUE.
1758+ EXIT
1759+ ENDIF
1760+ ENDDO
1761+C Determine it uses qp or not
1762+ DOING_QP=.FALSE.
1763+ IF(CTMODE.GE.4)DOING_QP=.TRUE.
1764+C Choose the correct loop library
1765+ CALL CHOOSE_LOOPLIB(LIBINDEX,NLOOPLINE,RANK,COMPLEX_MASS
1766+ $ ,DOING_QP,I_LIB)
1767+ IF(MLREDUCTIONLIB(I_LIB).EQ.1)THEN
1768+C USE CUTTOOLS
1769+ CALL CTLOOP(NLOOPLINE,PL,M2L,RANK,LOOPRES(1,SQUAREDSOINDEX
1770+ $ ,LOOPNUM),S(SQUAREDSOINDEX,LOOPNUM))
1771+ ELSE
1772+C USE TIR
1773+ CALL TIRLOOP(SQUAREDSOINDEX,LOOPNUM,I_LIB,NLOOPLINE,PL,M2L
1774+ $ ,RANK,LOOPRES(1,SQUAREDSOINDEX,LOOPNUM),S(SQUAREDSOINDEX
1775+ $ ,LOOPNUM))
1776+ ENDIF
1777+ ELSE
1778+ LOOPRES(1,SQUAREDSOINDEX,LOOPNUM)=(0.0D0,0.0D0)
1779+ LOOPRES(2,SQUAREDSOINDEX,LOOPNUM)=(0.0D0,0.0D0)
1780+ LOOPRES(3,SQUAREDSOINDEX,LOOPNUM)=(0.0D0,0.0D0)
1781+ S(SQUAREDSOINDEX,LOOPNUM)=.TRUE.
1782+ ENDIF
1783+ END
1784+
1785
1786=== added file 'tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%GOLEM_interface.f'
1787--- tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%GOLEM_interface.f 1970-01-01 00:00:00 +0000
1788+++ tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%GOLEM_interface.f 2016-02-24 13:54:50 +0000
1789@@ -0,0 +1,760 @@
1790+ SUBROUTINE GOLEMLOOP(NLOOPLINE,PL,M2L,RANK,RES,STABLE)
1791+C
1792+C Generated by MadGraph5_aMC@NLO v. %(version)s, %(date)s
1793+C By the MadGraph5_aMC@NLO Development Team
1794+C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch
1795+C
1796+C Interface between MG5 and Golem95.
1797+C The Golem95 version should be higher than 1.3.0.
1798+C It supports RANK = NLOOPLINE + 1 tensor integrals when 1 <
1799+C NLOOPLINE < 6.
1800+C
1801+C Process: d~ u > w+ WEIGHTED=2 QED=1 [ all = QCD ]
1802+C Process: s~ c > w+ WEIGHTED=2 QED=1 [ all = QCD ]
1803+C
1804+C
1805+C MODULES
1806+C
1807+ USE MATRICE_S
1808+ USE FORM_FACTOR_TYPE, ONLY: FORM_FACTOR
1809+ USE PRECISION_GOLEM, ONLY: KI
1810+ USE TENS_COMB
1811+ USE TENS_REC
1812+ USE FORM_FACTOR_1P, ONLY: A10
1813+ USE FORM_FACTOR_2P, ONLY: A20
1814+ USE FORM_FACTOR_3P, ONLY: A30
1815+ USE FORM_FACTOR_4P, ONLY: A40
1816+ USE FORM_FACTOR_5P, ONLY: A50
1817+ USE FORM_FACTOR_6P, ONLY: A60
1818+ IMPLICIT NONE
1819+C
1820+C CONSTANTS
1821+C
1822+ INTEGER NEXTERNAL
1823+ PARAMETER (NEXTERNAL=3)
1824+ LOGICAL CHECKPCONSERVATION
1825+ PARAMETER (CHECKPCONSERVATION=.TRUE.)
1826+ REAL*8 NORMALIZATION
1827+ PARAMETER (NORMALIZATION = 1.D0/(16.D0*3.14159265358979323846D0*
1828+ $ *2))
1829+ REAL(KI),DIMENSION(0:3),PARAMETER::NULL_VEC = (/0.0_KI,0.0_KI
1830+ $ ,0.0_KI,0.0_KI/)
1831+C GOLEM_RUN_MODE = 1: Use directly MadLoop tensorial coefficients
1832+C GOLEM_RUN_MODE = 2: Reconstruct the tensorial coefficeints
1833+C directly from
1834+C numerator using golem internal reconstruction routine
1835+C GOLEM_RUN_MODE = 3: Cross-checked reconstructed coefficients
1836+C against
1837+C MadLoop internal ones.
1838+ INTEGER GOLEM_RUN_MODE
1839+ PARAMETER (GOLEM_RUN_MODE=1)
1840+C The following is the acceptance threshold used for GOLEM_RUN_MODE
1841+C = 3
1842+ REAL*8 COEF_CHECK_THRS
1843+ DATA COEF_CHECK_THRS/1.0D-13/
1844+ COMMON/COEF_CHECK_THRS/COEF_CHECK_THRS
1845+
1846+ LOGICAL PASS_COEF_CHECK
1847+C
1848+C ARGUMENTS
1849+C
1850+ INTEGER NLOOPLINE, RANK
1851+ REAL*8 PL(0:3,NLOOPLINE)
1852+ REAL*8 PCT(0:3,0:NLOOPLINE-1)
1853+ REAL(KI) PGOLEM(NLOOPLINE,0:3)
1854+ COMPLEX*16 M2L(NLOOPLINE)
1855+ COMPLEX(KI) M2LGOLEM(NLOOPLINE)
1856+ COMPLEX*16 RES(3)
1857+ LOGICAL STABLE
1858+C
1859+C LOCAL VARIABLES
1860+C
1861+ INTEGER I, J, K
1862+ TYPE(FORM_FACTOR)::RES_GOLEM
1863+
1864+ COMPLEX(KI)::COEFFS0,COEFFS0_REC
1865+ TYPE(COEFF_TYPE_1)::COEFFS1,COEFFS1_REC
1866+ TYPE(COEFF_TYPE_2)::COEFFS2,COEFFS2_REC
1867+ TYPE(COEFF_TYPE_3)::COEFFS3,COEFFS3_REC
1868+ TYPE(COEFF_TYPE_4)::COEFFS4,COEFFS4_REC
1869+ TYPE(COEFF_TYPE_5)::COEFFS5,COEFFS5_REC
1870+ TYPE(COEFF_TYPE_6)::COEFFS6,COEFFS6_REC
1871+
1872+C The pinch propagator optimization is not used, so for now it is
1873+C always 0.
1874+ INTEGER PINCH
1875+C
1876+C EXTERNAL FUNCTIONS
1877+C
1878+ COMPLEX(KI) GOLEM_LOOPNUM
1879+ EXTERNAL GOLEM_LOOPNUM
1880+ LOGICAL COMPARE_COEFS_0
1881+ LOGICAL COMPARE_COEFS_1
1882+ LOGICAL COMPARE_COEFS_2
1883+ LOGICAL COMPARE_COEFS_3
1884+ LOGICAL COMPARE_COEFS_4
1885+ LOGICAL COMPARE_COEFS_5
1886+ LOGICAL COMPARE_COEFS_6
1887+C
1888+C GLOBAL VARIABLES
1889+C
1890+ INCLUDE 'coupl.inc'
1891+ INTEGER CTMODE
1892+ REAL*8 LSCALE
1893+ COMMON/CT/LSCALE,CTMODE
1894+
1895+ INTEGER ID,SQSOINDEX,R
1896+ COMMON/LOOP/ID,SQSOINDEX,R
1897+
1898+ LOGICAL CTINIT, TIRINIT, GOLEMINIT
1899+ COMMON/REDUCTIONCODEINIT/CTINIT, TIRINIT,GOLEMINIT
1900+
1901+ INTEGER NLOOPGROUPS
1902+ PARAMETER (NLOOPGROUPS=1)
1903+ INTEGER LOOPMAXCOEFS
1904+ PARAMETER (LOOPMAXCOEFS=15)
1905+ INTEGER NSQUAREDSO
1906+ PARAMETER (NSQUAREDSO=1)
1907+
1908+ COMPLEX*16 LOOPCOEFS(0:LOOPMAXCOEFS-1,NSQUAREDSO,NLOOPGROUPS)
1909+ COMMON/LCOEFS/LOOPCOEFS
1910+C ----------
1911+C BEGIN CODE
1912+C ----------
1913+
1914+C INITIALIZE CUTTOOLS IF NEEDED
1915+ IF (GOLEMINIT) THEN
1916+ GOLEMINIT=.FALSE.
1917+ CALL INITGOLEM()
1918+ ENDIF
1919+
1920+C No stability test intrisic to Golem95 now
1921+ STABLE=.TRUE.
1922+
1923+C This initialization must be done for each reduction because we
1924+C have not setup anyoptimization using pinched propagators yet.
1925+ CALL INITGOLEM95(NLOOPLINE)
1926+ PINCH = 0
1927+
1928+C YOU CAN FIND THE DETAILS ABOUT THE DIFFERENT CTMODE AT THE
1929+C BEGINNING OF THE FILE CTS_CUTS.F90 IN THE CUTTOOLS DISTRIBUTION
1930+
1931+C CONVERT THE MASSES TO BE COMPLEX
1932+ DO I=1,NLOOPLINE
1933+ M2LGOLEM(I)=M2L(I)
1934+ ENDDO
1935+
1936+C CONVERT THE MOMENTA FLOWING IN THE LOOP LINES TO CT CONVENTIONS
1937+ DO I=0,3
1938+ DO J=0,(NLOOPLINE-1)
1939+ PCT(I,J)=0.D0
1940+ ENDDO
1941+ ENDDO
1942+ DO I=0,3
1943+ DO J=1,NLOOPLINE
1944+ PCT(I,0)=PCT(I,0)+PL(I,J)
1945+ ENDDO
1946+ ENDDO
1947+ IF (CHECKPCONSERVATION) THEN
1948+ IF (PCT(0,0).GT.1.D-6) THEN
1949+ WRITE(*,*) 'energy is not conserved ',PCT(0,0)
1950+ STOP 'energy is not conserved'
1951+ ELSEIF (PCT(1,0).GT.1.D-6) THEN
1952+ WRITE(*,*) 'px is not conserved ',PCT(1,0)
1953+ STOP 'px is not conserved'
1954+ ELSEIF (PCT(2,0).GT.1.D-6) THEN
1955+ WRITE(*,*) 'py is not conserved ',PCT(2,0)
1956+ STOP 'py is not conserved'
1957+ ELSEIF (PCT(3,0).GT.1.D-6) THEN
1958+ WRITE(*,*) 'pz is not conserved ',PCT(3,0)
1959+ STOP 'pz is not conserved'
1960+ ENDIF
1961+ ENDIF
1962+ DO I=0,3
1963+ DO J=1,(NLOOPLINE-1)
1964+ DO K=1,J
1965+ PCT(I,J)=PCT(I,J)+PL(I,K)
1966+ ENDDO
1967+ ENDDO
1968+ ENDDO
1969+
1970+C Now convert the loop momenta to Golem95 conventions
1971+ DO I=0,3
1972+ PGOLEM(1,I)=0.0E0_KI
1973+ DO J=2,NLOOPLINE
1974+ PGOLEM(J,I)=PCT(I,J-1)
1975+ ENDDO
1976+ ENDDO
1977+
1978+C Fill in the kinematic s-matrix while taking care of on-shell
1979+C limits.
1980+ CALL SETUP_KIN_MATRIX(NLOOPLINE,PGOLEM,M2LGOLEM)
1981+C Construct the golem internal matrices derived from the kinetic
1982+C one.
1983+ CALL PREPARESMATRIX()
1984+
1985+C Fill in the golem coefficents and compute the loop
1986+ IF(GOLEM_RUN_MODE.EQ.2)THEN
1987+ RES_GOLEM = EVALUATE_B(GOLEM_LOOPNUM,PGOLEM,0,RANK)
1988+ ELSE
1989+ PASS_COEF_CHECK=.TRUE.
1990+ SELECT CASE(RANK)
1991+ CASE(0)
1992+ CALL FILL_GOLEM_COEFFS_0(LOOPCOEFS(0,SQSOINDEX,ID),COEFFS0)
1993+ IF(GOLEM_RUN_MODE.EQ.3)THEN
1994+ COEFFS0_REC = GOLEM_LOOPNUM(NULL_VEC,0.0_KI)
1995+ PASS_COEF_CHECK=COMPARE_COEFS_0(COEFFS0,COEFFS0_REC)
1996+ ENDIF
1997+ CASE(1)
1998+ CALL FILL_GOLEM_COEFFS_1(LOOPCOEFS(0,SQSOINDEX,ID),COEFFS1)
1999+ IF(GOLEM_RUN_MODE.EQ.3)THEN
2000+ CALL RECONSTRUCT1(GOLEM_LOOPNUM,COEFFS1_REC)
2001+ PASS_COEF_CHECK=COMPARE_COEFS_1(COEFFS1,COEFFS1_REC)
2002+ ENDIF
2003+ CASE(2)
2004+ CALL FILL_GOLEM_COEFFS_2(LOOPCOEFS(0,SQSOINDEX,ID),COEFFS2)
2005+ IF(GOLEM_RUN_MODE.EQ.3)THEN
2006+ CALL RECONSTRUCT2(GOLEM_LOOPNUM,COEFFS2_REC)
2007+ PASS_COEF_CHECK=COMPARE_COEFS_2(COEFFS2,COEFFS2_REC)
2008+ ENDIF
2009+ CASE(3)
2010+ CALL FILL_GOLEM_COEFFS_3(LOOPCOEFS(0,SQSOINDEX,ID),COEFFS3)
2011+ IF(GOLEM_RUN_MODE.EQ.3)THEN
2012+ CALL RECONSTRUCT3(GOLEM_LOOPNUM,COEFFS3_REC)
2013+ PASS_COEF_CHECK=COMPARE_COEFS_3(COEFFS3,COEFFS3_REC)
2014+ ENDIF
2015+ CASE(4)
2016+ CALL FILL_GOLEM_COEFFS_4(LOOPCOEFS(0,SQSOINDEX,ID),COEFFS4)
2017+ IF(GOLEM_RUN_MODE.EQ.3)THEN
2018+ CALL RECONSTRUCT4(GOLEM_LOOPNUM,COEFFS4_REC)
2019+ PASS_COEF_CHECK=COMPARE_COEFS_4(COEFFS4,COEFFS4_REC)
2020+ ENDIF
2021+ CASE(5)
2022+ CALL FILL_GOLEM_COEFFS_5(LOOPCOEFS(0,SQSOINDEX,ID),COEFFS5)
2023+ IF(GOLEM_RUN_MODE.EQ.3)THEN
2024+ CALL RECONSTRUCT5(GOLEM_LOOPNUM,COEFFS5_REC)
2025+ PASS_COEF_CHECK=COMPARE_COEFS_5(COEFFS5,COEFFS5_REC)
2026+ ENDIF
2027+ CASE(6)
2028+ CALL FILL_GOLEM_COEFFS_6(LOOPCOEFS(0,SQSOINDEX,ID),COEFFS6)
2029+ IF(GOLEM_RUN_MODE.EQ.3)THEN
2030+ CALL RECONSTRUCT6(GOLEM_LOOPNUM,COEFFS6_REC)
2031+ PASS_COEF_CHECK=COMPARE_COEFS_6(COEFFS6,COEFFS6_REC)
2032+ ENDIF
2033+ CASE DEFAULT
2034+ WRITE(*,*)'Not yet implemented in Golem95 for rank= ',RANK
2035+ STOP
2036+ END SELECT
2037+
2038+ IF(.NOT.PASS_COEF_CHECK)THEN
2039+ WRITE(*,*)'Coefs mismatch for ID ',ID,' and rank ',RANK
2040+ WRITE(*,*)'Coefs form MadLoop5:'
2041+ SELECT CASE(RANK)
2042+ CASE(0)
2043+ WRITE(*,*)'Constant coef = ',COEFFS0
2044+ CASE(1)
2045+ CALL PRINT_COEFFS(COEFFS1)
2046+ CASE(2)
2047+ CALL PRINT_COEFFS(COEFFS2)
2048+ CASE(3)
2049+ CALL PRINT_COEFFS(COEFFS3)
2050+ CASE(4)
2051+ CALL PRINT_COEFFS(COEFFS4)
2052+ CASE(5)
2053+ CALL PRINT_COEFFS(COEFFS5)
2054+ CASE(6)
2055+ CALL PRINT_COEFFS(COEFFS6)
2056+ END SELECT
2057+ WRITE(*,*)'Coefs reconstructed by Golem95:'
2058+ SELECT CASE(RANK)
2059+ CASE(0)
2060+ WRITE(*,*)'Constant coef = ',COEFFS0_REC
2061+ CASE(1)
2062+ CALL PRINT_COEFFS(COEFFS1_REC)
2063+ CASE(2)
2064+ CALL PRINT_COEFFS(COEFFS2_REC)
2065+ CASE(3)
2066+ CALL PRINT_COEFFS(COEFFS3_REC)
2067+ CASE(4)
2068+ CALL PRINT_COEFFS(COEFFS4_REC)
2069+ CASE(5)
2070+ CALL PRINT_COEFFS(COEFFS5_REC)
2071+ CASE(6)
2072+ CALL PRINT_COEFFS(COEFFS6_REC)
2073+ END SELECT
2074+ STOP
2075+ ENDIF
2076+
2077+ SELECT CASE(NLOOPLINE)
2078+ CASE(1)
2079+ WRITE(*,*)'Golem95 cannot handle with tadpole yet'
2080+ STOP
2081+ CASE(2)
2082+ SELECT CASE(RANK)
2083+ CASE(0)
2084+ RES_GOLEM = COEFFS0*A20(PINCH)
2085+ CASE(1)
2086+ RES_GOLEM = CONTRACT2_1(COEFFS1,PGOLEM,PINCH)
2087+ CASE(2)
2088+ RES_GOLEM = CONTRACT2_2(COEFFS2,PGOLEM,PINCH)
2089+ CASE(3)
2090+ RES_GOLEM = CONTRACT2_3(COEFFS3,PGOLEM,PINCH)
2091+ CASE DEFAULT
2092+ WRITE(*,*)'Golem95 cannot handle with: N,r = ',2,RANK
2093+ STOP
2094+ END SELECT
2095+ CASE(3)
2096+ SELECT CASE(RANK)
2097+ CASE(0)
2098+ RES_GOLEM = COEFFS0*A30(PINCH)
2099+ CASE(1)
2100+ RES_GOLEM = CONTRACT3_1(COEFFS1,PGOLEM,PINCH)
2101+ CASE(2)
2102+ RES_GOLEM = CONTRACT3_2(COEFFS2,PGOLEM,PINCH)
2103+ CASE(3)
2104+ RES_GOLEM = CONTRACT3_3(COEFFS3,PGOLEM,PINCH)
2105+ CASE(4)
2106+ RES_GOLEM = CONTRACT3_4(COEFFS4,PGOLEM,PINCH)
2107+ CASE DEFAULT
2108+ WRITE(*,*)'Golem95 cannot handle with: N,r = ',3,RANK
2109+ STOP
2110+ END SELECT
2111+ CASE(4)
2112+ SELECT CASE(RANK)
2113+ CASE(0)
2114+ RES_GOLEM = COEFFS0*A40(PINCH)
2115+ CASE(1)
2116+ RES_GOLEM = CONTRACT4_1(COEFFS1,PGOLEM,PINCH)
2117+ CASE(2)
2118+ RES_GOLEM = CONTRACT4_2(COEFFS2,PGOLEM,PINCH)
2119+ CASE(3)
2120+ RES_GOLEM = CONTRACT4_3(COEFFS3,PGOLEM,PINCH)
2121+ CASE(4)
2122+ RES_GOLEM = CONTRACT4_4(COEFFS4,PGOLEM,PINCH)
2123+ CASE(5)
2124+ RES_GOLEM = CONTRACT4_5(COEFFS5,PGOLEM,PINCH)
2125+ CASE DEFAULT
2126+ WRITE(*,*)'Golem95 cannot handle with: N,r = ',4,RANK
2127+ STOP
2128+ END SELECT
2129+ CASE(5)
2130+ SELECT CASE(RANK)
2131+ CASE(0)
2132+ RES_GOLEM = COEFFS0*A50(PINCH)
2133+ CASE(1)
2134+ RES_GOLEM = CONTRACT5_1(COEFFS1,PGOLEM,PINCH)
2135+ CASE(2)
2136+ RES_GOLEM = CONTRACT5_2(COEFFS2,PGOLEM,PINCH)
2137+ CASE(3)
2138+ RES_GOLEM = CONTRACT5_3(COEFFS3,PGOLEM,PINCH)
2139+ CASE(4)
2140+ RES_GOLEM = CONTRACT5_4(COEFFS4,PGOLEM,PINCH)
2141+ CASE(5)
2142+ RES_GOLEM = CONTRACT5_5(COEFFS5,PGOLEM,PINCH)
2143+ CASE(6)
2144+ RES_GOLEM = CONTRACT5_6(COEFFS6,PGOLEM,PINCH)
2145+ CASE DEFAULT
2146+ WRITE(*,*)'Golem95 cannot handle with: N,r = ',5,RANK
2147+ STOP
2148+ END SELECT
2149+ CASE(6)
2150+ SELECT CASE(RANK)
2151+ CASE(0)
2152+ RES_GOLEM = COEFFS0*A60(PINCH)
2153+ CASE(1)
2154+ RES_GOLEM = CONTRACT6_1(COEFFS1,PGOLEM,PINCH)
2155+ CASE(2)
2156+ RES_GOLEM = CONTRACT6_2(COEFFS2,PGOLEM,PINCH)
2157+ CASE(3)
2158+ RES_GOLEM = CONTRACT6_3(COEFFS3,PGOLEM,PINCH)
2159+ CASE(4)
2160+ RES_GOLEM = CONTRACT6_4(COEFFS4,PGOLEM,PINCH)
2161+ CASE(5)
2162+ RES_GOLEM = CONTRACT6_5(COEFFS5,PGOLEM,PINCH)
2163+ CASE(6)
2164+ RES_GOLEM = CONTRACT6_6(COEFFS6,PGOLEM,PINCH)
2165+ CASE DEFAULT
2166+ WRITE(*,*)'Golem95 cannot handle with: N,r = ',6,RANK
2167+ STOP
2168+ END SELECT
2169+ CASE DEFAULT
2170+ WRITE(*,*)'Golem95 cannot handle with: N = ',NLOOPLINE
2171+ STOP
2172+ END SELECT
2173+ ENDIF
2174+
2175+ RES(1)=NORMALIZATION*2.0D0*DBLE(RES_GOLEM%%C+2.0*LOG(MU_R)
2176+ $ *RES_GOLEM%%B+2.0*LOG(MU_R)**2*RES_GOLEM%%A)
2177+ RES(2)=NORMALIZATION*2.0D0*DBLE(RES_GOLEM%%B+2.0*LOG(MU_R)
2178+ $ *RES_GOLEM%%A)
2179+ RES(3)=NORMALIZATION*2.0D0*DBLE(RES_GOLEM%%A)
2180+C WRITE(*,*) 'Loop ID',ID,' =',RES(1),RES(2),RES(3)
2181+
2182+C Finally free golem memory and cache
2183+ CALL EXITGOLEM95()
2184+
2185+ END
2186+
2187+ FUNCTION GOLEM_LOOPNUM(Q,MU2)
2188+ USE PRECISION_GOLEM, ONLY: KI
2189+ REAL(KI),DIMENSION(0:3),INTENT(IN)::Q
2190+ REAL(KI),INTENT(IN)::MU2
2191+ COMPLEX(KI)::GOLEM_LOOPNUM
2192+
2193+ COMPLEX*16 QQ(0:3),NUM
2194+ INTEGER I
2195+
2196+ DO I=0,3
2197+ QQ(I)=CMPLX(Q(I),0.0D0,KIND=16)
2198+ ENDDO
2199+
2200+ CALL LOOPNUM(QQ,NUM)
2201+ GOLEM_LOOPNUM=NUM
2202+ RETURN
2203+ END FUNCTION
2204+
2205+ SUBROUTINE INITGOLEM()
2206+C
2207+C INITIALISATION OF GOLEM
2208+C
2209+C
2210+C MODULE
2211+C
2212+ USE PARAMETRE
2213+C
2214+C LOCAL VARIABLES
2215+C
2216+ REAL*8 THRS
2217+ LOGICAL EXT_NUM_FOR_R1
2218+C
2219+C GLOBAL VARIABLES
2220+C
2221+ INCLUDE 'MadLoopParams.inc'
2222+C ----------
2223+C BEGIN CODE
2224+C ----------
2225+
2226+C DEFAULT PARAMETERS FOR GOLEM
2227+C -------------------------------
2228+C One can chose here to have either just the rational R1 piece
2229+C or everything but the R2
2230+ RAT_OR_TOT_PAR = TOT
2231+
2232+ END
2233+
2234+ SUBROUTINE SETUP_KIN_MATRIX(NLOOPLINE,PGOLEM,M2L)
2235+C
2236+C MODULE
2237+C
2238+ USE MATRICE_S
2239+ USE PRECISION_GOLEM, ONLY: KI
2240+C
2241+C ARGUMENTS
2242+C
2243+ INTEGER NLOOPLINE
2244+ REAL(KI) PGOLEM(NLOOPLINE,0:3)
2245+ COMPLEX(KI) M2L(NLOOPLINE)
2246+
2247+C
2248+C GLOBAL VARIABLES
2249+C
2250+ INCLUDE 'MadLoopParams.inc'
2251+ INTEGER CTMODE
2252+ REAL*8 LSCALE
2253+ COMMON/CT/LSCALE,CTMODE
2254+ REAL*8 REF_NORMALIZATION
2255+C
2256+C LOCAL VARIABLES
2257+C
2258+ INTEGER I,J,K
2259+ COMPLEX(KI) DIFFSQ
2260+C ----------
2261+C BEGIN CODE
2262+C ----------
2263+
2264+ DO I=1,NLOOPLINE
2265+ DO J=1,NLOOPLINE
2266+ IF(I.EQ.J)THEN
2267+ S_MAT(I,J)=-(M2L(I)+M2L(J))
2268+ ELSE
2269+ DIFFSQ = (CMPLX(PGOLEM(I,0),0.0_KI,KIND=KI)-CMPLX(PGOLEM(J
2270+ $ ,0),0.0_KI,KIND=KI))**2
2271+ DO K=1,3
2272+ DIFFSQ = DIFFSQ-(CMPLX(PGOLEM(I,K),0.0_KI,KIND=KI)
2273+ $ -CMPLX(PGOLEM(J,K),0.0_KI,KIND=KI))**2
2274+ ENDDO
2275+ S_MAT(I,J)=DIFFSQ-M2L(I)-M2L(J)
2276+ IF(M2L(I).NE.0.0D0)THEN
2277+ IF(ABS((DIFFSQ-M2L(I))/M2L(I)).LT.OSTHRES)THEN
2278+ S_MAT(I,J)=-M2L(J)
2279+ ENDIF
2280+ ENDIF
2281+ IF(M2L(J).NE.0.0D0)THEN
2282+ IF(ABS((DIFFSQ-M2L(J))/M2L(J)).LT.OSTHRES)THEN
2283+ S_MAT(I,J)=-M2L(I)
2284+ ENDIF
2285+ ENDIF
2286+C Chose what seems the most appropriate way to compare
2287+C massless onshellness. (here we pick the energy component)
2288+ REF_NORMALIZATION=(PGOLEM(I,0)+PGOLEM(J,0))**2
2289+ IF(REF_NORMALIZATION.NE.0.0D0)THEN
2290+ IF(ABS(DIFFSQ/REF_NORMALIZATION).LT.OSTHRES)THEN
2291+ S_MAT(I,J)=-(M2L(I)+M2L(J))
2292+ ENDIF
2293+ ENDIF
2294+ ENDIF
2295+ ENDDO
2296+ ENDDO
2297+
2298+ END
2299+
2300+ FUNCTION COMPARE_COEFS_0(COEFS_A,COEFS_B)
2301+
2302+ USE PRECISION_GOLEM, ONLY: KI
2303+ COMPLEX(KI) COEFS_A,COEFS_B
2304+ REAL*8 COEF_CHECK_THRS
2305+ COMMON/COEF_CHECK_THRS/COEF_CHECK_THRS
2306+ REAL*8 DENOM,NUM
2307+ LOGICAL COMPARE_COEFS_0
2308+
2309+ NUM = ABS(COEFS_A-COEFS_B)
2310+ DENOM = ABS(COEFS_A+COEFS_B)
2311+ IF(DENOM.GT.0D0)THEN
2312+ COMPARE_COEFS_0=((NUM/DENOM).LT.COEF_CHECK_THRS)
2313+ ELSE
2314+ COMPARE_COEFS_0=(NUM.LT.COEF_CHECK_THRS)
2315+ ENDIF
2316+
2317+ END
2318+
2319+ FUNCTION COMPARE_COEFS_1(COEFS_A,COEFS_B)
2320+
2321+ USE TENS_REC
2322+ TYPE(COEFF_TYPE_1)COEFS_A,COEFS_B
2323+ REAL*8 COEF_CHECK_THRS
2324+ COMMON/COEF_CHECK_THRS/COEF_CHECK_THRS
2325+ REAL*8 DENOM,NUM
2326+ LOGICAL COMPARE_COEFS_1
2327+
2328+ NUM = ABS(COEFS_A%%C0-COEFS_B%%C0)+SUM(ABS(COEFS_A%%C1-COEFS_B%%C1))
2329+ DENOM = ABS(COEFS_A%%C0+COEFS_B%%C0)+SUM(ABS(COEFS_A%%C1+COEFS_B%%C1
2330+ $ ))
2331+
2332+ IF(DENOM.GT.0D0)THEN
2333+ COMPARE_COEFS_1=((NUM/DENOM).LT.COEF_CHECK_THRS)
2334+ ELSE
2335+ COMPARE_COEFS_1=(NUM.LT.COEF_CHECK_THRS)
2336+ ENDIF
2337+
2338+ END
2339+
2340+ FUNCTION COMPARE_COEFS_2(COEFS_A,COEFS_B)
2341+
2342+ USE TENS_REC
2343+ TYPE(COEFF_TYPE_2) COEFS_A,COEFS_B
2344+ REAL*8 COEF_CHECK_THRS
2345+ COMMON/COEF_CHECK_THRS/COEF_CHECK_THRS
2346+ REAL*8 DENOM,NUM
2347+ LOGICAL COMPARE_COEFS_2
2348+
2349+ NUM = ABS(COEFS_A%%C0-COEFS_B%%C0)+SUM(ABS(COEFS_A%%C1-COEFS_B%%C1))
2350+ $ +SUM(ABS(COEFS_A%%C2-COEFS_B%%C2))
2351+ DENOM = ABS(COEFS_A%%C0+COEFS_B%%C0)+SUM(ABS(COEFS_A%%C1+COEFS_B%%C1
2352+ $ ))+SUM(ABS(COEFS_A%%C2+COEFS_B%%C2))
2353+ IF(DENOM.GT.0D0)THEN
2354+ COMPARE_COEFS_2=((NUM/DENOM).LT.COEF_CHECK_THRS)
2355+ ELSE
2356+ COMPARE_COEFS_2=(NUM.LT.COEF_CHECK_THRS)
2357+ ENDIF
2358+
2359+ END
2360+
2361+ FUNCTION COMPARE_COEFS_3(COEFS_A,COEFS_B)
2362+
2363+ USE TENS_REC
2364+ TYPE(COEFF_TYPE_3) COEFS_A, COEFS_B
2365+ REAL*8 COEF_CHECK_THRS
2366+ COMMON/COEF_CHECK_THRS/COEF_CHECK_THRS
2367+ REAL*8 DENOM,NUM
2368+ LOGICAL COMPARE_COEFS_3
2369+
2370+ NUM = ABS(COEFS_A%%C0-COEFS_B%%C0)+SUM(ABS(COEFS_A%%C1-COEFS_B%%C1))
2371+ $ +SUM(ABS(COEFS_A%%C2-COEFS_B%%C2))+SUM(ABS(COEFS_A%%C3-COEFS_B%%C3))
2372+ DENOM = ABS(COEFS_A%%C0+COEFS_B%%C0)+SUM(ABS(COEFS_A%%C1+COEFS_B%%C1
2373+ $ ))+SUM(ABS(COEFS_A%%C2+COEFS_B%%C2))+SUM(ABS(COEFS_A%%C3+COEFS_B%%C3
2374+ $ ))
2375+ IF(DENOM.GT.0D0)THEN
2376+ COMPARE_COEFS_3=((NUM/DENOM).LT.COEF_CHECK_THRS)
2377+ ELSE
2378+ COMPARE_COEFS_3=(NUM.LT.COEF_CHECK_THRS)
2379+ ENDIF
2380+
2381+ END
2382+
2383+ FUNCTION COMPARE_COEFS_4(COEFS_A,COEFS_B)
2384+
2385+ USE TENS_REC
2386+ TYPE(COEFF_TYPE_4) COEFS_A, COEFS_B
2387+ REAL*8 COEF_CHECK_THRS
2388+ COMMON/COEF_CHECK_THRS/COEF_CHECK_THRS
2389+ REAL*8 DENOM,NUM
2390+ LOGICAL COMPARE_COEFS_4
2391+
2392+ NUM = ABS(COEFS_A%%C0-COEFS_B%%C0)+SUM(ABS(COEFS_A%%C1-COEFS_B%%C1))
2393+ $ +SUM(ABS(COEFS_A%%C2-COEFS_B%%C2))+SUM(ABS(COEFS_A%%C3-COEFS_B%%C3)
2394+ $ )+SUM(ABS(COEFS_A%%C4-COEFS_B%%C4))
2395+ DENOM = ABS(COEFS_A%%C0+COEFS_B%%C0)+SUM(ABS(COEFS_A%%C1+COEFS_B%%C1
2396+ $ ))+SUM(ABS(COEFS_A%%C2+COEFS_B%%C2))+SUM(ABS(COEFS_A%%C3+COEFS_B%%C3
2397+ $ ))+SUM(ABS(COEFS_A%%C4+COEFS_B%%C4))
2398+ IF(DENOM.GT.0D0)THEN
2399+ COMPARE_COEFS_4=((NUM/DENOM).LT.COEF_CHECK_THRS)
2400+ ELSE
2401+ COMPARE_COEFS_4=(NUM.LT.COEF_CHECK_THRS)
2402+ ENDIF
2403+
2404+ END
2405+
2406+ FUNCTION COMPARE_COEFS_5(COEFS_A,COEFS_B)
2407+
2408+ USE TENS_REC
2409+ TYPE(COEFF_TYPE_5) COEFS_A,COEFS_B
2410+ REAL*8 COEF_CHECK_THRS
2411+ COMMON/COEF_CHECK_THRS/COEF_CHECK_THRS
2412+ REAL*8 DENOM,NUM
2413+ LOGICAL COMPARE_COEFS_5
2414+
2415+ NUM = ABS(COEFS_A%%C0-COEFS_B%%C0)+SUM(ABS(COEFS_A%%C1-COEFS_B%%C1))
2416+ $ +SUM(ABS(COEFS_A%%C2-COEFS_B%%C2))+SUM(ABS(COEFS_A%%C3-COEFS_B%%C3)
2417+ $ )+SUM(ABS(COEFS_A%%C4-COEFS_B%%C4))
2418+ DENOM = ABS(COEFS_A%%C0+COEFS_B%%C0)+SUM(ABS(COEFS_A%%C1+COEFS_B%%C1
2419+ $ ))+SUM(ABS(COEFS_A%%C2+COEFS_B%%C2))+SUM(ABS(COEFS_A%%C3+COEFS_B%%C3
2420+ $ ))+SUM(ABS(COEFS_A%%C4+COEFS_B%%C4))
2421+ IF(DENOM.GT.0D0)THEN
2422+ COMPARE_COEFS_5=((NUM/DENOM).LT.COEF_CHECK_THRS)
2423+ ELSE
2424+ COMPARE_COEFS_5=(NUM.LT.COEF_CHECK_THRS)
2425+ ENDIF
2426+
2427+ END
2428+
2429+ FUNCTION COMPARE_COEFS_6(COEFS_A,COEFS_B)
2430+
2431+ USE TENS_REC
2432+ TYPE(COEFF_TYPE_6) COEFS_A,COEFS_B
2433+ REAL*8 COEF_CHECK_THRS
2434+ COMMON/COEF_CHECK_THRS/COEF_CHECK_THRS
2435+ REAL*8 DENOM,NUM
2436+ LOGICAL COMPARE_COEFS_6
2437+
2438+ NUM = ABS(COEFS_A%%C0-COEFS_B%%C0)+SUM(ABS(COEFS_A%%C1-COEFS_B%%C1))
2439+ $ +SUM(ABS(COEFS_A%%C2-COEFS_B%%C2))+SUM(ABS(COEFS_A%%C3-COEFS_B%%C3)
2440+ $ )+SUM(ABS(COEFS_A%%C4-COEFS_B%%C4))
2441+ DENOM = ABS(COEFS_A%%C0+COEFS_B%%C0)+SUM(ABS(COEFS_A%%C1+COEFS_B%%C1
2442+ $ ))+SUM(ABS(COEFS_A%%C2+COEFS_B%%C2))+SUM(ABS(COEFS_A%%C3+COEFS_B%%C3
2443+ $ ))+SUM(ABS(COEFS_A%%C4+COEFS_B%%C4))
2444+ IF(DENOM.GT.0D0)THEN
2445+ COMPARE_COEFS_6=((NUM/DENOM).LT.COEF_CHECK_THRS)
2446+ ELSE
2447+ COMPARE_COEFS_6=(NUM.LT.COEF_CHECK_THRS)
2448+ ENDIF
2449+
2450+ END
2451+
2452+
2453+ SUBROUTINE FILL_GOLEM_COEFFS_0(ML_COEFS,GOLEM_COEFS)
2454+ USE PRECISION_GOLEM, ONLY: KI
2455+ INCLUDE 'coef_specs.inc'
2456+ COMPLEX*16 ML_COEFS(0:LOOP_MAXCOEFS-1)
2457+ COMPLEX(KI) GOLEM_COEFS
2458+ GOLEM_COEFS=ML_COEFS(0)
2459+ END
2460+
2461+ SUBROUTINE FILL_GOLEM_COEFFS_1(ML_COEFS,GOLEM_COEFS)
2462+ USE TENS_REC, ONLY: COEFF_TYPE_1
2463+ INCLUDE 'coef_specs.inc'
2464+ COMPLEX*16 ML_COEFS(0:LOOP_MAXCOEFS-1)
2465+ TYPE(COEFF_TYPE_1) GOLEM_COEFS
2466+C Constant coefficient
2467+ GOLEM_COEFS%%C0=ML_COEFS(0)
2468+C Coefficient q(0)
2469+ GOLEM_COEFS%%C1(1,1)=-ML_COEFS(1)
2470+C Coefficient q(1)
2471+ GOLEM_COEFS%%C1(2,1)=-ML_COEFS(2)
2472+C Coefficient q(2)
2473+ GOLEM_COEFS%%C1(3,1)=-ML_COEFS(3)
2474+C Coefficient q(3)
2475+ GOLEM_COEFS%%C1(4,1)=-ML_COEFS(4)
2476+ END
2477+
2478+ SUBROUTINE FILL_GOLEM_COEFFS_2(ML_COEFS,GOLEM_COEFS)
2479+ USE TENS_REC, ONLY: COEFF_TYPE_2
2480+ INCLUDE 'coef_specs.inc'
2481+ COMPLEX*16 ML_COEFS(0:LOOP_MAXCOEFS-1)
2482+ TYPE(COEFF_TYPE_2) GOLEM_COEFS
2483+C Constant coefficient
2484+ GOLEM_COEFS%%C0=ML_COEFS(0)
2485+C Coefficient q(0)
2486+ GOLEM_COEFS%%C1(1,1)=-ML_COEFS(1)
2487+C Coefficient q(0)^2
2488+ GOLEM_COEFS%%C1(1,2)= ML_COEFS(5)
2489+C Coefficient q(1)
2490+ GOLEM_COEFS%%C1(2,1)=-ML_COEFS(2)
2491+C Coefficient q(1)^2
2492+ GOLEM_COEFS%%C1(2,2)= ML_COEFS(7)
2493+C Coefficient q(2)
2494+ GOLEM_COEFS%%C1(3,1)=-ML_COEFS(3)
2495+C Coefficient q(2)^2
2496+ GOLEM_COEFS%%C1(3,2)= ML_COEFS(10)
2497+C Coefficient q(3)
2498+ GOLEM_COEFS%%C1(4,1)=-ML_COEFS(4)
2499+C Coefficient q(3)^2
2500+ GOLEM_COEFS%%C1(4,2)= ML_COEFS(14)
2501+C Coefficient q(0)*q(1)
2502+ GOLEM_COEFS%%C2(1,1)= ML_COEFS(6)
2503+C Coefficient q(0)*q(2)
2504+ GOLEM_COEFS%%C2(2,1)= ML_COEFS(8)
2505+C Coefficient q(0)*q(3)
2506+ GOLEM_COEFS%%C2(3,1)= ML_COEFS(11)
2507+C Coefficient q(1)*q(2)
2508+ GOLEM_COEFS%%C2(4,1)= ML_COEFS(9)
2509+C Coefficient q(1)*q(3)
2510+ GOLEM_COEFS%%C2(5,1)= ML_COEFS(12)
2511+C Coefficient q(2)*q(3)
2512+ GOLEM_COEFS%%C2(6,1)= ML_COEFS(13)
2513+ END
2514+
2515+ SUBROUTINE FILL_GOLEM_COEFFS_3(ML_COEFS,GOLEM_COEFS)
2516+ USE TENS_REC, ONLY: COEFF_TYPE_3
2517+ INCLUDE 'coef_specs.inc'
2518+ COMPLEX*16 ML_COEFS(0:LOOP_MAXCOEFS-1)
2519+ TYPE(COEFF_TYPE_3) GOLEM_COEFS
2520+C Dummy routine for FILL_GOLEM_COEFS_3
2521+ STOP 'ERROR: 3 > 2'
2522+ END
2523+
2524+ SUBROUTINE FILL_GOLEM_COEFFS_4(ML_COEFS,GOLEM_COEFS)
2525+ USE TENS_REC, ONLY: COEFF_TYPE_4
2526+ INCLUDE 'coef_specs.inc'
2527+ COMPLEX*16 ML_COEFS(0:LOOP_MAXCOEFS-1)
2528+ TYPE(COEFF_TYPE_4) GOLEM_COEFS
2529+C Dummy routine for FILL_GOLEM_COEFS_4
2530+ STOP 'ERROR: 4 > 2'
2531+ END
2532+
2533+ SUBROUTINE FILL_GOLEM_COEFFS_5(ML_COEFS,GOLEM_COEFS)
2534+ USE TENS_REC, ONLY: COEFF_TYPE_5
2535+ INCLUDE 'coef_specs.inc'
2536+ COMPLEX*16 ML_COEFS(0:LOOP_MAXCOEFS-1)
2537+ TYPE(COEFF_TYPE_5) GOLEM_COEFS
2538+C Dummy routine for FILL_GOLEM_COEFS_5
2539+ STOP 'ERROR: 5 > 2'
2540+ END
2541+
2542+ SUBROUTINE FILL_GOLEM_COEFFS_6(ML_COEFS,GOLEM_COEFS)
2543+ USE TENS_REC, ONLY: COEFF_TYPE_6
2544+ INCLUDE 'coef_specs.inc'
2545+ COMPLEX*16 ML_COEFS(0:LOOP_MAXCOEFS-1)
2546+ TYPE(COEFF_TYPE_6) GOLEM_COEFS
2547+C Dummy routine for FILL_GOLEM_COEFS_6
2548+ STOP 'ERROR: 6 > 2'
2549+ END
2550
2551=== added file 'tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%TIR_interface.f'
2552--- tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%TIR_interface.f 1970-01-01 00:00:00 +0000
2553+++ tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%TIR_interface.f 2016-02-24 13:54:50 +0000
2554@@ -0,0 +1,423 @@
2555+ SUBROUTINE TIRLOOP(I_SQSO,I_LOOPGROUP,I_LIB,NLOOPLINE,PL,M2L
2556+ $ ,RANK,RES,STABLE)
2557+C
2558+C Generated by MadGraph5_aMC@NLO v. %(version)s, %(date)s
2559+C By the MadGraph5_aMC@NLO Development Team
2560+C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch
2561+C
2562+C Interface between MG5 and TIR.
2563+C
2564+C Process: d~ u > w+ WEIGHTED=2 QED=1 [ all = QCD ]
2565+C Process: s~ c > w+ WEIGHTED=2 QED=1 [ all = QCD ]
2566+C
2567+C
2568+C CONSTANTS
2569+C
2570+ INTEGER NLOOPGROUPS
2571+ PARAMETER (NLOOPGROUPS=1)
2572+C These are constants related to the split orders
2573+ INTEGER NSQUAREDSO
2574+ PARAMETER (NSQUAREDSO=1)
2575+ INTEGER LOOPMAXCOEFS
2576+ PARAMETER (LOOPMAXCOEFS=15)
2577+ INTEGER NEXTERNAL
2578+ PARAMETER (NEXTERNAL=3)
2579+ LOGICAL CHECKPCONSERVATION
2580+ PARAMETER (CHECKPCONSERVATION=.TRUE.)
2581+ REAL*8 NORMALIZATION
2582+ PARAMETER (NORMALIZATION = 1.D0/(16.D0*3.14159265358979323846D0*
2583+ $ *2))
2584+C
2585+C ARGUMENTS
2586+C
2587+ INTEGER I_SQSO,I_LOOPGROUP,I_LIB
2588+ INTEGER NLOOPLINE, RANK
2589+ REAL*8 PL(0:3,NLOOPLINE)
2590+ REAL*8 PCT(0:3,0:NLOOPLINE-1)
2591+ REAL*8 PDEN(0:3,NLOOPLINE-1)
2592+ COMPLEX*16 M2L(NLOOPLINE)
2593+ COMPLEX*16 M2LCT(0:NLOOPLINE-1)
2594+ COMPLEX*16 RES(3)
2595+ LOGICAL STABLE
2596+C
2597+C LOCAL VARIABLES
2598+C
2599+ INTEGER I, J, K
2600+ INTEGER NLOOPCOEFS
2601+ LOGICAL CTINIT, TIRINIT, GOLEMINIT
2602+ COMMON/REDUCTIONCODEINIT/CTINIT,TIRINIT,GOLEMINIT
2603+
2604+C This variable will be used to detect changes in the TIR library
2605+C used so as to force the reset of the TIR filter.
2606+ INTEGER LAST_LIB_USED
2607+ DATA LAST_LIB_USED/-1/
2608+
2609+ COMPLEX*16 TIRCOEFS(0:LOOPMAXCOEFS-1,3)
2610+ COMPLEX*16 PJCOEFS(0:LOOPMAXCOEFS-1,3)
2611+C
2612+C EXTERNAL FUNCTIONS
2613+C
2614+C
2615+C GLOBAL VARIABLES
2616+C
2617+ INCLUDE 'MadLoopParams.inc'
2618+ INCLUDE 'coupl.inc'
2619+ INTEGER CTMODE
2620+ REAL*8 LSCALE
2621+ COMMON/CT/LSCALE,CTMODE
2622+
2623+C The argument ILIB is the TIR library to be used for that
2624+C specific library.
2625+ INTEGER LIBINDEX
2626+ COMMON/I_LIB/LIBINDEX
2627+
2628+ COMPLEX*16 LOOPCOEFS(0:LOOPMAXCOEFS-1,NSQUAREDSO,NLOOPGROUPS)
2629+ COMMON/LCOEFS/LOOPCOEFS
2630+C ----------
2631+C BEGIN CODE
2632+C ----------
2633+
2634+C Initialize for the very first time ML is called LAST_ILIB with
2635+C the first ILIB used.
2636+ IF(LAST_LIB_USED.EQ.-1) THEN
2637+ LAST_LIB_USED = MLREDUCTIONLIB(LIBINDEX)
2638+ ELSE
2639+C We changed the TIR library so we must refresh the cache.
2640+ IF(MLREDUCTIONLIB(LIBINDEX).NE.LAST_LIB_USED) THEN
2641+ LAST_LIB_USED = MLREDUCTIONLIB(LIBINDEX)
2642+ CALL CLEAR_TIR_CACHE()
2643+ ENDIF
2644+ ENDIF
2645+
2646+ IF (MLREDUCTIONLIB(I_LIB).EQ.4) THEN
2647+C Using Golem95
2648+C PDEN is dummy for Golem95 so we just initialize it to zero
2649+C here so as to use it for the function SWITCHORDER
2650+ DO I=0,3
2651+ DO J=1,NLOOPLINE-1
2652+ PDEN(I,J)=0.0D0
2653+ ENDDO
2654+ ENDDO
2655+ CALL SWITCH_ORDER(CTMODE,NLOOPLINE,PL,PDEN,M2L)
2656+ CALL GOLEMLOOP(NLOOPLINE,PL,M2L,RANK,RES,STABLE)
2657+ RETURN
2658+ ENDIF
2659+
2660+C INITIALIZE TIR IF NEEDED
2661+ IF (TIRINIT) THEN
2662+ TIRINIT=.FALSE.
2663+ CALL INITTIR()
2664+ ENDIF
2665+
2666+C CONVERT THE MASSES TO BE COMPLEX
2667+ DO I=1,NLOOPLINE
2668+ M2LCT(I-1)=M2L(I)
2669+ ENDDO
2670+
2671+C CONVERT THE MOMENTA FLOWING IN THE LOOP LINES TO CT CONVENTIONS
2672+ DO I=0,3
2673+ DO J=0,(NLOOPLINE-1)
2674+ PCT(I,J)=0.D0
2675+ ENDDO
2676+ ENDDO
2677+ DO I=0,3
2678+ DO J=1,NLOOPLINE
2679+ PCT(I,0)=PCT(I,0)+PL(I,J)
2680+ ENDDO
2681+ ENDDO
2682+ IF (CHECKPCONSERVATION) THEN
2683+ IF (PCT(0,0).GT.1.D-6) THEN
2684+ WRITE(*,*) 'energy is not conserved ',PCT(0,0)
2685+ STOP 'energy is not conserved'
2686+ ELSEIF (PCT(1,0).GT.1.D-6) THEN
2687+ WRITE(*,*) 'px is not conserved ',PCT(1,0)
2688+ STOP 'px is not conserved'
2689+ ELSEIF (PCT(2,0).GT.1.D-6) THEN
2690+ WRITE(*,*) 'py is not conserved ',PCT(2,0)
2691+ STOP 'py is not conserved'
2692+ ELSEIF (PCT(3,0).GT.1.D-6) THEN
2693+ WRITE(*,*) 'pz is not conserved ',PCT(3,0)
2694+ STOP 'pz is not conserved'
2695+ ENDIF
2696+ ENDIF
2697+ DO I=0,3
2698+ DO J=1,(NLOOPLINE-1)
2699+ DO K=1,J
2700+ PCT(I,J)=PCT(I,J)+PL(I,K)
2701+ ENDDO
2702+ ENDDO
2703+ ENDDO
2704+
2705+ DO I=0,3
2706+ DO J=1,(NLOOPLINE-1)
2707+ PDEN(I,J)=PCT(I,J)
2708+ ENDDO
2709+ ENDDO
2710+C NUMBER OF INDEPEDENT LOOPCOEFS FOR RANK=RANK
2711+ NLOOPCOEFS=0
2712+ DO I=0,RANK
2713+ NLOOPCOEFS=NLOOPCOEFS+(3+I)*(2+I)*(1+I)/6
2714+ ENDDO
2715+ SELECT CASE(MLREDUCTIONLIB(I_LIB))
2716+ CASE(2)
2717+C PJFry++
2718+ WRITE(*,*) 'ERROR:: PJFRY++ is not interfaced.'
2719+ STOP
2720+ CASE(3)
2721+C IREGI
2722+ CALL IMLOOP(CTMODE,IREGIMODE,NLOOPLINE,LOOPMAXCOEFS,RANK,PDEN
2723+ $ ,M2L,MU_R,PJCOEFS,STABLE)
2724+C CONVERT TO MADLOOP CONVENTION
2725+ CALL CONVERT_IREGI_COEFFS(RANK,PJCOEFS,TIRCOEFS)
2726+ END SELECT
2727+ DO I=1,3
2728+ RES(I)=(0.0D0,0.0D0)
2729+ DO J=0,NLOOPCOEFS-1
2730+ RES(I)=RES(I)+LOOPCOEFS(J,I_SQSO,I_LOOPGROUP)*TIRCOEFS(J,I)
2731+ ENDDO
2732+ ENDDO
2733+ RES(1)=NORMALIZATION*2.0D0*DBLE(RES(1))
2734+ RES(2)=NORMALIZATION*2.0D0*DBLE(RES(2))
2735+ RES(3)=NORMALIZATION*2.0D0*DBLE(RES(3))
2736+C WRITE(*,*) 'Loop ID',ID,' =',RES(1),RES(2),RES(3)
2737+ END
2738+
2739+ SUBROUTINE SWITCH_ORDER(CTMODE,NLOOPLINE,PL,PDEN,M2L)
2740+ IMPLICIT NONE
2741+
2742+ INTEGER CTMODE,NLOOPLINE
2743+
2744+ REAL*8 PL(0:3,NLOOPLINE)
2745+ REAL*8 PDEN(0:3,NLOOPLINE-1)
2746+ COMPLEX*16 M2L(NLOOPLINE)
2747+ REAL*8 NEW_PL(0:3,NLOOPLINE)
2748+ REAL*8 NEW_PDEN(0:3,NLOOPLINE-1)
2749+ COMPLEX*16 NEW_M2L(NLOOPLINE)
2750+
2751+ INTEGER I,J,K
2752+
2753+ IF (CTMODE.NE.2.AND.CTMODE.NE.4) THEN
2754+ RETURN
2755+ ENDIF
2756+
2757+ IF (NLOOPLINE.LE.2) THEN
2758+ RETURN
2759+ ENDIF
2760+
2761+ DO I=1,NLOOPLINE-1
2762+ DO J=0,3
2763+ NEW_PDEN(J,NLOOPLINE-I) = PDEN(J,I)
2764+ ENDDO
2765+ ENDDO
2766+ DO I=1,NLOOPLINE-1
2767+ DO J=0,3
2768+ PDEN(J,I) = NEW_PDEN(J,I)
2769+ ENDDO
2770+ ENDDO
2771+
2772+ DO I=2,NLOOPLINE
2773+ NEW_M2L(I)=M2L(NLOOPLINE-I+2)
2774+ ENDDO
2775+ DO I=2,NLOOPLINE
2776+ M2L(I)=NEW_M2L(I)
2777+ ENDDO
2778+
2779+
2780+ DO I=1,NLOOPLINE
2781+ DO J=0,3
2782+ NEW_PL(J,I) = -PL(J,NLOOPLINE+1-I)
2783+ ENDDO
2784+ ENDDO
2785+ DO I=1,NLOOPLINE
2786+ DO J=0,3
2787+ PL(J,I) = NEW_PL(J,I)
2788+ ENDDO
2789+ ENDDO
2790+
2791+ END
2792+
2793+ SUBROUTINE INITTIR()
2794+C
2795+C INITIALISATION OF TIR
2796+C
2797+C LOCAL VARIABLES
2798+C
2799+ REAL*8 THRS
2800+ LOGICAL EXT_NUM_FOR_R1
2801+C
2802+C GLOBAL VARIABLES
2803+C
2804+ INCLUDE 'MadLoopParams.inc'
2805+ LOGICAL CTINIT, TIRINIT, GOLEMINIT
2806+ COMMON/REDUCTIONCODEINIT/CTINIT,TIRINIT,GOLEMINIT
2807+
2808+C ----------
2809+C BEGIN CODE
2810+C ----------
2811+
2812+C DEFAULT PARAMETERS FOR TIR
2813+C -------------------------------
2814+C THRS1 IS THE PRECISION LIMIT BELOW WHICH THE MP ROUTINES
2815+C ACTIVATES
2816+C USE THE SAME MADLOOP PARAMETER IN CUTTOOLS AND TIR
2817+C IT IS NECESSARY TO INITIALIZE CT BECAUSE IREGI USES THE VERSION
2818+C OF ONELOOP
2819+C FROM CUTTOOLS LIBRARY
2820+ THRS=CTSTABTHRES
2821+C LOOPLIB SET WHAT LIBRARY CT USES
2822+C 1 -> LOOPTOOLS
2823+C 2 -> AVH
2824+C 3 -> QCDLOOP
2825+ LOOPLIB=CTLOOPLIBRARY
2826+ CALL INITIREGI(IREGIRECY,LOOPLIB,1D-6)
2827+C The initialization below is for CT v1.9.2+
2828+ IF (CTINIT) THEN
2829+ CTINIT=.FALSE.
2830+ CALL INITCT()
2831+ ENDIF
2832+ END
2833+
2834+ SUBROUTINE CHOOSE_LOOPLIB(LIBINDEX,NLOOPLINE,RANK,COMPLEX_MASS
2835+ $ ,DOING_QP,I_LIB)
2836+C
2837+C CHOOSE THE CORRECT LOOP LIB
2838+C Example:
2839+C MLReductionLib=3|2|1 and LIBINDEX=3
2840+C IF THE LOOP IS BEYOND THE SCOPE OF LOOP LIB MLReductionLib(3)=1
2841+C USE LIBINDEX=1, and LIBINDEX=2 ...
2842+C IF IT IS STILL NOT GOOD,STOP
2843+C
2844+ IMPLICIT NONE
2845+C
2846+C CONSTANTS
2847+C
2848+ INTEGER NLOOPLIB,QP_NLOOPLIB
2849+ PARAMETER (NLOOPLIB=4,QP_NLOOPLIB=1)
2850+C
2851+C ARGUMENTS
2852+C
2853+ INTEGER LIBINDEX,NLOOPLINE,RANK,I_LIB
2854+ LOGICAL COMPLEX_MASS,DOING_QP
2855+C
2856+C LOCAL VARIABLES
2857+C
2858+ INTEGER I,J_LIB,LIBNUM,SELECT_LIBINDEX
2859+ LOGICAL LPASS
2860+C
2861+C GLOBAL VARIABLES
2862+C
2863+ INCLUDE 'MadLoopParams.inc'
2864+C TILL NOW, ONLY CUTTOOLS PROVIDE QP
2865+ LOGICAL QP_TOOLS_AVAILABLE
2866+ INTEGER INDEX_QP_TOOLS(QP_NLOOPLIB)
2867+ COMMON/LOOP_TOOLS/QP_TOOLS_AVAILABLE,INDEX_QP_TOOLS
2868+C ----------
2869+C BEGIN CODE
2870+C ----------
2871+
2872+ IF(DOING_QP)THEN
2873+C QP EVALUATION, ONLY CUTTOOLS
2874+ IF(.NOT.QP_TOOLS_AVAILABLE)THEN
2875+ STOP 'No qp tools available, please make sure MLReductionLi'
2876+ $ //'b is correct'
2877+ ENDIF
2878+ J_LIB=0
2879+ SELECT_LIBINDEX=LIBINDEX
2880+ DO WHILE(J_LIB.EQ.0)
2881+ DO I=1,QP_NLOOPLIB
2882+ IF(INDEX_QP_TOOLS(I).EQ.SELECT_LIBINDEX)THEN
2883+ J_LIB=I
2884+ EXIT
2885+ ENDIF
2886+ ENDDO
2887+ IF(J_LIB.EQ.0)THEN
2888+ SELECT_LIBINDEX=SELECT_LIBINDEX+1
2889+ IF(SELECT_LIBINDEX.GT.NLOOPLIB.OR.MLREDUCTIONLIB(SELECT_LIB
2890+ $ INDEX).EQ.0)SELECT_LIBINDEX=1
2891+ ENDIF
2892+ ENDDO
2893+ I=J_LIB
2894+ I_LIB=SELECT_LIBINDEX
2895+ LIBNUM=MLREDUCTIONLIB(I_LIB)
2896+ DO
2897+ CALL DETECT_LOOPLIB(LIBNUM,NLOOPLINE,RANK,COMPLEX_MASS,LPASS)
2898+ IF(LPASS)EXIT
2899+ I=I+1
2900+ IF(I.GT.QP_NLOOPLIB.AND.INDEX_QP_TOOLS(I).EQ.0)THEN
2901+ I=1
2902+ ENDIF
2903+ IF(I.EQ.J_LIB)THEN
2904+ STOP 'No qp loop library can deal with this integral'
2905+ ENDIF
2906+ I_LIB=INDEX_QP_TOOLS(I)
2907+ LIBNUM=MLREDUCTIONLIB(I_LIB)
2908+ ENDDO
2909+ ELSE
2910+C DP EVALUATION
2911+ I_LIB=LIBINDEX
2912+ LIBNUM=MLREDUCTIONLIB(I_LIB)
2913+ DO
2914+ CALL DETECT_LOOPLIB(LIBNUM,NLOOPLINE,RANK,COMPLEX_MASS,LPASS)
2915+ IF(LPASS)EXIT
2916+ I_LIB=I_LIB+1
2917+ IF(I_LIB.GT.NLOOPLIB.OR.MLREDUCTIONLIB(I_LIB).EQ.0)THEN
2918+ I_LIB=1
2919+ ENDIF
2920+ IF(I_LIB.EQ.LIBINDEX)THEN
2921+ STOP 'No dp loop library can deal with this integral'
2922+ ENDIF
2923+ LIBNUM=MLREDUCTIONLIB(I_LIB)
2924+ ENDDO
2925+ ENDIF
2926+ RETURN
2927+ END
2928+
2929+ SUBROUTINE CLEAR_TIR_CACHE()
2930+C No TIR caching implemented, this is dummy. (The subroutine is
2931+C kept as it might be called by the MC).
2932+ CONTINUE
2933+ END SUBROUTINE
2934+
2935+
2936+
2937+ SUBROUTINE CONVERT_IREGI_COEFFS(RANK,IREGICOEFS,TIRCOEFS)
2938+C GLOABLE VARIABLES
2939+ INCLUDE 'coef_specs.inc'
2940+C ARGUMENTS
2941+ INTEGER RANK
2942+ COMPLEX*16 IREGICOEFS(0:LOOP_MAXCOEFS-1,3)
2943+ COMPLEX*16 TIRCOEFS(0:LOOP_MAXCOEFS-1,3)
2944+C Reduction Coefficient 1
2945+ TIRCOEFS(0,1:3)=IREGICOEFS(0,1:3)
2946+ IF(RANK.LE.0)RETURN
2947+C Reduction Coefficient q(0)
2948+ TIRCOEFS(1,1:3)=IREGICOEFS(1,1:3)
2949+C Reduction Coefficient q(1)
2950+ TIRCOEFS(2,1:3)=IREGICOEFS(2,1:3)
2951+C Reduction Coefficient q(2)
2952+ TIRCOEFS(3,1:3)=IREGICOEFS(3,1:3)
2953+C Reduction Coefficient q(3)
2954+ TIRCOEFS(4,1:3)=IREGICOEFS(4,1:3)
2955+ IF(RANK.LE.1)RETURN
2956+C Reduction Coefficient q(0)^2
2957+ TIRCOEFS(5,1:3)=IREGICOEFS(5,1:3)
2958+C Reduction Coefficient q(0)*q(1)
2959+ TIRCOEFS(6,1:3)=IREGICOEFS(6,1:3)
2960+C Reduction Coefficient q(1)^2
2961+ TIRCOEFS(7,1:3)=IREGICOEFS(9,1:3)
2962+C Reduction Coefficient q(0)*q(2)
2963+ TIRCOEFS(8,1:3)=IREGICOEFS(7,1:3)
2964+C Reduction Coefficient q(1)*q(2)
2965+ TIRCOEFS(9,1:3)=IREGICOEFS(10,1:3)
2966+C Reduction Coefficient q(2)^2
2967+ TIRCOEFS(10,1:3)=IREGICOEFS(12,1:3)
2968+C Reduction Coefficient q(0)*q(3)
2969+ TIRCOEFS(11,1:3)=IREGICOEFS(8,1:3)
2970+C Reduction Coefficient q(1)*q(3)
2971+ TIRCOEFS(12,1:3)=IREGICOEFS(11,1:3)
2972+C Reduction Coefficient q(2)*q(3)
2973+ TIRCOEFS(13,1:3)=IREGICOEFS(13,1:3)
2974+C Reduction Coefficient q(3)^2
2975+ TIRCOEFS(14,1:3)=IREGICOEFS(14,1:3)
2976+ IF(RANK.LE.2)RETURN
2977+ END
2978
2979=== added file 'tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%born_matrix.f'
2980--- tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%born_matrix.f 1970-01-01 00:00:00 +0000
2981+++ tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%born_matrix.f 2016-02-24 13:54:50 +0000
2982@@ -0,0 +1,540 @@
2983+ SUBROUTINE SMATRIX(P,ANS_SUMMED)
2984+C
2985+C Simple routine wrapper to provide the same interface for
2986+C backward compatibility for usage without split orders.
2987+C
2988+C
2989+C CONSTANTS
2990+C
2991+ INTEGER NEXTERNAL
2992+ PARAMETER (NEXTERNAL=3)
2993+ INTEGER NSQAMPSO
2994+ PARAMETER (NSQAMPSO=1)
2995+C
2996+C ARGUMENTS
2997+C
2998+ REAL*8 P(0:3,NEXTERNAL), ANS_SUMMED
2999+C
3000+C VARIABLES
3001+C
3002+ INTEGER I
3003+ REAL*8 ANS(0:NSQAMPSO)
3004+C
3005+C BEGIN CODE
3006+C
3007+ CALL SMATRIX_SPLITORDERS(P,ANS)
3008+ ANS_SUMMED=ANS(0)
3009+
3010+ END
3011+
3012+ SUBROUTINE SMATRIXHEL(P,HEL,ANS)
3013+ IMPLICIT NONE
3014+C
3015+C CONSTANT
3016+C
3017+ INTEGER NEXTERNAL
3018+ PARAMETER (NEXTERNAL=3)
3019+ INTEGER NCOMB
3020+ PARAMETER ( NCOMB=12)
3021+C
3022+C ARGUMENTS
3023+C
3024+ REAL*8 P(0:3,NEXTERNAL),ANS
3025+ INTEGER HEL
3026+C
3027+C GLOBAL VARIABLES
3028+C
3029+ INTEGER USERHEL
3030+ COMMON/HELUSERCHOICE/USERHEL
3031+C ----------
3032+C BEGIN CODE
3033+C ----------
3034+ USERHEL=HEL
3035+ CALL SMATRIX(P,ANS)
3036+ USERHEL=-1
3037+
3038+ END
3039+
3040+ SUBROUTINE SMATRIX_SPLITORDERS(P,ANS)
3041+C
3042+C Generated by MadGraph5_aMC@NLO v. %(version)s, %(date)s
3043+C By the MadGraph5_aMC@NLO Development Team
3044+C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch
3045+C
3046+C MadGraph StandAlone Version
3047+C
3048+C Returns amplitude squared summed/avg over colors
3049+C and helicities
3050+C for the point in phase space P(0:3,NEXTERNAL)
3051+C
3052+C Process: d~ u > w+ WEIGHTED=2 QED=1 [ all = QCD ]
3053+C Process: s~ c > w+ WEIGHTED=2 QED=1 [ all = QCD ]
3054+C
3055+ IMPLICIT NONE
3056+C
3057+C CONSTANTS
3058+C
3059+ INTEGER NEXTERNAL
3060+ PARAMETER (NEXTERNAL=3)
3061+ INTEGER NCOMB
3062+ PARAMETER ( NCOMB=12)
3063+ INTEGER NSQAMPSO
3064+ PARAMETER (NSQAMPSO=1)
3065+ INTEGER HELAVGFACTOR
3066+ PARAMETER (HELAVGFACTOR=4)
3067+ LOGICAL CHOSEN_SO_CONFIGS(NSQAMPSO)
3068+ DATA CHOSEN_SO_CONFIGS/.TRUE./
3069+ COMMON/CHOSEN_BORN_SQSO/CHOSEN_SO_CONFIGS
3070+C
3071+C ARGUMENTS
3072+C
3073+ REAL*8 P(0:3,NEXTERNAL),ANS(0:NSQAMPSO)
3074+C
3075+C LOCAL VARIABLES
3076+C
3077+ INTEGER NHEL(NEXTERNAL,NCOMB),NTRY
3078+ REAL*8 T(NSQAMPSO), BUFF
3079+ INTEGER IHEL,IDEN, I
3080+ INTEGER JC(NEXTERNAL)
3081+ LOGICAL GOODHEL(NCOMB)
3082+ DATA NTRY/0/
3083+ DATA GOODHEL/NCOMB*.FALSE./
3084+ DATA (NHEL(I, 1),I=1,3) /-1, 1,-1/
3085+ DATA (NHEL(I, 2),I=1,3) /-1, 1, 0/
3086+ DATA (NHEL(I, 3),I=1,3) /-1, 1, 1/
3087+ DATA (NHEL(I, 4),I=1,3) /-1,-1,-1/
3088+ DATA (NHEL(I, 5),I=1,3) /-1,-1, 0/
3089+ DATA (NHEL(I, 6),I=1,3) /-1,-1, 1/
3090+ DATA (NHEL(I, 7),I=1,3) / 1, 1,-1/
3091+ DATA (NHEL(I, 8),I=1,3) / 1, 1, 0/
3092+ DATA (NHEL(I, 9),I=1,3) / 1, 1, 1/
3093+ DATA (NHEL(I, 10),I=1,3) / 1,-1,-1/
3094+ DATA (NHEL(I, 11),I=1,3) / 1,-1, 0/
3095+ DATA (NHEL(I, 12),I=1,3) / 1,-1, 1/
3096+ DATA IDEN/36/
3097+C
3098+C GLOBAL VARIABLES
3099+C
3100+ INTEGER USERHEL
3101+ DATA USERHEL/-1/
3102+ COMMON/HELUSERCHOICE/USERHEL
3103+
3104+C ----------
3105+C BEGIN CODE
3106+C ----------
3107+ NTRY=NTRY+1
3108+ DO IHEL=1,NEXTERNAL
3109+ JC(IHEL) = +1
3110+ ENDDO
3111+ DO I=1,NSQAMPSO
3112+ ANS(I) = 0D0
3113+ ENDDO
3114+ DO IHEL=1,NCOMB
3115+ IF (USERHEL.EQ.-1.OR.USERHEL.EQ.IHEL) THEN
3116+ IF (GOODHEL(IHEL) .OR. NTRY .LT. 2 .OR.USERHEL.NE.-1) THEN
3117+ CALL MATRIX(P ,NHEL(1,IHEL),JC(1), T)
3118+ BUFF=0D0
3119+ DO I=1,NSQAMPSO
3120+ ANS(I)=ANS(I)+T(I)
3121+ BUFF=BUFF+T(I)
3122+ ENDDO
3123+ IF (BUFF .NE. 0D0 .AND. .NOT. GOODHEL(IHEL)) THEN
3124+ GOODHEL(IHEL)=.TRUE.
3125+ ENDIF
3126+ ENDIF
3127+ ENDIF
3128+ ENDDO
3129+ ANS(0)=0.0D0
3130+ DO I=1,NSQAMPSO
3131+ ANS(I)=ANS(I)/DBLE(IDEN)
3132+ IF (CHOSEN_SO_CONFIGS(I)) THEN
3133+ ANS(0)=ANS(0)+ANS(I)
3134+ ENDIF
3135+ ENDDO
3136+ IF(USERHEL.NE.-1) THEN
3137+ ANS(0)=ANS(0)*HELAVGFACTOR
3138+ DO I=1,NSQAMPSO
3139+ ANS(I)=ANS(I)*HELAVGFACTOR
3140+ ENDDO
3141+ ENDIF
3142+ END
3143+
3144+ SUBROUTINE SMATRIXHEL_SPLITORDERS(P,HEL,ANS)
3145+ IMPLICIT NONE
3146+C
3147+C CONSTANT
3148+C
3149+ INTEGER NEXTERNAL
3150+ PARAMETER (NEXTERNAL=3)
3151+ INTEGER NCOMB
3152+ PARAMETER ( NCOMB=12)
3153+ INTEGER NSQAMPSO
3154+ PARAMETER (NSQAMPSO=1)
3155+C
3156+C ARGUMENTS
3157+C
3158+ REAL*8 P(0:3,NEXTERNAL),ANS(0:NSQAMPSO)
3159+ INTEGER HEL
3160+C
3161+C GLOBAL VARIABLES
3162+C
3163+ INTEGER USERHEL
3164+ COMMON/HELUSERCHOICE/USERHEL
3165+C ----------
3166+C BEGIN CODE
3167+C ----------
3168+ USERHEL=HEL
3169+ CALL SMATRIX_SPLITORDERS(P,ANS)
3170+ USERHEL=-1
3171+
3172+ END
3173+
3174+ SUBROUTINE MATRIX(P,NHEL,IC,RES)
3175+C
3176+C Generated by MadGraph5_aMC@NLO v. %(version)s, %(date)s
3177+C By the MadGraph5_aMC@NLO Development Team
3178+C Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch
3179+C
3180+C Returns amplitude squared summed/avg over colors
3181+C for the point with external lines W(0:6,NEXTERNAL)
3182+C
3183+C Process: d~ u > w+ WEIGHTED=2 QED=1 [ all = QCD ]
3184+C Process: s~ c > w+ WEIGHTED=2 QED=1 [ all = QCD ]
3185+C
3186+ IMPLICIT NONE
3187+C
3188+C CONSTANTS
3189+C
3190+ INTEGER NGRAPHS
3191+ PARAMETER (NGRAPHS=1)
3192+ INTEGER NEXTERNAL
3193+ PARAMETER (NEXTERNAL=3)
3194+ INTEGER NWAVEFUNCS, NCOLOR
3195+ PARAMETER (NWAVEFUNCS=3, NCOLOR=1)
3196+ INTEGER NAMPSO, NSQAMPSO
3197+ PARAMETER (NAMPSO=1, NSQAMPSO=1)
3198+ REAL*8 ZERO
3199+ PARAMETER (ZERO=0D0)
3200+ COMPLEX*16 IMAG1
3201+ PARAMETER (IMAG1=(0D0,1D0))
3202+C
3203+C ARGUMENTS
3204+C
3205+ REAL*8 P(0:3,NEXTERNAL)
3206+ INTEGER NHEL(NEXTERNAL), IC(NEXTERNAL)
3207+ REAL*8 RES(NSQAMPSO)
3208+C
3209+C LOCAL VARIABLES
3210+C
3211+ INTEGER I,J,M,N
3212+ COMPLEX*16 ZTEMP
3213+ REAL*8 DENOM(NCOLOR), CF(NCOLOR,NCOLOR)
3214+ COMPLEX*16 AMP(NGRAPHS)
3215+ COMPLEX*16 JAMP(NCOLOR,NAMPSO)
3216+ COMPLEX*16 W(20,NWAVEFUNCS)
3217+ COMPLEX*16 DUM0,DUM1
3218+ DATA DUM0, DUM1/(0D0, 0D0), (1D0, 0D0)/
3219+C
3220+C FUNCTION
3221+C
3222+ INTEGER SQSOINDEX
3223+C
3224+C GLOBAL VARIABLES
3225+C
3226+ INCLUDE 'coupl.inc'
3227+C
3228+C COLOR DATA
3229+C
3230+ DATA DENOM(1)/1/
3231+ DATA (CF(I, 1),I= 1, 1) / 3/
3232+C 1 T(1,2)
3233+C ----------
3234+C BEGIN CODE
3235+C ----------
3236+ CALL OXXXXX(P(0,1),ZERO,NHEL(1),-1*IC(1),W(1,1))
3237+ CALL IXXXXX(P(0,2),ZERO,NHEL(2),+1*IC(2),W(1,2))
3238+ CALL VXXXXX(P(0,3),MDL_MW,NHEL(3),+1*IC(3),W(1,3))
3239+C Amplitude(s) for diagram number 1
3240+ CALL FFV2_0(W(1,2),W(1,1),W(1,3),GC_47,AMP(1))
3241+C JAMPs contributing to orders QCD=0
3242+ JAMP(1,1)=-AMP(1)
3243+
3244+ RES = 0.D0
3245+ DO M = 1, NAMPSO
3246+ DO I = 1, NCOLOR
3247+ ZTEMP = (0.D0,0.D0)
3248+ DO J = 1, NCOLOR
3249+ ZTEMP = ZTEMP + CF(J,I)*JAMP(J,M)
3250+ ENDDO
3251+ DO N = 1, NAMPSO
3252+ RES(SQSOINDEX(M,N)) = RES(SQSOINDEX(M,N)) + ZTEMP
3253+ $ *DCONJG(JAMP(I,N))/DENOM(I)
3254+ ENDDO
3255+ ENDDO
3256+ ENDDO
3257+
3258+ END
3259+
3260+ SUBROUTINE GET_ME(P, ALPHAS, NHEL ,ANS)
3261+ IMPLICIT NONE
3262+C
3263+C CONSTANT
3264+C
3265+ INTEGER NEXTERNAL
3266+ PARAMETER (NEXTERNAL=3)
3267+C
3268+C ARGUMENTS
3269+C
3270+ REAL*8 P(0:3,NEXTERNAL),ANS
3271+ INTEGER NHEL
3272+ DOUBLE PRECISION ALPHAS
3273+ REAL*8 PI
3274+CF2PY INTENT(OUT) :: ANS
3275+CF2PY INTENT(IN) :: NHEL
3276+CF2PY INTENT(IN) :: P(0:3,NEXTERNAL)
3277+CF2PY INTENT(IN) :: ALPHAS
3278+C ROUTINE FOR F2PY to read the benchmark point.
3279+C the include file with the values of the parameters and masses
3280+ INCLUDE 'coupl.inc'
3281+
3282+ PI = 3.141592653589793D0
3283+ G = 2* DSQRT(ALPHAS*PI)
3284+ CALL UPDATE_AS_PARAM()
3285+ IF (NHEL.NE.0) THEN
3286+ CALL SMATRIXHEL(P, NHEL, ANS)
3287+ ELSE
3288+ CALL SMATRIX(P, ANS)
3289+ ENDIF
3290+ RETURN
3291+ END
3292+
3293+ SUBROUTINE INITIALISE(PATH)
3294+C ROUTINE FOR F2PY to read the benchmark point.
3295+ IMPLICIT NONE
3296+ CHARACTER*180 PATH
3297+CF2PY INTENT(IN) :: PATH
3298+ CALL SETPARA(PATH) !first call to setup the paramaters
3299+ RETURN
3300+ END
3301+
3302+
3303+C Set of functions to handle the array indices of the split orders
3304+
3305+
3306+ INTEGER FUNCTION SQSOINDEX(ORDERINDEXA, ORDERINDEXB)
3307+C
3308+C This functions plays the role of the interference matrix. It can
3309+C be hardcoded or
3310+C made more elegant using hashtables if its execution speed ever
3311+C becomes a relevant
3312+C factor. From two split order indices, it return the corresponding
3313+C index in the squared
3314+C order canonical ordering.
3315+C
3316+C CONSTANTS
3317+C
3318+
3319+ INTEGER NSO, NSQUAREDSO, NAMPSO
3320+ PARAMETER (NSO=1, NSQUAREDSO=1, NAMPSO=1)
3321+C
3322+C ARGUMENTS
3323+C
3324+ INTEGER ORDERINDEXA, ORDERINDEXB
3325+C
3326+C LOCAL VARIABLES
3327+C
3328+ INTEGER I, SQORDERS(NSO)
3329+ INTEGER AMPSPLITORDERS(NAMPSO,NSO)
3330+ DATA (AMPSPLITORDERS( 1,I),I= 1, 1) / 0/
3331+ COMMON/AMPSPLITORDERS/AMPSPLITORDERS
3332+C
3333+C FUNCTION
3334+C
3335+ INTEGER SOINDEX_FOR_SQUARED_ORDERS
3336+C
3337+C BEGIN CODE
3338+C
3339+ DO I=1,NSO
3340+ SQORDERS(I)=AMPSPLITORDERS(ORDERINDEXA,I)+AMPSPLITORDERS(ORDERI
3341+ $ NDEXB,I)
3342+ ENDDO
3343+ SQSOINDEX=SOINDEX_FOR_SQUARED_ORDERS(SQORDERS)
3344+ END
3345+
3346+ INTEGER FUNCTION SOINDEX_FOR_SQUARED_ORDERS(ORDERS)
3347+C
3348+C This functions returns the integer index identifying the squared
3349+C split orders list passed in argument which corresponds to the
3350+C values of the following list of couplings (and in this order).
3351+C ['QCD']
3352+C
3353+C CONSTANTS
3354+C
3355+ INTEGER NSO, NSQSO, NAMPSO
3356+ PARAMETER (NSO=1, NSQSO=1, NAMPSO=1)
3357+C
3358+C ARGUMENTS
3359+C
3360+ INTEGER ORDERS(NSO)
3361+C
3362+C LOCAL VARIABLES
3363+C
3364+ INTEGER I,J
3365+ INTEGER SQSPLITORDERS(NSQSO,NSO)
3366+ DATA (SQSPLITORDERS( 1,I),I= 1, 1) / 0/
3367+ COMMON/SQPLITORDERS/SQPLITORDERS
3368+C
3369+C BEGIN CODE
3370+C
3371+ DO I=1,NSQSO
3372+ DO J=1,NSO
3373+ IF (ORDERS(J).NE.SQSPLITORDERS(I,J)) GOTO 1009
3374+ ENDDO
3375+ SOINDEX_FOR_SQUARED_ORDERS = I
3376+ RETURN
3377+ 1009 CONTINUE
3378+ ENDDO
3379+
3380+ WRITE(*,*) 'ERROR:: Stopping in function'
3381+ WRITE(*,*) 'SOINDEX_FOR_SQUARED_ORDERS'
3382+ WRITE(*,*) 'Could not find squared orders ',(ORDERS(I),I=1,NSO)
3383+ STOP
3384+
3385+ END
3386+
3387+ SUBROUTINE GET_NSQSO_BORN(NSQSO)
3388+C
3389+C Simple subroutine returning the number of squared split order
3390+C contributions returned when calling smatrix_split_orders
3391+C
3392+
3393+ INTEGER NSQUAREDSO
3394+ PARAMETER (NSQUAREDSO=1)
3395+
3396+ INTEGER NSQSO
3397+
3398+ NSQSO=NSQUAREDSO
3399+
3400+ END
3401+
3402+C This is the inverse subroutine of SOINDEX_FOR_SQUARED_ORDERS.
3403+C Not directly useful, but provided nonetheless.
3404+ SUBROUTINE GET_SQUARED_ORDERS_FOR_SOINDEX(SOINDEX,ORDERS)
3405+C
3406+C This functions returns the orders identified by the squared
3407+C split order index in argument. Order values correspond to
3408+C following list of couplings (and in this order):
3409+C ['QCD']
3410+C
3411+C CONSTANTS
3412+C
3413+ INTEGER NSO, NSQSO
3414+ PARAMETER (NSO=1, NSQSO=1)
3415+C
3416+C ARGUMENTS
3417+C
3418+ INTEGER SOINDEX, ORDERS(NSO)
3419+C
3420+C LOCAL VARIABLES
3421+C
3422+ INTEGER I
3423+ INTEGER SQPLITORDERS(NSQSO,NSO)
3424+ COMMON/SQPLITORDERS/SQPLITORDERS
3425+C
3426+C BEGIN CODE
3427+C
3428+ IF (SOINDEX.GT.0.AND.SOINDEX.LE.NSQSO) THEN
3429+ DO I=1,NSO
3430+ ORDERS(I) = SQPLITORDERS(SOINDEX,I)
3431+ ENDDO
3432+ RETURN
3433+ ENDIF
3434+
3435+ WRITE(*,*) 'ERROR:: Stopping function GET_SQUARED_ORDERS_FOR_SOI'
3436+ $ //'NDEX'
3437+ WRITE(*,*) 'Could not find squared orders index ',SOINDEX
3438+ STOP
3439+
3440+ END SUBROUTINE
3441+
3442+C This is the inverse subroutine of getting amplitude SO orders.
3443+C Not directly useful, but provided nonetheless.
3444+ SUBROUTINE GET_ORDERS_FOR_AMPSOINDEX(SOINDEX,ORDERS)
3445+C
3446+C This functions returns the orders identified by the split order
3447+C index in argument. Order values correspond to following list of
3448+C couplings (and in this order):
3449+C ['QCD']
3450+C
3451+C CONSTANTS
3452+C
3453+ INTEGER NSO, NAMPSO
3454+ PARAMETER (NSO=1, NAMPSO=1)
3455+C
3456+C ARGUMENTS
3457+C
3458+ INTEGER SOINDEX, ORDERS(NSO)
3459+C
3460+C LOCAL VARIABLES
3461+C
3462+ INTEGER I
3463+ INTEGER AMPSPLITORDERS(NAMPSO,NSO)
3464+ COMMON/AMPSPLITORDERS/AMPSPLITORDERS
3465+C
3466+C BEGIN CODE
3467+C
3468+ IF (SOINDEX.GT.0.AND.SOINDEX.LE.NAMPSO) THEN
3469+ DO I=1,NSO
3470+ ORDERS(I) = AMPSPLITORDERS(SOINDEX,I)
3471+ ENDDO
3472+ RETURN
3473+ ENDIF
3474+
3475+ WRITE(*,*) 'ERROR:: Stopping function GET_ORDERS_FOR_AMPSOINDEX'
3476+ WRITE(*,*) 'Could not find amplitude split orders index ',SOINDEX
3477+ STOP
3478+
3479+ END SUBROUTINE
3480+
3481+C This function is not directly useful, but included for completene
3482+C ss
3483+ INTEGER FUNCTION SOINDEX_FOR_AMPORDERS(ORDERS)
3484+C
3485+C This functions returns the integer index identifying the
3486+C amplitude split orders passed in argument which correspond to
3487+C the values of the following list of couplings (and in this
3488+C order):
3489+C ['QCD']
3490+C
3491+C CONSTANTS
3492+C
3493+ INTEGER NSO, NAMPSO
3494+ PARAMETER (NSO=1, NAMPSO=1)
3495+C
3496+C ARGUMENTS
3497+C
3498+ INTEGER ORDERS(NSO)
3499+C
3500+C LOCAL VARIABLES
3501+C
3502+ INTEGER I,J
3503+ INTEGER AMPSPLITORDERS(NAMPSO,NSO)
3504+ COMMON/AMPSPLITORDERS/AMPSPLITORDERS
3505+C
3506+C BEGIN CODE
3507+C
3508+ DO I=1,NAMPSO
3509+ DO J=1,NSO
3510+ IF (ORDERS(J).NE.AMPSPLITORDERS(I,J)) GOTO 1009
3511+ ENDDO
3512+ SOINDEX_FOR_AMPORDERS = I
3513+ RETURN
3514+ 1009 CONTINUE
3515+ ENDDO
3516+
3517+ WRITE(*,*) 'ERROR:: Stopping function SOINDEX_FOR_AMPORDERS'
3518+ WRITE(*,*) 'Could not find squared orders ',(ORDERS(I),I=1,NSO)
3519+ STOP
3520+
3521+ END
3522+
3523
3524=== added file 'tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%check_sa.f'
3525--- tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%check_sa.f 1970-01-01 00:00:00 +0000
3526+++ tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%check_sa.f 2016-02-24 13:54:50 +0000
3527@@ -0,0 +1,756 @@
3528+ PROGRAM DRIVER
3529+C *****************************************************************
3530+C ********
3531+C THIS IS THE DRIVER FOR CHECKING THE STANDALONE MATRIX ELEMENT.
3532+C IT USES A SIMPLE PHASE SPACE GENERATOR
3533+C *****************************************************************
3534+C ********
3535+ IMPLICIT NONE
3536+C
3537+C CONSTANTS
3538+C
3539+ REAL*8 ZERO
3540+ PARAMETER (ZERO=0D0)
3541+
3542+ LOGICAL READPS
3543+ PARAMETER (READPS = .FALSE.)
3544+
3545+ INTEGER NPSPOINTS
3546+ PARAMETER (NPSPOINTS = 4)
3547+
3548+C integer nexternal and number particles (incoming+outgoing) in
3549+C the me
3550+ INTEGER NEXTERNAL, NINCOMING
3551+ PARAMETER (NEXTERNAL=3,NINCOMING=2)
3552+
3553+ CHARACTER(512) MADLOOPRESOURCEPATH
3554+
3555+C
3556+C INCLUDE FILES
3557+C
3558+C the include file with the values of the parameters and masses
3559+C
3560+ INCLUDE 'coupl.inc'
3561+C particle masses
3562+ REAL*8 PMASS(NEXTERNAL)
3563+C integer n_max_cg
3564+ INCLUDE 'ngraphs.inc'
3565+ INCLUDE 'nsqso_born.inc'
3566+ INCLUDE 'nsquaredSO.inc'
3567+
3568+C
3569+C LOCAL
3570+C
3571+ INTEGER I,J,K
3572+C four momenta. Energy is the zeroth component.
3573+ REAL*8 P(0:3,NEXTERNAL)
3574+ INTEGER MATELEM_ARRAY_DIM
3575+ REAL*8 , ALLOCATABLE :: MATELEM(:,:)
3576+ REAL*8 SQRTS,AO2PI,TOTMASS
3577+C sqrt(s)= center of mass energy
3578+ REAL*8 PIN(0:3), POUT(0:3)
3579+ CHARACTER*120 BUFF(NEXTERNAL)
3580+ INTEGER RETURNCODE, UNITS, TENS, HUNDREDS
3581+ INTEGER NSQUAREDSO_LOOP
3582+ REAL*8 , ALLOCATABLE :: PREC_FOUND(:)
3583+
3584+C
3585+C GLOBAL VARIABLES
3586+C
3587+C This is from ML code for the list of split orders selected by
3588+C the process definition
3589+C
3590+ INTEGER NLOOPCHOSEN
3591+ CHARACTER*20 CHOSEN_LOOP_SO_INDICES(NSQUAREDSO)
3592+ LOGICAL CHOSEN_LOOP_SO_CONFIGS(NSQUAREDSO)
3593+ COMMON/CHOSEN_LOOP_SQSO/CHOSEN_LOOP_SO_CONFIGS
3594+ INTEGER NBORNCHOSEN
3595+ CHARACTER*20 CHOSEN_BORN_SO_INDICES(NSQSO_BORN)
3596+ LOGICAL CHOSEN_BORN_SO_CONFIGS(NSQSO_BORN)
3597+ COMMON/CHOSEN_BORN_SQSO/CHOSEN_BORN_SO_CONFIGS
3598+
3599+C
3600+C SAVED VARIABLES
3601+C
3602+ LOGICAL INIT
3603+ DATA INIT/.TRUE./
3604+ COMMON/INITCHECKSA/INIT
3605+C
3606+C EXTERNAL
3607+C
3608+ REAL*8 DOT
3609+ EXTERNAL DOT
3610+
3611+C
3612+C BEGIN CODE
3613+C
3614+C
3615+
3616+ IF (INIT) THEN
3617+ INIT=.FALSE.
3618+ CALL GET_ANSWER_DIMENSION(MATELEM_ARRAY_DIM)
3619+ ALLOCATE(MATELEM(0:3,0:MATELEM_ARRAY_DIM))
3620+ CALL GET_NSQSO_LOOP(NSQUAREDSO_LOOP)
3621+ ALLOCATE(PREC_FOUND(0:NSQUAREDSO_LOOP))
3622+
3623+C INITIALIZATION CALLS
3624+C
3625+C Call to initialize the values of the couplings, masses and
3626+C widths
3627+C used in the evaluation of the matrix element. The primary
3628+C parameters of the
3629+C models are read from Cards/param_card.dat. The secondary
3630+C parameters are calculated
3631+C in Source/MODEL/couplings.f. The values are stored in common
3632+C blocks that are listed
3633+C in coupl.inc .
3634+C first call to setup the paramaters
3635+ CALL SETPARA('param_card.dat')
3636+C set up masses
3637+ INCLUDE 'pmass.inc'
3638+
3639+ ENDIF
3640+
3641+
3642+C Start by initializing what is the squared split orders indices
3643+C chosen
3644+ NLOOPCHOSEN=0
3645+ DO I=1,NSQUAREDSO
3646+ IF (CHOSEN_LOOP_SO_CONFIGS(I)) THEN
3647+ NLOOPCHOSEN=NLOOPCHOSEN+1
3648+ WRITE(CHOSEN_LOOP_SO_INDICES(NLOOPCHOSEN),'(I3,A2)') I,'L)'
3649+ ENDIF
3650+ ENDDO
3651+ NBORNCHOSEN=0
3652+ DO I=1,NSQSO_BORN
3653+ IF (CHOSEN_BORN_SO_CONFIGS(I)) THEN
3654+ NBORNCHOSEN=NBORNCHOSEN+1
3655+ WRITE(CHOSEN_BORN_SO_INDICES(NBORNCHOSEN),'(I3,A2)') I,'B)'
3656+ ENDIF
3657+ ENDDO
3658+
3659+ AO2PI=G**2/(8.D0*(3.14159265358979323846D0**2))
3660+
3661+ WRITE(*,*) 'AO2PI=',AO2PI
3662+C Now use a simple multipurpose PS generator (RAMBO) just to get a
3663+C RANDOM set of four momenta of given masses pmass(i) to be used
3664+C to evaluate
3665+C the madgraph matrix-element.
3666+C Alternatevely, here the user can call or set the four momenta at
3667+C his will, see below.
3668+C
3669+ IF(NINCOMING.EQ.1) THEN
3670+ SQRTS=PMASS(1)
3671+ ELSE
3672+ TOTMASS = 0.0D0
3673+ DO I=1,NEXTERNAL
3674+ TOTMASS = TOTMASS + PMASS(I)
3675+ ENDDO
3676+C CMS energy in GEV
3677+ SQRTS=MAX(1000D0,2.0D0*TOTMASS)
3678+ ENDIF
3679+
3680+ CALL PRINTOUT()
3681+
3682+
3683+
3684+ DO K=1,NPSPOINTS
3685+
3686+ IF(READPS) THEN
3687+ OPEN(967, FILE='PS.input', ERR=976, STATUS='OLD', ACTION='RE'
3688+ $ //'AD')
3689+ DO I=1,NEXTERNAL
3690+ READ(967,*,END=978) P(0,I),P(1,I),P(2,I),P(3,I)
3691+ ENDDO
3692+ GOTO 978
3693+ 976 CONTINUE
3694+ STOP 'Could not read the PS.input phase-space point.'
3695+ 978 CONTINUE
3696+ CLOSE(967)
3697+ ELSE
3698+ IF ((NINCOMING.EQ.2).AND.((NEXTERNAL - NINCOMING .EQ.1))
3699+ $ ) THEN
3700+ IF (PMASS(3).EQ.0.0D0) THEN
3701+ STOP 'Cannot generate 2>1 kin. config. with m3=0.0d0'
3702+ ELSE
3703+C deal with the case of only one particle in the final
3704+C state
3705+ P(0,1) = PMASS(3)/2D0
3706+ P(1,1) = 0D0
3707+ P(2,1) = 0D0
3708+ P(3,1) = PMASS(3)/2D0
3709+ IF (PMASS(1).GT.0D0) THEN
3710+ P(3,1) = DSQRT(PMASS(3)**2/4D0 - PMASS(1)**2)
3711+ ENDIF
3712+ P(0,2) = PMASS(3)/2D0
3713+ P(1,2) = 0D0
3714+ P(2,2) = 0D0
3715+ P(3,2) = -PMASS(3)/2D0
3716+ IF (PMASS(2) > 0D0) THEN
3717+ P(3,2) = -DSQRT(PMASS(3)**2/4D0 - PMASS(1)**2)
3718+ ENDIF
3719+ P(0,3) = PMASS(3)
3720+ P(1,3) = 0D0
3721+ P(2,3) = 0D0
3722+ P(3,3) = 0D0
3723+ ENDIF
3724+ ELSE
3725+ CALL GET_MOMENTA(SQRTS,PMASS,P)
3726+ ENDIF
3727+ ENDIF
3728+
3729+ DO I=0,3
3730+ PIN(I)=0.0D0
3731+ DO J=1,NINCOMING
3732+ PIN(I)=PIN(I)+P(I,J)
3733+ ENDDO
3734+ ENDDO
3735+
3736+C In standalone mode, always use sqrt_s as the renormalization
3737+C scale.
3738+ SQRTS=DSQRT(DABS(DOT(PIN(0),PIN(0))))
3739+ MU_R=SQRTS
3740+
3741+C Update the couplings with the new MU_R
3742+ CALL UPDATE_AS_PARAM()
3743+
3744+C Optionally the user can set where to find the MadLoop5_resource
3745+C s folder.
3746+C Otherwise it will look for it automatically and find it if it
3747+C has not
3748+C been moved
3749+C MadLoopResourcePath = '<MadLoop5_resources_path>'
3750+C CALL SETMADLOOPPATH(MadLoopResourcePath)
3751+C To force the stabiliy check to also be performed in the
3752+C initialization phase
3753+C CALL FORCE_STABILITY_CHECK(.TRUE.)
3754+C To chose a particular tartget split order, SOTARGET is an
3755+C integer labeling
3756+C the possible squared order couplings contributions (only in
3757+C optimized mode)
3758+C CALL SET_COUPLINGORDERS_TARGET(SOTARGET)
3759+
3760+
3761+C
3762+C Now we can call the matrix element
3763+C
3764+ CALL SLOOPMATRIX_THRES(P,MATELEM,-1.0D0,PREC_FOUND,RETURNCODE)
3765+
3766+C
3767+C write the information on the four momenta
3768+C
3769+ IF (K.EQ.NPSPOINTS) THEN
3770+ WRITE (*,*)
3771+ WRITE (*,*) ' Phase space point:'
3772+ WRITE (*,*)
3773+ WRITE (*,*) '---------------------------------'
3774+ WRITE (*,*) 'n E px py pz m'
3775+ DO I=1,NEXTERNAL
3776+ WRITE (*,'(i2,1x,5e15.7)') I, P(0,I),P(1,I),P(2,I),P(3,I)
3777+ $ ,DSQRT(DABS(DOT(P(0,I),P(0,I))))
3778+ ENDDO
3779+ WRITE (*,*) '---------------------------------'
3780+ WRITE (*,*) 'Detailed result for each coupling order'
3781+ $ //'s combination.'
3782+ WRITE(*,*) 'All Born contributions are of split order'
3783+ $ //'s (QCD=0)'
3784+ WRITE (*,*) '---------------------------------'
3785+ WRITE(*,*) 'All loop contributions are of split order'
3786+ $ //'s (QCD=2)'
3787+ WRITE (*,*) '---------------------------------'
3788+ UNITS=MOD(RETURNCODE,10)
3789+ TENS=(MOD(RETURNCODE,100)-UNITS)/10
3790+ HUNDREDS=(RETURNCODE-TENS*10-UNITS)/100
3791+ IF (HUNDREDS.EQ.1) THEN
3792+ IF (TENS.EQ.3.OR.TENS.EQ.4) THEN
3793+ WRITE(*,*) 'Unknown numerical stability because MadLoo'
3794+ $ //'p is in the initialization stage.'
3795+ ELSE
3796+ WRITE(*,*) 'Unknown numerical stability, check CTModeRu'
3797+ $ //'n value in MadLoopParams.dat.'
3798+ ENDIF
3799+ ELSEIF (HUNDREDS.EQ.2) THEN
3800+ WRITE(*,*) 'Stable kinematic configuration (SPS).'
3801+ ELSEIF (HUNDREDS.EQ.3) THEN
3802+ WRITE(*,*) 'Unstable kinematic configuration (UPS).'
3803+ WRITE(*,*) 'Quadruple precision rescue successful.'
3804+ ELSEIF (HUNDREDS.EQ.4) THEN
3805+ WRITE(*,*) 'Exceptional kinematic configuration (EPS).'
3806+ WRITE(*,*) 'Both double an quadruple precision computation'
3807+ $ //'s, are unstable.'
3808+ ENDIF
3809+ IF (TENS.EQ.2.OR.TENS.EQ.4) THEN
3810+ WRITE(*,*) 'Quadruple precision computation used.'
3811+ ENDIF
3812+ IF (HUNDREDS.NE.1) THEN
3813+ IF (PREC_FOUND(0).GT.0.0D0) THEN
3814+ WRITE(*,'(1x,a23,1x,1e10.2)') 'Relative accuracy ='
3815+ $ ,PREC_FOUND(0)
3816+ ELSEIF (PREC_FOUND(0).EQ.0.0D0) THEN
3817+ WRITE(*,'(1x,a23,1x,1e10.2,1x,a30)') 'Relative accuracy'
3818+ $ //' =',PREC_FOUND(0),'(i.e. beyond double precisio'
3819+ $ //'n)'
3820+ ELSE
3821+ WRITE(*,*) 'Estimated accuracy could not be computed fo'
3822+ $ //'r an unknown reason.'
3823+ ENDIF
3824+ ENDIF
3825+ WRITE (*,*) '---------------------------------'
3826+ IF (NBORNCHOSEN.EQ.0) THEN
3827+ WRITE (*,*) 'No Born contribution satisfied the square'
3828+ $ //'d order constraints.'
3829+ ELSE IF (NBORNCHOSEN.NE.NSQSO_BORN) THEN
3830+ WRITE (*,*) 'Selected squared coupling orders combinatio'
3831+ $ //'n for the Born summed result below:'
3832+ WRITE (*,*) (CHOSEN_BORN_SO_INDICES(I),I=1,NBORNCHOSEN)
3833+ ENDIF
3834+ IF (NLOOPCHOSEN.NE.NSQUAREDSO) THEN
3835+ WRITE (*,*) 'Selected squared coupling orders combinatio'
3836+ $ //'n for the loop summed result below:'
3837+ WRITE (*,*) (CHOSEN_LOOP_SO_INDICES(I),I=1,NLOOPCHOSEN)
3838+ ENDIF
3839+ WRITE (*,*) '---------------------------------'
3840+ WRITE (*,*) 'Matrix element born = ', MATELEM(0,0)
3841+ $ , ' GeV^',-(2*NEXTERNAL-8)
3842+ WRITE (*,*) 'Matrix element finite = ', MATELEM(1,0)
3843+ $ , ' GeV^',-(2*NEXTERNAL-8)
3844+ WRITE (*,*) 'Matrix element 1eps = ', MATELEM(2,0)
3845+ $ , ' GeV^',-(2*NEXTERNAL-8)
3846+ WRITE (*,*) 'Matrix element 2eps = ', MATELEM(3,0)
3847+ $ , ' GeV^',-(2*NEXTERNAL-8)
3848+ WRITE (*,*) '---------------------------------'
3849+ IF (MATELEM(0,0).NE.0.0D0) THEN
3850+ WRITE (*,*) 'finite / (born*ao2pi) = ', MATELEM(1,0)
3851+ $ /MATELEM(0,0)/AO2PI
3852+ WRITE (*,*) '1eps / (born*ao2pi) = ', MATELEM(2,0)
3853+ $ /MATELEM(0,0)/AO2PI
3854+ WRITE (*,*) '2eps / (born*ao2pi) = ', MATELEM(3,0)
3855+ $ /MATELEM(0,0)/AO2PI
3856+ ELSE
3857+ WRITE (*,*) 'finite / ao2pi = ', MATELEM(1,0)/AO2PI
3858+ WRITE (*,*) '1eps / ao2pi = ', MATELEM(2,0)/AO2PI
3859+ WRITE (*,*) '2eps / ao2pi = ', MATELEM(3,0)/AO2PI
3860+ ENDIF
3861+ WRITE (*,*) '---------------------------------'
3862+
3863+ OPEN(69, FILE='result.dat', ERR=976, ACTION='WRITE')
3864+ DO I=1,NEXTERNAL
3865+ WRITE (69,'(a2,1x,5e25.15)') 'PS',P(0,I),P(1,I),P(2,I),P(3
3866+ $ ,I)
3867+ ENDDO
3868+ WRITE (69,'(a3,1x,i2)') 'EXP',-(2*NEXTERNAL-8)
3869+ WRITE (69,'(a4,1x,1e25.15)') 'BORN',MATELEM(0,0)
3870+ IF (MATELEM(0,0).NE.0.0D0) THEN
3871+ WRITE (69,'(a3,1x,1e25.15)') 'FIN',MATELEM(1,0)/MATELEM(0
3872+ $ ,0)/AO2PI
3873+ WRITE (69,'(a4,1x,1e25.15)') '1EPS',MATELEM(2,0)/MATELEM(0
3874+ $ ,0)/AO2PI
3875+ WRITE (69,'(a4,1x,1e25.15)') '2EPS',MATELEM(3,0)/MATELEM(0
3876+ $ ,0)/AO2PI
3877+ ELSE
3878+ WRITE (69,'(a3,1x,1e25.15)') 'FIN',MATELEM(1,0)/AO2PI
3879+ WRITE (69,'(a4,1x,1e25.15)') '1EPS',MATELEM(2,0)/AO2PI
3880+ WRITE (69,'(a4,1x,1e25.15)') '2EPS',MATELEM(3,0)/AO2PI
3881+ ENDIF
3882+ WRITE (69,'(a6,1x,1e25.15)') 'ASO2PI',AO2PI
3883+ WRITE (69,*) 'Export_Format Default'
3884+ WRITE (69,'(a7,1x,i3)') 'RETCODE',RETURNCODE
3885+ WRITE (69,'(a3,1x,1e10.4)') 'ACC',PREC_FOUND(0)
3886+ WRITE (69,*) 'Born_kept',(CHOSEN_BORN_SO_CONFIGS(I),I=1
3887+ $ ,NSQSO_BORN)
3888+ WRITE (69,*) 'Loop_kept',(CHOSEN_LOOP_SO_CONFIGS(I),I=1
3889+ $ ,NSQUAREDSO)
3890+ WRITE (69,*) 'Born_SO_Results 0'
3891+ WRITE (69,*) 'SO_Born BORN ',MATELEM(0,1)
3892+ WRITE (69,*) 'Split_Orders_Names QCD'
3893+ WRITE (69,*) 'Loop_SO_Results 2'
3894+ WRITE (69,*) 'SO_Loop ACC ',PREC_FOUND(1)
3895+ WRITE (69,*) 'SO_Loop FIN ',MATELEM(1,1)
3896+ WRITE (69,*) 'SO_Loop 1EPS ',MATELEM(2,1)
3897+ WRITE (69,*) 'SO_Loop 2EPS ',MATELEM(3,1)
3898+ CLOSE(69)
3899+ ELSE
3900+ WRITE (*,*) 'PS Point #',K,' done.'
3901+ ENDIF
3902+ ENDDO
3903+
3904+C C
3905+C C Copy down here (or read in) the four momenta as a string.
3906+C C
3907+C C
3908+C buff(1)=" 1 0.5630480E+04 0.0000000E+00 0.0000000E+00
3909+C 0.5630480E+04"
3910+C buff(2)=" 2 0.5630480E+04 0.0000000E+00 0.0000000E+00
3911+C -0.5630480E+04"
3912+C buff(3)=" 3 0.5466073E+04 0.4443190E+03 0.2446331E+04
3913+C -0.4864732E+04"
3914+C buff(4)=" 4 0.8785819E+03 -0.2533886E+03 0.2741971E+03
3915+C 0.7759741E+03"
3916+C buff(5)=" 5 0.4916306E+04 -0.1909305E+03 -0.2720528E+04
3917+C 0.4088757E+04"
3918+C C
3919+C C Here the k,E,px,py,pz are read from the string into the
3920+C momenta array.
3921+C C k=1,2 : incoming
3922+C C k=3,nexternal : outgoing
3923+C C
3924+C do i=1,nexternal
3925+C read (buff(i),*) k, P(0,i),P(1,i),P(2,i),P(3,i)
3926+C enddo
3927+C
3928+C C print the momenta out
3929+C
3930+C do i=1,nexternal
3931+C write (*,'(i2,1x,5e15.7)') i, P(0,i),P(1,i),P(2,i),P(3,i),
3932+C &dsqrt(dabs(DOT(p(0,i),p(0,i))))
3933+C enddo
3934+C
3935+C CALL SLOOPMATRIX(P,MATELEM)
3936+C
3937+C write (*,*) "-------------------------------------------------"
3938+C write (*,*) "Matrix element = ", MATELEM(1), " GeV^",-(2*nexterna
3939+C l-8)
3940+C write (*,*) "-------------------------------------------------"
3941+
3942+ DEALLOCATE(MATELEM)
3943+ DEALLOCATE(PREC_FOUND)
3944+
3945+ END
3946+
3947+
3948+
3949+
3950+ DOUBLE PRECISION FUNCTION DOT(P1,P2)
3951+C *************************************************************
3952+C 4-Vector Dot product
3953+C *************************************************************
3954+ IMPLICIT NONE
3955+ DOUBLE PRECISION P1(0:3),P2(0:3)
3956+ DOT=P1(0)*P2(0)-P1(1)*P2(1)-P1(2)*P2(2)-P1(3)*P2(3)
3957+ END
3958+
3959+
3960+ SUBROUTINE GET_MOMENTA(ENERGY,PMASS,P)
3961+C auxiliary function to change convention between madgraph and
3962+C rambo
3963+C four momenta.
3964+ IMPLICIT NONE
3965+ INTEGER NEXTERNAL, NINCOMING
3966+ PARAMETER (NEXTERNAL=3,NINCOMING=2)
3967+C ARGUMENTS
3968+ REAL*8 ENERGY,PMASS(NEXTERNAL),P(0:3,NEXTERNAL),PRAMBO(4,10),WGT
3969+C LOCAL
3970+ INTEGER I
3971+ REAL*8 ETOT2,MOM,M1,M2,E1,E2
3972+
3973+ ETOT2=ENERGY**2
3974+ M1=PMASS(1)
3975+ M2=PMASS(2)
3976+ MOM=(ETOT2**2 - 2*ETOT2*M1**2 + M1**4 - 2*ETOT2*M2**2 - 2*M1**2
3977+ $ *M2**2 + M2**4)/(4.*ETOT2)
3978+ MOM=DSQRT(MOM)
3979+ E1=DSQRT(MOM**2+M1**2)
3980+ E2=DSQRT(MOM**2+M2**2)
3981+C write (*,*) e1+e2,mom
3982+
3983+ IF(NINCOMING.EQ.2) THEN
3984+
3985+ P(0,1)=E1
3986+ P(1,1)=0D0
3987+ P(2,1)=0D0
3988+ P(3,1)=MOM
3989+
3990+ P(0,2)=E2
3991+ P(1,2)=0D0
3992+ P(2,2)=0D0
3993+ P(3,2)=-MOM
3994+
3995+ CALL RAMBO(NEXTERNAL-2,ENERGY,PMASS(3),PRAMBO,WGT)
3996+ DO I=3, NEXTERNAL
3997+ P(0,I)=PRAMBO(4,I-2)
3998+ P(1,I)=PRAMBO(1,I-2)
3999+ P(2,I)=PRAMBO(2,I-2)
4000+ P(3,I)=PRAMBO(3,I-2)
4001+ ENDDO
4002+
4003+ ELSEIF(NINCOMING.EQ.1) THEN
4004+
4005+ P(0,1)=ENERGY
4006+ P(1,1)=0D0
4007+ P(2,1)=0D0
4008+ P(3,1)=0D0
4009+
4010+ CALL RAMBO(NEXTERNAL-1,ENERGY,PMASS(2),PRAMBO,WGT)
4011+ DO I=2, NEXTERNAL
4012+ P(0,I)=PRAMBO(4,I-1)
4013+ P(1,I)=PRAMBO(1,I-1)
4014+ P(2,I)=PRAMBO(2,I-1)
4015+ P(3,I)=PRAMBO(3,I-1)
4016+ ENDDO
4017+ ENDIF
4018+
4019+ RETURN
4020+ END
4021+
4022+
4023+ SUBROUTINE RAMBO(N,ET,XM,P,WT)
4024+C *****************************************************************
4025+C *****
4026+C RAMBO *
4027+C RA(NDOM) M(OMENTA) B(EAUTIFULLY) O(RGANIZED)
4028+C *
4029+C *
4030+C A DEMOCRATIC MULTI-PARTICLE PHASE SPACE GENERATOR
4031+C *
4032+C AUTHORS: S.D. ELLIS, R. KLEISS, W.J. STIRLING
4033+C *
4034+C THIS IS VERSION 1.0 - WRITTEN BY R. KLEISS
4035+C *
4036+C -- ADJUSTED BY HANS KUIJF, WEIGHTS ARE LOGARITHMIC (20-08-90)
4037+C *
4038+C *
4039+C N = NUMBER OF PARTICLES
4040+C *
4041+C ET = TOTAL CENTRE-OF-MASS ENERGY
4042+C *
4043+C XM = PARTICLE MASSES ( DIM=NEXTERNAL-nincoming )
4044+C *
4045+C P = PARTICLE MOMENTA ( DIM=(4,NEXTERNAL-nincoming) )
4046+C *
4047+C WT = WEIGHT OF THE EVENT
4048+C *
4049+C *****************************************************************
4050+C *****
4051+ IMPLICIT REAL*8(A-H,O-Z)
4052+ INTEGER NEXTERNAL, NINCOMING
4053+ PARAMETER (NEXTERNAL=3,NINCOMING=2)
4054+ DIMENSION XM(NEXTERNAL-NINCOMING),P(4,NEXTERNAL-NINCOMING)
4055+ DIMENSION Q(4,NEXTERNAL-NINCOMING),Z(NEXTERNAL-NINCOMING),R(4)
4056+ $ ,B(3),P2(NEXTERNAL-NINCOMING),XM2(NEXTERNAL-NINCOMING)
4057+ $ ,E(NEXTERNAL-NINCOMING),V(NEXTERNAL-NINCOMING),IWARN(5)
4058+ SAVE ACC,ITMAX,IBEGIN,IWARN
4059+ DATA ACC/1.D-14/,ITMAX/6/,IBEGIN/0/,IWARN/5*0/
4060+C
4061+C INITIALIZATION STEP: FACTORIALS FOR THE PHASE SPACE WEIGHT
4062+ IF(IBEGIN.NE.0) GOTO 103
4063+ IBEGIN=1
4064+ TWOPI=8.*DATAN(1.D0)
4065+ PO2LOG=LOG(TWOPI/4.)
4066+ Z(2)=PO2LOG
4067+ DO 101 K=3,(NEXTERNAL-NINCOMING)
4068+ 101 Z(K)=Z(K-1)+PO2LOG-2.*LOG(DFLOAT(K-2))
4069+ DO 102 K=3,(NEXTERNAL-NINCOMING)
4070+ 102 Z(K)=(Z(K)-LOG(DFLOAT(K-1)))
4071+C
4072+C CHECK ON THE NUMBER OF PARTICLES
4073+ 103 IF(N.GT.1.AND.N.LT.101) GOTO 104
4074+ PRINT 1001,N
4075+ STOP
4076+C
4077+C CHECK WHETHER TOTAL ENERGY IS SUFFICIENT; COUNT NONZERO MASSES
4078+ 104 XMT=0.
4079+ NM=0
4080+ DO 105 I=1,N
4081+ IF(XM(I).NE.0.D0) NM=NM+1
4082+ 105 XMT=XMT+ABS(XM(I))
4083+ IF(XMT.LE.ET) GOTO 201
4084+ PRINT 1002,XMT,ET
4085+ STOP
4086+C
4087+C THE PARAMETER VALUES ARE NOW ACCEPTED
4088+C
4089+C GENERATE N MASSLESS MOMENTA IN INFINITE PHASE SPACE
4090+ 201 DO 202 I=1,N
4091+ R1=RN(1)
4092+ C=2.*R1-1.
4093+ S=SQRT(1.-C*C)
4094+ F=TWOPI*RN(2)
4095+ R1=RN(3)
4096+ R2=RN(4)
4097+ Q(4,I)=-LOG(R1*R2)
4098+ Q(3,I)=Q(4,I)*C
4099+ Q(2,I)=Q(4,I)*S*COS(F)
4100+ 202 Q(1,I)=Q(4,I)*S*SIN(F)
4101+C
4102+C CALCULATE THE PARAMETERS OF THE CONFORMAL TRANSFORMATION
4103+ DO 203 I=1,4
4104+ 203 R(I)=0.
4105+ DO 204 I=1,N
4106+ DO 204 K=1,4
4107+ 204 R(K)=R(K)+Q(K,I)
4108+ RMAS=SQRT(R(4)**2-R(3)**2-R(2)**2-R(1)**2)
4109+ DO 205 K=1,3
4110+ 205 B(K)=-R(K)/RMAS
4111+ G=R(4)/RMAS
4112+ A=1./(1.+G)
4113+ X=ET/RMAS
4114+C
4115+C TRANSFORM THE Q'S CONFORMALLY INTO THE P'S
4116+ DO 207 I=1,N
4117+ BQ=B(1)*Q(1,I)+B(2)*Q(2,I)+B(3)*Q(3,I)
4118+ DO 206 K=1,3
4119+ 206 P(K,I)=X*(Q(K,I)+B(K)*(Q(4,I)+A*BQ))
4120+ 207 P(4,I)=X*(G*Q(4,I)+BQ)
4121+C
4122+C CALCULATE WEIGHT AND POSSIBLE WARNINGS
4123+ WT=PO2LOG
4124+ IF(N.NE.2) WT=(2.*N-4.)*LOG(ET)+Z(N)
4125+ IF(WT.GE.-180.D0) GOTO 208
4126+ IF(IWARN(1).LE.5) PRINT 1004,WT
4127+ IWARN(1)=IWARN(1)+1
4128+ 208 IF(WT.LE. 174.D0) GOTO 209
4129+ IF(IWARN(2).LE.5) PRINT 1005,WT
4130+ IWARN(2)=IWARN(2)+1
4131+C
4132+C RETURN FOR WEIGHTED MASSLESS MOMENTA
4133+ 209 IF(NM.NE.0) GOTO 210
4134+C RETURN LOG OF WEIGHT
4135+ WT=WT
4136+ RETURN
4137+C
4138+C MASSIVE PARTICLES: RESCALE THE MOMENTA BY A FACTOR X
4139+ 210 XMAX=SQRT(1.-(XMT/ET)**2)
4140+ DO 301 I=1,N
4141+ XM2(I)=XM(I)**2
4142+ 301 P2(I)=P(4,I)**2
4143+ ITER=0
4144+ X=XMAX
4145+ ACCU=ET*ACC
4146+ 302 F0=-ET
4147+ G0=0.
4148+ X2=X*X
4149+ DO 303 I=1,N
4150+ E(I)=SQRT(XM2(I)+X2*P2(I))
4151+ F0=F0+E(I)
4152+ 303 G0=G0+P2(I)/E(I)
4153+ IF(ABS(F0).LE.ACCU) GOTO 305
4154+ ITER=ITER+1
4155+ IF(ITER.LE.ITMAX) GOTO 304
4156+ PRINT 1006,ITMAX
4157+ GOTO 305
4158+ 304 X=X-F0/(X*G0)
4159+ GOTO 302
4160+ 305 DO 307 I=1,N
4161+ V(I)=X*P(4,I)
4162+ DO 306 K=1,3
4163+ 306 P(K,I)=X*P(K,I)
4164+ 307 P(4,I)=E(I)
4165+C
4166+C CALCULATE THE MASS-EFFECT WEIGHT FACTOR
4167+ WT2=1.
4168+ WT3=0.
4169+ DO 308 I=1,N
4170+ WT2=WT2*V(I)/E(I)
4171+ 308 WT3=WT3+V(I)**2/E(I)
4172+ WTM=(2.*N-3.)*LOG(X)+LOG(WT2/WT3*ET)
4173+C
4174+C RETURN FOR WEIGHTED MASSIVE MOMENTA
4175+ WT=WT+WTM
4176+ IF(WT.GE.-180.D0) GOTO 309
4177+ IF(IWARN(3).LE.5) PRINT 1004,WT
4178+ IWARN(3)=IWARN(3)+1
4179+ 309 IF(WT.LE. 174.D0) GOTO 310
4180+ IF(IWARN(4).LE.5) PRINT 1005,WT
4181+ IWARN(4)=IWARN(4)+1
4182+C RETURN LOG OF WEIGHT
4183+ 310 WT=WT
4184+ RETURN
4185+C
4186+ 1001 FORMAT(' RAMBO FAILS: # OF PARTICLES =',I5,' IS NOT ALLOWED')
4187+ 1002 FORMAT(' RAMBO FAILS: TOTAL MASS =',D15.6,' IS NOT',' SMALLE'
4188+ $ //'R THAN TOTAL ENERGY =',D15.6)
4189+ 1004 FORMAT(' RAMBO WARNS: WEIGHT = EXP(',F20.9,') MAY UNDERFLOW')
4190+ 1005 FORMAT(' RAMBO WARNS: WEIGHT = EXP(',F20.9,') MAY OVERFLOW')
4191+ 1006 FORMAT(' RAMBO WARNS:',I3,' ITERATIONS DID NOT GIVE THE'
4192+ $ ,' DESIRED ACCURACY =',D15.6)
4193+ END
4194+
4195+ FUNCTION RN(IDUMMY)
4196+ REAL*8 RN,RAN
4197+ SAVE INIT
4198+ DATA INIT /1/
4199+ IF (INIT.EQ.1) THEN
4200+ INIT=0
4201+ CALL RMARIN(1802,9373)
4202+ END IF
4203+C
4204+ 10 CALL RANMAR(RAN)
4205+ IF (RAN.LT.1D-16) GOTO 10
4206+ RN=RAN
4207+C
4208+ END
4209+
4210+
4211+
4212+ SUBROUTINE RANMAR(RVEC)
4213+C -----------------
4214+C Universal random number generator proposed by Marsaglia and
4215+C Zaman
4216+C in report FSU-SCRI-87-50
4217+C In this version RVEC is a double precision variable.
4218+ IMPLICIT REAL*8(A-H,O-Z)
4219+ COMMON/ RASET1 / RANU(97),RANC,RANCD,RANCM
4220+ COMMON/ RASET2 / IRANMR,JRANMR
4221+ SAVE /RASET1/,/RASET2/
4222+ UNI = RANU(IRANMR) - RANU(JRANMR)
4223+ IF(UNI .LT. 0D0) UNI = UNI + 1D0
4224+ RANU(IRANMR) = UNI
4225+ IRANMR = IRANMR - 1
4226+ JRANMR = JRANMR - 1
4227+ IF(IRANMR .EQ. 0) IRANMR = 97
4228+ IF(JRANMR .EQ. 0) JRANMR = 97
4229+ RANC = RANC - RANCD
4230+ IF(RANC .LT. 0D0) RANC = RANC + RANCM
4231+ UNI = UNI - RANC
4232+ IF(UNI .LT. 0D0) UNI = UNI + 1D0
4233+ RVEC = UNI
4234+ END
4235+
4236+ SUBROUTINE RMARIN(IJ,KL)
4237+C -----------------
4238+C Initializing routine for RANMAR, must be called before
4239+C generating
4240+C any pseudorandom numbers with RANMAR. The input values should
4241+C be in
4242+C the ranges 0<=ij<=31328 ; 0<=kl<=30081
4243+ IMPLICIT REAL*8(A-H,O-Z)
4244+ COMMON/ RASET1 / RANU(97),RANC,RANCD,RANCM
4245+ COMMON/ RASET2 / IRANMR,JRANMR
4246+ SAVE /RASET1/,/RASET2/
4247+C This shows correspondence between the simplified input seeds
4248+C IJ, KL
4249+C and the original Marsaglia-Zaman seeds I,J,K,L.
4250+C To get the standard values in the Marsaglia-Zaman paper
4251+C (i=12,j=34
4252+C k=56,l=78) put ij=1802, kl=9373
4253+ I = MOD( IJ/177 , 177 ) + 2
4254+ J = MOD( IJ , 177 ) + 2
4255+ K = MOD( KL/169 , 178 ) + 1
4256+ L = MOD( KL , 169 )
4257+ DO 300 II = 1 , 97
4258+ S = 0D0
4259+ T = .5D0
4260+ DO 200 JJ = 1 , 24
4261+ M = MOD( MOD(I*J,179)*K , 179 )
4262+ I = J
4263+ J = K
4264+ K = M
4265+ L = MOD( 53*L+1 , 169 )
4266+ IF(MOD(L*M,64) .GE. 32) S = S + T
4267+ T = .5D0*T
4268+ 200 CONTINUE
4269+ RANU(II) = S
4270+ 300 CONTINUE
4271+ RANC = 362436D0 / 16777216D0
4272+ RANCD = 7654321D0 / 16777216D0
4273+ RANCM = 16777213D0 / 16777216D0
4274+ IRANMR = 97
4275+ JRANMR = 33
4276+ END
4277+
4278+
4279+
4280+
4281+
4282+
4283+
4284
4285=== added file 'tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%check_sa_born_splitOrders.f'
4286--- tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%check_sa_born_splitOrders.f 1970-01-01 00:00:00 +0000
4287+++ tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%check_sa_born_splitOrders.f 2016-02-24 13:54:50 +0000
4288@@ -0,0 +1,524 @@
4289+ PROGRAM DRIVER
4290+C *****************************************************************
4291+C *********
4292+C THIS IS THE DRIVER FOR CHECKING THE STANDALONE MATRIX ELEMENT.
4293+C IT USES A SIMPLE PHASE SPACE GENERATOR
4294+C Fabio Maltoni - 3rd Febraury 2007
4295+C *****************************************************************
4296+C *********
4297+ IMPLICIT NONE
4298+C
4299+C CONSTANTS
4300+C
4301+ REAL*8 ZERO
4302+ PARAMETER (ZERO=0D0)
4303+ INTEGER NSPLITORDERS
4304+ PARAMETER (NSPLITORDERS=1)
4305+C
4306+C INCLUDE FILES
4307+C
4308+C --- the include file with the values of the parameters and
4309+C masses
4310+ INCLUDE 'coupl.inc'
4311+C integer nexternal and number particles (incoming+outgoing) in
4312+C the me
4313+ INTEGER NEXTERNAL, NINCOMING
4314+ PARAMETER (NEXTERNAL=3,NINCOMING=2)
4315+C --- particle masses
4316+ REAL*8 PMASS(NEXTERNAL)
4317+ REAL*8 TOTALMASS
4318+C --- integer n_max_cg
4319+ INCLUDE 'ngraphs.inc' !how many diagrams (could be useful to know...)
4320+
4321+C
4322+C LOCAL
4323+C
4324+ INTEGER I,J,K
4325+ REAL*8 P(0:3,NEXTERNAL) ! four momenta. Energy is the zeroth component.
4326+ REAL*8 SQRTS ! sqrt(s)= center of mass energy
4327+ REAL*8 MATELEM, MATELEMS(0:NSPLITORDERS)
4328+ REAL*8 PIN(0:3), POUT(0:3)
4329+ CHARACTER*120 BUFF(NEXTERNAL)
4330+
4331+ INTEGER NCHOSEN
4332+ CHARACTER*20 CHOSEN_SO_INDICES(NSPLITORDERS)
4333+
4334+C
4335+C EXTERNAL
4336+C
4337+ REAL*8 DOT
4338+ EXTERNAL DOT
4339+
4340+ LOGICAL CHOSEN_SO_CONFIGS(NSPLITORDERS)
4341+ COMMON/CHOSEN_BORN_SQSO/CHOSEN_SO_CONFIGS
4342+
4343+C -----
4344+C BEGIN CODE
4345+C -----
4346+C
4347+C Start by initializing what is the squared split orders indices
4348+C chosen
4349+ NCHOSEN=0
4350+ DO I=1,NSPLITORDERS
4351+ IF (CHOSEN_SO_CONFIGS(I)) THEN
4352+ NCHOSEN=NCHOSEN+1
4353+ WRITE(CHOSEN_SO_INDICES(NCHOSEN),'(I3,A1)') I,')'
4354+ ENDIF
4355+ ENDDO
4356+
4357+C --- INITIALIZATION CALLS
4358+C
4359+C --- Call to initialize the values of the couplings, masses and
4360+C widths
4361+C used in the evaluation of the matrix element. The primary
4362+C parameters of the
4363+C models are read from Cards/param_card.dat. The secondary
4364+C parameters are calculated
4365+C in Source/MODEL/couplings.f. The values are stored in common
4366+C blocks that are listed
4367+C in coupl.inc .
4368+
4369+ CALL SETPARA('param_card.dat') !first call to setup the paramaters
4370+ INCLUDE 'pmass.inc' !set up masses
4371+
4372+ TOTALMASS = 0.0D0
4373+ DO I=1,NEXTERNAL
4374+ TOTALMASS = TOTALMASS + PMASS(I)
4375+ ENDDO
4376+
4377+C --- Now use a simple multipurpose PS generator (RAMBO) just to
4378+C get a
4379+C RANDOM set of four momenta of given masses pmass(i) to be used
4380+C to evaluate
4381+C the madgraph matrix-element.
4382+C Alternatevely, here the user can call or set the four momenta at
4383+C his will, see below.
4384+C
4385+ IF(NINCOMING.EQ.1) THEN
4386+ SQRTS=PMASS(1)
4387+ ELSE
4388+ SQRTS=1000D0 !CMS energy in GEV
4389+ IF (SQRTS.LE.2.0D0*TOTALMASS) THEN
4390+ SQRTS = 2.0D0*TOTALMASS
4391+ ENDIF
4392+ ENDIF
4393+
4394+ CALL PRINTOUT()
4395+
4396+ CALL GET_MOMENTA(SQRTS,PMASS,P)
4397+C
4398+C write the information on the four momenta
4399+C
4400+ WRITE (*,*)
4401+ WRITE (*,*) ' Phase space point:'
4402+ WRITE (*,*)
4403+ WRITE (*,*) '-----------------------------'
4404+ WRITE (*,*) 'n E px py pz m '
4405+ DO I=1,NEXTERNAL
4406+ WRITE (*,'(i2,1x,5e15.7)') I, P(0,I),P(1,I),P(2,I),P(3,I)
4407+ $ ,DSQRT(DABS(DOT(P(0,I),P(0,I))))
4408+ ENDDO
4409+ WRITE (*,*) '-----------------------------'
4410+
4411+C
4412+C Now we can call the matrix element!
4413+C
4414+ CALL SMATRIX_SPLITORDERS(P,MATELEMS)
4415+ MATELEM=MATELEMS(0)
4416+ WRITE(*,*) '1) Matrix element for (QCD=0) = ',MATELEMS(1)
4417+C
4418+ IF (NCHOSEN.NE.NSPLITORDERS) THEN
4419+ WRITE (*,*) 'Selected squared coupling orders combination fo'
4420+ $ //'r the sum below:'
4421+ WRITE (*,*) (CHOSEN_SO_INDICES(I),I=1,NCHOSEN)
4422+ ENDIF
4423+ WRITE (*,*) 'Total Matrix element = ', MATELEM, ' GeV^',
4424+ $ -(2*NEXTERNAL-8)
4425+ WRITE (*,*) '-----------------------------'
4426+
4427+C c
4428+C c Copy down here (or read in) the four momenta as a string.
4429+C c
4430+C c
4431+C buff(1)=" 1 0.5630480E+04 0.0000000E+00 0.0000000E+00
4432+C 0.5630480E+04"
4433+C buff(2)=" 2 0.5630480E+04 0.0000000E+00 0.0000000E+00
4434+C -0.5630480E+04"
4435+C buff(3)=" 3 0.5466073E+04 0.4443190E+03 0.2446331E+04
4436+C -0.4864732E+04"
4437+C buff(4)=" 4 0.8785819E+03 -0.2533886E+03 0.2741971E+03
4438+C 0.7759741E+03"
4439+C buff(5)=" 5 0.4916306E+04 -0.1909305E+03 -0.2720528E+04
4440+C 0.4088757E+04"
4441+C c
4442+C c Here the k,E,px,py,pz are read from the string into the
4443+C momenta array.
4444+C c k=1,2 : incoming
4445+C c k=3,nexternal : outgoing
4446+C c
4447+C do i=1,nexternal
4448+C read (buff(i),*) k, P(0,i),P(1,i),P(2,i),P(3,i)
4449+C enddo
4450+C
4451+C c- print the momenta out
4452+C
4453+C do i=1,nexternal
4454+C write (*,'(i2,1x,5e15.7)') i, P(0,i),P(1,i),P(2,i),P(3,i),
4455+C .dsqrt(dabs(DOT(p(0,i),p(0,i))))
4456+C enddo
4457+C
4458+C CALL SMATRIX(P,MATELEM)
4459+C
4460+C write (*,*) "-------------------------------------------------"
4461+C write (*,*) "Matrix element = ", MATELEM, " GeV^",-(2*nexternal-8
4462+C )
4463+C write (*,*) "-------------------------------------------------"
4464+
4465+ END
4466+
4467+
4468+
4469+
4470+ DOUBLE PRECISION FUNCTION DOT(P1,P2)
4471+C *****************************************************************
4472+C ***********
4473+C 4-Vector Dot product
4474+C *****************************************************************
4475+C ***********
4476+ IMPLICIT NONE
4477+ DOUBLE PRECISION P1(0:3),P2(0:3)
4478+ DOT=P1(0)*P2(0)-P1(1)*P2(1)-P1(2)*P2(2)-P1(3)*P2(3)
4479+ END
4480+
4481+
4482+ SUBROUTINE GET_MOMENTA(ENERGY,PMASS,P)
4483+C ---- auxiliary function to change convention between madgraph
4484+C and rambo
4485+C ---- four momenta.
4486+ IMPLICIT NONE
4487+C integer nexternal and number particles (incoming+outgoing) in
4488+C the me
4489+ INTEGER NEXTERNAL, NINCOMING
4490+ PARAMETER (NEXTERNAL=3,NINCOMING=2)
4491+C ARGUMENTS
4492+ REAL*8 ENERGY,PMASS(NEXTERNAL),P(0:3,NEXTERNAL),PRAMBO(4,10),WGT
4493+C LOCAL
4494+ INTEGER I
4495+ REAL*8 ETOT2,MOM,M1,M2,E1,E2
4496+
4497+ ETOT2=ENERGY**2
4498+ M1=PMASS(1)
4499+ M2=PMASS(2)
4500+ MOM=(ETOT2**2 - 2*ETOT2*M1**2 + M1**4 - 2*ETOT2*M2**2 - 2*M1**2
4501+ $ *M2**2 + M2**4)/(4.*ETOT2)
4502+ MOM=DSQRT(MOM)
4503+ E1=DSQRT(MOM**2+M1**2)
4504+ E2=DSQRT(MOM**2+M2**2)
4505+ WRITE (*,*) E1+E2,MOM
4506+
4507+ IF(NINCOMING.EQ.2) THEN
4508+
4509+ P(0,1)=E1
4510+ P(1,1)=0D0
4511+ P(2,1)=0D0
4512+ P(3,1)=MOM
4513+
4514+ P(0,2)=E2
4515+ P(1,2)=0D0
4516+ P(2,2)=0D0
4517+ P(3,2)=-MOM
4518+
4519+ CALL RAMBO(NEXTERNAL-2,ENERGY,PMASS(3),PRAMBO,WGT)
4520+ DO I=3, NEXTERNAL
4521+ P(0,I)=PRAMBO(4,I-2)
4522+ P(1,I)=PRAMBO(1,I-2)
4523+ P(2,I)=PRAMBO(2,I-2)
4524+ P(3,I)=PRAMBO(3,I-2)
4525+ ENDDO
4526+
4527+ ELSEIF(NINCOMING.EQ.1) THEN
4528+
4529+ P(0,1)=ENERGY
4530+ P(1,1)=0D0
4531+ P(2,1)=0D0
4532+ P(3,1)=0D0
4533+
4534+ CALL RAMBO(NEXTERNAL-1,ENERGY,PMASS(2),PRAMBO,WGT)
4535+ DO I=2, NEXTERNAL
4536+ P(0,I)=PRAMBO(4,I-1)
4537+ P(1,I)=PRAMBO(1,I-1)
4538+ P(2,I)=PRAMBO(2,I-1)
4539+ P(3,I)=PRAMBO(3,I-1)
4540+ ENDDO
4541+ ENDIF
4542+
4543+ RETURN
4544+ END
4545+
4546+
4547+ SUBROUTINE RAMBO(N,ET,XM,P,WT)
4548+C *****************************************************************
4549+C ******
4550+C * RAMBO
4551+C *
4552+C * RA(NDOM) M(OMENTA) B(EAUTIFULLY) O(RGANIZED)
4553+C *
4554+C *
4555+C *
4556+C * A DEMOCRATIC MULTI-PARTICLE PHASE SPACE GENERATOR
4557+C *
4558+C * AUTHORS: S.D. ELLIS, R. KLEISS, W.J. STIRLING
4559+C *
4560+C * THIS IS VERSION 1.0 - WRITTEN BY R. KLEISS
4561+C *
4562+C * -- ADJUSTED BY HANS KUIJF, WEIGHTS ARE LOGARITHMIC
4563+C (20-08-90) *
4564+C *
4565+C *
4566+C * N = NUMBER OF PARTICLES
4567+C *
4568+C * ET = TOTAL CENTRE-OF-MASS ENERGY
4569+C *
4570+C * XM = PARTICLE MASSES ( DIM=NEXTERNAL-nincoming )
4571+C *
4572+C * P = PARTICLE MOMENTA ( DIM=(4,NEXTERNAL-nincoming) )
4573+C *
4574+C * WT = WEIGHT OF THE EVENT
4575+C *
4576+C *****************************************************************
4577+C ******
4578+ IMPLICIT REAL*8(A-H,O-Z)
4579+C integer nexternal and number particles (incoming+outgoing) in
4580+C the me
4581+ INTEGER NEXTERNAL, NINCOMING
4582+ PARAMETER (NEXTERNAL=3,NINCOMING=2)
4583+ DIMENSION XM(NEXTERNAL-NINCOMING),P(4,NEXTERNAL-NINCOMING)
4584+ DIMENSION Q(4,NEXTERNAL-NINCOMING),Z(NEXTERNAL-NINCOMING),R(4)
4585+ $ , B(3),P2(NEXTERNAL-NINCOMING),XM2(NEXTERNAL-NINCOMING)
4586+ $ , E(NEXTERNAL-NINCOMING),V(NEXTERNAL-NINCOMING),IWARN(5)
4587+ SAVE ACC,ITMAX,IBEGIN,IWARN
4588+ DATA ACC/1.D-14/,ITMAX/6/,IBEGIN/0/,IWARN/5*0/
4589+C *
4590+C * INITIALIZATION STEP: FACTORIALS FOR THE PHASE SPACE WEIGHT
4591+ IF(IBEGIN.NE.0) GOTO 103
4592+ IBEGIN=1
4593+ TWOPI=8.*DATAN(1.D0)
4594+ PO2LOG=LOG(TWOPI/4.)
4595+ Z(2)=PO2LOG
4596+ DO 101 K=3,NEXTERNAL-NINCOMING-1
4597+ 101 Z(K)=Z(K-1)+PO2LOG-2.*LOG(DFLOAT(K-2))
4598+ DO 102 K=3,NEXTERNAL-NINCOMING-1
4599+ 102 Z(K)=(Z(K)-LOG(DFLOAT(K-1)))
4600+C *
4601+C * CHECK ON THE NUMBER OF PARTICLES
4602+ 103 IF(N.GT.1.AND.N.LT.101) GOTO 104
4603+ PRINT 1001,N
4604+ STOP
4605+C *
4606+C * CHECK WHETHER TOTAL ENERGY IS SUFFICIENT; COUNT NONZERO MASSES
4607+ 104 XMT=0.
4608+ NM=0
4609+ DO 105 I=1,N
4610+ IF(XM(I).NE.0.D0) NM=NM+1
4611+ 105 XMT=XMT+ABS(XM(I))
4612+ IF(XMT.LE.ET) GOTO 201
4613+ PRINT 1002,XMT,ET
4614+ STOP
4615+C *
4616+C * THE PARAMETER VALUES ARE NOW ACCEPTED
4617+C *
4618+C * GENERATE N MASSLESS MOMENTA IN INFINITE PHASE SPACE
4619+ 201 DO 202 I=1,N
4620+ R1=RN(1)
4621+ C=2.*R1-1.
4622+ S=SQRT(1.-C*C)
4623+ F=TWOPI*RN(2)
4624+ R1=RN(3)
4625+ R2=RN(4)
4626+ Q(4,I)=-LOG(R1*R2)
4627+ Q(3,I)=Q(4,I)*C
4628+ Q(2,I)=Q(4,I)*S*COS(F)
4629+ 202 Q(1,I)=Q(4,I)*S*SIN(F)
4630+C *
4631+C * CALCULATE THE PARAMETERS OF THE CONFORMAL TRANSFORMATION
4632+ DO 203 I=1,4
4633+ 203 R(I)=0.
4634+ DO 204 I=1,N
4635+ DO 204 K=1,4
4636+ 204 R(K)=R(K)+Q(K,I)
4637+ RMAS=SQRT(R(4)**2-R(3)**2-R(2)**2-R(1)**2)
4638+ DO 205 K=1,3
4639+ 205 B(K)=-R(K)/RMAS
4640+ G=R(4)/RMAS
4641+ A=1./(1.+G)
4642+ X=ET/RMAS
4643+C *
4644+C * TRANSFORM THE Q'S CONFORMALLY INTO THE P'S
4645+ DO 207 I=1,N
4646+ BQ=B(1)*Q(1,I)+B(2)*Q(2,I)+B(3)*Q(3,I)
4647+ DO 206 K=1,3
4648+ 206 P(K,I)=X*(Q(K,I)+B(K)*(Q(4,I)+A*BQ))
4649+ 207 P(4,I)=X*(G*Q(4,I)+BQ)
4650+C *
4651+C * CALCULATE WEIGHT AND POSSIBLE WARNINGS
4652+ WT=PO2LOG
4653+ IF(N.NE.2) WT=(2.*N-4.)*LOG(ET)+Z(N)
4654+ IF(WT.GE.-180.D0) GOTO 208
4655+ IF(IWARN(1).LE.5) PRINT 1004,WT
4656+ IWARN(1)=IWARN(1)+1
4657+ 208 IF(WT.LE. 174.D0) GOTO 209
4658+ IF(IWARN(2).LE.5) PRINT 1005,WT
4659+ IWARN(2)=IWARN(2)+1
4660+C *
4661+C * RETURN FOR WEIGHTED MASSLESS MOMENTA
4662+ 209 IF(NM.NE.0) GOTO 210
4663+C * RETURN LOG OF WEIGHT
4664+ WT=WT
4665+ RETURN
4666+C *
4667+C * MASSIVE PARTICLES: RESCALE THE MOMENTA BY A FACTOR X
4668+ 210 XMAX=SQRT(1.-(XMT/ET)**2)
4669+ DO 301 I=1,N
4670+ XM2(I)=XM(I)**2
4671+ 301 P2(I)=P(4,I)**2
4672+ ITER=0
4673+ X=XMAX
4674+ ACCU=ET*ACC
4675+ 302 F0=-ET
4676+ G0=0.
4677+ X2=X*X
4678+ DO 303 I=1,N
4679+ E(I)=SQRT(XM2(I)+X2*P2(I))
4680+ F0=F0+E(I)
4681+ 303 G0=G0+P2(I)/E(I)
4682+ IF(ABS(F0).LE.ACCU) GOTO 305
4683+ ITER=ITER+1
4684+ IF(ITER.LE.ITMAX) GOTO 304
4685+ PRINT 1006,ITMAX
4686+ GOTO 305
4687+ 304 X=X-F0/(X*G0)
4688+ GOTO 302
4689+ 305 DO 307 I=1,N
4690+ V(I)=X*P(4,I)
4691+ DO 306 K=1,3
4692+ 306 P(K,I)=X*P(K,I)
4693+ 307 P(4,I)=E(I)
4694+C *
4695+C * CALCULATE THE MASS-EFFECT WEIGHT FACTOR
4696+ WT2=1.
4697+ WT3=0.
4698+ DO 308 I=1,N
4699+ WT2=WT2*V(I)/E(I)
4700+ 308 WT3=WT3+V(I)**2/E(I)
4701+ WTM=(2.*N-3.)*LOG(X)+LOG(WT2/WT3*ET)
4702+C *
4703+C * RETURN FOR WEIGHTED MASSIVE MOMENTA
4704+ WT=WT+WTM
4705+ IF(WT.GE.-180.D0) GOTO 309
4706+ IF(IWARN(3).LE.5) PRINT 1004,WT
4707+ IWARN(3)=IWARN(3)+1
4708+ 309 IF(WT.LE. 174.D0) GOTO 310
4709+ IF(IWARN(4).LE.5) PRINT 1005,WT
4710+ IWARN(4)=IWARN(4)+1
4711+C * RETURN LOG OF WEIGHT
4712+ 310 WT=WT
4713+ RETURN
4714+C *
4715+ 1001 FORMAT(' RAMBO FAILS: # OF PARTICLES =',I5,' IS NOT ALLOWED')
4716+ 1002 FORMAT(' RAMBO FAILS: TOTAL MASS =',D15.6,' IS NOT SMALLER THA'
4717+ $ //'N TOTAL ENERGY =',D15.6)
4718+ 1004 FORMAT(' RAMBO WARNS: WEIGHT = EXP(',F20.9,') MAY UNDERFLOW')
4719+ 1005 FORMAT(' RAMBO WARNS: WEIGHT = EXP(',F20.9,') MAY OVERFLOW')
4720+ 1006 FORMAT(' RAMBO WARNS:',I3,' ITERATIONS DID NOT GIVE THE DESIRE'
4721+ $ //'D ACCURACY =',D15.6)
4722+ END
4723+
4724+ FUNCTION RN(IDUMMY)
4725+ REAL*8 RN,RAN
4726+ SAVE INIT
4727+ DATA INIT /1/
4728+ IF (INIT.EQ.1) THEN
4729+ INIT=0
4730+ CALL RMARIN(1802,9373)
4731+ END IF
4732+C *
4733+ 10 CALL RANMAR(RAN)
4734+ IF (RAN.LT.1D-16) GOTO 10
4735+ RN=RAN
4736+C *
4737+ END
4738+
4739+
4740+
4741+ SUBROUTINE RANMAR(RVEC)
4742+C * -----------------
4743+C * Universal random number generator proposed by Marsaglia and
4744+C Zaman
4745+C * in report FSU-SCRI-87-50
4746+C * In this version RVEC is a double precision variable.
4747+ IMPLICIT REAL*8(A-H,O-Z)
4748+ COMMON/ RASET1 / RANU(97),RANC,RANCD,RANCM
4749+ COMMON/ RASET2 / IRANMR,JRANMR
4750+ SAVE /RASET1/,/RASET2/
4751+ UNI = RANU(IRANMR) - RANU(JRANMR)
4752+ IF(UNI .LT. 0D0) UNI = UNI + 1D0
4753+ RANU(IRANMR) = UNI
4754+ IRANMR = IRANMR - 1
4755+ JRANMR = JRANMR - 1
4756+ IF(IRANMR .EQ. 0) IRANMR = 97
4757+ IF(JRANMR .EQ. 0) JRANMR = 97
4758+ RANC = RANC - RANCD
4759+ IF(RANC .LT. 0D0) RANC = RANC + RANCM
4760+ UNI = UNI - RANC
4761+ IF(UNI .LT. 0D0) UNI = UNI + 1D0
4762+ RVEC = UNI
4763+ END
4764+
4765+ SUBROUTINE RMARIN(IJ,KL)
4766+C * -----------------
4767+C * Initializing routine for RANMAR, must be called before
4768+C generating
4769+C * any pseudorandom numbers with RANMAR. The input values
4770+C should be in
4771+C * the ranges 0<=ij<=31328 ; 0<=kl<=30081
4772+ IMPLICIT REAL*8(A-H,O-Z)
4773+ COMMON/ RASET1 / RANU(97),RANC,RANCD,RANCM
4774+ COMMON/ RASET2 / IRANMR,JRANMR
4775+ SAVE /RASET1/,/RASET2/
4776+C * This shows correspondence between the simplified input seeds
4777+C IJ, KL
4778+C * and the original Marsaglia-Zaman seeds I,J,K,L.
4779+C * To get the standard values in the Marsaglia-Zaman paper
4780+C (i=12,j=34
4781+C * k=56,l=78) put ij=1802, kl=9373
4782+ I = MOD( IJ/177 , 177 ) + 2
4783+ J = MOD( IJ , 177 ) + 2
4784+ K = MOD( KL/169 , 178 ) + 1
4785+ L = MOD( KL , 169 )
4786+ DO 300 II = 1 , 97
4787+ S = 0D0
4788+ T = .5D0
4789+ DO 200 JJ = 1 , 24
4790+ M = MOD( MOD(I*J,179)*K , 179 )
4791+ I = J
4792+ J = K
4793+ K = M
4794+ L = MOD( 53*L+1 , 169 )
4795+ IF(MOD(L*M,64) .GE. 32) S = S + T
4796+ T = .5D0*T
4797+ 200 CONTINUE
4798+ RANU(II) = S
4799+ 300 CONTINUE
4800+ RANC = 362436D0 / 16777216D0
4801+ RANCD = 7654321D0 / 16777216D0
4802+ RANCM = 16777213D0 / 16777216D0
4803+ IRANMR = 97
4804+ JRANMR = 33
4805+ END
4806+
4807+
4808+
4809+
4810+
4811+
4812+
4813
4814=== added file 'tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%coef_specs.inc'
4815--- tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%coef_specs.inc 1970-01-01 00:00:00 +0000
4816+++ tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%coef_specs.inc 2016-02-24 13:54:50 +0000
4817@@ -0,0 +1,6 @@
4818+ INTEGER MAXLWFSIZE
4819+ PARAMETER (MAXLWFSIZE=4)
4820+ INTEGER LOOP_MAXCOEFS
4821+ PARAMETER (LOOP_MAXCOEFS=15)
4822+ INTEGER VERTEXMAXCOEFS
4823+ PARAMETER (VERTEXMAXCOEFS=5)
4824
4825=== added file 'tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%improve_ps.f'
4826--- tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%improve_ps.f 1970-01-01 00:00:00 +0000
4827+++ tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%improve_ps.f 2016-02-24 13:54:50 +0000
4828@@ -0,0 +1,981 @@
4829+ SUBROUTINE IMPROVE_PS_POINT_PRECISION(P)
4830+ IMPLICIT NONE
4831+C
4832+C CONSTANTS
4833+C
4834+ INTEGER NEXTERNAL
4835+ PARAMETER (NEXTERNAL=3)
4836+C
4837+C ARGUMENTS
4838+C
4839+ DOUBLE PRECISION P(0:3,NEXTERNAL)
4840+ REAL*16 QP_P(0:3,NEXTERNAL)
4841+C
4842+C LOCAL VARIABLES
4843+C
4844+ INTEGER I,J
4845+
4846+C ----------
4847+C BEGIN CODE
4848+C ----------
4849+
4850+ DO I=1,NEXTERNAL
4851+ DO J=0,3
4852+ QP_P(J,I)=P(J,I)
4853+ ENDDO
4854+ ENDDO
4855+
4856+ CALL MP_IMPROVE_PS_POINT_PRECISION(QP_P)
4857+
4858+ DO I=1,NEXTERNAL
4859+ DO J=0,3
4860+ P(J,I)=QP_P(J,I)
4861+ ENDDO
4862+ ENDDO
4863+
4864+ END
4865+
4866+
4867+ SUBROUTINE MP_IMPROVE_PS_POINT_PRECISION(P)
4868+ IMPLICIT NONE
4869+C
4870+C CONSTANTS
4871+C
4872+ INTEGER NEXTERNAL
4873+ PARAMETER (NEXTERNAL=3)
4874+C
4875+C ARGUMENTS
4876+C
4877+ REAL*16 P(0:3,NEXTERNAL)
4878+C
4879+C LOCAL VARIABLES
4880+C
4881+ INTEGER I,J
4882+ INTEGER ERRCODE,ERRCODETMP
4883+ REAL*16 NEWP(0:3,NEXTERNAL)
4884+C
4885+C FUNCTIONS
4886+C
4887+ LOGICAL MP_IS_PHYSICAL
4888+C
4889+C SAVED VARIABLES
4890+C
4891+ INCLUDE 'MadLoopParams.inc'
4892+C
4893+C SAVED VARIABLES
4894+C
4895+ INTEGER WARNED
4896+ DATA WARNED/0/
4897+
4898+ LOGICAL TOLD_SUPPRESS
4899+ DATA TOLD_SUPPRESS/.FALSE./
4900+C ----------
4901+C BEGIN CODE
4902+C ----------
4903+
4904+C ERROR CODES CONVENTION
4905+C
4906+C 1 :: None physical PS point input
4907+C 100-1000 :: Error in the origianl method for restoring
4908+C precision
4909+C 1000-9999 :: Error when restoring precision ala PSMC
4910+C
4911+ ERRCODETMP=0
4912+ ERRCODE=0
4913+
4914+ DO J=1,NEXTERNAL
4915+ DO I=0,3
4916+ NEWP(I,J)=P(I,J)
4917+ ENDDO
4918+ ENDDO
4919+
4920+C Check the sanity of the original PS point
4921+ IF (.NOT.MP_IS_PHYSICAL(NEWP,WARNED)) THEN
4922+ ERRCODE = 1
4923+ WRITE(*,*) 'ERROR:: The input PS point is not precise enough.'
4924+ GOTO 100
4925+ ENDIF
4926+
4927+C Now restore the precision
4928+ IF (IMPROVEPSPOINT.EQ.1) THEN
4929+ CALL MP_PSMC_IMPROVE_PS_POINT_PRECISION(NEWP,ERRCODE,WARNED)
4930+ ELSEIF((IMPROVEPSPOINT.EQ.2).OR.(IMPROVEPSPOINT.LE.0)) THEN
4931+ CALL MP_ORIG_IMPROVE_PS_POINT_PRECISION(NEWP,ERRCODE,WARNED)
4932+ ENDIF
4933+ IF (ERRCODE.NE.0) THEN
4934+ IF (WARNED.LT.20) THEN
4935+ WRITE(*,*) 'INFO:: Attempting to rescue the precisio'
4936+ $ //'n improvement with an alternative method.'
4937+ WARNED=WARNED+1
4938+ ENDIF
4939+ IF (IMPROVEPSPOINT.EQ.1) THEN
4940+ CALL MP_ORIG_IMPROVE_PS_POINT_PRECISION(NEWP,ERRCODETMP
4941+ $ ,WARNED)
4942+ ELSEIF((IMPROVEPSPOINT.EQ.2).OR.(IMPROVEPSPOINT.LE.0)) THEN
4943+ CALL MP_PSMC_IMPROVE_PS_POINT_PRECISION(NEWP,ERRCODETMP
4944+ $ ,WARNED)
4945+ ENDIF
4946+ IF (ERRCODETMP.NE.0) GOTO 100
4947+ ENDIF
4948+
4949+C Report to the user or update the PS point.
4950+
4951+ GOTO 101
4952+ 100 CONTINUE
4953+ IF (WARNED.LT.20) THEN
4954+ WRITE(*,*) 'WARNING:: This PS point could not be improved'
4955+ $ //'. Error code = ',ERRCODE,ERRCODETMP
4956+ CALL MP_WRITE_MOM(P)
4957+ WARNED = WARNED +1
4958+ ENDIF
4959+ GOTO 102
4960+ 101 CONTINUE
4961+ DO J=1,NEXTERNAL
4962+ DO I=0,3
4963+ P(I,J)=NEWP(I,J)
4964+ ENDDO
4965+ ENDDO
4966+ 102 CONTINUE
4967+
4968+ IF (WARNED.GE.20.AND..NOT.TOLD_SUPPRESS) THEN
4969+ WRITE(*,*) 'INFO:: Further warnings from the improve_p'
4970+ $ //'s routine will now be supressed.'
4971+ TOLD_SUPPRESS=.TRUE.
4972+ ENDIF
4973+
4974+ END
4975+
4976+
4977+ FUNCTION MP_IS_CLOSE(P,NEWP,WARNED)
4978+ IMPLICIT NONE
4979+C
4980+C CONSTANTS
4981+C
4982+ INTEGER NEXTERNAL
4983+ PARAMETER (NEXTERNAL=3)
4984+ REAL*16 ZERO
4985+ PARAMETER (ZERO=0.0E+00_16)
4986+ REAL*16 THRS_CLOSE
4987+ PARAMETER (THRS_CLOSE=1.0E-02_16)
4988+C
4989+C ARGUMENTS
4990+C
4991+ REAL*16 P(0:3,NEXTERNAL), NEWP(0:3,NEXTERNAL)
4992+ LOGICAL MP_IS_CLOSE
4993+ INTEGER WARNED
4994+C
4995+C LOCAL VARIABLES
4996+C
4997+ INTEGER I,J
4998+ REAL*16 REF,REF2
4999+ DOUBLE PRECISION BUFFDP
5000+
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: