Merge lp:~maddevelopers/mg5amcnlo/NLO into lp:mg5amcnlo/lts

Proposed by Valentin Hirschi
Status: Superseded
Proposed branch: lp:~maddevelopers/mg5amcnlo/NLO
Merge into: lp:mg5amcnlo/lts
Diff against target: 189398 lines (+182026/-2345) (has conflicts)
335 files modified
aloha/aloha_writers.py (+45/-32)
aloha/create_aloha.py (+55/-12)
aloha/template_files/aloha_functions_loop.f (+1690/-0)
loop_material/CutTools/README (+449/-0)
loop_material/CutTools/examples/cts_mpc.h (+1/-0)
loop_material/CutTools/examples/cts_mpr.h (+1/-0)
loop_material/CutTools/examples/cts_mprec.h (+1/-0)
loop_material/CutTools/examples/example0.f (+263/-0)
loop_material/CutTools/examples/example1.f (+289/-0)
loop_material/CutTools/examples/makefile (+38/-0)
loop_material/CutTools/examples/mpnumerators.f90 (+86/-0)
loop_material/CutTools/examples/numerators.f (+31/-0)
loop_material/CutTools/examples/rambo.f (+185/-0)
loop_material/CutTools/examples/random.f (+52/-0)
loop_material/CutTools/examples/testmp.f (+288/-0)
loop_material/CutTools/makefile (+61/-0)
loop_material/CutTools/src/avh/avh_olo.f90 (+8454/-0)
loop_material/CutTools/src/avh/avh_olo_mp.f90 (+8678/-0)
loop_material/CutTools/src/cts/cts_combinatorics.f90 (+179/-0)
loop_material/CutTools/src/cts/cts_constants.f90 (+494/-0)
loop_material/CutTools/src/cts/cts_cutroutines.f90 (+552/-0)
loop_material/CutTools/src/cts/cts_cuttools.f90 (+151/-0)
loop_material/CutTools/src/cts/cts_dpc.h (+1/-0)
loop_material/CutTools/src/cts/cts_dpr.h (+1/-0)
loop_material/CutTools/src/cts/cts_dynamics.f90 (+29/-0)
loop_material/CutTools/src/cts/cts_kinematics.f90 (+5918/-0)
loop_material/CutTools/src/cts/cts_loopfunctions.f90 (+672/-0)
loop_material/CutTools/src/cts/cts_mpc.h (+1/-0)
loop_material/CutTools/src/cts/cts_mpc.in (+1/-0)
loop_material/CutTools/src/cts/cts_mpr.h (+1/-0)
loop_material/CutTools/src/cts/cts_mpr.in (+1/-0)
loop_material/CutTools/src/cts/cts_mprec.h (+1/-0)
loop_material/CutTools/src/cts/cts_qpc.in (+1/-0)
loop_material/CutTools/src/cts/cts_qpr.in (+1/-0)
loop_material/CutTools/src/cts/cts_tensors.f90 (+139/-0)
loop_material/CutTools/src/cts/cts_type.f90 (+107/-0)
loop_material/CutTools/src/makefile (+101/-0)
loop_material/CutTools/src/mpfun90/mpfun90.f90 (+8038/-0)
loop_material/CutTools/src/mpfun90/mpmod90.f90 (+7561/-0)
loop_material/CutTools/src/mpfun90/mpmodm90.f90 (+732/-0)
loop_material/CutTools/src/mpfun90/mpmodx90.f90 (+695/-0)
loop_material/CutTools/src/qcdloop/aa.h (+2/-0)
loop_material/CutTools/src/qcdloop/aacbc.f (+220/-0)
loop_material/CutTools/src/qcdloop/aaccc.f (+583/-0)
loop_material/CutTools/src/qcdloop/aacinv.f (+186/-0)
loop_material/CutTools/src/qcdloop/aaxbx.f (+201/-0)
loop_material/CutTools/src/qcdloop/aaxcx.f (+569/-0)
loop_material/CutTools/src/qcdloop/aaxdx.f (+976/-0)
loop_material/CutTools/src/qcdloop/aaxex.f (+710/-0)
loop_material/CutTools/src/qcdloop/aaxinv.f (+273/-0)
loop_material/CutTools/src/qcdloop/auxCD.f (+134/-0)
loop_material/CutTools/src/qcdloop/ddilog.f (+76/-0)
loop_material/CutTools/src/qcdloop/ff.h (+169/-0)
loop_material/CutTools/src/qcdloop/ff2dl2.f (+632/-0)
loop_material/CutTools/src/qcdloop/ffabcd.f (+501/-0)
loop_material/CutTools/src/qcdloop/ffca0.f (+194/-0)
loop_material/CutTools/src/qcdloop/ffcb0.f (+1022/-0)
loop_material/CutTools/src/qcdloop/ffcb1.f (+447/-0)
loop_material/CutTools/src/qcdloop/ffcb2.f (+400/-0)
loop_material/CutTools/src/qcdloop/ffcb2p.f (+526/-0)
loop_material/CutTools/src/qcdloop/ffcc0.f (+1250/-0)
loop_material/CutTools/src/qcdloop/ffcc0p.f (+638/-0)
loop_material/CutTools/src/qcdloop/ffcc1.f (+218/-0)
loop_material/CutTools/src/qcdloop/ffcd0.f (+796/-0)
loop_material/CutTools/src/qcdloop/ffcdb0.f (+880/-0)
loop_material/CutTools/src/qcdloop/ffcdbd.f (+474/-0)
loop_material/CutTools/src/qcdloop/ffcel2.f (+782/-0)
loop_material/CutTools/src/qcdloop/ffcel3.f (+402/-0)
loop_material/CutTools/src/qcdloop/ffcel4.f (+419/-0)
loop_material/CutTools/src/qcdloop/ffcel5.f (+575/-0)
loop_material/CutTools/src/qcdloop/ffceta.f (+463/-0)
loop_material/CutTools/src/qcdloop/ffcli2.f (+720/-0)
loop_material/CutTools/src/qcdloop/ffcrr.f (+844/-0)
loop_material/CutTools/src/qcdloop/ffcxr.f (+634/-0)
loop_material/CutTools/src/qcdloop/ffcxs3.f (+779/-0)
loop_material/CutTools/src/qcdloop/ffcxs4.f (+1021/-0)
loop_material/CutTools/src/qcdloop/ffcxyz.f (+375/-0)
loop_material/CutTools/src/qcdloop/ffdcc0.f (+443/-0)
loop_material/CutTools/src/qcdloop/ffdcxs.f (+931/-0)
loop_material/CutTools/src/qcdloop/ffdel2.f (+801/-0)
loop_material/CutTools/src/qcdloop/ffdel3.f (+374/-0)
loop_material/CutTools/src/qcdloop/ffdel4.f (+424/-0)
loop_material/CutTools/src/qcdloop/ffdel5.f (+661/-0)
loop_material/CutTools/src/qcdloop/ffdel6.f (+787/-0)
loop_material/CutTools/src/qcdloop/ffdl2i.f (+342/-0)
loop_material/CutTools/src/qcdloop/ffdl5p.f (+444/-0)
loop_material/CutTools/src/qcdloop/ffdxc0.f (+1029/-0)
loop_material/CutTools/src/qcdloop/ffini.f (+16/-0)
loop_material/CutTools/src/qcdloop/ffinit.f (+1276/-0)
loop_material/CutTools/src/qcdloop/ffinit_mine.f (+1316/-0)
loop_material/CutTools/src/qcdloop/ffrcvr.f (+29/-0)
loop_material/CutTools/src/qcdloop/ffs.h (+39/-0)
loop_material/CutTools/src/qcdloop/fftest.f (+622/-0)
loop_material/CutTools/src/qcdloop/fftran.f (+944/-0)
loop_material/CutTools/src/qcdloop/ffwarn.dat (+294/-0)
loop_material/CutTools/src/qcdloop/ffxb0.f (+1171/-0)
loop_material/CutTools/src/qcdloop/ffxb1.f (+372/-0)
loop_material/CutTools/src/qcdloop/ffxb2p.f (+487/-0)
loop_material/CutTools/src/qcdloop/ffxc0.f (+994/-0)
loop_material/CutTools/src/qcdloop/ffxc0i.f (+956/-0)
loop_material/CutTools/src/qcdloop/ffxc0p.f (+641/-0)
loop_material/CutTools/src/qcdloop/ffxc1.f (+256/-0)
loop_material/CutTools/src/qcdloop/ffxd0.f (+1005/-0)
loop_material/CutTools/src/qcdloop/ffxd0h.f (+897/-0)
loop_material/CutTools/src/qcdloop/ffxd0i.f (+187/-0)
loop_material/CutTools/src/qcdloop/ffxd0p.f (+814/-0)
loop_material/CutTools/src/qcdloop/ffxd1.f (+352/-0)
loop_material/CutTools/src/qcdloop/ffxdb0.f (+827/-0)
loop_material/CutTools/src/qcdloop/ffxdbd.f (+1047/-0)
loop_material/CutTools/src/qcdloop/ffxdi.f (+938/-0)
loop_material/CutTools/src/qcdloop/ffxdpv.f (+261/-0)
loop_material/CutTools/src/qcdloop/ffxe0.f (+1236/-0)
loop_material/CutTools/src/qcdloop/ffxe1.f (+452/-0)
loop_material/CutTools/src/qcdloop/ffxf0.f (+508/-0)
loop_material/CutTools/src/qcdloop/ffxf0h.f (+1071/-0)
loop_material/CutTools/src/qcdloop/ffxli2.f (+640/-0)
loop_material/CutTools/src/qcdloop/ffxxyz.f (+856/-0)
loop_material/CutTools/src/qcdloop/npoin.f (+208/-0)
loop_material/CutTools/src/qcdloop/npointes.f (+68/-0)
loop_material/CutTools/src/qcdloop/qlI1.f (+41/-0)
loop_material/CutTools/src/qcdloop/qlI2.f (+54/-0)
loop_material/CutTools/src/qcdloop/qlI2fin.f (+67/-0)
loop_material/CutTools/src/qcdloop/qlI3.f (+71/-0)
loop_material/CutTools/src/qcdloop/qlI3fin.f (+8/-0)
loop_material/CutTools/src/qcdloop/qlI3sub.f (+77/-0)
loop_material/CutTools/src/qcdloop/qlI4.f (+44/-0)
loop_material/CutTools/src/qcdloop/qlI4DNS41.f (+70/-0)
loop_material/CutTools/src/qcdloop/qlI4array.f (+60/-0)
loop_material/CutTools/src/qcdloop/qlI4fin.f (+8/-0)
loop_material/CutTools/src/qcdloop/qlI4sub0m.f (+110/-0)
loop_material/CutTools/src/qcdloop/qlI4sub1m.f (+101/-0)
loop_material/CutTools/src/qcdloop/qlI4sub2m.f (+64/-0)
loop_material/CutTools/src/qcdloop/qlI4sub2ma.f (+50/-0)
loop_material/CutTools/src/qcdloop/qlI4sub2mo.f (+58/-0)
loop_material/CutTools/src/qcdloop/qlI4sub3m.f (+60/-0)
loop_material/CutTools/src/qcdloop/qlLi2omprod.f (+53/-0)
loop_material/CutTools/src/qcdloop/qlLi2omrat.f (+18/-0)
loop_material/CutTools/src/qcdloop/qlLi2omx.f (+28/-0)
loop_material/CutTools/src/qcdloop/qlLi2omx2.f (+27/-0)
loop_material/CutTools/src/qcdloop/qlYcalc.f (+99/-0)
loop_material/CutTools/src/qcdloop/qlbox1.f (+42/-0)
loop_material/CutTools/src/qcdloop/qlbox10.f (+73/-0)
loop_material/CutTools/src/qcdloop/qlbox11.f (+89/-0)
loop_material/CutTools/src/qcdloop/qlbox12.f (+99/-0)
loop_material/CutTools/src/qcdloop/qlbox13.f (+140/-0)
loop_material/CutTools/src/qcdloop/qlbox14.f (+60/-0)
loop_material/CutTools/src/qcdloop/qlbox15.f (+118/-0)
loop_material/CutTools/src/qcdloop/qlbox16.f (+105/-0)
loop_material/CutTools/src/qcdloop/qlbox2.f (+42/-0)
loop_material/CutTools/src/qcdloop/qlbox3.f (+65/-0)
loop_material/CutTools/src/qcdloop/qlbox4.f (+52/-0)
loop_material/CutTools/src/qcdloop/qlbox5.f (+78/-0)
loop_material/CutTools/src/qcdloop/qlbox6.f (+39/-0)
loop_material/CutTools/src/qcdloop/qlbox7.f (+43/-0)
loop_material/CutTools/src/qcdloop/qlbox8.f (+56/-0)
loop_material/CutTools/src/qcdloop/qlbox9.f (+47/-0)
loop_material/CutTools/src/qcdloop/qlcLi2omx2.f (+28/-0)
loop_material/CutTools/src/qcdloop/qlcLi2omx3.f (+33/-0)
loop_material/CutTools/src/qcdloop/qlconstants.f (+16/-0)
loop_material/CutTools/src/qcdloop/qlfndd.f (+37/-0)
loop_material/CutTools/src/qcdloop/qlfunctions.f (+90/-0)
loop_material/CutTools/src/qcdloop/qlinit.f (+15/-0)
loop_material/CutTools/src/qcdloop/qlkfn.f (+51/-0)
loop_material/CutTools/src/qcdloop/qllnomrat4.f (+22/-0)
loop_material/CutTools/src/qcdloop/qllnrat.f (+18/-0)
loop_material/CutTools/src/qcdloop/qlonshellcutoff.f (+2/-0)
loop_material/CutTools/src/qcdloop/qlratgam.f (+22/-0)
loop_material/CutTools/src/qcdloop/qlratreal.f (+30/-0)
loop_material/CutTools/src/qcdloop/qlsnglsort.f (+15/-0)
loop_material/CutTools/src/qcdloop/qlspencer.f (+36/-0)
loop_material/CutTools/src/qcdloop/qltri1.f (+10/-0)
loop_material/CutTools/src/qcdloop/qltri2.f (+20/-0)
loop_material/CutTools/src/qcdloop/qltri3.f (+33/-0)
loop_material/CutTools/src/qcdloop/qltri4.f (+24/-0)
loop_material/CutTools/src/qcdloop/qltri5.f (+12/-0)
loop_material/CutTools/src/qcdloop/qltri6.f (+47/-0)
loop_material/CutTools/src/qcdloop/qltrisort.f (+42/-0)
loop_material/CutTools/src/qcdloop/qlxpicheck.f (+21/-0)
loop_material/CutTools/src/qcdloop/qlzero.f (+23/-0)
loop_material/CutTools/src/qcdloop/spence.f (+48/-0)
loop_material/StandAlone/Source/makefile (+74/-0)
loop_material/StandAlone/SubProcesses/check_sa.f (+514/-0)
loop_material/StandAlone/SubProcesses/makefile (+12/-0)
madgraph/core/base_objects.py (+370/-26)
madgraph/core/color_algebra.py (+1/-1)
madgraph/core/color_amp.py (+5/-2)
madgraph/core/color_ordered_amplitudes.py (+1226/-0)
madgraph/core/diagram_generation.py (+123/-38)
madgraph/core/drawing.py (+511/-119)
madgraph/core/helas_objects.py (+304/-71)
madgraph/interface/launch_ext_program.py (+0/-1)
madgraph/interface/madgraph_interface.py (+123/-39)
madgraph/iolibs/drawing_eps.py (+46/-22)
madgraph/iolibs/export_v4.py (+135/-52)
madgraph/iolibs/helas_call_writers.py (+357/-81)
madgraph/iolibs/template_files/loop/CT_interface.inc (+135/-0)
madgraph/iolibs/template_files/loop/born_color_split.inc (+7/-0)
madgraph/iolibs/template_files/loop/helas_calls_split.inc (+42/-0)
madgraph/iolibs/template_files/loop/helas_loop_amplitude.inc (+61/-0)
madgraph/iolibs/template_files/loop/helas_loop_amplitude_pairing.inc (+67/-0)
madgraph/iolibs/template_files/loop/jamp_calls_split.inc (+41/-0)
madgraph/iolibs/template_files/loop/loop_color_split.inc (+7/-0)
madgraph/iolibs/template_files/loop/loop_matrix_standalone.inc (+180/-0)
madgraph/iolibs/template_files/loop/loop_matrix_standalone_split.inc (+181/-0)
madgraph/iolibs/template_files/loop/loop_matrix_standalone_split_helasCallsOnly.inc (+202/-0)
madgraph/iolibs/template_files/loop/loop_num.inc (+68/-0)
madgraph/loop/loop_base_objects.py (+1170/-0)
madgraph/loop/loop_color_amp.py (+137/-0)
madgraph/loop/loop_diagram_generation.py (+858/-0)
madgraph/loop/loop_drawing.py (+44/-0)
madgraph/loop/loop_exporters.py (+692/-0)
madgraph/loop/loop_helas_objects.py (+1753/-0)
madgraph/various/process_checks.py (+362/-85)
models/OLD_loopModels_backup/loop_ToyModel/__init__.py (+23/-0)
models/OLD_loopModels_backup/loop_ToyModel/coupling_orders.py (+10/-0)
models/OLD_loopModels_backup/loop_ToyModel/couplings.py (+103/-0)
models/OLD_loopModels_backup/loop_ToyModel/couplings_smart4GR2.py (+95/-0)
models/OLD_loopModels_backup/loop_ToyModel/ct_vertices.py (+182/-0)
models/OLD_loopModels_backup/loop_ToyModel/ct_vertices_smart4GR2.py (+174/-0)
models/OLD_loopModels_backup/loop_ToyModel/function_library.py (+54/-0)
models/OLD_loopModels_backup/loop_ToyModel/lorentz.py (+60/-0)
models/OLD_loopModels_backup/loop_ToyModel/object_library.py (+243/-0)
models/OLD_loopModels_backup/loop_ToyModel/parameters.py (+112/-0)
models/OLD_loopModels_backup/loop_ToyModel/particles.py (+54/-0)
models/OLD_loopModels_backup/loop_ToyModel/restrict_default.dat (+16/-0)
models/OLD_loopModels_backup/loop_ToyModel/vertices.py (+41/-0)
models/OLD_loopModels_backup/loop_ToyModel/write_param_card.py (+181/-0)
models/OLD_loopModels_backup/loop_ToyModel_4GR2_Traces/__init__.py (+23/-0)
models/OLD_loopModels_backup/loop_ToyModel_4GR2_Traces/coupling_orders.py (+10/-0)
models/OLD_loopModels_backup/loop_ToyModel_4GR2_Traces/couplings.py (+91/-0)
models/OLD_loopModels_backup/loop_ToyModel_4GR2_Traces/ct_vertices.py (+185/-0)
models/OLD_loopModels_backup/loop_ToyModel_4GR2_Traces/ct_vertices_brute_Traces.py (+185/-0)
models/OLD_loopModels_backup/loop_ToyModel_4GR2_Traces/ct_vertices_smartTraces.py (+185/-0)
models/OLD_loopModels_backup/loop_ToyModel_4GR2_Traces/ct_vertices_smart_Traces.py (+172/-0)
models/OLD_loopModels_backup/loop_ToyModel_4GR2_Traces/function_library.py (+54/-0)
models/OLD_loopModels_backup/loop_ToyModel_4GR2_Traces/lorentz.py (+60/-0)
models/OLD_loopModels_backup/loop_ToyModel_4GR2_Traces/object_library.py (+243/-0)
models/OLD_loopModels_backup/loop_ToyModel_4GR2_Traces/parameters.py (+77/-0)
models/OLD_loopModels_backup/loop_ToyModel_4GR2_Traces/particles.py (+54/-0)
models/OLD_loopModels_backup/loop_ToyModel_4GR2_Traces/restrict_default.dat (+16/-0)
models/OLD_loopModels_backup/loop_ToyModel_4GR2_Traces/vertices.py (+41/-0)
models/OLD_loopModels_backup/loop_ToyModel_4GR2_Traces/write_param_card.py (+181/-0)
models/OLD_loopModels_backup/smQCDNLO/__init__.py (+23/-0)
models/OLD_loopModels_backup/smQCDNLO/coupling_orders.py (+10/-0)
models/OLD_loopModels_backup/smQCDNLO/couplings.py (+103/-0)
models/OLD_loopModels_backup/smQCDNLO/ct_vertices.py (+182/-0)
models/OLD_loopModels_backup/smQCDNLO/function_library.py (+54/-0)
models/OLD_loopModels_backup/smQCDNLO/lorentz.py (+64/-0)
models/OLD_loopModels_backup/smQCDNLO/object_library.py (+243/-0)
models/OLD_loopModels_backup/smQCDNLO/parameters.py (+109/-0)
models/OLD_loopModels_backup/smQCDNLO/particles.py (+71/-0)
models/OLD_loopModels_backup/smQCDNLO/restrict_default.dat (+16/-0)
models/OLD_loopModels_backup/smQCDNLO/vertices.py (+49/-0)
models/OLD_loopModels_backup/smQCDNLO/write_param_card.py (+181/-0)
models/OLD_loopModels_backup/smQCDNLOmass/CT_couplings.py (+157/-0)
models/OLD_loopModels_backup/smQCDNLOmass/CT_parameters.py (+85/-0)
models/OLD_loopModels_backup/smQCDNLOmass/CT_vertices.py (+256/-0)
models/OLD_loopModels_backup/smQCDNLOmass/__init__.py (+24/-0)
models/OLD_loopModels_backup/smQCDNLOmass/coupling_orders.py (+11/-0)
models/OLD_loopModels_backup/smQCDNLOmass/couplings.py (+22/-0)
models/OLD_loopModels_backup/smQCDNLOmass/function_library.py (+54/-0)
models/OLD_loopModels_backup/smQCDNLOmass/lorentz.py (+72/-0)
models/OLD_loopModels_backup/smQCDNLOmass/object_library.py (+289/-0)
models/OLD_loopModels_backup/smQCDNLOmass/parameters.py (+86/-0)
models/OLD_loopModels_backup/smQCDNLOmass/particles.py (+140/-0)
models/OLD_loopModels_backup/smQCDNLOmass/restrict_default.dat (+16/-0)
models/OLD_loopModels_backup/smQCDNLOmass/vertices.py (+49/-0)
models/OLD_loopModels_backup/smQCDNLOmass/write_param_card.py (+181/-0)
models/import_ufo.py (+276/-48)
models/loop_SM_QCD/CT_couplings.py (+158/-0)
models/loop_SM_QCD/CT_parameters.py (+84/-0)
models/loop_SM_QCD/CT_vertices.py (+274/-0)
models/loop_SM_QCD/__init__.py (+25/-0)
models/loop_SM_QCD/coupling_orders.py (+11/-0)
models/loop_SM_QCD/couplings.py (+22/-0)
models/loop_SM_QCD/function_library.py (+54/-0)
models/loop_SM_QCD/lorentz.py (+72/-0)
models/loop_SM_QCD/object_library.py (+333/-0)
models/loop_SM_QCD/parameters.py (+86/-0)
models/loop_SM_QCD/particles.py (+158/-0)
models/loop_SM_QCD/restrict_default.dat (+22/-0)
models/loop_SM_QCD/vertices.py (+73/-0)
models/loop_SM_QCD/write_param_card.py (+181/-0)
models/loop_sm/CT_couplings.py (+444/-0)
models/loop_sm/CT_parameters.py (+119/-0)
models/loop_sm/CT_vertices.py (+662/-0)
models/loop_sm/__init__.py (+25/-0)
models/loop_sm/coupling_orders.py (+16/-0)
models/loop_sm/couplings.py (+198/-0)
models/loop_sm/function_library.py (+54/-0)
models/loop_sm/lorentz.py (+139/-0)
models/loop_sm/object_library.py (+333/-0)
models/loop_sm/parameters.py (+490/-0)
models/loop_sm/particles.py (+310/-0)
models/loop_sm/restrict_ckm.dat (+59/-0)
models/loop_sm/restrict_default.dat (+59/-0)
models/loop_sm/vertices.py (+445/-0)
models/loop_sm/write_param_card.py (+181/-0)
models/model_reader.py (+2/-1)
models/sm/couplings.py (+0/-2)
tests/.mg5_logging.conf (+1/-1)
tests/acceptance_tests/test_cmd.py (+4/-4)
tests/input_files/LoopSMTest/CT_couplings.py (+444/-0)
tests/input_files/LoopSMTest/CT_parameters.py (+119/-0)
tests/input_files/LoopSMTest/CT_vertices.py (+652/-0)
tests/input_files/LoopSMTest/__init__.py (+25/-0)
tests/input_files/LoopSMTest/coupling_orders.py (+16/-0)
tests/input_files/LoopSMTest/couplings.py (+198/-0)
tests/input_files/LoopSMTest/function_library.py (+54/-0)
tests/input_files/LoopSMTest/lorentz.py (+139/-0)
tests/input_files/LoopSMTest/object_library.py (+333/-0)
tests/input_files/LoopSMTest/parameters.py (+490/-0)
tests/input_files/LoopSMTest/particles.py (+310/-0)
tests/input_files/LoopSMTest/restrict_ckm.dat (+59/-0)
tests/input_files/LoopSMTest/restrict_default.dat (+59/-0)
tests/input_files/LoopSMTest/vertices.py (+445/-0)
tests/input_files/LoopSMTest/write_param_card.py (+181/-0)
tests/input_files/test_8fs.pkl (+1701/-1578)
tests/input_files/test_draw_nlo.obj (+51398/-0)
tests/input_files/test_toyLoopModel.pkl (+2158/-0)
tests/parallel_tests/loop_me_comparator.py (+1319/-0)
tests/parallel_tests/loop_sample_script.py (+126/-0)
tests/parallel_tests/me_comparator.py (+2/-1)
tests/unit_tests/core/test_base_objects.py (+33/-11)
tests/unit_tests/core/test_color_ordered_amplitudes.tmp (+1654/-0)
tests/unit_tests/core/test_drawing.py (+94/-92)
tests/unit_tests/core/test_helas_objects.py (+161/-3)
tests/unit_tests/iolibs/test_export_v4.py (+19/-19)
tests/unit_tests/loop/test_import_LoopUFOModel.py (+176/-0)
tests/unit_tests/loop/test_loop_diagram_generation.py (+1505/-0)
tests/unit_tests/loop/test_loop_drawing.py (+1028/-0)
tests/unit_tests/loop/test_loop_exporters.py (+478/-0)
tests/unit_tests/loop/test_loop_helas_objects.py (+835/-0)
tests/unit_tests/various/test_aloha.py (+3/-3)
tests/unit_tests/various/test_write_param.py (+0/-1)
Text conflict in aloha/create_aloha.py
Text conflict in models/import_ufo.py
To merge this branch: bzr merge lp:~maddevelopers/mg5amcnlo/NLO
Reviewer Review Type Date Requested Status
Stefano Frixione Pending
Rikkert Frederix Pending
Tim Stelzer Pending
FabioMaltoni Pending
marco zaro Pending
Olivier Mattelaer Pending
Johan Alwall structural Pending
Review via email: mp+86290@code.launchpad.net

This proposal has been superseded by a proposal from 2012-03-06.

Description of the change

=============================
|| MadLoop 5 version -1.0 ||
=============================

Major upgrade and modifications with respect to the existing trunk.
This branch basically represents MadLoop5 in its current stage of development and it will take part of the 2.0 release of MadGraph 5 along with MadFKS5 which will ultimately allow to have aMC@NLO incorporated in MadGraph 5 2.0.

This version of MadLoop 5 is ***stable*** and implements:

I) Generation and computation of virtual amplitudes for any process in the full QCD sector of the SM.
  > The model file to be imported for this is 'loop_SM_QCD-full'. (default restriction is not working for loop models yet.)
  > The syntax for process generation is now initial_state > final_state 'born_orders' [pert_orders] 'squared_orders' 'process_options' (Notice that the 'add' functionality still work at NLO)
  > There is only one output mode which is fortran standalone, that you can access as usual with the command 'output standalone'
  > Here is an example of test you could perform with this version:
      a) Compile CutTools once and for all by doing:
          'cd loop_material/CutTools/ && make && cd ../..'
      b) Then run the MG5 shell:
          './bin/mg5'
      c) Run some process, like:
          'import model loop_SM_QCD-full'
          'generate g g > t t~ [QCD]'
          'output standalone Trial'
      d) Then compile the test program 'check_sa.f' in your generated process:
          'cd Trial/SubProcesses/P0_gg_ttx/'
          'make'
          './check'
         You should see some trial PS points being evaluated.
  > Some comments are in order:
      a) The interface needs a lot of polishing and acceptance tests must be written.
      b) Decay chains are supported at NLO in principle (so the structure is thought to be compliant with it), but never tested yet.
      c) Multiple particle labels cannot be used for NLO. (MadFKS will take care of that)
      d) Most massive QCD processes have been crosschecked against MadLoop4, NGLuon and soon GoSam. But the proper systematic parallel tests are still missing.
      e) Mixed order perturbation and loop-induced processes (i.e. no born) are supported for generation only right now, and not for output yet.
      f) Fermion-flows are in principle dealt with, but never tested in practice (never tried majorana yet)
      g) Once CutTools is compiled, all tests should be passing except those related to the loop drawing.

II) What is missing?
  > Loop drawings are there in principle but bugged. Olivier will take care of that as soon as he has some time.
  > Interface upgrade with all NLO process features and the corresponding acceptance tests.
  > The parallel tests for the process I have crosschecked already, like gg>ng, n=2,3,4 and q q~ > q q~, g g > q q~, g g > t t~, etc...
  > The UFO model for the full SM (but notice that it could in principle already be handled by this version, if existing)
  > [...]

===================
|| FINAL COMMENT ||
===================

This is not at all a good-looking finished and polished product but rather a raw sketch of a first version of MadLoop 5 which is stable and complete enough to be brought to light.
I could have waited more for the above mentioned missing items to be implemented but I thought that since the portion of new code in MadLoop5 with respect to the MG5 trunk is already quite big, it is crucial that you guys give me some feedback and remarks on the actual implementation.
This will ease the merging of MadFKS5 and the future upgrade of the existing MG5 trunk.

To post a comment you must log in.
lp:~maddevelopers/mg5amcnlo/NLO updated
213. By Valentin Hirschi <email address hidden>

1. Fixed a bug in the loop model restriction so that it now correctly handles the coupling present in the particle counterterms.
2. Implemented parallel tests for loop processes. (Try it in NLO/tests/parallel_tests/loop_sample_script.py)

214. By Olivier Mattelaer

merge with 1.4 version

215. By Olivier Mattelaer

correct some of the unit_test failure

216. By Olivier Mattelaer

fix a couple of unit tests

217. By mattelaer-olivier

try to merge

218. By mattelaer-olivier

acceptance tests working

219. By mattelaer-olivier

only 3 tests didn't pass

220. By Olivier Mattelaer

merge with NLO branch

221. By Valentin Hirschi <email address hidden>

1. Upgraded to CutTools v1.6.9

222. By Valentin Hirschi <email address hidden>

1. Added two tests for the odd behavior of ALOHA with its new 'tag' setup.

223. By Valentin Hirschi <email address hidden>

1. Fixed an error in a modification of the loop_exporters test in last revision.

224. By Valentin Hirschi <email address hidden>

1. Fixed aloha problem and clean up for checks.

225. By Valentin Hirschi <email address hidden>

1. Merged with Olivier's fix for the aloha problem.

226. By Valentin Hirschi <email address hidden>

1. Corrected loop_sample_script.py

227. By Valentin Hirschi <email address hidden>

1. Merged with the new interface setup of MG5 2.0

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'aloha/aloha_writers.py'
2--- aloha/aloha_writers.py 2012-01-31 16:28:22 +0000
3+++ aloha/aloha_writers.py 2012-02-27 13:42:21 +0000
4@@ -2,7 +2,8 @@
5 import madgraph.iolibs.file_writers as writers
6 except:
7 import aloha.file_writers as writers
8-
9+
10+
11 import os
12 import re
13 from numbers import Number
14@@ -10,6 +11,7 @@
15 class WriteALOHA:
16 """ Generic writing functions """
17
18+ LOOP_MODE = False
19 power_symbol = '**'
20 change_var_format = str
21 change_number_format = str
22@@ -17,6 +19,7 @@
23 type_to_variable = {2:'F',3:'V',5:'T',1:'S'}
24 type_to_size = {'S':3, 'T':18, 'V':6, 'F':6}
25
26+
27 def __init__(self, abstract_routine, dirpath):
28
29
30@@ -37,6 +40,7 @@
31 self.offshell = abstract_routine.outgoing
32 self.symmetries = abstract_routine.symmetries
33 self.tag = abstract_routine.tag
34+ self.loop_routine = 'L' in self.tag
35
36 #prepare the necessary object
37 self.collect_variables() # Look for the different variables
38@@ -310,7 +314,10 @@
39 if len(OverM) > 0:
40 str_out += 'double complex ' + ','.join(OverM) + '\n'
41 if len(Momenta) > 0:
42- str_out += 'double precision ' + '(0:3),'.join(Momenta) + '(0:3)\n'
43+ if self.loop_routine:
44+ str_out += 'double complex ' + '(0:3),'.join(Momenta) + '(0:3)\n'
45+ else:
46+ str_out += 'double precision ' + '(0:3),'.join(Momenta) + '(0:3)\n'
47
48 # Add entry for symmetry
49 #str_out += '\n'
50@@ -344,9 +351,13 @@
51 offshelltype = self.particles[self.offshell -1]
52 offshell_size = self.type_to_size[offshelltype]
53 #Implement the conservation of Energy Impulsion
54- for i in range(-1,1):
55+ if self.LOOP_MODE:
56+ max = 3 # each component is one momentum (since it's complex)
57+ else:
58+ max = 1 # one componenet correspond to 2 component
59+ for i in range(-1, max):
60 str_out += '%s%d(%d)= ' % (offshelltype, self.offshell, \
61- offshell_size + i)
62+ offshell_size + i)
63
64 pat=re.compile(r'^[-+]?(?P<spin>\w)')
65 for elem in momentum_conservation:
66@@ -363,19 +374,25 @@
67 sign = ''
68 if self.offshell == index and type in ['V','S']:
69 sign = '-'
70-
71- str_out += '%s(0) = %s dble(%s%d(%d))\n' % (mom, sign, type, index, energy_pos)
72- str_out += '%s(1) = %s dble(%s%d(%d))\n' % (mom, sign, type, index, energy_pos + 1)
73- str_out += '%s(2) = %s dimag(%s%d(%d))\n' % (mom, sign, type, index, energy_pos + 1)
74- str_out += '%s(3) = %s dimag(%s%d(%d))\n' % (mom, sign, type, index, energy_pos)
75+
76+ if self.LOOP_MODE:
77+ str_out += '%s(0) = %s %s%d(%d)\n' % (mom, sign, type, index, energy_pos)
78+ str_out += '%s(1) = %s %s%d(%d)\n' % (mom, sign, type, index, energy_pos + 1)
79+ str_out += '%s(2) = %s %s%d(%d)\n' % (mom, sign, type, index, energy_pos + 2)
80+ str_out += '%s(3) = %s %s%d(%d)\n' % (mom, sign, type, index, energy_pos + 3)
81+ else:
82+ str_out += '%s(0) = %s dble(%s%d(%d))\n' % (mom, sign, type, index, energy_pos)
83+ str_out += '%s(1) = %s dble(%s%d(%d))\n' % (mom, sign, type, index, energy_pos + 1)
84+ str_out += '%s(2) = %s dimag(%s%d(%d))\n' % (mom, sign, type, index, energy_pos + 1)
85+ str_out += '%s(3) = %s dimag(%s%d(%d))\n' % (mom, sign, type, index, energy_pos)
86
87
88- # Definition for the One Over Mass**2 terms
89- for elem in overm:
90- #Mom is in format OMX with X the number of the particle
91- index = int(elem[2:])
92- str_out += 'OM%d = 0d0\n' % (index)
93- str_out += 'if (M%d .ne. 0d0) OM%d' % (index, index) + '=1d0/M%d**2\n' % (index)
94+ # Definition for the One Over Mass**2 terms
95+ for elem in overm:
96+ #Mom is in format OMX with X the number of the particle
97+ index = int(elem[2:])
98+ str_out += 'OM%d = 0d0\n' % (index)
99+ str_out += 'if (M%d .ne. 0d0) OM%d' % (index, index) + '=1d0/M%d**2\n' % (index)
100
101 # Returning result
102 return str_out
103@@ -429,10 +446,13 @@
104 denominator = self.obj.denominator
105 for ind in denominator.listindices():
106 denom = self.write_obj(denominator.get_rep(ind))
107- string = 'denom =' + '1d0/(' + denom + ')'
108- string = string.replace('+-', '-')
109- string = re.sub('\((?P<num>[+-]*[0-9])\+(?P<num2>[+-][0-9])[Jj]\)\.', '(\g<num>d0,\g<num2>d0)', string)
110- string = re.sub('(?P<num>[0-9])[Jj]\.', '\g<num>*(0d0,1d0)', string)
111+ if self.loop_routine:
112+ string = 'denom = 1d0'
113+ else:
114+ string = 'denom =' + '1d0/(' + denom + ')'
115+ string = string.replace('+-', '-')
116+ string = re.sub('\((?P<num>[+-]*[0-9])\+(?P<num2>[+-][0-9])[Jj]\)\.', '(\g<num>d0,\g<num2>d0)', string)
117+ string = re.sub('(?P<num>[0-9])[Jj]\.', '\g<num>*(0d0,1d0)', string)
118 OutString = OutString + string + '\n'
119 for ind in numerator.listindices():
120 string = '%s(%d)= COUP*denom*' % (OffShellParticle, self.pass_to_HELAS(ind, start=1))
121@@ -509,23 +529,15 @@
122 if not offshell:
123 text += ' double complex TMP\n'
124 else:
125- spin = self.particles[offshell -1]
126- text += ' double complex TMP(%s)\n integer i' % self.type_to_size[spin]
127+ spin = self.particles[offshell -1]
128+ if self.LOOP_MODE:
129+ text += ' double complex TMP(%s)\n integer i' % (self.type_to_size[spin]+2)
130+ else:
131+ text += ' double complex TMP(%s)\n integer i' % self.type_to_size[spin]
132
133 # Define which part of the routine should be called
134 addon = ''.join(self.tag) + '_%s' % self.offshell
135
136-# if 'C' in self.namestring:
137-# short_name, addon = name.split('C',1)
138-# if addon.split('_')[0].isdigit():
139-# addon = 'C' +self.namestring.split('C',1)[1]
140-# elif all([n.isdigit() for n in addon.split('_')[0].split('C')]):
141-# addon = 'C' +self.namestring.split('C',1)[1]
142-# else:
143-# addon = '_%s' % self.offshell
144-# else:
145-# addon = '_%s' % self.offshell
146-
147 # how to call the routine
148 if not offshell:
149 main = 'vertex'
150@@ -598,6 +610,7 @@
151
152 def combine_name(name, other_names, outgoing, tag=None):
153 """ build the name for combined aloha function """
154+
155
156
157 # Two possible scheme FFV1C1_2_X or FFV1__FFV2C1_X
158
159=== modified file 'aloha/create_aloha.py'
160--- aloha/create_aloha.py 2012-02-01 20:26:10 +0000
161+++ aloha/create_aloha.py 2012-02-27 13:42:21 +0000
162@@ -40,6 +40,7 @@
163
164 _conjugate_gap = 50
165 _spin2_mult = 1000
166+LOOP_MODE = False
167
168 class ALOHAERROR(Exception): pass
169
170@@ -57,8 +58,8 @@
171 self.infostr = infostr
172 self.symmetries = []
173 self.combined = []
174+ #self.loop = False # Check if we need the denominator
175 self.tag = []
176-
177
178 def add_symmetry(self, outgoing):
179 """ add an outgoing """
180@@ -436,9 +437,13 @@
181 (lorentzname, outgoing) )
182 return None
183
184- def set(self, lorentzname, outgoing, abstract_routine):
185+ def set(self, lorentzname, outgoing, abstract_routine, loop=False):
186 """ add in the dictionary """
187
188+ if loop and not 'L' in abstract_routine.tag:
189+ abstract_routine = copy.copy(abstract_routine)
190+ abstract_routine.tag = abstract_routine.tag + ['L']
191+
192 self[(lorentzname, outgoing)] = abstract_routine
193
194 def compute_all(self, save=True, wanted_lorentz = []):
195@@ -512,15 +517,34 @@
196 # reorganize the data (in order to use optimization for a given lorentz
197 #structure
198 request = {}
199+
200+ #Check Loop status
201+ aloha_writers.WriteALOHA.LOOP_MODE = any(['L' in tag for l,tag,out in data])
202+ # Add loop attribut for those which are not defined
203+
204 for list_l_name, tag, outgoing in data:
205+ conjugate = tuple([int(c[1:]) for c in tag if c.startswith('C')])
206+ loop = ('L' in tag)
207 for l_name in list_l_name:
208 try:
209+<<<<<<< TREE
210 request[l_name][tag].append(outgoing)
211+=======
212+ request[l_name][conjugate].append((outgoing, loop))
213+>>>>>>> MERGE-SOURCE
214 except:
215 try:
216+<<<<<<< TREE
217 request[l_name][tag] = [outgoing]
218+=======
219+ request[l_name][conjugate] = [(outgoing, loop)]
220+>>>>>>> MERGE-SOURCE
221 except:
222+<<<<<<< TREE
223 request[l_name] = {tag: [outgoing]}
224+=======
225+ request[l_name] = {conjugate: [(outgoing, loop)]}
226+>>>>>>> MERGE-SOURCE
227
228 # Loop on the structure to build exactly what is request
229 for l_name in request:
230@@ -537,37 +561,43 @@
231
232 for conjg in request[l_name]:
233 #ensure that routines are in rising order (for symetries)
234- routines = sorted(request[l_name][conjg])
235+ outgoing = sorted([a[0] for a in request[l_name][conjg] if not a[1]])
236+ outgoing_loop = sorted([a[0] for a in request[l_name][conjg] if a[1]])
237 if not conjg:
238 # No need to conjugate -> compute directly
239- self.compute_aloha(builder, routines=routines)
240+ self.compute_aloha(builder, routines=outgoing,
241+ routines_loop=outgoing_loop)
242 else:
243 # Define the high level conjugate routine
244 conjg_builder = builder.define_conjugate_builder(conjg)
245 # Compute routines
246 self.compute_aloha(conjg_builder, symmetry=lorentz.name,
247- routines=routines)
248+ routines=outgoing,
249+ routines_loop=outgoing_loop )
250
251 # Build mutiple lorentz call
252- for list_l_name, conjugate, outgoing in data:
253+ for list_l_name, tag, outgoing in data:
254 if len(list_l_name) >1:
255- lorentzname = list_l_name[0]
256- for c in conjugate:
257- lorentzname += 'C%s' % c
258+ lorentzname = list_l_name[0] + ''.join(tag)
259 self[(lorentzname, outgoing)].add_combine(list_l_name[1:])
260
261- def compute_aloha(self, builder, symmetry=None, routines=None):
262+ def compute_aloha(self, builder, symmetry=None, routines=None, routines_loop=None):
263 """ define all the AbstractRoutine linked to a given lorentz structure
264 symmetry authorizes to use the symmetry of anoter lorentz structure.
265- routines to define only a subset of the routines."""
266+ routines to define only a subset of the routines.
267+ routines loop defines those which should also be written in loop output
268+ """
269
270 name = builder.name
271 if not symmetry:
272 symmetry = name
273 if not routines:
274 routines = range(len(builder.spins) + 1)
275-
276+ if not routines_loop:
277+ routines_loop = []
278+
279 # Create the routines
280+ # First create the tree-level routines
281 for outgoing in routines:
282 symmetric = self.has_symmetries(symmetry, outgoing, valid_output=routines)
283 if symmetric:
284@@ -577,6 +607,19 @@
285 #Store the information
286 realname = name + ''.join(wavefunction.tag)
287 self.set(realname, outgoing, wavefunction)
288+
289+ # Creates the Loop routines
290+ for outgoing in routines_loop:
291+ symmetric = self.has_symmetries(symmetry, outgoing, valid_output=routines_loop)
292+ if symmetric:
293+ self.get(name+'L', symmetric).add_symmetry(outgoing)
294+ elif outgoing in routines:
295+ abstract = self.get(name, outgoing)
296+ self.set(name+'L', outgoing, abstract, loop=True)
297+ else:
298+ wavefunction = builder.compute_routine(outgoing)
299+ #Store the information
300+ self.set(name+'L', outgoing, wavefunction, loop=True)
301
302 def compute_aloha_without_kernel(self, builder, symmetry=None, routines=None):
303 """define all the AbstractRoutine linked to a given lorentz structure
304
305=== added file 'aloha/template_files/aloha_functions_loop.f'
306--- aloha/template_files/aloha_functions_loop.f 1970-01-01 00:00:00 +0000
307+++ aloha/template_files/aloha_functions_loop.f 2012-02-27 13:42:21 +0000
308@@ -0,0 +1,1690 @@
309+C###############################################################################
310+C
311+C Copyright (c) 2010 The ALOHA Development team and Contributors
312+C
313+C This file is a part of the MadGraph 5 project, an application which
314+C automatically generates Feynman diagrams and matrix elements for arbitrary
315+C high-energy processes in the Standard Model and beyond.
316+C
317+C It is subject to the ALOHA license which should accompany this
318+C distribution.
319+C
320+C###############################################################################
321+ subroutine ixxxxx(p, fmass, nhel, nsf ,fi)
322+c
323+c This subroutine computes a fermion wavefunction with the flowing-IN
324+c fermion number.
325+c
326+c input:
327+c real p(0:3) : four-momentum of fermion
328+c real fmass : mass of fermion
329+c integer nhel = -1 or 1 : helicity of fermion
330+c integer nsf = -1 or 1 : +1 for particle, -1 for anti-particle
331+c
332+c output:
333+c complex fi(6) : fermion wavefunction |fi>
334+c
335+ implicit none
336+ double complex fi(8),chi(2)
337+ double precision p(0:3),sf(2),sfomeg(2),omega(2),fmass,
338+ & pp,pp3,sqp0p3,sqm(0:1)
339+ integer nhel,nsf,ip,im,nh
340+
341+ double precision rZero, rHalf, rTwo
342+ parameter( rZero = 0.0d0, rHalf = 0.5d0, rTwo = 2.0d0 )
343+
344+c#ifdef HELAS_CHECK
345+c double precision p2
346+c double precision epsi
347+c parameter( epsi = 2.0d-5 )
348+c integer stdo
349+c parameter( stdo = 6 )
350+c#endif
351+c
352+c#ifdef HELAS_CHECK
353+c pp = sqrt(p(1)**2+p(2)**2+p(3)**2)
354+c if ( abs(p(0))+pp.eq.rZero ) then
355+c write(stdo,*)
356+c & ' helas-error : p(0:3) in ixxxxx is zero momentum'
357+c endif
358+c if ( p(0).le.rZero ) then
359+c write(stdo,*)
360+c & ' helas-error : p(0:3) in ixxxxx has non-positive energy'
361+c write(stdo,*)
362+c & ' : p(0) = ',p(0)
363+c endif
364+c p2 = (p(0)-pp)*(p(0)+pp)
365+c if ( abs(p2-fmass**2).gt.p(0)**2*epsi ) then
366+c write(stdo,*)
367+c & ' helas-error : p(0:3) in ixxxxx has inappropriate mass'
368+c write(stdo,*)
369+c & ' : p**2 = ',p2,' : fmass**2 = ',fmass**2
370+c endif
371+c if (abs(nhel).ne.1) then
372+c write(stdo,*) ' helas-error : nhel in ixxxxx is not -1,1'
373+c write(stdo,*) ' : nhel = ',nhel
374+c endif
375+c if (abs(nsf).ne.1) then
376+c write(stdo,*) ' helas-error : nsf in ixxxxx is not -1,1'
377+c write(stdo,*) ' : nsf = ',nsf
378+c endif
379+c#endif
380+
381+c Convention for trees
382+c fi(5) = dcmplx(p(0),p(3))*nsf
383+c fi(6) = dcmplx(p(1),p(2))*nsf
384+
385+c Convention for loop computations
386+ fi(5) = dcmplx(p(0),0.D0)*nsf
387+ fi(6) = dcmplx(p(1),0.D0)*nsf
388+ fi(7) = dcmplx(p(2),0.D0)*nsf
389+ fi(8) = dcmplx(p(3),0.D0)*nsf
390+
391+ nh = nhel*nsf
392+
393+ if ( fmass.ne.rZero ) then
394+
395+ pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2))
396+
397+ if ( pp.eq.rZero ) then
398+
399+ sqm(0) = dsqrt(abs(fmass)) ! possibility of negative fermion masses
400+ sqm(1) = sign(sqm(0),fmass) ! possibility of negative fermion masses
401+ ip = (1+nh)/2
402+ im = (1-nh)/2
403+
404+ fi(1) = ip * sqm(ip)
405+ fi(2) = im*nsf * sqm(ip)
406+ fi(3) = ip*nsf * sqm(im)
407+ fi(4) = im * sqm(im)
408+
409+ else
410+
411+ sf(1) = dble(1+nsf+(1-nsf)*nh)*rHalf
412+ sf(2) = dble(1+nsf-(1-nsf)*nh)*rHalf
413+ omega(1) = dsqrt(p(0)+pp)
414+ omega(2) = fmass/omega(1)
415+ ip = (3+nh)/2
416+ im = (3-nh)/2
417+ sfomeg(1) = sf(1)*omega(ip)
418+ sfomeg(2) = sf(2)*omega(im)
419+ pp3 = max(pp+p(3),rZero)
420+ chi(1) = dcmplx( dsqrt(pp3*rHalf/pp) )
421+ if ( pp3.eq.rZero ) then
422+ chi(2) = dcmplx(-nh )
423+ else
424+ chi(2) = dcmplx( nh*p(1) , p(2) )/dsqrt(rTwo*pp*pp3)
425+ endif
426+
427+ fi(1) = sfomeg(1)*chi(im)
428+ fi(2) = sfomeg(1)*chi(ip)
429+ fi(3) = sfomeg(2)*chi(im)
430+ fi(4) = sfomeg(2)*chi(ip)
431+
432+ endif
433+
434+ else
435+
436+ if(p(1).eq.0d0.and.p(2).eq.0d0.and.p(3).lt.0d0) then
437+ sqp0p3 = 0d0
438+ else
439+ sqp0p3 = dsqrt(max(p(0)+p(3),rZero))*nsf
440+ end if
441+ chi(1) = dcmplx( sqp0p3 )
442+ if ( sqp0p3.eq.rZero ) then
443+ chi(2) = dcmplx(-nhel )*dsqrt(rTwo*p(0))
444+ else
445+ chi(2) = dcmplx( nh*p(1), p(2) )/sqp0p3
446+ endif
447+ if ( nh.eq.1 ) then
448+ fi(1) = dcmplx( rZero )
449+ fi(2) = dcmplx( rZero )
450+ fi(3) = chi(1)
451+ fi(4) = chi(2)
452+ else
453+ fi(1) = chi(2)
454+ fi(2) = chi(1)
455+ fi(3) = dcmplx( rZero )
456+ fi(4) = dcmplx( rZero )
457+ endif
458+ endif
459+c
460+ return
461+ end
462+
463+
464+ subroutine oxxxxx(p,fmass,nhel,nsf , fo)
465+c
466+c This subroutine computes a fermion wavefunction with the flowing-OUT
467+c fermion number.
468+c
469+c input:
470+c real p(0:3) : four-momentum of fermion
471+c real fmass : mass of fermion
472+c integer nhel = -1 or 1 : helicity of fermion
473+c integer nsf = -1 or 1 : +1 for particle, -1 for anti-particle
474+c
475+c output:
476+c complex fo(6) : fermion wavefunction <fo|
477+c
478+ implicit none
479+ double complex fo(8),chi(2)
480+ double precision p(0:3),sf(2),sfomeg(2),omega(2),fmass,
481+ & pp,pp3,sqp0p3,sqm(0:1)
482+ integer nhel,nsf,nh,ip,im
483+
484+ double precision rZero, rHalf, rTwo
485+ parameter( rZero = 0.0d0, rHalf = 0.5d0, rTwo = 2.0d0 )
486+
487+c#ifdef HELAS_CHECK
488+c double precision p2
489+c double precision epsi
490+c parameter( epsi = 2.0d-5 )
491+c integer stdo
492+c parameter( stdo = 6 )
493+c#endif
494+c
495+c#ifdef HELAS_CHECK
496+c pp = sqrt(p(1)**2+p(2)**2+p(3)**2)
497+c if ( abs(p(0))+pp.eq.rZero ) then
498+c write(stdo,*)
499+c & ' helas-error : p(0:3) in oxxxxx is zero momentum'
500+c endif
501+c if ( p(0).le.rZero ) then
502+c write(stdo,*)
503+c & ' helas-error : p(0:3) in oxxxxx has non-positive energy'
504+c write(stdo,*)
505+c & ' : p(0) = ',p(0)
506+c endif
507+c p2 = (p(0)-pp)*(p(0)+pp)
508+c if ( abs(p2-fmass**2).gt.p(0)**2*epsi ) then
509+c write(stdo,*)
510+c & ' helas-error : p(0:3) in oxxxxx has inappropriate mass'
511+c write(stdo,*)
512+c & ' : p**2 = ',p2,' : fmass**2 = ',fmass**2
513+c endif
514+c if ( abs(nhel).ne.1 ) then
515+c write(stdo,*) ' helas-error : nhel in oxxxxx is not -1,1'
516+c write(stdo,*) ' : nhel = ',nhel
517+c endif
518+c if ( abs(nsf).ne.1 ) then
519+c write(stdo,*) ' helas-error : nsf in oxxxxx is not -1,1'
520+c write(stdo,*) ' : nsf = ',nsf
521+c endif
522+c#endif
523+
524+c Convention for trees
525+c fo(5) = dcmplx(p(0),p(3))*nsf
526+c fo(6) = dcmplx(p(1),p(2))*nsf
527+
528+c Convention for loop computations
529+ fo(5) = dcmplx(p(0),0.D0)*nsf
530+ fo(6) = dcmplx(p(1),0.D0)*nsf
531+ fo(7) = dcmplx(p(2),0.D0)*nsf
532+ fo(8) = dcmplx(p(3),0.D0)*nsf
533+
534+
535+ nh = nhel*nsf
536+
537+ if ( fmass.ne.rZero ) then
538+
539+ pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2))
540+
541+ if ( pp.eq.rZero ) then
542+
543+ sqm(0) = dsqrt(abs(fmass)) ! possibility of negative fermion masses
544+ sqm(1) = sign(sqm(0),fmass) ! possibility of negative fermion masses
545+ ip = -((1+nh)/2)
546+ im = (1-nh)/2
547+
548+ fo(1) = im * sqm(im)
549+ fo(2) = ip*nsf * sqm(im)
550+ fo(3) = im*nsf * sqm(-ip)
551+ fo(4) = ip * sqm(-ip)
552+
553+ else
554+
555+ pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2))
556+ sf(1) = dble(1+nsf+(1-nsf)*nh)*rHalf
557+ sf(2) = dble(1+nsf-(1-nsf)*nh)*rHalf
558+ omega(1) = dsqrt(p(0)+pp)
559+ omega(2) = fmass/omega(1)
560+ ip = (3+nh)/2
561+ im = (3-nh)/2
562+ sfomeg(1) = sf(1)*omega(ip)
563+ sfomeg(2) = sf(2)*omega(im)
564+ pp3 = max(pp+p(3),rZero)
565+ chi(1) = dcmplx( dsqrt(pp3*rHalf/pp) )
566+ if ( pp3.eq.rZero ) then
567+ chi(2) = dcmplx(-nh )
568+ else
569+ chi(2) = dcmplx( nh*p(1) , -p(2) )/dsqrt(rTwo*pp*pp3)
570+ endif
571+
572+ fo(1) = sfomeg(2)*chi(im)
573+ fo(2) = sfomeg(2)*chi(ip)
574+ fo(3) = sfomeg(1)*chi(im)
575+ fo(4) = sfomeg(1)*chi(ip)
576+
577+ endif
578+
579+ else
580+
581+ if(p(1).eq.0d0.and.p(2).eq.0d0.and.p(3).lt.0d0) then
582+ sqp0p3 = 0d0
583+ else
584+ sqp0p3 = dsqrt(max(p(0)+p(3),rZero))*nsf
585+ end if
586+ chi(1) = dcmplx( sqp0p3 )
587+ if ( sqp0p3.eq.rZero ) then
588+ chi(2) = dcmplx(-nhel )*dsqrt(rTwo*p(0))
589+ else
590+ chi(2) = dcmplx( nh*p(1), -p(2) )/sqp0p3
591+ endif
592+ if ( nh.eq.1 ) then
593+ fo(1) = chi(1)
594+ fo(2) = chi(2)
595+ fo(3) = dcmplx( rZero )
596+ fo(4) = dcmplx( rZero )
597+ else
598+ fo(1) = dcmplx( rZero )
599+ fo(2) = dcmplx( rZero )
600+ fo(3) = chi(2)
601+ fo(4) = chi(1)
602+ endif
603+
604+ endif
605+c
606+ return
607+ end
608+
609+ subroutine pxxxxx(p,tmass,nhel,nst , tc)
610+
611+c CP3 2009.NOV
612+
613+c This subroutine computes a PSEUDOR wavefunction.
614+c
615+c input:
616+c real p(0:3) : four-momentum of tensor boson
617+c real tmass : mass of tensor boson
618+c integer nhel : helicity of tensor boson
619+c = -2,-1,0,1,2 : (0 is forbidden if tmass=0.0)
620+c integer nst = -1 or 1 : +1 for final, -1 for initial
621+c
622+c output:
623+c complex tc(18) : PSEUDOR wavefunction epsilon^mu^nu(t)
624+c
625+ implicit none
626+ double precision p(0:3), tmass
627+ integer nhel, nst
628+ double complex tc(20)
629+
630+ double complex ft(6,4), ep(4), em(4), e0(4)
631+ double precision pt, pt2, pp, pzpt, emp, sqh, sqs
632+ integer i, j
633+
634+ double precision rZero, rHalf, rOne, rTwo
635+ parameter( rZero = 0.0d0, rHalf = 0.5d0 )
636+ parameter( rOne = 1.0d0, rTwo = 2.0d0 )
637+
638+
639+ tc(1)=NHEL
640+
641+c Convention for trees
642+c tc(17) = dcmplx(p(0),p(3))*nst
643+c tc(18) = dcmplx(p(1),p(2))*nst
644+
645+c Convention for loop computations
646+ tc(17) = dcmplx(p(0),0.D0)*nst
647+ tc(18) = dcmplx(p(1),0.D0)*nst
648+ tc(19) = dcmplx(p(2),0.D0)*nst
649+ tc(20) = dcmplx(p(3),0.D0)*nst
650+
651+ return
652+ end
653+
654+ subroutine sxxxxx(p,nss , sc)
655+c
656+c This subroutine computes a complex SCALAR wavefunction.
657+c
658+c input:
659+c real p(0:3) : four-momentum of scalar boson
660+c integer nss = -1 or 1 : +1 for final, -1 for initial
661+c
662+c output:
663+c complex sc(3) : scalar wavefunction s
664+c
665+ implicit none
666+ double complex sc(5)
667+ double precision p(0:3)
668+ integer nss
669+
670+ double precision rOne
671+ parameter( rOne = 1.0d0 )
672+
673+c#ifdef HELAS_CHECK
674+c double precision p2
675+c double precision epsi
676+c parameter( epsi = 2.0d-5 )
677+c double precision rZero
678+c parameter( rZero = 0.0d0 )
679+c integer stdo
680+c parameter( stdo = 6 )
681+c#endif
682+c
683+c#ifdef HELAS_CHECK
684+c if ( abs(p(0))+abs(p(1))+abs(p(2))+abs(p(3)).eq.rZero ) then
685+c write(stdo,*)
686+c & ' helas-error : p(0:3) in sxxxxx is zero momentum'
687+c endif
688+c if ( p(0).le.rZero ) then
689+c write(stdo,*)
690+c & ' helas-error : p(0:3) in sxxxxx has non-positive energy'
691+c write(stdo,*)
692+c & ' : p(0) = ',p(0)
693+c endif
694+c p2 = p(0)**2-(p(1)**2+p(2)**2+p(3)**2)
695+c if ( p2.lt.-p(0)**2*epsi ) then
696+c write(stdo,*) ' helas-error : p(0:3) in sxxxxx is spacelike'
697+c write(stdo,*) ' : p**2 = ',p2
698+c endif
699+c if ( abs(nss).ne.1 ) then
700+c write(stdo,*) ' helas-error : nss in sxxxxx is not -1,1'
701+c write(stdo,*) ' : nss = ',nss
702+c endif
703+c#endif
704+
705+ sc(1) = dcmplx( rOne )
706+
707+c Convention for trees
708+c sc(2) = dcmplx(p(0),p(3))*nss
709+c sc(3) = dcmplx(p(1),p(2))*nss
710+
711+c Convention for loop computations
712+ sc(2) = dcmplx(p(0),0.D0)*nss
713+ sc(3) = dcmplx(p(1),0.D0)*nss
714+ sc(4) = dcmplx(p(2),0.D0)*nss
715+ sc(5) = dcmplx(p(3),0.D0)*nss
716+c
717+ return
718+ end
719+
720+ subroutine txxxxx(p,tmass,nhel,nst , tc)
721+c
722+c This subroutine computes a TENSOR wavefunction.
723+c
724+c input:
725+c real p(0:3) : four-momentum of tensor boson
726+c real tmass : mass of tensor boson
727+c integer nhel : helicity of tensor boson
728+c = -2,-1,0,1,2 : (0 is forbidden if tmass=0.0)
729+c integer nst = -1 or 1 : +1 for final, -1 for initial
730+c
731+c output:
732+c complex tc(18) : tensor wavefunction epsilon^mu^nu(t)
733+c
734+ implicit none
735+ double precision p(0:3), tmass
736+ integer nhel, nst
737+ double complex tc(20)
738+
739+ double complex ft(6,4), ep(4), em(4), e0(4)
740+ double precision pt, pt2, pp, pzpt, emp, sqh, sqs
741+ integer i, j
742+
743+ double precision rZero, rHalf, rOne, rTwo
744+ parameter( rZero = 0.0d0, rHalf = 0.5d0 )
745+ parameter( rOne = 1.0d0, rTwo = 2.0d0 )
746+
747+ integer stdo
748+ parameter( stdo = 6 )
749+
750+ sqh = sqrt(rHalf)
751+ sqs = sqrt(rHalf/3.d0)
752+
753+ pt2 = p(1)**2 + p(2)**2
754+ pp = min(p(0),sqrt(pt2+p(3)**2))
755+ pt = min(pp,sqrt(pt2))
756+
757+c Convention for trees
758+c ft(5,1) = dcmplx(p(0),p(3))*nst
759+c ft(6,1) = dcmplx(p(1),p(2))*nst
760+
761+c Convention for loop computations
762+ ft(5,1) = dcmplx(p(0),0.D0)*nst
763+ ft(6,1) = dcmplx(p(1),0.D0)*nst
764+ ft(7,1) = dcmplx(p(2),0.D0)*nst
765+ ft(8,1) = dcmplx(p(3),0.D0)*nst
766+
767+ if ( nhel.ge.0 ) then
768+c construct eps+
769+ if ( pp.eq.rZero ) then
770+ ep(1) = dcmplx( rZero )
771+ ep(2) = dcmplx( -sqh )
772+ ep(3) = dcmplx( rZero , nst*sqh )
773+ ep(4) = dcmplx( rZero )
774+ else
775+ ep(1) = dcmplx( rZero )
776+ ep(4) = dcmplx( pt/pp*sqh )
777+ if ( pt.ne.rZero ) then
778+ pzpt = p(3)/(pp*pt)*sqh
779+ ep(2) = dcmplx( -p(1)*pzpt , -nst*p(2)/pt*sqh )
780+ ep(3) = dcmplx( -p(2)*pzpt , nst*p(1)/pt*sqh )
781+ else
782+ ep(2) = dcmplx( -sqh )
783+ ep(3) = dcmplx( rZero , nst*sign(sqh,p(3)) )
784+ endif
785+ endif
786+ end if
787+
788+ if ( nhel.le.0 ) then
789+c construct eps-
790+ if ( pp.eq.rZero ) then
791+ em(1) = dcmplx( rZero )
792+ em(2) = dcmplx( sqh )
793+ em(3) = dcmplx( rZero , nst*sqh )
794+ em(4) = dcmplx( rZero )
795+ else
796+ em(1) = dcmplx( rZero )
797+ em(4) = dcmplx( -pt/pp*sqh )
798+ if ( pt.ne.rZero ) then
799+ pzpt = -p(3)/(pp*pt)*sqh
800+ em(2) = dcmplx( -p(1)*pzpt , -nst*p(2)/pt*sqh )
801+ em(3) = dcmplx( -p(2)*pzpt , nst*p(1)/pt*sqh )
802+ else
803+ em(2) = dcmplx( sqh )
804+ em(3) = dcmplx( rZero , nst*sign(sqh,p(3)) )
805+ endif
806+ endif
807+ end if
808+
809+ if ( abs(nhel).le.1 ) then
810+c construct eps0
811+ if ( pp.eq.rZero ) then
812+ e0(1) = dcmplx( rZero )
813+ e0(2) = dcmplx( rZero )
814+ e0(3) = dcmplx( rZero )
815+ e0(4) = dcmplx( rOne )
816+ else
817+ emp = p(0)/(tmass*pp)
818+ e0(1) = dcmplx( pp/tmass )
819+ e0(4) = dcmplx( p(3)*emp )
820+ if ( pt.ne.rZero ) then
821+ e0(2) = dcmplx( p(1)*emp )
822+ e0(3) = dcmplx( p(2)*emp )
823+ else
824+ e0(2) = dcmplx( rZero )
825+ e0(3) = dcmplx( rZero )
826+ endif
827+ end if
828+ end if
829+
830+ if ( nhel.eq.2 ) then
831+ do j = 1,4
832+ do i = 1,4
833+ ft(i,j) = ep(i)*ep(j)
834+ end do
835+ end do
836+ else if ( nhel.eq.-2 ) then
837+ do j = 1,4
838+ do i = 1,4
839+ ft(i,j) = em(i)*em(j)
840+ end do
841+ end do
842+ else if (tmass.eq.0) then
843+ do j = 1,4
844+ do i = 1,4
845+ ft(i,j) = 0
846+ end do
847+ end do
848+ else if (tmass.ne.0) then
849+ if ( nhel.eq.1 ) then
850+ do j = 1,4
851+ do i = 1,4
852+ ft(i,j) = sqh*( ep(i)*e0(j) + e0(i)*ep(j) )
853+ end do
854+ end do
855+ else if ( nhel.eq.0 ) then
856+ do j = 1,4
857+ do i = 1,4
858+ ft(i,j) = sqs*( ep(i)*em(j) + em(i)*ep(j)
859+ & + rTwo*e0(i)*e0(j) )
860+ end do
861+ end do
862+ else if ( nhel.eq.-1 ) then
863+ do j = 1,4
864+ do i = 1,4
865+ ft(i,j) = sqh*( em(i)*e0(j) + e0(i)*em(j) )
866+ end do
867+ end do
868+ else
869+ write(stdo,*) 'invalid helicity in TXXXXX'
870+ stop
871+ end if
872+ end if
873+
874+ tc(1) = ft(1,1)
875+ tc(2) = ft(1,2)
876+ tc(3) = ft(1,3)
877+ tc(4) = ft(1,4)
878+ tc(5) = ft(2,1)
879+ tc(6) = ft(2,2)
880+ tc(7) = ft(2,3)
881+ tc(8) = ft(2,4)
882+ tc(9) = ft(3,1)
883+ tc(10) = ft(3,2)
884+ tc(11) = ft(3,3)
885+ tc(12) = ft(3,4)
886+ tc(13) = ft(4,1)
887+ tc(14) = ft(4,2)
888+ tc(15) = ft(4,3)
889+ tc(16) = ft(4,4)
890+ tc(17) = ft(5,1)
891+ tc(18) = ft(6,1)
892+ tc(19) = ft(5,1)
893+ tc(20) = ft(6,1)
894+
895+ return
896+ end
897+
898+
899+ subroutine vxxxxx(p,vmass,nhel,nsv , vc)
900+c
901+c This subroutine computes a VECTOR wavefunction.
902+c
903+c input:
904+c real p(0:3) : four-momentum of vector boson
905+c real vmass : mass of vector boson
906+c integer nhel = -1, 0, 1: helicity of vector boson
907+c (0 is forbidden if vmass=0.0)
908+c integer nsv = -1 or 1 : +1 for final, -1 for initial
909+c
910+c output:
911+c complex vc(6) : vector wavefunction epsilon^mu(v)
912+c
913+ implicit none
914+ double complex vc(8)
915+ double precision p(0:3),vmass,hel,hel0,pt,pt2,pp,pzpt,emp,sqh
916+ integer nhel,nsv,nsvahl
917+
918+ double precision rZero, rHalf, rOne, rTwo
919+ parameter( rZero = 0.0d0, rHalf = 0.5d0 )
920+ parameter( rOne = 1.0d0, rTwo = 2.0d0 )
921+
922+c#ifdef HELAS_CHECK
923+c double precision p2
924+c double precision epsi
925+c parameter( epsi = 2.0d-5 )
926+c integer stdo
927+c parameter( stdo = 6 )
928+c#endif
929+c
930+c#ifdef HELAS_CHECK
931+c pp = sqrt(p(1)**2+p(2)**2+p(3)**2)
932+c if ( abs(p(0))+pp.eq.rZero ) then
933+c write(stdo,*)
934+c & ' helas-error : p(0:3) in vxxxxx is zero momentum'
935+c endif
936+c if ( p(0).le.rZero ) then
937+c write(stdo,*)
938+c & ' helas-error : p(0:3) in vxxxxx has non-positive energy'
939+c write(stdo,*)
940+c & ' : p(0) = ',p(0)
941+c endif
942+c p2 = (p(0)+pp)*(p(0)-pp)
943+c if ( abs(p2-vmass**2).gt.p(0)**2*2.e-5 ) then
944+c write(stdo,*)
945+c & ' helas-error : p(0:3) in vxxxxx has inappropriate mass'
946+c write(stdo,*)
947+c & ' : p**2 = ',p2,' : vmass**2 = ',vmass**2
948+c endif
949+c if ( vmass.ne.rZero ) then
950+c if ( abs(nhel).gt.1 ) then
951+c write(stdo,*) ' helas-error : nhel in vxxxxx is not -1,0,1'
952+c write(stdo,*) ' : nhel = ',nhel
953+c endif
954+c else
955+c if ( abs(nhel).ne.1 ) then
956+c write(stdo,*) ' helas-error : nhel in vxxxxx is not -1,1'
957+c write(stdo,*) ' : nhel = ',nhel
958+c endif
959+c endif
960+c if ( abs(nsv).ne.1 ) then
961+c write(stdo,*) ' helas-error : nsv in vmxxxx is not -1,1'
962+c write(stdo,*) ' : nsv = ',nsv
963+c endif
964+c#endif
965+
966+ sqh = dsqrt(rHalf)
967+ hel = dble(nhel)
968+ nsvahl = nsv*dabs(hel)
969+ pt2 = p(1)**2+p(2)**2
970+ pp = min(p(0),dsqrt(pt2+p(3)**2))
971+ pt = min(pp,dsqrt(pt2))
972+
973+c Convention for trees
974+c vc(5) = dcmplx(p(0),p(3))*nsv
975+c vc(6) = dcmplx(p(1),p(2))*nsv
976+
977+c Convention for loop computations
978+ vc(5) = dcmplx(p(0),0.D0)*nsv
979+ vc(6) = dcmplx(p(1),0.D0)*nsv
980+ vc(7) = dcmplx(p(2),0.D0)*nsv
981+ vc(8) = dcmplx(p(3),0.D0)*nsv
982+
983+c#ifdef HELAS_CHECK
984+c nhel=4 option for scalar polarization
985+c if( nhel.eq.4 ) then
986+c if( vmass.eq.rZero ) then
987+c vc(1) = rOne
988+c vc(2) = p(1)/p(0)
989+c vc(3) = p(2)/p(0)
990+c vc(4) = p(3)/p(0)
991+c else
992+c vc(1) = p(0)/vmass
993+c vc(2) = p(1)/vmass
994+c vc(3) = p(2)/vmass
995+c vc(4) = p(3)/vmass
996+c endif
997+c return
998+c endif
999+c#endif
1000+
1001+ if ( vmass.ne.rZero ) then
1002+
1003+ hel0 = rOne-dabs(hel)
1004+
1005+ if ( pp.eq.rZero ) then
1006+
1007+ vc(1) = dcmplx( rZero )
1008+ vc(2) = dcmplx(-hel*sqh )
1009+ vc(3) = dcmplx( rZero , nsvahl*sqh )
1010+ vc(4) = dcmplx( hel0 )
1011+
1012+ else
1013+
1014+ emp = p(0)/(vmass*pp)
1015+ vc(1) = dcmplx( hel0*pp/vmass )
1016+ vc(4) = dcmplx( hel0*p(3)*emp+hel*pt/pp*sqh )
1017+ if ( pt.ne.rZero ) then
1018+ pzpt = p(3)/(pp*pt)*sqh*hel
1019+ vc(2) = dcmplx( hel0*p(1)*emp-p(1)*pzpt ,
1020+ & -nsvahl*p(2)/pt*sqh )
1021+ vc(3) = dcmplx( hel0*p(2)*emp-p(2)*pzpt ,
1022+ & nsvahl*p(1)/pt*sqh )
1023+ else
1024+ vc(2) = dcmplx( -hel*sqh )
1025+ vc(3) = dcmplx( rZero , nsvahl*sign(sqh,p(3)) )
1026+ endif
1027+
1028+ endif
1029+
1030+ else
1031+
1032+ pp = p(0)
1033+ pt = sqrt(p(1)**2+p(2)**2)
1034+ vc(1) = dcmplx( rZero )
1035+ vc(4) = dcmplx( hel*pt/pp*sqh )
1036+ if ( pt.ne.rZero ) then
1037+ pzpt = p(3)/(pp*pt)*sqh*hel
1038+ vc(2) = dcmplx( -p(1)*pzpt , -nsv*p(2)/pt*sqh )
1039+ vc(3) = dcmplx( -p(2)*pzpt , nsv*p(1)/pt*sqh )
1040+ else
1041+ vc(2) = dcmplx( -hel*sqh )
1042+ vc(3) = dcmplx( rZero , nsv*sign(sqh,p(3)) )
1043+ endif
1044+
1045+ endif
1046+c
1047+ return
1048+ end
1049+
1050+ subroutine boostx(p,q , pboost)
1051+c
1052+c This subroutine performs the Lorentz boost of a four-momentum. The
1053+c momentum p is assumed to be given in the rest frame of q. pboost is
1054+c the momentum p boosted to the frame in which q is given. q must be a
1055+c timelike momentum.
1056+c
1057+c input:
1058+c real p(0:3) : four-momentum p in the q rest frame
1059+c real q(0:3) : four-momentum q in the boosted frame
1060+c
1061+c output:
1062+c real pboost(0:3) : four-momentum p in the boosted frame
1063+c
1064+ implicit none
1065+ double precision p(0:3),q(0:3),pboost(0:3),pq,qq,m,lf
1066+
1067+ double precision rZero
1068+ parameter( rZero = 0.0d0 )
1069+
1070+c#ifdef HELAS_CHECK
1071+c integer stdo
1072+c parameter( stdo = 6 )
1073+c double precision pp
1074+c#endif
1075+c
1076+ qq = q(1)**2+q(2)**2+q(3)**2
1077+
1078+c#ifdef HELAS_CHECK
1079+c if (abs(p(0))+abs(p(1))+abs(p(2))+abs(p(3)).eq.rZero) then
1080+c write(stdo,*)
1081+c & ' helas-error : p(0:3) in boostx is zero momentum'
1082+c endif
1083+c if (abs(q(0))+qq.eq.rZero) then
1084+c write(stdo,*)
1085+c & ' helas-error : q(0:3) in boostx is zero momentum'
1086+c endif
1087+c if (p(0).le.rZero) then
1088+c write(stdo,*)
1089+c & ' helas-warn : p(0:3) in boostx has not positive energy'
1090+c write(stdo,*)
1091+c & ' : p(0) = ',p(0)
1092+c endif
1093+c if (q(0).le.rZero) then
1094+c write(stdo,*)
1095+c & ' helas-error : q(0:3) in boostx has not positive energy'
1096+c write(stdo,*)
1097+c & ' : q(0) = ',q(0)
1098+c endif
1099+c pp=p(0)**2-p(1)**2-p(2)**2-p(3)**2
1100+c if (pp.lt.rZero) then
1101+c write(stdo,*)
1102+c & ' helas-warn : p(0:3) in boostx is spacelike'
1103+c write(stdo,*)
1104+c & ' : p**2 = ',pp
1105+c endif
1106+c if (q(0)**2-qq.le.rZero) then
1107+c write(stdo,*)
1108+c & ' helas-error : q(0:3) in boostx is not timelike'
1109+c write(stdo,*)
1110+c & ' : q**2 = ',q(0)**2-qq
1111+c endif
1112+c if (qq.eq.rZero) then
1113+c write(stdo,*)
1114+c & ' helas-warn : q(0:3) in boostx has zero spacial components'
1115+c endif
1116+c#endif
1117+
1118+ if ( qq.ne.rZero ) then
1119+ pq = p(1)*q(1)+p(2)*q(2)+p(3)*q(3)
1120+ m = sqrt(q(0)**2-qq)
1121+ lf = ((q(0)-m)*pq/qq+p(0))/m
1122+ pboost(0) = (p(0)*q(0)+pq)/m
1123+ pboost(1) = p(1)+q(1)*lf
1124+ pboost(2) = p(2)+q(2)*lf
1125+ pboost(3) = p(3)+q(3)*lf
1126+ else
1127+ pboost(0) = p(0)
1128+ pboost(1) = p(1)
1129+ pboost(2) = p(2)
1130+ pboost(3) = p(3)
1131+ endif
1132+c
1133+ return
1134+ end
1135+
1136+ subroutine momntx(energy,mass,costh,phi , p)
1137+c
1138+c This subroutine sets up a four-momentum from the four inputs.
1139+c
1140+c input:
1141+c real energy : energy
1142+c real mass : mass
1143+c real costh : cos(theta)
1144+c real phi : azimuthal angle
1145+c
1146+c output:
1147+c real p(0:3) : four-momentum
1148+c
1149+ implicit none
1150+ double precision p(0:3),energy,mass,costh,phi,pp,sinth
1151+
1152+ double precision rZero, rOne
1153+ parameter( rZero = 0.0d0, rOne = 1.0d0 )
1154+
1155+c#ifdef HELAS_CHECK
1156+c double precision rPi, rTwo
1157+c parameter( rPi = 3.14159265358979323846d0, rTwo = 2.d0 )
1158+c integer stdo
1159+c parameter( stdo = 6 )
1160+c#endif
1161+c
1162+c#ifdef HELAS_CHECK
1163+c if (energy.lt.mass) then
1164+c write(stdo,*)
1165+c & ' helas-error : energy in momntx is less than mass'
1166+c write(stdo,*)
1167+c & ' : energy = ',energy,' : mass = ',mass
1168+c endif
1169+c if (mass.lt.rZero) then
1170+c write(stdo,*) ' helas-error : mass in momntx is negative'
1171+c write(stdo,*) ' : mass = ',mass
1172+c endif
1173+c if (abs(costh).gt.rOne) then
1174+c write(stdo,*) ' helas-error : costh in momntx is improper'
1175+c write(stdo,*) ' : costh = ',costh
1176+c endif
1177+c if (phi.lt.rZero .or. phi.gt.rTwo*rPi) then
1178+c write(stdo,*)
1179+c & ' helas-warn : phi in momntx does not lie on 0.0 thru 2.0*pi'
1180+c write(stdo,*)
1181+c & ' : phi = ',phi
1182+c endif
1183+c#endif
1184+
1185+ p(0) = energy
1186+
1187+ if ( energy.eq.mass ) then
1188+
1189+ p(1) = rZero
1190+ p(2) = rZero
1191+ p(3) = rZero
1192+
1193+ else
1194+
1195+ pp = sqrt((energy-mass)*(energy+mass))
1196+ sinth = sqrt((rOne-costh)*(rOne+costh))
1197+ p(3) = pp*costh
1198+ if ( phi.eq.rZero ) then
1199+ p(1) = pp*sinth
1200+ p(2) = rZero
1201+ else
1202+ p(1) = pp*sinth*cos(phi)
1203+ p(2) = pp*sinth*sin(phi)
1204+ endif
1205+
1206+ endif
1207+c
1208+ return
1209+ end
1210+ subroutine rotxxx(p,q , prot)
1211+c
1212+c This subroutine performs the spacial rotation of a four-momentum.
1213+c the momentum p is assumed to be given in the frame where the spacial
1214+c component of q points the positive z-axis. prot is the momentum p
1215+c rotated to the frame where q is given.
1216+c
1217+c input:
1218+c real p(0:3) : four-momentum p in q(1)=q(2)=0 frame
1219+c real q(0:3) : four-momentum q in the rotated frame
1220+c
1221+c output:
1222+c real prot(0:3) : four-momentum p in the rotated frame
1223+c
1224+ implicit none
1225+ double precision p(0:3),q(0:3),prot(0:3),qt2,qt,psgn,qq,p1
1226+
1227+ double precision rZero, rOne
1228+ parameter( rZero = 0.0d0, rOne = 1.0d0 )
1229+
1230+c#ifdef HELAS_CHECK
1231+c integer stdo
1232+c parameter( stdo = 6 )
1233+c#endif
1234+c
1235+ prot(0) = p(0)
1236+
1237+ qt2 = q(1)**2 + q(2)**2
1238+
1239+c#ifdef HELAS_CHECK
1240+c if (abs(p(0))+abs(p(1))+abs(p(2))+abs(p(3)).eq.rZero) then
1241+c write(stdo,*)
1242+c & ' helas-error : p(0:3) in rotxxx is zero momentum'
1243+c endif
1244+c if (abs(q(0))+abs(q(3))+qt2.eq.rZero) then
1245+c write(stdo,*)
1246+c & ' helas-error : q(0:3) in rotxxx is zero momentum'
1247+c endif
1248+c if (qt2+abs(q(3)).eq.rZero) then
1249+c write(stdo,*)
1250+c & ' helas-warn : q(0:3) in rotxxx has zero spacial momentum'
1251+c endif
1252+c#endif
1253+
1254+ if ( qt2.eq.rZero ) then
1255+ if ( q(3).eq.rZero ) then
1256+ prot(1) = p(1)
1257+ prot(2) = p(2)
1258+ prot(3) = p(3)
1259+ else
1260+ psgn = dsign(rOne,q(3))
1261+ prot(1) = p(1)*psgn
1262+ prot(2) = p(2)*psgn
1263+ prot(3) = p(3)*psgn
1264+ endif
1265+ else
1266+ qq = sqrt(qt2+q(3)**2)
1267+ qt = sqrt(qt2)
1268+ p1 = p(1)
1269+ prot(1) = q(1)*q(3)/qq/qt*p1 -q(2)/qt*p(2) +q(1)/qq*p(3)
1270+ prot(2) = q(2)*q(3)/qq/qt*p1 +q(1)/qt*p(2) +q(2)/qq*p(3)
1271+ prot(3) = -qt/qq*p1 +q(3)/qq*p(3)
1272+ endif
1273+c
1274+ return
1275+ end
1276+
1277+ subroutine mom2cx(esum,mass1,mass2,costh1,phi1 , p1,p2)
1278+c
1279+c This subroutine sets up two four-momenta in the two particle rest
1280+c frame.
1281+c
1282+c input:
1283+c real esum : energy sum of particle 1 and 2
1284+c real mass1 : mass of particle 1
1285+c real mass2 : mass of particle 2
1286+c real costh1 : cos(theta) of particle 1
1287+c real phi1 : azimuthal angle of particle 1
1288+c
1289+c output:
1290+c real p1(0:3) : four-momentum of particle 1
1291+c real p2(0:3) : four-momentum of particle 2
1292+c
1293+ implicit none
1294+ double precision p1(0:3),p2(0:3),
1295+ & esum,mass1,mass2,costh1,phi1,md2,ed,pp,sinth1
1296+
1297+ double precision rZero, rHalf, rOne, rTwo
1298+ parameter( rZero = 0.0d0, rHalf = 0.5d0 )
1299+ parameter( rOne = 1.0d0, rTwo = 2.0d0 )
1300+
1301+c#ifdef HELAS_CHECK
1302+c double precision rPi
1303+c parameter( rPi = 3.14159265358979323846d0 )
1304+c integer stdo
1305+c parameter( stdo = 6 )
1306+c#endif
1307+cc
1308+c#ifdef HELAS_CHECK
1309+c if (esum.lt.mass1+mass2) then
1310+c write(stdo,*)
1311+c & ' helas-error : esum in mom2cx is less than mass1+mass2'
1312+c write(stdo,*)
1313+c & ' : esum = ',esum,
1314+c & ' : mass1+mass2 = ',mass1,mass2
1315+c endif
1316+c if (mass1.lt.rZero) then
1317+c write(stdo,*) ' helas-error : mass1 in mom2cx is negative'
1318+c write(stdo,*) ' : mass1 = ',mass1
1319+c endif
1320+c if (mass2.lt.rZero) then
1321+c write(stdo,*) ' helas-error : mass2 in mom2cx is negative'
1322+c write(stdo,*) ' : mass2 = ',mass2
1323+c endif
1324+c if (abs(costh1).gt.1.) then
1325+c write(stdo,*) ' helas-error : costh1 in mom2cx is improper'
1326+c write(stdo,*) ' : costh1 = ',costh1
1327+c endif
1328+c if (phi1.lt.rZero .or. phi1.gt.rTwo*rPi) then
1329+c write(stdo,*)
1330+c & ' helas-warn : phi1 in mom2cx does not lie on 0.0 thru 2.0*pi'
1331+c write(stdo,*)
1332+c & ' : phi1 = ',phi1
1333+c endif
1334+c#endif
1335+
1336+ md2 = (mass1-mass2)*(mass1+mass2)
1337+ ed = md2/esum
1338+ if ( mass1*mass2.eq.rZero ) then
1339+ pp = (esum-abs(ed))*rHalf
1340+ else
1341+ pp = sqrt((md2/esum)**2-rTwo*(mass1**2+mass2**2)+esum**2)*rHalf
1342+ endif
1343+ sinth1 = sqrt((rOne-costh1)*(rOne+costh1))
1344+
1345+ p1(0) = max((esum+ed)*rHalf,rZero)
1346+ p1(1) = pp*sinth1*cos(phi1)
1347+ p1(2) = pp*sinth1*sin(phi1)
1348+ p1(3) = pp*costh1
1349+
1350+ p2(0) = max((esum-ed)*rHalf,rZero)
1351+ p2(1) = -p1(1)
1352+ p2(2) = -p1(2)
1353+ p2(3) = -p1(3)
1354+c
1355+ return
1356+ end
1357+
1358+C###############################################################################
1359+C LOOP related universal subroutines
1360+C###############################################################################
1361+
1362+C===============================================================================
1363+C Subroutines to close the lorentz traces of loops
1364+C===============================================================================
1365+
1366+ SUBROUTINE CLOSE_V(Q,M,AMPS,RES)
1367+
1368+ COMPLEX*16 Q(0:3)
1369+ COMPLEX*16 RES
1370+ COMPLEX*16 AMPS(4)
1371+
1372+ IF (M.NE.0.D0) THEN
1373+ STOP 'Massive vector L-cut particle not supported'
1374+ ENDIF
1375+ RES=AMPS(1)-AMPS(2)-AMPS(3)-AMPS(4)
1376+
1377+ END
1378+
1379+c This subroutine is to recreate the fermion propagator with 4 helicities
1380+c only. This has problems with certain configuration of the imaginary
1381+c momentum q, so it is not implemented yet.
1382+
1383+ SUBROUTINE CLOSE_F4HEL(Q,M,AMPS,RES)
1384+
1385+ COMPLEX*16 Q(0:3)
1386+ COMPLEX*16 RES, QNORM
1387+ REAL*8 M
1388+ COMPLEX*16 AMPS(4)
1389+ COMPLEX*16 PMM, PPM
1390+
1391+ PPM=AMPS(1)+AMPS(2)
1392+ PMM=AMPS(3)+AMPS(4)
1393+ write(*,*) 'PPM=',PPM
1394+ write(*,*) 'PMM=',PMM
1395+ IF (M.NE.0.D0) THEN
1396+ QNORM=SQRT(Q(0)**2-Q(1)**2-Q(2)**2-Q(3)**2)
1397+ write(*,*) 'Q=',Q
1398+ write(*,*) 'QNORM=',QNORM
1399+ write(*,*) 'M=',M
1400+ RES=(0.D0,0.5D0)*((PPM+PMM)+(PPM-PMM)*(M/QNORM))
1401+ write(*,*) 'RES1=',RES
1402+ ELSE
1403+ RES=(0.D0,0.5D0)*(PPM+PMM)
1404+ write(*,*) 'RES2=',RES
1405+ ENDIF
1406+
1407+ END
1408+
1409+
1410+ SUBROUTINE CLOSE_F(Q,M,AMPS,RES)
1411+
1412+ COMPLEX*16 Q(0:3)
1413+ COMPLEX*16 RES
1414+ REAL*8 M
1415+ COMPLEX*16 AMPS(12)
1416+
1417+ RES=(0.D0,0.D0)
1418+ RES=(Q(0)-Q(3))*AMPS(1)+
1419+ & (-Q(1)+(0.0d0,1.0d0)*Q(2))*AMPS(2)+
1420+ & (-Q(1)-(0.0d0,1.0d0)*Q(2))*AMPS(3)+
1421+ & (Q(0)+Q(3))*AMPS(4)+
1422+ & (Q(0)+Q(3))*AMPS(5)+
1423+ & (Q(1)-(0.0d0,1.0d0)*Q(2))*AMPS(6)+
1424+ & (Q(1)+(0.0d0,1.0d0)*Q(2))*AMPS(7)+
1425+ & (Q(0)-Q(3))*AMPS(8)
1426+ IF (M.NE.0.D0) THEN
1427+ RES=RES-M*(AMPS(9)+AMPS(10)+AMPS(11)+AMPS(12))
1428+ ENDIF
1429+
1430+ END
1431+
1432+ SUBROUTINE CLOSE_S(Q,AMP,RES)
1433+
1434+ COMPLEX*16 Q(0:3)
1435+ COMPLEX*16 RES
1436+ COMPLEX*16 AMP
1437+
1438+ RES=(1.D0,0.D0)*AMP
1439+
1440+ END
1441+
1442+C===============================================================================
1443+C Subroutines to create the external wavefunctions of the L-cut particles
1444+C===============================================================================
1445+
1446+c This subroutine is to recreate the fermion propagator with 4 helicities
1447+c only. This has problems with certain configuration of the imaginary
1448+c momentum q, so it is not implemented yet.
1449+
1450+ SUBROUTINE LCUT_F4HEL(Q,M,CFIG,SCD,W)
1451+
1452+ COMPLEX*16 Q(0:3)
1453+ INTEGER CFIG,J
1454+ LOGICAL SCD
1455+ REAL*8 M
1456+ COMPLEX*16 W(20)
1457+
1458+ IF (CFIG.EQ.1) THEN
1459+ IF (SCD) THEN
1460+C UBAR, HEL=-1
1461+ CALL ILXXXX(Q(0),M,-1,1,W(1))
1462+ ELSE
1463+C U, HEL=-1
1464+ CALL ILXXXX(Q(0),M,-1,-1,W(1))
1465+ do J=1,4
1466+ write(*,*) 'Wcf(',j,',1)=',W(1)
1467+ enddo
1468+ ENDIF
1469+ ELSEIF (CFIG.EQ.2) THEN
1470+ IF (SCD) THEN
1471+C UBAR, HEL=1
1472+ CALL ILXXXX(Q(0),M,1,1,W(1))
1473+ ELSE
1474+C U, HEL=1
1475+ CALL ILXXXX(Q(0),M,1,-1,W(1))
1476+ ENDIF
1477+ ELSEIF (CFIG.EQ.3) THEN
1478+ IF (SCD) THEN
1479+C VBAR, HEL=-1,
1480+ CALL OLXXXX(Q(0),M,-1,-1,W(1))
1481+ ELSE
1482+C V, HEL=-1
1483+ CALL OLXXXX(Q(0),M,-1,1,W(1))
1484+ ENDIF
1485+ ELSEIF (CFIG.EQ.4) THEN
1486+ IF (SCD) THEN
1487+C VBAR, HEL=1
1488+ CALL OLXXXX(Q(0),M,1,-1,W(1))
1489+ ELSE
1490+C V, HEL=1
1491+ CALL OLXXXX(Q(0),M,1,1,W(1))
1492+ ENDIF
1493+ ENDIF
1494+C REVERSE THE MOMENTUM IN THE WF FOR THE SECOND L-CUT SPINORS
1495+ IF (SCD) THEN
1496+ W(5)=-Q(0)
1497+ W(6)=-Q(1)
1498+ W(7)=-Q(2)
1499+ W(8)=-Q(3)
1500+ ENDIF
1501+
1502+ END
1503+
1504+ SUBROUTINE LCUT_F(Q,M,CFIG,SCD,W)
1505+
1506+ COMPLEX*16 Q(0:3)
1507+ INTEGER CFIG
1508+ LOGICAL SCD
1509+ REAL*8 M
1510+ COMPLEX*16 W(20)
1511+
1512+ W(1)=(0.d0,0.d0)
1513+ W(2)=(0.d0,0.d0)
1514+ W(3)=(0.d0,0.d0)
1515+ W(4)=(0.d0,0.d0)
1516+
1517+ IF (CFIG.eq.1) then
1518+ IF (SCD) then
1519+ W(3)=(1.d0,0.d0)
1520+ ELSE
1521+ W(1)=(1.d0,0.d0)
1522+ ENDIF
1523+ ELSEIF (CFIG.eq.2) then
1524+ IF (SCD) then
1525+ W(4)=(1.d0,0.d0)
1526+ ELSE
1527+ W(1)=(1.d0,0.d0)
1528+ ENDIF
1529+ ELSEIF (CFIG.eq.3) then
1530+ IF (SCD) then
1531+ W(3)=(1.d0,0.d0)
1532+ ELSE
1533+ W(2)=(1.d0,0.d0)
1534+ ENDIF
1535+ ELSEIF (CFIG.eq.4) then
1536+ IF (SCD) then
1537+ W(4)=(1.d0,0.d0)
1538+ ELSE
1539+ W(2)=(1.d0,0.d0)
1540+ ENDIF
1541+ ELSEIF (CFIG.eq.5) then
1542+ IF (SCD) then
1543+ W(1)=(1.d0,0.d0)
1544+ ELSE
1545+ W(3)=(1.d0,0.d0)
1546+ ENDIF
1547+ ELSEIF (CFIG.eq.6) then
1548+ IF (SCD) then
1549+ W(2)=(1.d0,0.d0)
1550+ ELSE
1551+ W(3)=(1.d0,0.d0)
1552+ ENDIF
1553+ ELSEIF (CFIG.eq.7) then
1554+ IF (SCD) then
1555+ W(1)=(1.d0,0.d0)
1556+ ELSE
1557+ W(4)=(1.d0,0.d0)
1558+ ENDIF
1559+ ELSEIF (CFIG.eq.8) then
1560+ IF (SCD) then
1561+ W(2)=(1.d0,0.d0)
1562+ ELSE
1563+ W(4)=(1.d0,0.d0)
1564+ ENDIF
1565+ ELSEIF (CFIG.eq.9) then
1566+ IF (SCD) then
1567+ W(1)=(1.d0,0.d0)
1568+ ELSE
1569+ W(1)=(1.d0,0.d0)
1570+ ENDIF
1571+ ELSEIF (CFIG.eq.10) then
1572+ IF (SCD) then
1573+ W(2)=(1.d0,0.d0)
1574+ ELSE
1575+ W(2)=(1.d0,0.d0)
1576+ ENDIF
1577+ ELSEIF (CFIG.eq.11) then
1578+ IF (SCD) then
1579+ W(3)=(1.d0,0.d0)
1580+ ELSE
1581+ W(3)=(1.d0,0.d0)
1582+ ENDIF
1583+ ELSEIF (CFIG.eq.12) then
1584+ IF (SCD) then
1585+ W(4)=(1.d0,0.d0)
1586+ ELSE
1587+ W(4)=(1.d0,0.d0)
1588+ ENDIF
1589+ ENDIF
1590+C REVERSE THE MOMENTUM IN THE WF FOR THE SECOND L-CUT SPINORS
1591+ IF (SCD) THEN
1592+ W(5)=-Q(0)
1593+ W(6)=-Q(1)
1594+ W(7)=-Q(2)
1595+ W(8)=-Q(3)
1596+ ELSE
1597+ W(5)=Q(0)
1598+ W(6)=Q(1)
1599+ W(7)=Q(2)
1600+ W(8)=Q(3)
1601+ ENDIF
1602+
1603+ END
1604+
1605+ SUBROUTINE LCUT_CF(Q,M,CFIG,SCD,W)
1606+
1607+ COMPLEX*16 Q(0:3)
1608+ INTEGER CFIG
1609+ LOGICAL SCD
1610+ REAL*8 M
1611+ COMPLEX*16 W(20)
1612+
1613+ IF (CFIG.EQ.1) THEN
1614+ IF (SCD) THEN
1615+C UBAR, HEL=-1
1616+ CALL ICLXXX(Q(0),M,-1,1,W(1))
1617+ ELSE
1618+C U, HEL=-1
1619+ CALL ICLXXX(Q(0),M,-1,-1,W(1))
1620+ ENDIF
1621+ ELSEIF (CFIG.EQ.2) THEN
1622+ IF (SCD) THEN
1623+C UBAR, HEL=1
1624+ CALL ICLXXX(Q(0),M,1,1,W(1))
1625+ ELSE
1626+C U, HEL=1
1627+ CALL ICLXXX(Q(0),M,1,-1,W(1))
1628+ ENDIF
1629+ ELSEIF (CFIG.EQ.3) THEN
1630+ IF (SCD) THEN
1631+C VBAR, HEL=-1,
1632+ CALL OCLXXX(Q(0),M,-1,-1,W(1))
1633+ ELSE
1634+C V, HEL=-1
1635+ CALL OCLXXX(Q(0),M,-1,1,W(1))
1636+ ENDIF
1637+ ELSEIF (CFIG.EQ.4) THEN
1638+ IF (SCD) THEN
1639+C VBAR, HEL=1
1640+ CALL OCLXXX(Q(0),M,1,-1,W(1))
1641+ ELSE
1642+C V, HEL=1
1643+ CALL OCLXXX(Q(0),M,1,1,W(1))
1644+ ENDIF
1645+ ENDIF
1646+C REVERSE THE MOMENTUM IN THE WF FOR THE SECOND L-CUT SPINORS
1647+ IF (SCD) THEN
1648+ W(5)=-Q(0)
1649+ W(6)=-Q(1)
1650+ W(7)=-Q(2)
1651+ W(8)=-Q(3)
1652+ ENDIF
1653+
1654+ END
1655+
1656+ SUBROUTINE LCUT_V(Q,M,CFIG,SCD,W)
1657+
1658+ COMPLEX*16 Q(0:3)
1659+ INTEGER CFIG
1660+ LOGICAL SCD
1661+ REAL*8 M
1662+ COMPLEX*16 W(20)
1663+
1664+ IF (M.NE.0.D0) THEN
1665+ STOP 'Massive vector L-cut particle not supported'
1666+ ENDIF
1667+ W(1)=(0.d0,0.d0)
1668+ W(2)=(0.d0,0.d0)
1669+ W(3)=(0.d0,0.d0)
1670+ W(4)=(0.d0,0.d0)
1671+ IF (CFIG.EQ.1) THEN
1672+ W(1)=(1.d0,0.d0)
1673+ ELSEIF (CFIG.EQ.2) THEN
1674+ W(2)=(1.d0,0.d0)
1675+ ELSEIF (CFIG.EQ.3) THEN
1676+ W(3)=(1.d0,0.d0)
1677+ ELSEIF (CFIG.EQ.4) THEN
1678+ W(4)=(1.d0,0.d0)
1679+ ENDIF
1680+C REVERSE THE MOMENTUM IN THE WF FOR THE SECOND L-CUT VECTORS
1681+ IF (SCD) THEN
1682+ W(5)=-Q(0)
1683+ W(6)=-Q(1)
1684+ W(7)=-Q(2)
1685+ W(8)=-Q(3)
1686+ ELSE
1687+ W(5)=Q(0)
1688+ W(6)=Q(1)
1689+ W(7)=Q(2)
1690+ W(8)=Q(3)
1691+ ENDIF
1692+
1693+ END
1694+
1695+ SUBROUTINE LCUT_S(Q,M,CFIG,SCD,W)
1696+
1697+ COMPLEX*16 Q(0:3)
1698+ REAL*8 M
1699+ INTEGER CFIG
1700+ LOGICAL SCD
1701+ COMPLEX*16 W(20)
1702+
1703+ W(1)=(1.D0,0.D0)
1704+
1705+C REVERSE THE MOMENTUM IN THE WF FOR THE SECOND SCALAR
1706+ IF (SCD) THEN
1707+ W(2)=-Q(0)
1708+ W(3)=-Q(1)
1709+ W(4)=-Q(2)
1710+ W(5)=-Q(3)
1711+ ELSE
1712+ W(2)=Q(0)
1713+ W(3)=Q(1)
1714+ W(4)=Q(2)
1715+ W(5)=Q(3)
1716+ ENDIF
1717+
1718+ END
1719+
1720+C===============================================================================
1721+C Complex-momentum version of the subroutine to create on-shell
1722+C wavefunctions of particles with different spins.
1723+C===============================================================================
1724+
1725+ subroutine ilxxxx(p,ffmass,nhel,nsf,fi)
1726+c
1727+c This subroutine computes a fermion wavefunction with the flowing-IN
1728+c fermion number and defined with complex ONSHELL momentium.
1729+c
1730+c input:
1731+c complex p(0:3) : four-momentum of fermion
1732+c real fmass : mass of fermion
1733+c integer nhel = -1 or 1 : helicity of fermion
1734+c integer nsf = -1 or 1 : +1 for particle, -1 for anti-particle
1735+c
1736+c output:
1737+c complex fi(8) : fermion wavefunction |fi>
1738+c Note: There are 4 components for the spinor and four for the
1739+c momentum.
1740+ implicit none
1741+ double complex fi(8),chi(2), fmass
1742+c double precision p(0:3),sf(2),sfomeg(2),omega(2),fmass,
1743+c & pp,pp3,sqp0p3,sqm(0:1)
1744+ double complex sqm(0:1)
1745+ double precision sf(2),ffmass
1746+ double complex p(0:3), sfomeg(2),omega(2),
1747+ & pp,pp3,sqp0p3
1748+ integer nhel,nsf,ip,im,nh
1749+
1750+ double precision rZero, rHalf, rTwo
1751+ parameter( rZero = 0.0d0, rHalf = 0.5d0, rTwo = 2.0d0 )
1752+
1753+
1754+
1755+c fi(5) = dcmplx(p(0),p(3))*nsf
1756+c fi(6) = dcmplx(p(1),p(2))*nsf
1757+ fi(5) = p(0)*nsf
1758+ fi(6) = p(1)*nsf
1759+ fi(7) = p(2)*nsf
1760+ fi(8) = p(3)*nsf
1761+
1762+ nh = nhel*nsf
1763+
1764+ fmass = sqrt(p(0)**2-p(1)**2-p(2)**2-p(3)**2)
1765+
1766+ if ( ffmass.ne.rZero ) then
1767+c special treatment for massless particles.
1768+c pp = min(p(0),sqrt(p(1)**2+p(2)**2+p(3)**2))
1769+ pp=sqrt(p(1)**2+p(2)**2+p(3)**2)
1770+c for time-like four-momenta we can always think of it as the p_vec^2
1771+ if ( abs(pp).eq.rZero ) then
1772+c particle at rest.
1773+ sqm(0) = sqrt(fmass) ! possibility of negative fermion masses
1774+ sqm(1) = sqm(0) ! possibility of negative fermion masses
1775+ ip = (1+nh)/2
1776+ im = (1-nh)/2
1777+
1778+ fi(1) = ip * sqm(ip)
1779+ fi(2) = im*nsf * sqm(ip)
1780+ fi(3) = ip*nsf * sqm(im)
1781+ fi(4) = im * sqm(im)
1782+
1783+ else
1784+c standard spinor
1785+
1786+ pp=sqrt(p(1)**2+p(2)**2+p(3)**2)
1787+ write(*,*) 'ppre=',pp
1788+c if( (dble(p(0)) .lt. 0 .and. dble(pp) .gt. 0) .or.
1789+c & (dble(p(0)) .lt. 0 .and. dble(pp) .gt. 0) ) then
1790+c pp=-pp
1791+c endif
1792+ sf(1) = dble(1+nsf+(1-nsf)*nh)*rHalf
1793+c fermion spin using HELAS conventions.
1794+ sf(2) = dble(1+nsf-(1-nsf)*nh)*rHalf
1795+ omega(1) = sqrt(p(0)+pp)
1796+c the omega of the definition.
1797+c omega(2) = fmass/omega(1)
1798+ omega(2) = sqrt(p(0)-pp)
1799+c the prefactor
1800+ ip = (3+nh)/2
1801+ im = (3-nh)/2
1802+ sfomeg(1) = sf(1)*omega(ip)
1803+ sfomeg(2) = sf(2)*omega(im)
1804+c pp3 = max(pp+p(3),rZero)
1805+ pp3=pp+p(3)
1806+ chi(1) = sqrt(pp3*rHalf/pp)
1807+ if ( abs(pp3).eq.rZero ) then
1808+ chi(2) = dcmplx(-nh )
1809+ else
1810+ chi(2) = ( (nh*p(1)) + ((0d0,1d0)*p(2)) )/
1811+ .sqrt(rTwo*pp*pp3)
1812+ endif
1813+
1814+
1815+c Write(*,*) 'Chi=',Chi(1),' and ',Chi(2)
1816+
1817+ fi(1) = sfomeg(1)*chi(im)
1818+ fi(2) = sfomeg(1)*chi(ip)
1819+c Write(*,*) 'fi(2)=',fi(2)
1820+ fi(3) = sfomeg(2)*chi(im)
1821+c Write(*,*) 'fi(3)=',fi(3)
1822+ fi(4) = sfomeg(2)*chi(ip)
1823+
1824+ endif
1825+
1826+ else
1827+
1828+c if(zabs(p(1)).eq.0d0.and.zabs(p(2)).eq.0d0.and.
1829+c .zabs(p(3)).lt.0d0) then
1830+c sqp0p3 = 0d0
1831+c else
1832+ sqp0p3 = sqrt(p(0)+p(3))*nsf
1833+c end if
1834+ chi(1) = sqp0p3
1835+ if ( abs(sqp0p3).eq.rZero ) then
1836+ chi(2) = dcmplx(-nhel )*sqrt(rTwo*p(0))
1837+ else
1838+ chi(2) = ( nh*p(1) + ((0d0,1d0)*p(2) ) )/sqp0p3
1839+ endif
1840+ if ( nh.eq.1 ) then
1841+ fi(1) = dcmplx( rZero )
1842+ fi(2) = dcmplx( rZero )
1843+ fi(3) = chi(1)
1844+ fi(4) = chi(2)
1845+ else
1846+ fi(1) = chi(2)
1847+ fi(2) = chi(1)
1848+ fi(3) = dcmplx( rZero )
1849+ fi(4) = dcmplx( rZero )
1850+ endif
1851+ endif
1852+
1853+ return
1854+ end
1855+
1856+ subroutine olxxxx(p,ffmass,nhel,nsf,fo)
1857+c
1858+c This subroutine computes a fermion wavefunction with the flowing-OUT
1859+c fermion number and defined with complex ONSHELL momentum.
1860+c
1861+c input:
1862+c complex p(0:3) : four-momentum of fermion
1863+c real fmass : mass of fermion
1864+c integer nhel = -1 or 1 : helicity of fermion
1865+c integer nsf = -1 or 1 : +1 for particle, -1 for anti-particle
1866+c
1867+c output:
1868+c complex fo(8) : fermion wavefunction <fo|
1869+c
1870+ implicit none
1871+ double complex fo(8),chi(2), fmass
1872+
1873+ double complex sqm(0:1)
1874+ double precision sf(2), ffmass
1875+
1876+ double complex p(0:3),sfomeg(2),omega(2),
1877+ & pp,pp3,sqp0p3
1878+ integer nhel,nsf,nh,ip,im
1879+
1880+ double precision rZero, rHalf, rTwo
1881+ parameter( rZero = 0.0d0, rHalf = 0.5d0, rTwo = 2.0d0 )
1882+
1883+
1884+c fo(5) = dcmplx(p(0),p(3))*nsf
1885+c fo(6) = dcmplx(p(1),p(2))*nsf
1886+ fo(5) = p(0)*(nsf)
1887+ fo(6) = p(1)*(nsf)
1888+ fo(7) = p(2)*(nsf)
1889+ fo(8) = p(3)*(nsf)
1890+
1891+ nh = nhel*nsf
1892+
1893+ fmass=sqrt(p(0)**2-p(1)**2-p(2)**2-p(3)**2)
1894+
1895+ if ( ffmass.ne.rZero ) then
1896+
1897+c pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2))
1898+ pp=sqrt(p(1)**2+p(2)**2+p(3)**2)
1899+
1900+ if ( abs(pp).eq.rZero ) then
1901+
1902+ sqm(0) = sqrt(fmass) ! possibility of negative fermion masses
1903+ sqm(1) = sqm(0) ! possibility of negative fermion masses
1904+ ip = -((1+nh)/2)
1905+ im = (1-nh)/2
1906+
1907+ fo(1) = im * sqm(im)
1908+ fo(2) = ip*nsf * sqm(im)
1909+ fo(3) = im*nsf * sqm(-ip)
1910+ fo(4) = ip * sqm(-ip)
1911+
1912+ else
1913+
1914+c pp = min(p(0),dsqrt(p(1)**2+p(2)**2+p(3)**2))
1915+ pp=sqrt(p(1)**2+p(2)**2+p(3)**2) !repetition
1916+c if( (dble(p(0)) .lt. 0 .and. dble(pp) .gt. 0) .or.
1917+c & (dble(p(0)) .lt. 0 .and. dble(pp) .gt. 0) ) then
1918+c pp=-pp
1919+c endif
1920+ sf(1) = dble(1+nsf+(1-nsf)*nh)*rHalf
1921+ sf(2) = dble(1+nsf-(1-nsf)*nh)*rHalf
1922+ omega(1) = sqrt(p(0)+pp)
1923+c omega(2) = fmass/omega(1)
1924+ omega(2) = sqrt(p(0)-pp)
1925+ ip = (3+nh)/2
1926+ im = (3-nh)/2
1927+ sfomeg(1) = sf(1)*omega(ip)
1928+ sfomeg(2) = sf(2)*omega(im)
1929+ pp3 = pp+p(3)
1930+ chi(1) = sqrt(pp3*rHalf/pp)
1931+ if ( abs(pp3).eq.rZero ) then
1932+ chi(2) = dcmplx(-nh )
1933+ else
1934+ chi(2) = ( nh*p(1) - ((0d0,1d0)*p(2)) )/
1935+ .sqrt(rTwo*pp*pp3)
1936+ endif
1937+
1938+ fo(1) = sfomeg(2)*chi(im)
1939+ fo(2) = sfomeg(2)*chi(ip)
1940+ fo(3) = sfomeg(1)*chi(im)
1941+ fo(4) = sfomeg(1)*chi(ip)
1942+
1943+ endif
1944+
1945+ else
1946+
1947+c if(zabs(p(1)).eq.0d0.and.zabs(p(2)).eq.0d0.and.zabs(p(3)).lt.0d0) then
1948+c sqp0p3 = 0d0
1949+c else
1950+ sqp0p3 = sqrt(p(0)+p(3))*nsf
1951+c end if
1952+ chi(1) = sqp0p3
1953+ if ( abs(sqp0p3).eq.rZero ) then
1954+ chi(2) = dcmplx(-nhel )*sqrt(rTwo*p(0))
1955+ else
1956+ chi(2) = ( nh*p(1)-((0d0,1d0)*p(2)) )/sqp0p3
1957+ endif
1958+ if ( nh.eq.1 ) then
1959+ fo(1) = chi(1)
1960+ fo(2) = chi(2)
1961+ fo(3) = dcmplx( rZero )
1962+ fo(4) = dcmplx( rZero )
1963+ else
1964+ fo(1) = dcmplx( rZero )
1965+ fo(2) = dcmplx( rZero )
1966+ fo(3) = chi(2)
1967+ fo(4) = chi(1)
1968+ endif
1969+
1970+ endif
1971+c
1972+ return
1973+ end
1974+
1975+
1976+C The subroutine with charge conjugation are not yet implemented
1977+
1978+ subroutine oclxxx(p,ffmass,nhel,nsf,fo)
1979+
1980+ implicit none
1981+ double complex fo(8),p(0:3)
1982+ double precision ffmass
1983+ integer nhel,nsf
1984+
1985+ CALL olxxxx(p,ffmass,nhel,nsf,fo)
1986+
1987+ end
1988+
1989+ subroutine iclxxx(p,ffmass,nhel,nsf,fi)
1990+
1991+ implicit none
1992+ double complex fi(8),p(0:3)
1993+ double precision ffmass
1994+ integer nhel,nsf
1995+
1996+ CALL ilxxxx(p,ffmass,nhel,nsf,fi)
1997+
1998+ end
1999
2000=== added directory 'loop_material'
2001=== added directory 'loop_material/CutTools'
2002=== added directory 'loop_material/CutTools/DOC'
2003=== added file 'loop_material/CutTools/DOC/cuttools.pdf'
2004Binary files loop_material/CutTools/DOC/cuttools.pdf 1970-01-01 00:00:00 +0000 and loop_material/CutTools/DOC/cuttools.pdf 2012-02-27 13:42:21 +0000 differ
2005=== added file 'loop_material/CutTools/DOC/cuttools.ps.gz'
2006Binary files loop_material/CutTools/DOC/cuttools.ps.gz 1970-01-01 00:00:00 +0000 and loop_material/CutTools/DOC/cuttools.ps.gz 2012-02-27 13:42:21 +0000 differ
2007=== added file 'loop_material/CutTools/DOC/mpfun90.ps.gz'
2008Binary files loop_material/CutTools/DOC/mpfun90.ps.gz 1970-01-01 00:00:00 +0000 and loop_material/CutTools/DOC/mpfun90.ps.gz 2012-02-27 13:42:21 +0000 differ
2009=== added file 'loop_material/CutTools/DOC/mpfun90.tex.gz'
2010Binary files loop_material/CutTools/DOC/mpfun90.tex.gz 1970-01-01 00:00:00 +0000 and loop_material/CutTools/DOC/mpfun90.tex.gz 2012-02-27 13:42:21 +0000 differ
2011=== added file 'loop_material/CutTools/README'
2012--- loop_material/CutTools/README 1970-01-01 00:00:00 +0000
2013+++ loop_material/CutTools/README 2012-02-27 13:42:21 +0000
2014@@ -0,0 +1,449 @@
2015+------------------------------------------------------------------------
2016+------------------------------------------------------------------------
2017+
2018+ CutTools V1.6.9 (Dec 16 2011)
2019+
2020+ contact author: pittau@ugr.es
2021+
2022+ - Authors: Giovanni Ossola, Costas G. Papadopoulos, Roberto Pittau
2023+
2024+ - When using this code, please quote the following 4 papers:
2025+
2026+ \bibitem{CutTools}
2027+ G.~Ossola, C.~G.~Papadopoulos and R.~Pittau,
2028+ %``CutTools: a program implementing the OPP reduction method
2029+ %to compute one-loop amplitudes,''
2030+ arXiv:0711.3596 [hep-ph].
2031+ %%CITATION = ARXIV:0711.3596;%%
2032+
2033+ \bibitem{Ossola:2006us}
2034+ G.~Ossola, C.~G.~Papadopoulos and R.~Pittau,
2035+ %``Reducing full one-loop amplitudes to scalar integrals at the integrand
2036+ %level,''
2037+ Nucl.\ Phys.\ B {\bf 763} (2007) 147 [arXiv:hep-ph/0609007].
2038+ %%CITATION = NUPHA,B763,147;%%
2039+
2040+ \bibitem{Ossola:2008xq}
2041+ G.~Ossola, C.~G.~Papadopoulos and R.~Pittau,
2042+ %``On the Rational Terms of the one-loop amplitudes,''
2043+ JHEP {\bf 0805} (2008) 004
2044+ [arXiv:0802.1876 [hep-ph]].
2045+ %%CITATION = JHEPA,0805,004;%%
2046+
2047+ \bibitem{Ossola:2007bb}
2048+ G.~Ossola, C.~G.~Papadopoulos and R.~Pittau,
2049+ %``Numerical Evaluation of Six-Photon Amplitudes,''
2050+ JHEP {\bf 0707} (2007) 085
2051+ [arXiv:0704.1271 [hep-ph]].
2052+ %%CITATION = JHEPA,0707,085;%%
2053+
2054+ - When using this code, together with the routines in
2055+ avh_olo_s4.f, please quote also the 2 papers:
2056+
2057+ A. van Hameren,
2058+ Comput.Phys.Commun. 182 (2011) 2427-2438, arXiv:1007.4716
2059+ A. van Hameren, C.G. Papadopoulos and R. Pittau,
2060+ JHEP 0909:106,2009, arXiv:0903.4665
2061+
2062+ - When using this code, together with the routines in
2063+ qcdloop, please quote also the paper:
2064+
2065+ \bibitem{Ellis:2007qk}
2066+ R.~K.~Ellis and G.~Zanderighi,
2067+ %``Scalar one-loop integrals for QCD,''
2068+ JHEP {\bf 0802} (2008) 002
2069+ [arXiv:0712.1851 [hep-ph]].
2070+ %%CITATION = ARXIV:0712.1851;%%
2071+
2072+ - !!Do not forget that the rational part R2 should be provided externally!!
2073+ (see, for example, arXiv:1111.4965 [hep-ph]
2074+ arXiv:0910.3130 [hep-ph]
2075+ arXiv:0903.0356 [hep-ph])
2076+
2077+---------------------------------------------------------------------------
2078+---------------------------------------------------------------------------
2079+
2080+To compile and to test the program:
2081+----------------------------------
2082+edit the first line of the makefile and set the option for the multiprecision
2083+computation between PRECISION= MP (internal multiprecision routines) and
2084+PRECISION= QP (quadruple precision compiler, if supported by your system)
2085+
2086+Then type:
2087+
2088+ > make
2089+
2090+This will produce the directory "includects", containing the *.h files, the
2091+*.mod files and the library "libcts.a". The whole directory "includects"
2092+and the library "libcts.a", should be present (on linked with a soft link)
2093+in your working directory (called "examples" in the following).
2094+
2095+To check your installation:
2096+--------------------------
2097+go to the working directory "examples" and type
2098+
2099+ > make
2100+
2101+Then, check the implementation of the multiprecision routines by typing
2102+
2103+ > make mpcheck
2104+
2105+To compare with reference outputs contained in "examples/testdir", type
2106+
2107+ > make test
2108+
2109+In directory "examples" will then appear the file "testoutput", containing the
2110+differences between the generates outputs (out*_ccc) and the reference
2111+ones (out*_ref) contained in "examples/testdir.
2112+
2113+How to use the program:
2114+-----------------------
2115+Your own numerator function to be "CutToolized" should be written in the file
2116+"numerators.f", that is also included in the directory "examples".
2117+When provided, a multi-precision version of it should be put in
2118+"mpnumerators.f90".
2119+If you want to work in another directory, the whole directory "includects"
2120+and the library "libcts.a", should be present (on linked with a soft link)
2121+in that directory.
2122+
2123+To perform the computation, three subroutines should be called
2124+
2125+ call ctsinit (to initialize cuttools)
2126+ call ctsxcut (to get the amplitude amp and R1)
2127+ call ctsstatistics (to get statistical information on the run)
2128+
2129+In particular:
2130+
2131+ ctsinit:
2132+
2133+!---------------------------------------------------------------------
2134+! To initialize CutTools call ctsinit(limitvalue,scaloop)
2135+!
2136+! INPUT:
2137+!
2138+! real*8 limitvalue -> limit of precision below which
2139+! the PS point is considered stable
2140+! by tha A=A test (see below)
2141+!
2142+! integer scaloop -> library used to compute the scalar
2143+! 1-loop functions:
2144+! scaloop= 1 -> looptools (not implemented)
2145+! scaloop= 2 -> avh (complex masses)
2146+! scaloop= 3 -> qcdloop.
2147+! OUTPUT: none
2148+!---------------------------------------------------------------------
2149+
2150+ ctsxcut:
2151+
2152+!---------------------------------------------------------------------
2153+! To compute the 1-loop amplitude
2154+!
2155+! call ctsxcut(imode,rootsvalue,muscale,number_propagators,test,
2156+! & mpfortest,rnk,pp,m2,amp,ampcc,ampr1,stable)
2157+!
2158+!
2159+! INPUT: integer imode -> the running mode of CutTools according
2160+! to the following scheme:
2161+!
2162+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2163+!! !
2164+!! imode:| actions performed by ctsxcut: !
2165+!! | !
2166+!! 0 | (dp_dir,dp_inv)-> dp_Atest -> stable -> (only if stable=.false.) ->!
2167+!! | (mp_dir,mp_inv)-> mp_Atest -> stable !
2168+!! 1 | (dp_dir) -> dp_Ntest -> stable !
2169+!! 2 | (dp_inv) -> dp_Ntest -> stable !
2170+!! 3 | (dp_dir,dp_inv)-> dp_Atest -> stable !
2171+!! 4 | (mp_dir) -> mp_Ntest -> stable !
2172+!! 5 | (mp_inv) -> mp_Ntest -> stable !
2173+!! 6 | (mp_dir,mp_inv)-> mp_Atest -> stable !
2174+!! !
2175+!! Legenda: !
2176+!! !
2177+!! dp_dir = compute amp in double precision with normal propagator order !
2178+!! dp_inv = compute amp in double precision with reversed propagator order !
2179+!! mp_dir = compute amp in multi precision with normal propagator order !
2180+!! mp_inv = compute amp in multi precision with reversed propagator order !
2181+!! dp_Atest = perform the A=A test in double precision !
2182+!! mp_Atest = perform the A=A test in multi precision !
2183+!! dp_Ntest = perform the N=N test in double precision !
2184+!! mp_Ntest = perform the N=N test in multi precision !
2185+!! -> stable = set stable=.true. or stable=.false. !
2186+!! according to the outcome of the test !
2187+!! !
2188+!! Tests: !
2189+!! !
2190+!! -The N=N test is a test on the reconstructed OPP integrand performed !
2191+!! by comparing original and reconstacted integrands at an arbirtary value !
2192+!! of the integration momentum. !
2193+!! !
2194+!! -The A=A test checks the 2 amplitudes obtained with dir and inv orders !
2195+!! of the propagators given in the input !
2196+!! Notes: !
2197+!! !
2198+!! a) imode= 0 is recommended, unless you really know what you are doing. !
2199+!! !
2200+!! b) When two determinations of amp are available, that one with more !
2201+!! accurate recounstructed numerator (coming from the N=N test) is used. !
2202+!! !
2203+!! c) When running in multi precision with scaloop= 3 (qcdloop), the loop !
2204+!! functions are computed in double precision only. A full multi !
2205+!! precision result can only be obtained with scaloop= 2 (OneLoop). !
2206+!! !
2207+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2208+!
2209+! real*8 rootsvalue -> the arbitrary OPP scale
2210+! set event by event.
2211+!
2212+! real*8 muscale -> the scale for the 1-loop integrals
2213+! set event by event.
2214+! It has dimension of an energy.
2215+!
2216+! integer number_propagators -> number of propagators.
2217+!
2218+! external test -> name of the subroutine
2219+! computing N(q).
2220+!
2221+! external mpfortest -> name of the subroutine
2222+! computing N(q) in
2223+! multi-precision (if absent
2224+! put dummy).
2225+!
2226+! integer rnk -> the maximum rank of N(q) (if
2227+! unknown put number_propagators).
2228+!
2229+! real*8 pp(0:3,0:number_propagators-1)
2230+! -> momenta flowing in the internal
2231+! propagators.
2232+!
2233+! complex*16 m2(0:number_propagators-1)
2234+! -> masses squared of the internal
2235+! propagators. When scaloop supports it,
2236+! they can be complex. When scaloop does
2237+! not support complex masses, only
2238+! the real part of m2 is used.
2239+!
2240+!
2241+! OUTPUT: complex*16 amp(0:2) -> Amplitude (without r2):
2242+! amp(0) is the total finite part
2243+! (INCLUDING R1!!!)
2244+! amp(1) is the coeff. of 1/eps pole
2245+! amp(2) is the coeff. of 1/eps^2 pole.
2246+!
2247+! complex*16 ampcc -> the Cut Constructible contribution
2248+! complex*16 ampr1 -> the R1 contribution
2249+! (NOTE that ampcc+ampr1 = amp(0))
2250+!
2251+! logical stable -> .false. if CutTools detects
2252+! numerical instabilities.
2253+!---------------------------------------------------------------------
2254+
2255+ ctsstatistics:
2256+
2257+!---------------------------------------------------------------------
2258+! To know the statistics of the run call ctsstatistics(discarded)
2259+!
2260+! INPUT : none
2261+!
2262+! OUTPUT: logical discarded -> .true. if there are discarded PS points
2263+!
2264+! Print out of the statistics of the run:
2265+!
2266+! n_mp -> n.of points evaluated in multi-precision.
2267+! n_disc -> n.of discarded points.
2268+! n_tot -> n.of calls to ctsxcut
2269+!---------------------------------------------------------------------
2270+
2271+An explicit example is presented in the file "examples/example0.f".
2272+The file "examples/ooutput0" contains the output you should obtain when
2273+compiling and running example0.f in the directory "examples"
2274+(to copile it, just go to that directory and type
2275+
2276+ > make)
2277+
2278+---------------------------------------------------------------------------
2279+---------------------------------------------------------------------------
2280+
2281+ Some history of the current version:
2282+
2283+ 25 Jan 2007:
2284+
2285+ Towards a version with m-denominators
2286+
2287+ 09 Apr 2008:
2288+
2289+- in dp_cutting4:
2290+ if (real(cb3).le.0.d0) then changed to
2291+ if (real(cb3).lt.0.d0) then
2292+
2293+- in mp_cutting4:
2294+ if (mpreal(cb3).le.0.d0) then changed to
2295+ if (mpreal(cb3).lt.0.d0)
2296+
2297+- corrected test_rat in multiprecision (d_6 was not properly allocated
2298+ when printing out its value)
2299+
2300+ 24 Jun 2008:
2301+
2302+- in dp_cutting4 and mp_cutting4: corrected the roots of the quadratic
2303+ equations to always get precise results
2304+- corrected l3 and l4 computation to always get precise results
2305+- The N=N test changed using now the m momenta appearing in the m denominators
2306+- program restructured to interface with Formcalc/Feyncalc
2307+ (call dcut,ccut etc...)
2308+
2309+ 28 July 2008:
2310+
2311+- The N=N test now also contains a small component with a generic q
2312+
2313+ 02 September 2008:
2314+
2315+- new algorithm implemented for calculating Rational Terms with inf=.true.
2316+
2317+ 04 September 2008:
2318+
2319+- dp_getd amd mp_getd modified to call the num function only 2 times.
2320+
2321+ 24 September 2008:
2322+
2323+- Corrected error in subroutine getdloop (cts_loopfunctions.f90)
2324+
2325+ wrong -> k2 = den(bn4(np,3,i))%p-den(bn4(np,2,1))%p
2326+ right -> k2 = den(bn4(np,3,i))%p-den(bn4(np,2,i))%p
2327+
2328+ October 30 2008:
2329+
2330+- interface with general avh routines
2331+- corrected wrong scaless b11 function in cts_loopfunctions.f90: it was not 0.
2332+
2333+ November 04 2008:
2334+
2335+- interface with qcdloop (still to be activated at the compilation level)
2336+- changed the basis for the 1-point functions
2337+
2338+ December 01 2008:
2339+
2340+- changed the basis for the 2-point functions
2341+
2342+ January 23 2009:
2343+
2344+- interface with qcdloop activated
2345+- loptools library disactivated (because of conflicts with qcdloop)
2346+
2347+ July 2 2009:
2348+
2349+- try to make of it the official version V1.1
2350+
2351+- August 20 2009:
2352+
2353+- makefile simplified, eliminated configure, eliminated LoopTools
2354+- qcdloop version 1.9 replaces qcdloop version 1.8
2355+ (problem fixed in qlbox15.f)
2356+- makefile modified to run on DOS/Windows Platforms as well
2357+
2358+- November 19 2009:
2359+
2360+- m^2 (and not m!) as an input in acut,...,xcut
2361+- thrs added as an input in ctsinit
2362+- new bases in the 3,2 and 1 point sectors
2363+- N(q) is called the minimum amount of times
2364+- N = N test only performed with q = -momenta in the denominators
2365+- flag inf1 added to choose amomg 2 different ways to compute R_1
2366+ in the 4 point sector in the qt2 -> limit
2367+- version of avh_olo with complex masses
2368+
2369+- June 1 2010:
2370+
2371+- new test for the numerical accuracy based on a re-fitting
2372+ the re-constructed numerator at different values of qt2.
2373+ The test is now trustable.
2374+ The computation time is larger for simple Numerator functions because
2375+ the fitted ones takes more time. In real life, when N(q) is complicated
2376+ that should be OK.
2377+- The 4-point part of R_1 is obtained with a new algorithm.
2378+- Most of the times, computing N(q) in double precision and
2379+ all the fitting procedure in mprec ADJUSTS the bad points.
2380+ See mpnumerators.f90 and example1.f to see how to achieve that.
2381+- Routines acut, bcut, ccut, dcut ... eliminated from
2382+ cts_cutroutines.f90
2383+- example2.f eliminated
2384+- R_1 separated from the rest of the amplitude (HELAC-NLO convention)
2385+
2386+- February 4 2011:
2387+
2388+- eliminated any use of dynamical memory
2389+- loose N=N test added to avoid large unstable weights
2390+
2391+- February 10 2011:
2392+
2393+- computing R_1 by colling Num (not Numrec). This gives more numerical
2394+ stability
2395+- updated version of mprec implemented
2396+
2397+- March 1 2011:
2398+
2399+- computing R_1 and amp1 by calling Num (not Numrec) ONLY in multiprecision
2400+ to comprimize between speed and accuracy
2401+- declarations of real, complex, mp_real and mp_complex
2402+ variables put in include files
2403+- put parameter maxden in cts_combinatorics.f90 and inserted protection
2404+ when number_propagators > maxden
2405+- inserted rootsvalue and muscalein in the input of ctsxcut
2406+- introduced 2 new files cts_combinatorics.f90 and cts_combinatorics.f90, to
2407+ organize better the code
2408+
2409+- March 18 2011:
2410+
2411+- double-double precision routines implemented (significantly faster)
2412+- mptest program added in diectory examples to test the implementation
2413+ of the multiprecision routines
2414+
2415+- May 9 2011:
2416+
2417+- double-double precision routines my be buggy: old multiprecision
2418+ re-implemented
2419+- maxden= 6 in this version (to be re-fixed soon)
2420+- option dmr= -1 implemented when 1 denominator is present in the numerator
2421+ function
2422+
2423+- June 5 2011:
2424+
2425+- generic choice of maxden reinserted in /src/cts/cts_combinatorics.f90
2426+- an automatic test of the cuttools implementation on the user's platform
2427+ is now available
2428+- forcemp flag added to force the code to switch in multiprecision
2429+
2430+- October 19 2011:
2431+
2432+- new test for numerical precision introduced, based on reversing the order
2433+ of the denominators at the input level
2434+
2435+- the threshold for testmp has been put to 10^-11 (rnk= 4) in this version,
2436+ because the loop functions are computed in double precision only
2437+
2438+- November 24 2011:
2439+
2440+- inclusion of new fortran95 version of OneLOop in this version
2441+
2442+- December 16 2011:
2443+
2444+- mp_OneLOop implemented in this version
2445+
2446+- the threshold for testmp has been re-put to 10^-21 and rnk= 6
2447+
2448+- input/output of ctsxcut, ctsinit and ctsstatistics restructured
2449+
2450+- imode options intruduced in ctsxcut
2451+
2452+- mp/qp option introduced in the makefile
2453+
2454+- DOS/Windows Platforms optiond eliminated from the makefile
2455+
2456+- Jan 17 2012:
2457+
2458+- Bug corrected in OneLOop-2.2:In "subroutine box16"
2459+ sm1 = cmplx(abs(rmu)) -> cmplx(abs(rmu),kind=kindc2)
2460+
2461+---------------------------------------------------------------------------
2462+Last modification of this document: Jan 17 2012
2463+---------------------------------------------------------------------------
2464
2465=== added directory 'loop_material/CutTools/examples'
2466=== added file 'loop_material/CutTools/examples/cts_mpc.h'
2467--- loop_material/CutTools/examples/cts_mpc.h 1970-01-01 00:00:00 +0000
2468+++ loop_material/CutTools/examples/cts_mpc.h 2012-02-27 13:42:21 +0000
2469@@ -0,0 +1,1 @@
2470+ type(mp_complex)&
2471
2472=== added file 'loop_material/CutTools/examples/cts_mpr.h'
2473--- loop_material/CutTools/examples/cts_mpr.h 1970-01-01 00:00:00 +0000
2474+++ loop_material/CutTools/examples/cts_mpr.h 2012-02-27 13:42:21 +0000
2475@@ -0,0 +1,1 @@
2476+ type(mp_real)&
2477
2478=== added file 'loop_material/CutTools/examples/cts_mprec.h'
2479--- loop_material/CutTools/examples/cts_mprec.h 1970-01-01 00:00:00 +0000
2480+++ loop_material/CutTools/examples/cts_mprec.h 2012-02-27 13:42:21 +0000
2481@@ -0,0 +1,1 @@
2482+ use mpmodule
2483
2484=== added file 'loop_material/CutTools/examples/example0.f'
2485--- loop_material/CutTools/examples/example0.f 1970-01-01 00:00:00 +0000
2486+++ loop_material/CutTools/examples/example0.f 2012-02-27 13:42:21 +0000
2487@@ -0,0 +1,263 @@
2488+!---------------------------------------------------------------------
2489+! EXAMPLE OF MAIN PROGRAM
2490+!
2491+! Pourpose of the program:
2492+! -----------------------
2493+!
2494+!
2495+! / N(q)
2496+! Computing amp= | d^n q ------------------------
2497+! / D_0 D_1 D_2 D_3 D_4 D_5
2498+!
2499+!
2500+! General Structure of the program:
2501+! --------------------------------
2502+!
2503+! To perform the computation, three subroutines should be called
2504+!
2505+! call ctsinit (to initialize cuttools)
2506+! call ctsxcut (to get the amplitude amp and R1)
2507+! call ctsstatistics (to get statistical information on the run)
2508+!
2509+! as detailed below.
2510+!---------------------------------------------------------------------
2511+!
2512+ program example0
2513+ implicit none
2514+! !----------------------------------!
2515+ external test ! Name of the subroutine computing !
2516+! ! the numerator function N(q). !
2517+! ! Location: numerators.f. !
2518+! !----------------------------------!
2519+!
2520+! !---------------------------------------!
2521+ external mptest ! Name of the mpsubroutine (if present) !
2522+! ! computing the numerator function N(q).!
2523+! ! in multiprecision. !
2524+! ! Location: mpnumerators.f90. !
2525+! ! If absent put 'external dummy' !
2526+! !---------------------------------------!
2527+!
2528+!---------------------------------------------------------------------
2529+
2530+ common/rango/rango ! only used by the toy numerators test and mptest
2531+ complex*16 amp(0:2),ampcc,ampr1
2532+ real*8 rootsvalue,limitvalue,muscale
2533+ real*8 pp(0:3,0:5)
2534+ complex*16 m2(0:5)
2535+ integer number_propagators
2536+ integer rnk,rango,imode
2537+ integer scaloop
2538+ logical stable,discarded
2539+!
2540+ rootsvalue= 50.d0
2541+ limitvalue= 1.d-2
2542+ imode = 0
2543+ scaloop= 2
2544+ muscale= 1.d0
2545+!---------------------------------------------------------------------
2546+! To initialize CutTools call ctsinit(limitvalue,scaloop)
2547+!
2548+! INPUT:
2549+!
2550+! real*8 limitvalue -> limit of precision below which
2551+! the PS point is considered stable
2552+! by tha A=A test.
2553+!
2554+! integer scaloop -> library used to compute the scalar
2555+! 1-loop functions:
2556+! scaloop= 1 -> looptools (not implemented)
2557+! scaloop= 2 -> avh (complex masses)
2558+! scaloop= 3 -> qcdloop.
2559+! OUTPUT: none
2560+!---------------------------------------------------------------------
2561+ call ctsinit(limitvalue,scaloop)
2562+
2563+ number_propagators= 6
2564+ rango= 6
2565+ rnk= rango
2566+!
2567+! momenta flowing in the 6 internal propagators:
2568+!
2569+! 0 is the energy component
2570+! 1 is the x component
2571+! 2 is the y component
2572+! 3 is the z component
2573+!
2574+ pp(0,0)= 0.d0
2575+ pp(1,0)= 0.d0
2576+ pp(2,0)= 0.d0
2577+ pp(3,0)= 0.d0
2578+!
2579+ pp(0,1)= 25.d0
2580+ pp(1,1)= 0.d0
2581+ pp(2,1)= 0.d0
2582+ pp(3,1)= -25.d0
2583+!
2584+ pp(0,2)= 12.2944131682730d0
2585+ pp(1,2)= 1.03940959319740d0
2586+ pp(2,2)= -6.52053527152409d0
2587+ pp(3,2)= -35.8551455176305d0
2588+!
2589+ pp(0,3)= -3.11940819171487d0
2590+ pp(1,3)= 16.2625830020165d0
2591+ pp(2,3)= -7.82868841887933d0
2592+ pp(3,3)= -33.8229999456535d0
2593+!
2594+ pp(0,4)= -4.47137880909124d0
2595+ pp(1,4)= 15.9241558606968d0
2596+ pp(2,4)= -8.11309412871339d0
2597+ pp(3,4)= -35.1006560075423d0
2598+!
2599+ pp(0,5)= -25.d0
2600+ pp(1,5)= 0.d0
2601+ pp(2,5)= 0.d0
2602+ pp(3,5)= -25.d0
2603+!
2604+! masses of the 6 internal propagators:
2605+!
2606+ m2(0)= 0.d0
2607+ m2(1)= 0.d0
2608+ m2(2)= 0.d0
2609+ m2(3)= 0.d0
2610+ m2(4)= 0.d0
2611+ m2(5)= 0.d0
2612+!---------------------------------------------------------------------
2613+! To compute the 1-loop amplitude
2614+!
2615+! call ctsxcut(imode,rootsvalue,muscale,number_propagators,test,
2616+! & mpfortest,rnk,pp,m2,amp,ampcc,ampr1,stable)
2617+!
2618+!
2619+! INPUT: integer imode -> the running mode of CutTools according
2620+! to the following scheme:
2621+!
2622+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2623+!! !
2624+!! imode:| actions performed by ctsxcut: !
2625+!! | !
2626+!! 0 | (dp_dir,dp_inv)-> dp_Atest -> stable -> (only if stable=.false.) ->!
2627+!! | (mp_dir,mp_inv)-> mp_Atest -> stable !
2628+!! 1 | (dp_dir) -> dp_Ntest -> stable !
2629+!! 2 | (dp_inv) -> dp_Ntest -> stable !
2630+!! 3 | (dp_dir,dp_inv)-> dp_Atest -> stable !
2631+!! 4 | (mp_dir) -> mp_Ntest -> stable !
2632+!! 5 | (mp_inv) -> mp_Ntest -> stable !
2633+!! 6 | (mp_dir,mp_inv)-> mp_Atest -> stable !
2634+!! !
2635+!! Legenda: !
2636+!! !
2637+!! dp_dir = compute amp in double precision with normal propagator order !
2638+!! dp_inv = compute amp in double precision with reversed propagator order !
2639+!! mp_dir = compute amp in multi precision with normal propagator order !
2640+!! mp_inv = compute amp in multi precision with reversed propagator order !
2641+!! dp_Atest = perform the A=A test in double precision !
2642+!! mp_Atest = perform the A=A test in multi precision !
2643+!! dp_Ntest = perform the N=N test in double precision !
2644+!! mp_Ntest = perform the N=N test in multi precision !
2645+!! -> stable = set stable=.true. or stable=.false. !
2646+!! according to the outcome of the test !
2647+!! !
2648+!! Tests: !
2649+!! !
2650+!! -The N=N test is a test on the reconstructed OPP integrand performed !
2651+!! by comparing original and reconstacted integrands at an arbirtary value !
2652+!! of the integration momentum. !
2653+!! !
2654+!! -The A=A test checks the 2 amplitudes obtained with dir and inv orders !
2655+!! of the propagators given in the input !
2656+!! Notes: !
2657+!! !
2658+!! a) imode= 0 is recommended, unless you really know what you are doing. !
2659+!! !
2660+!! b) When two determinations of amp are available, that one with more !
2661+!! accurate recounstructed numerator (coming from the N=N test) is used. !
2662+!! !
2663+!! c) When running in multi precision with scaloop= 3 (qcdloop), the loop !
2664+!! functions are computed in double precision only. A full multi !
2665+!! precision result can only be obtained with scaloop= 2 (OneLoop). !
2666+!! !
2667+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2668+!
2669+! real*8 rootsvalue -> the arbitrary OPP scale
2670+! set event by event.
2671+!
2672+! real*8 muscale -> the scale for the 1-loop integrals
2673+! set event by event.
2674+! It has dimension of an energy.
2675+!
2676+! integer number_propagators -> number of propagators.
2677+!
2678+! external test -> name of the subroutine
2679+! computing N(q).
2680+!
2681+! external mpfortest -> name of the subroutine
2682+! computing N(q) in
2683+! multi-precision (if absent
2684+! put dummy).
2685+!
2686+! integer rnk -> the maximum rank of N(q) (if
2687+! unknown put number_propagators).
2688+!
2689+! real*8 pp(0:3,0:number_propagators-1)
2690+! -> momenta flowing in the internal
2691+! propagators.
2692+!
2693+! complex*16 m2(0:number_propagators-1)
2694+! -> masses squared of the internal
2695+! propagators. When scaloop supports it,
2696+! they can be complex. When scaloop does
2697+! not support complex masses, only
2698+! the real part of m2 is used.
2699+!
2700+!
2701+! OUTPUT: complex*16 amp(0:2) -> Amplitude (without r2):
2702+! amp(0) is the total finite part
2703+! (INCLUDING R1!!!)
2704+! amp(1) is the coeff. of 1/eps pole
2705+! amp(2) is the coeff. of 1/eps^2 pole.
2706+!
2707+! complex*16 ampcc -> the Cut Constructible contribution
2708+! complex*16 ampr1 -> the R1 contribution
2709+! (NOTE that ampcc+ampr1 = amp(0))
2710+!
2711+! logical stable -> .false. if CutTools detects
2712+! numerical instabilities.
2713+!---------------------------------------------------------------------
2714+
2715+ call ctsxcut(imode,rootsvalue,muscale,number_propagators,test,
2716+ & mptest,rnk,pp,m2,amp,ampcc,ampr1,stable)
2717+ write(*,*)' '
2718+ write(*,*)' Complete Amplitude (without r2): '
2719+ write(*,*)' '
2720+ write(*,*)' '
2721+ write(*,*)' finite part amp(0)=',amp(0)
2722+ write(*,*)' coeff of 1/eps pole amp(1)=',amp(1)
2723+ write(*,*)' coeff of 1/eps^2 pole amp(2)=',amp(2)
2724+ write(*,*)' ampcc=',ampcc
2725+ write(*,*)' R1=',ampr1
2726+ write(*,*)' stable=',stable
2727+ write(*,*)' '
2728+!---------------------------------------------------------------------
2729+! To know the statistics of the run call ctsstatistics(discarded)
2730+!
2731+! INPUT : none
2732+!
2733+! OUTPUT: logical discarded -> .true. if there are discarded PS points
2734+!
2735+! Print out of the statistics of the run:
2736+!
2737+! n_mp -> n.of points evaluated in multi-precision.
2738+! n_disc -> n.of discarded points.
2739+! n_tot -> n.of calls to ctsxcut
2740+!---------------------------------------------------------------------
2741+ call ctsstatistics(discarded)
2742+ end program example0
2743+
2744+
2745+
2746+
2747+
2748+
2749+
2750+
2751
2752=== added file 'loop_material/CutTools/examples/example1.f'
2753--- loop_material/CutTools/examples/example1.f 1970-01-01 00:00:00 +0000
2754+++ loop_material/CutTools/examples/example1.f 2012-02-27 13:42:21 +0000
2755@@ -0,0 +1,289 @@
2756+!---------------------------------------------------------------------
2757+! EXAMPLE OF MAIN PROGRAM
2758+!---------------------------------------------------------------------
2759+ program example1
2760+ implicit none
2761+! !----------------------------------!
2762+ external test ! Name of the subroutine computing !
2763+! ! the numerator function. !
2764+! ! Location numerators.f. !
2765+! !----------------------------------!
2766+!
2767+! !--------------------------------------!
2768+ external mptest ! Name of the mpsubroutine (if present)!
2769+! ! computing the numerator function. !
2770+! ! Location mpnumerators.f90. !
2771+! ! If absent put 'external dummy' !
2772+! !--------------------------------------!
2773+!---------------------------------------------------------------------
2774+ integer maxden
2775+ parameter (maxden= 10)
2776+ complex*16 m2(0:maxden-1)
2777+ real*8 pp(0:3,0:maxden-1)
2778+!---------------------------------------------------------------------
2779+! Auxiliary variables:
2780+!---------------------------------------------------------------------
2781+ common/rango/rango ! only used by the toy numerator
2782+ real*8 xm(1:maxden-2),p(4,maxden-2),k(0:3,maxden)
2783+ real*8 rootsvalue,limitvalue,roots,muscale
2784+ complex*16 amp(0:2),ampcc,ampr1
2785+ integer number_propagators
2786+ integer rnk,i,j,l,iter,rango
2787+ integer scaloop,imode
2788+ integer npoints
2789+ logical stable,discarded
2790+!---------------------------------------------------------------------
2791+! Read number of MC points, the number of propagators and the rank:
2792+!---------------------------------------------------------------------
2793+ print*,'enter npoints,number_propagators,rank,scaloop,muscale'
2794+ print*,' '
2795+ print*,'scaloop= 1 -> looptools 1-loop '
2796+ print*,'scaloop= 2 -> avh 1-loop (massive with complex masses)'
2797+ print*,'scaloop= 3 -> qcdloop 1-loop (Ellis and Zanderighi)'
2798+ print*,'muscale (dimension of energy) is the scale'
2799+ print*,'for the 1-loop integrals'
2800+ print*,' '
2801+ read*,npoints,number_propagators,rnk,scaloop,muscale
2802+ rango= rnk ! only used by the toy numerators
2803+ ! located in numerators.f and
2804+ ! mpnumerators.f90
2805+! !
2806+ if (number_propagators.gt.maxden) then
2807+ stop 'increase maxden in example1.f90'
2808+ endif
2809+ roots = 50.d0 ! value of sqrt(s)
2810+ rootsvalue= roots
2811+ limitvalue= 1.d-2
2812+ imode = 0
2813+!---------------------------------------------------------------------
2814+! Input momenta and masses in each denominator:
2815+!---------------------------------------------------------------------
2816+ k(0,1)= roots/2.d0
2817+ k(1,1)= 0.d0
2818+ k(2,1)= 0.d0
2819+ k(3,1)= roots/2.d0
2820+ k(0,2)= roots/2.d0
2821+ k(1,2)= 0.d0
2822+ k(2,2)= 0.d0
2823+ k(3,2)=-roots/2.d0
2824+!
2825+ do i= 1,number_propagators-2
2826+ xm(i) = 1.d0
2827+ enddo
2828+!---------------------------------------------------------------------
2829+! To initialize CutTools call ctsinit(limitvalue,scaloop)
2830+!
2831+! INPUT:
2832+!
2833+! real*8 limitvalue -> limit of precision below which
2834+! the PS point is considered stable
2835+! by tha A=A test.
2836+!
2837+! integer scaloop -> library used to compute the scalar
2838+! 1-loop functions:
2839+! scaloop= 1 -> looptools (not implemented)
2840+! scaloop= 2 -> avh (complex masses)
2841+! scaloop= 3 -> qcdloop.
2842+! OUTPUT: none
2843+!---------------------------------------------------------------------
2844+ call ctsinit(limitvalue,scaloop)
2845+ do iter= 1,npoints ! do-loop over events
2846+ if (number_propagators.ge.4) then
2847+ call rambo(0,number_propagators-2,roots,xm,p)
2848+ elseif (number_propagators.eq.3) then
2849+ p(4,1)= k(0,1)+k(0,2)
2850+ p(1,1)= k(1,1)+k(1,2)
2851+ p(2,1)= k(2,1)+k(2,2)
2852+ p(3,1)= k(3,1)+k(3,2)
2853+ elseif (number_propagators.eq.2) then
2854+ elseif (number_propagators.eq.1) then
2855+ else
2856+ print*,'number_propagators=',number_propagators,'not allowed!'
2857+ stop
2858+ endif
2859+ do j= 0,3
2860+ if (j.ne.0) then
2861+ do l= 1,number_propagators-2
2862+ k(j,l+2)= p(j,l)
2863+ enddo
2864+ else
2865+ do l= 1,number_propagators-2
2866+ k(j,l+2)= p(4,l)
2867+ enddo
2868+ endif
2869+ enddo
2870+!
2871+ do l= 0,3
2872+ pp(l,0)= 0.d0
2873+ enddo
2874+ do i= 1,number_propagators-1
2875+ do l= 0,3
2876+ pp(l,i)= k(l,2)
2877+ enddo
2878+ do j= 3,i+1
2879+ do l= 0,3
2880+ pp(l,i)= pp(l,i)-k(l,j)
2881+ enddo
2882+ enddo
2883+ enddo
2884+!
2885+! do i= 0,number_propagators-1
2886+! m2(i)= 0.d0
2887+! enddo
2888+!
2889+ m2(0)= 1.d0
2890+ m2(1)= 2.d0
2891+ m2(2)= 3.d0
2892+ m2(3)= 4.d0
2893+ m2(4)= 0.d0
2894+ m2(5)= 0.d0
2895+!
2896+!comment
2897+! do i= 1,number_propagators-1
2898+! do l= 0,3
2899+! print*,'l,i,pp(l,i)=',l,i,pp(l,i)
2900+! enddo
2901+! enddo
2902+!comment
2903+!---------------------------------------------------------------------
2904+! To compute the 1-loop amplitude
2905+!
2906+! call ctsxcut(imode,rootsvalue,muscale,number_propagators,test,
2907+! & mpfortest,rnk,pp,m2,amp,ampcc,ampr1,stable)
2908+!
2909+!
2910+! INPUT: integer imode -> the running mode of CutTools according
2911+! to the following scheme:
2912+!
2913+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2914+!! !
2915+!! imode:| actions performed by ctsxcut: !
2916+!! | !
2917+!! 0 | (dp_dir,dp_inv)-> dp_Atest -> stable -> (only if stable=.false.) ->!
2918+!! | (mp_dir,mp_inv)-> mp_Atest -> stable !
2919+!! 1 | (dp_dir) -> dp_Ntest -> stable !
2920+!! 2 | (dp_inv) -> dp_Ntest -> stable !
2921+!! 3 | (dp_dir,dp_inv)-> dp_Atest -> stable !
2922+!! 4 | (mp_dir) -> mp_Ntest -> stable !
2923+!! 5 | (mp_inv) -> mp_Ntest -> stable !
2924+!! 6 | (mp_dir,mp_inv)-> mp_Atest -> stable !
2925+!! !
2926+!! Legenda: !
2927+!! !
2928+!! dp_dir = compute amp in double precision with normal propagator order !
2929+!! dp_inv = compute amp in double precision with reversed propagator order !
2930+!! mp_dir = compute amp in multi precision with normal propagator order !
2931+!! mp_inv = compute amp in multi precision with reversed propagator order !
2932+!! dp_Atest = perform the A=A test in double precision !
2933+!! mp_Atest = perform the A=A test in multi precision !
2934+!! dp_Ntest = perform the N=N test in double precision !
2935+!! mp_Ntest = perform the N=N test in multi precision !
2936+!! -> stable = set stable=.true. or stable=.false. !
2937+!! according to the outcome of the test !
2938+!! !
2939+!! Tests: !
2940+!! !
2941+!! -The N=N test is a test on the reconstructed OPP integrand performed !
2942+!! by comparing original and reconstacted integrands at an arbirtary value !
2943+!! of the integration momentum. !
2944+!! !
2945+!! -The A=A test checks the 2 amplitudes obtained with dir and inv orders !
2946+!! of the propagators given in the input !
2947+!! Notes: !
2948+!! !
2949+!! a) imode= 0 is recommended, unless you really know what you are doing. !
2950+!! !
2951+!! b) When two determinations of amp are available, that one with more !
2952+!! accurate recounstructed numerator (coming from the N=N test) is used. !
2953+!! !
2954+!! c) When running in multi precision with scaloop= 3 (qcdloop), the loop !
2955+!! functions are computed in double precision only. A full multi !
2956+!! precision result can only be obtained with scaloop= 2 (OneLoop). !
2957+!! !
2958+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2959+!
2960+! real*8 rootsvalue -> the arbitrary OPP scale
2961+! set event by event.
2962+!
2963+! real*8 muscale -> the scale for the 1-loop integrals
2964+! set event by event.
2965+! It has dimension of an energy.
2966+!
2967+! integer number_propagators -> number of propagators.
2968+!
2969+! external test -> name of the subroutine
2970+! computing N(q).
2971+!
2972+! external mpfortest -> name of the subroutine
2973+! computing N(q) in
2974+! multi-precision (if absent
2975+! put dummy).
2976+!
2977+! integer rnk -> the maximum rank of N(q) (if
2978+! unknown put number_propagators).
2979+!
2980+! real*8 pp(0:3,0:number_propagators-1)
2981+! -> momenta flowing in the internal
2982+! propagators.
2983+!
2984+! complex*16 m2(0:number_propagators-1)
2985+! -> masses squared of the internal
2986+! propagators. When scaloop supports it,
2987+! they can be complex. When scaloop does
2988+! not support complex masses, only
2989+! the real part of m2 is used.
2990+!
2991+!
2992+! OUTPUT: complex*16 amp(0:2) -> Amplitude (without r2):
2993+! amp(0) is the total finite part
2994+! (INCLUDING R1!!!)
2995+! amp(1) is the coeff. of 1/eps pole
2996+! amp(2) is the coeff. of 1/eps^2 pole.
2997+!
2998+! complex*16 ampcc -> the Cut Constructible contribution
2999+! complex*16 ampr1 -> the R1 contribution
3000+! (NOTE that ampcc+ampr1 = amp(0))
3001+!
3002+! logical stable -> .false. if CutTools detects
3003+! numerical instabilities.
3004+!---------------------------------------------------------------------
3005+ call ctsxcut(imode,rootsvalue,muscale,number_propagators,test,
3006+ & mptest,rnk,pp,m2,amp,ampcc,ampr1,stable)
3007+ write(*,*)' '
3008+ write(*,*)' iter= ',iter
3009+ write(*,*)' '
3010+ write(*,*)' '
3011+ write(*,*)' Complete Amplitude (without r2): '
3012+ write(*,*)' '
3013+ write(*,*)' '
3014+ write(*,*)' finite part amp(0)=',amp(0)
3015+ write(*,*)' coeff of 1/eps pole amp(1)=',amp(1)
3016+ write(*,*)' coeff of 1/eps^2 pole amp(2)=',amp(2)
3017+ write(*,*)' ampcc=',ampcc
3018+ write(*,*)' R1=',ampr1
3019+ write(*,*)' stable=',stable
3020+ write(*,*)' '
3021+ enddo
3022+!---------------------------------------------------------------------
3023+! To know the statistics of the run call ctsstatistics(discarded)
3024+!
3025+! INPUT : none
3026+!
3027+! OUTPUT: logical discarded -> .true. if there are discarded PS points
3028+!
3029+! Print out of the statistics of the run:
3030+!
3031+! n_mp -> n.of points evaluated in multi-precision.
3032+! n_disc -> n.of discarded points.
3033+! n_tot -> n.of calls to ctsxcut
3034+!---------------------------------------------------------------------
3035+ call ctsstatistics(discarded)
3036+ end program example1
3037+
3038+
3039+
3040+
3041+
3042+
3043+
3044+
3045
3046=== added file 'loop_material/CutTools/examples/makefile'
3047--- loop_material/CutTools/examples/makefile 1970-01-01 00:00:00 +0000
3048+++ loop_material/CutTools/examples/makefile 2012-02-27 13:42:21 +0000
3049@@ -0,0 +1,38 @@
3050+all: testmp$(EXE) example0$(EXE) example1$(EXE)
3051+
3052+include ../makefile
3053+
3054+NUMS0= numerators.o mpnumerators.o
3055+
3056+NUMS = numerators.o mpnumerators.o rambo.o random.o
3057+
3058+mpcheck:
3059+ ./testmp
3060+
3061+test:
3062+ cd testdir; cp input* ../; cp do ../; cp cdiff ../; cd ../; sh do; \
3063+ cp out* testdir; rm out*; rm input* ; sh cdiff > testoutput; rm cdiff; rm do
3064+
3065+testmp$(EXE): $(NUMS) libcts.a testmp.o
3066+ $(FC) $(FFLAGS) -Iincludects -o testmp$(EXE) \
3067+ testmp.f $(NUMS) libcts.a
3068+
3069+example0$(EXE): $(NUMS0) libcts.a example0.o
3070+ $(FC) $(FFLAGS) -Iincludects -o example0$(EXE) \
3071+ example0.f $(NUMS0) libcts.a
3072+
3073+example1$(EXE): $(NUMS) libcts.a example1.o
3074+ $(FC) $(FFLAGS) -Iincludects -o example1$(EXE) \
3075+ example1.f $(NUMS) libcts.a
3076+
3077+libcts.a:
3078+ cd .. ; $(MAKE)
3079+
3080+.SUFFIXES: .f90
3081+
3082+.f90.o:
3083+ $(FC) $(FFLAGS) -Iincludects -c $<
3084+
3085+clean:
3086+ $(RM) testmp$(EXE) example0$(EXE) example1$(EXE) *.o testoutput
3087+
3088
3089=== added file 'loop_material/CutTools/examples/mpnumerators.f90'
3090--- loop_material/CutTools/examples/mpnumerators.f90 1970-01-01 00:00:00 +0000
3091+++ loop_material/CutTools/examples/mpnumerators.f90 2012-02-27 13:42:21 +0000
3092@@ -0,0 +1,86 @@
3093+!---------------------------------------------------------------------
3094+!
3095+!
3096+! In this file (mpnumerators.f90)
3097+! you should place all multi-precision numerator functions
3098+!
3099+!
3100+!---------------------------------------------------------------------
3101+!
3102+ subroutine dummy(q,amp)
3103+!
3104+!-----------------------------------------------
3105+!
3106+! dummy subroutine, to be calld when idig= 0
3107+!
3108+!----------------------------------------------
3109+
3110+ include 'cts_mprec.h'
3111+ implicit none
3112+ include 'cts_mpc.h'
3113+ , intent(in), dimension(0:3) :: q
3114+ include 'cts_mpc.h'
3115+ , intent(out) :: amp
3116+ amp = 0
3117+ end subroutine dummy
3118+!
3119+ subroutine mptest(q,amp)
3120+!
3121+!-------------------------------
3122+!
3123+! "Test" numerator
3124+!
3125+!-------------------------------
3126+!
3127+ include 'cts_mprec.h'
3128+ implicit none
3129+ include 'cts_mpc.h'
3130+ , intent(in), dimension(0:3) :: q
3131+ include 'cts_mpc.h'
3132+ , intent(out) :: amp
3133+ complex(kind(1.d0)) :: dpamp,dpq(0:3)
3134+ integer :: j
3135+ integer rango
3136+ common/rango/rango
3137+!
3138+! comment: the double precision version of the function is called here
3139+!
3140+! amp = 2.d0+(4.d0+q(0)*2.22333d0-q(1)*30.666d0+q(2)*1.55d0 &
3141+! & +q(3)*3.6541122d0)**rango
3142+
3143+! amp= (2.d0+(4.d0+q(0)*2.22333d0-q(1)*30.666d0+q(2)*1.55d0 &
3144+! +q(3)*3.6541122d0)**2 &
3145+! )*(q(0)**2-q(1)**2-q(2)**2-q(3)**2+7.d0)* &
3146+! (q(0)*1.12333d0-q(1)*10.666d0+q(2)*5.55d0 &
3147+! -q(3)*2.6541122d0)
3148+
3149+ do j= 0,3; dpq(j)= q(j); enddo
3150+ call test(dpq,dpamp)
3151+ amp= dpamp
3152+! comment
3153+ end subroutine mptest
3154+
3155+ subroutine mpfortest(q,amp)
3156+!
3157+!-------------------------------
3158+!
3159+! Numerator for testing the
3160+! implementation of the
3161+! multiprecision routines
3162+!
3163+!-------------------------------
3164+!
3165+ include 'cts_mprec.h'
3166+ implicit none
3167+ include 'cts_mpc.h'
3168+ , intent(in), dimension(0:3) :: q
3169+ include 'cts_mpc.h'
3170+ , intent(out) :: amp
3171+ complex(kind(1.d0)) :: dpamp,dpq(0:3)
3172+ integer :: j
3173+ integer rango
3174+ common/rango/rango
3175+ amp = 2.d0+(4.d0+q(0)*2.22333d0-q(1)*30.666d0+q(2)*1.55d0 &
3176+ & +q(3)*3.6541122d0)**rango
3177+
3178+ end subroutine mpfortest
3179
3180=== added file 'loop_material/CutTools/examples/numerators.f'
3181--- loop_material/CutTools/examples/numerators.f 1970-01-01 00:00:00 +0000
3182+++ loop_material/CutTools/examples/numerators.f 2012-02-27 13:42:21 +0000
3183@@ -0,0 +1,31 @@
3184+!---------------------------------------------------------------------
3185+!
3186+!
3187+! In this file (numerators.f)
3188+! you should place all numerator functions
3189+!
3190+!
3191+!---------------------------------------------------------------------
3192+!
3193+ subroutine test(q,amp)
3194+!
3195+!-------------------------------
3196+!
3197+! "Test" numerator
3198+!
3199+!-------------------------------
3200+!
3201+ implicit none
3202+ complex*16 q(0:3)
3203+ complex*16 amp
3204+ integer rango
3205+ common/rango/rango
3206+ amp = 2.d0+(4.d0+q(0)*2.22333d0-q(1)*30.666d0+q(2)*1.55d0
3207+ & +q(3)*3.6541122d0)**rango
3208+
3209+! amp= (2.d0+(4.d0+q(0)*2.22333d0-q(1)*30.666d0+q(2)*1.55d0
3210+! & +q(3)*3.6541122d0)**2
3211+! & )*(q(0)**2-q(1)**2-q(2)**2-q(3)**2+7.d0)*
3212+! & (q(0)*1.12333d0-q(1)*10.666d0+q(2)*5.55d0
3213+! & -q(3)*2.6541122d0)
3214+ end subroutine test
3215
3216=== added file 'loop_material/CutTools/examples/rambo.f'
3217--- loop_material/CutTools/examples/rambo.f 1970-01-01 00:00:00 +0000
3218+++ loop_material/CutTools/examples/rambo.f 2012-02-27 13:42:21 +0000
3219@@ -0,0 +1,185 @@
3220+ SUBROUTINE RAMBO(LFLAG,N,ET,XM,P)
3221+c------------------------------------------------------
3222+c
3223+c RAMBO
3224+c
3225+c RA(NDOM) M(OMENTA) B(EAUTIFULLY) O(RGANIZED)
3226+c
3227+c A DEMOCRATIC MULTI-PARTICLE PHASE SPACE GENERATOR
3228+c AUTHORS: S.D. ELLIS, R. KLEISS, W.J. STIRLING
3229+c THIS IS VERSION 1.0 - WRITTEN BY R. KLEISS
3230+c (MODIFIED BY R. PITTAU)
3231+c
3232+c INPUT OUTPUT
3233+c
3234+c LFLAG= 0: N, ET, XM P, (DJ)
3235+c LFLAG= 1: N, ET, XM, P (DJ)
3236+c
3237+c N = NUMBER OF PARTICLES (>1, IN THIS VERSION <101)
3238+c ET = TOTAL CENTRE-OF-MASS ENERGY
3239+c XM = PARTICLE MASSES ( DIM=100 )
3240+c P = PARTICLE MOMENTA ( DIM=(4,100) )
3241+c DJ = 1/(WEIGHT OF THE EVENT)
3242+c
3243+c------------------------------------------------------
3244+ IMPLICIT DOUBLE PRECISION(A-H,O-Z)
3245+ DIMENSION XM(100),P(4,100),Q(4,100),Z(100),R(4),
3246+ . B(3),P2(100),XM2(100),E(100),V(100),IWARN(5)
3247+ SAVE ACC,ITMAX,IBEGIN,IWARN,Z,TWOPI,PO2LOG
3248+ DATA ACC/1.D-14/,ITMAX/10/,IBEGIN/0/,IWARN/5*0/
3249+C
3250+C INITIALIZATION STEP: FACTORIALS FOR THE PHASE SPACE WEIGHT
3251+ IF(IBEGIN.NE.0) GOTO 103
3252+ IBEGIN=1
3253+ TWOPI=8.*DATAN(1.D0)
3254+ PO2LOG=LOG(TWOPI/4.)
3255+ Z(2)=PO2LOG
3256+ DO 101 K=3,100
3257+ 101 Z(K)=Z(K-1)+PO2LOG-2.*LOG(DFLOAT(K-2))
3258+ DO 102 K=3,100
3259+ 102 Z(K)=(Z(K)-LOG(DFLOAT(K-1)))
3260+C
3261+C CHECK ON THE NUMBER OF PARTICLES
3262+ 103 IF(N.GT.1.AND.N.LT.101) GOTO 104
3263+ PRINT 1001,N
3264+ STOP
3265+C
3266+C CHECK WHETHER TOTAL ENERGY IS SUFFICIENT; COUNT NONZERO MASSES
3267+ 104 XMT=0.
3268+ NM=0
3269+ DO 105 I=1,N
3270+ IF(XM(I).NE.0.D0) NM=NM+1
3271+ 105 XMT=XMT+ABS(XM(I))
3272+ IF(XMT.LE.ET) GOTO 201
3273+ PRINT 1002,XMT,ET
3274+ STOP
3275+
3276+ 201 CONTINUE
3277+ if (lflag.eq.1) then
3278+ w0= exp((2.*N-4.)*LOG(ET)+Z(N))
3279+ do j= 1,N
3280+ v(j)= sqrt(p(1,j)**2+p(2,j)**2+p(3,j)**2)
3281+ enddo
3282+
3283+ a1= 0.d0
3284+ a3= 0.d0
3285+ a2= 1.d0
3286+ do j= 1,N
3287+ a1= a1+v(j)/ET
3288+ a2= a2*v(j)/p(4,j)
3289+ a3= a3+v(j)*v(j)/p(4,j)/ET
3290+ enddo
3291+ wm= a1**(2*N-3)*a2/a3
3292+ dj= 1.d0/w0/wm
3293+ return
3294+ endif
3295+C
3296+C THE PARAMETER VALUES ARE NOW ACCEPTED
3297+C
3298+C GENERATE N MASSLESS MOMENTA IN INFINITE PHASE SPACE
3299+
3300+ DO 202 I=1,N
3301+ call rans(RAN1)
3302+ call rans(RAN2)
3303+ call rans(RAN3)
3304+ call rans(RAN4)
3305+ C=2.*RAN1-1.
3306+ S=SQRT(1.-C*C)
3307+ F=TWOPI*RAN2
3308+ Q(4,I)=-LOG(RAN3*RAN4)
3309+ Q(3,I)=Q(4,I)*C
3310+ Q(2,I)=Q(4,I)*S*COS(F)
3311+ 202 Q(1,I)=Q(4,I)*S*SIN(F)
3312+C
3313+C CALCULATE THE PARAMETERS OF THE CONFORMAL TRANSFORMATION
3314+ DO 203 I=1,4
3315+ 203 R(I)=0.
3316+ DO 204 I=1,N
3317+ DO 204 K=1,4
3318+ 204 R(K)=R(K)+Q(K,I)
3319+ RMAS=SQRT(R(4)**2-R(3)**2-R(2)**2-R(1)**2)
3320+ DO 205 K=1,3
3321+ 205 B(K)=-R(K)/RMAS
3322+ G=R(4)/RMAS
3323+ A=1./(1.+G)
3324+ X=ET/RMAS
3325+C
3326+C TRANSFORM THE Q'S CONFORMALLY INTO THE P'S
3327+ DO 207 I=1,N
3328+ BQ=B(1)*Q(1,I)+B(2)*Q(2,I)+B(3)*Q(3,I)
3329+ DO 206 K=1,3
3330+ 206 P(K,I)=X*(Q(K,I)+B(K)*(Q(4,I)+A*BQ))
3331+ 207 P(4,I)=X*(G*Q(4,I)+BQ)
3332+C
3333+C CALCULATE WEIGHT AND POSSIBLE WARNINGS
3334+ WT=PO2LOG
3335+ IF(N.NE.2) WT=(2.*N-4.)*LOG(ET)+Z(N)
3336+ IF(WT.GE.-180.D0) GOTO 208
3337+ IF(IWARN(1).LE.5) PRINT 1004,WT
3338+ IWARN(1)=IWARN(1)+1
3339+ 208 IF(WT.LE. 174.D0) GOTO 209
3340+ IF(IWARN(2).LE.5) PRINT 1005,WT
3341+ IWARN(2)=IWARN(2)+1
3342+C
3343+C RETURN FOR WEIGHTED MASSLESS MOMENTA
3344+ 209 IF(NM.NE.0) GOTO 210
3345+ WT=EXP(WT)
3346+ DJ= 1.d0/WT
3347+ RETURN
3348+C
3349+C MASSIVE PARTICLES: RESCALE THE MOMENTA BY A FACTOR X
3350+ 210 XMAX=SQRT(1.-(XMT/ET)**2)
3351+ DO 301 I=1,N
3352+ XM2(I)=XM(I)**2
3353+ 301 P2(I)=P(4,I)**2
3354+ ITER=0
3355+ X=XMAX
3356+ ACCU=ET*ACC
3357+ 302 F0=-ET
3358+ G0=0.
3359+ X2=X*X
3360+ DO 303 I=1,N
3361+ E(I)=SQRT(XM2(I)+X2*P2(I))
3362+ F0=F0+E(I)
3363+ 303 G0=G0+P2(I)/E(I)
3364+ IF(ABS(F0).LE.ACCU) GOTO 305
3365+ ITER=ITER+1
3366+ IF(ITER.LE.ITMAX) GOTO 304
3367+ PRINT 1006,ITMAX
3368+ GOTO 305
3369+ 304 X=X-F0/(X*G0)
3370+ GOTO 302
3371+ 305 DO 307 I=1,N
3372+ V(I)=X*P(4,I)
3373+ DO 306 K=1,3
3374+ 306 P(K,I)=X*P(K,I)
3375+ 307 P(4,I)=E(I)
3376+C
3377+C CALCULATE THE MASS-EFFECT WEIGHT FACTOR
3378+ WT2=1.
3379+ WT3=0.
3380+ DO 308 I=1,N
3381+ WT2=WT2*V(I)/E(I)
3382+ 308 WT3=WT3+V(I)**2/E(I)
3383+ WTM=(2.*N-3.)*LOG(X)+LOG(WT2/WT3*ET)
3384+C
3385+C RETURN FOR WEIGHTED MASSIVE MOMENTA
3386+ WT=WT+WTM
3387+ IF(WT.GE.-180.D0) GOTO 309
3388+ IF(IWARN(3).LE.5) PRINT 1004,WT
3389+ IWARN(3)=IWARN(3)+1
3390+ 309 IF(WT.LE. 174.D0) GOTO 310
3391+ IF(IWARN(4).LE.5) PRINT 1005,WT
3392+ IWARN(4)=IWARN(4)+1
3393+ 310 WT=EXP(WT)
3394+ DJ= 1.d0/WT
3395+ RETURN
3396+C
3397+ 1001 FORMAT(' RAMBO FAILS: # OF PARTICLES =',I5,' IS NOT ALLOWED')
3398+ 1002 FORMAT(' RAMBO FAILS: TOTAL MASS =',D15.6,' IS NOT',
3399+ . ' SMALLER THAN TOTAL ENERGY =',D15.6)
3400+ 1004 FORMAT(' RAMBO WARNS: WEIGHT = EXP(',F20.9,') MAY UNDERFLOW')
3401+ 1005 FORMAT(' RAMBO WARNS: WEIGHT = EXP(',F20.9,') MAY OVERFLOW')
3402+ 1006 FORMAT(' RAMBO WARNS:',I3,' ITERATIONS DID NOT GIVE THE',
3403+ . ' DESIRED ACCURACY =',D15.6)
3404+ END
3405
3406=== added file 'loop_material/CutTools/examples/random.f'
3407--- loop_material/CutTools/examples/random.f 1970-01-01 00:00:00 +0000
3408+++ loop_material/CutTools/examples/random.f 2012-02-27 13:42:21 +0000
3409@@ -0,0 +1,52 @@
3410+ subroutine rans(r)
3411+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
3412+c c
3413+c Random number generator c
3414+c c
3415+cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
3416+ implicit none
3417+ real*8 r,rangen
3418+ r = rangen(1)
3419+ end
3420+
3421+*-- Author : F. James, modified by Mike Seymour
3422+C-----------------------------------------------------------------------
3423+ FUNCTION RANGEN(I)
3424+C-----------------------------------------------------------------------
3425+C MAIN RANDOM NUMBER GENERATOR
3426+C USES METHOD OF l'Ecuyer, (VIA F.JAMES, COMP PHYS COMM 60(1990)329)
3427+C-----------------------------------------------------------------------
3428+ IMPLICIT NONE
3429+ DOUBLE PRECISION RANGEN,RANSET,RANGET
3430+ INTEGER I,ISEED(2),K,IZ,JSEED(2)
3431+ SAVE ISEED
3432+ DATA ISEED/12345,67890/
3433+ K=ISEED(1)/53668
3434+ ISEED(1)=40014*(ISEED(1)-K*53668)-K*12211
3435+ IF (ISEED(1).LT.0) ISEED(1)=ISEED(1)+2147483563
3436+ K=ISEED(2)/52774
3437+ ISEED(2)=40692*(ISEED(2)-K*52774)-K*3791
3438+ IF (ISEED(2).LT.0) ISEED(2)=ISEED(2)+2147483399
3439+ IZ=ISEED(1)-ISEED(2)
3440+ IF (IZ.LT.1) IZ=IZ+2147483562
3441+ RANGEN=DBLE(IZ)*4.656613001013252D-10
3442+C---> (4.656613001013252D-10 = 1.D0/2147483589)
3443+ RETURN
3444+C-----------------------------------------------------------------------
3445+ ENTRY RANSET(JSEED)
3446+C-----------------------------------------------------------------------
3447+ IF (JSEED(1).EQ.0.OR.JSEED(2).EQ.0) then
3448+ write(6,*) 'Jseeds=0, wrong settings for RANSET'
3449+ stop
3450+ endif
3451+ ISEED(1)=JSEED(1)
3452+ ISEED(2)=JSEED(2)
3453+ 999 RETURN
3454+C-----------------------------------------------------------------------
3455+ ENTRY RANGET(JSEED)
3456+C-----------------------------------------------------------------------
3457+ JSEED(1)=ISEED(1)
3458+ JSEED(2)=ISEED(2)
3459+ RETURN
3460+ END
3461+
3462
3463=== added file 'loop_material/CutTools/examples/testmp.f'
3464--- loop_material/CutTools/examples/testmp.f 1970-01-01 00:00:00 +0000
3465+++ loop_material/CutTools/examples/testmp.f 2012-02-27 13:42:21 +0000
3466@@ -0,0 +1,288 @@
3467+!---------------------------------------------------------------------
3468+! PROGRAM FOR TESTING THE IMPLEMENTATION OF THE MP ROUTINES
3469+!---------------------------------------------------------------------
3470+ program testmp
3471+ implicit none
3472+! !----------------------------------!
3473+ external test ! Name of the subroutine computing !
3474+! ! the numerator function. !
3475+! ! Location numerators.f. !
3476+! !----------------------------------!
3477+!
3478+! !--------------------------------------!
3479+ external mpfortest ! Name of the mpsubroutine (if present)!
3480+! ! computing the numerator function. !
3481+! ! Location mpnumerators.f90. !
3482+! ! If absent put 'external dummy' !
3483+! !--------------------------------------!
3484+!---------------------------------------------------------------------
3485+ integer maxden,imode
3486+ parameter (maxden= 10)
3487+ complex*16 m2(0:maxden-1)
3488+ real*8 pp(0:3,0:maxden-1)
3489+!---------------------------------------------------------------------
3490+! Auxiliary variables:
3491+!---------------------------------------------------------------------
3492+ common/rango/rango ! only used by the toy numerator
3493+ real*8 xm(1:maxden-2),p(4,maxden-2),k(0:3,maxden)
3494+ real*8 rootsvalue,limitvalue,roots,muscale,thrs
3495+ complex*16 amp(0:2),ampcc,ampr1
3496+ integer number_propagators
3497+ integer rnk,i,j,l,iter,idig,rango
3498+ integer scaloop
3499+ integer npoints
3500+ logical stable,discarded
3501+!
3502+ npoints = 10
3503+ imode = 0
3504+ number_propagators= 6
3505+ rnk = 6
3506+ scaloop = 2
3507+ muscale = 1.d0
3508+ limitvalue = 1.d-21
3509+!
3510+ rango= rnk ! only used by the toy numerators
3511+ ! located in numerators.f and
3512+ ! mpnumerators.f90
3513+! !
3514+ if (number_propagators.gt.maxden) then
3515+ stop 'increase maxden in testmp.f'
3516+ endif
3517+!
3518+ roots = 50.d0 ! value of sqrt(s)
3519+ rootsvalue= roots ! used as an internal scale of the OPP algorithm
3520+!---------------------------------------------------------------------
3521+! Input momenta and masses in each denominator:
3522+!---------------------------------------------------------------------
3523+ k(0,1)= roots/2.d0
3524+ k(1,1)= 0.d0
3525+ k(2,1)= 0.d0
3526+ k(3,1)= roots/2.d0
3527+ k(0,2)= roots/2.d0
3528+ k(1,2)= 0.d0
3529+ k(2,2)= 0.d0
3530+ k(3,2)=-roots/2.d0
3531+ do i= 1,number_propagators-2
3532+ xm(i) = 0.d0
3533+ enddo
3534+!---------------------------------------------------------------------
3535+! To initialize CutTools call ctsinit(limitvalue,scaloop)
3536+!
3537+! INPUT:
3538+!
3539+! real*8 limitvalue -> limit of precision below which
3540+! the PS point is considered stable
3541+! by tha A=A test.
3542+!
3543+! integer scaloop -> library used to compute the scalar
3544+! 1-loop functions:
3545+! scaloop= 1 -> looptools (not implemented)
3546+! scaloop= 2 -> avh (complex masses)
3547+! scaloop= 3 -> qcdloop.
3548+! OUTPUT: none
3549+!---------------------------------------------------------------------
3550+ call ctsinit(limitvalue,scaloop)
3551+ print*,' '
3552+ do iter= 1,npoints ! do-loop over events
3553+ print*,'I am running to check event n.',iter,' over 10'
3554+ if (number_propagators.ge.4) then
3555+ call rambo(0,number_propagators-2,roots,xm,p)
3556+ elseif (number_propagators.eq.3) then
3557+ p(4,1)= k(0,1)+k(0,2)
3558+ p(1,1)= k(1,1)+k(1,2)
3559+ p(2,1)= k(2,1)+k(2,2)
3560+ p(3,1)= k(3,1)+k(3,2)
3561+ elseif (number_propagators.eq.2) then
3562+ elseif (number_propagators.eq.1) then
3563+ else
3564+ print*,'number_propagators=',number_propagators,'not allowed!'
3565+ stop
3566+ endif
3567+ do j= 0,3
3568+ if (j.ne.0) then
3569+ do l= 1,number_propagators-2
3570+ k(j,l+2)= p(j,l)
3571+ enddo
3572+ else
3573+ do l= 1,number_propagators-2
3574+ k(j,l+2)= p(4,l)
3575+ enddo
3576+ endif
3577+ enddo
3578+!
3579+ do l= 0,3
3580+ pp(l,0)= 0.d0
3581+ enddo
3582+ do i= 1,number_propagators-1
3583+ do l= 0,3
3584+ pp(l,i)= k(l,2)
3585+ enddo
3586+ do j= 3,i+1
3587+ do l= 0,3
3588+ pp(l,i)= pp(l,i)-k(l,j)
3589+ enddo
3590+ enddo
3591+ enddo
3592+
3593+ do i= 0,number_propagators-1
3594+ m2(i)= 0.d0
3595+ enddo
3596+!
3597+ m2(0)= 1.d0
3598+ m2(1)= 2.d0
3599+ m2(2)= 3.d0
3600+ m2(3)= 4.d0
3601+ m2(4)= 0.d0
3602+ m2(5)= 0.d0
3603+!comment
3604+!
3605+! do i= 1,number_propagators-1
3606+! do l= 0,3
3607+! print*,'l,i,pp(l,i)=',l,i,pp(l,i)
3608+! enddo
3609+! enddo
3610+!
3611+!comment
3612+
3613+!---------------------------------------------------------------------
3614+! To compute the 1-loop amplitude
3615+!
3616+! call ctsxcut(imode,rootsvalue,muscale,number_propagators,test,
3617+! & mpfortest,rnk,pp,m2,amp,ampcc,ampr1,stable)
3618+!
3619+!
3620+! INPUT: integer imode -> the running mode of CutTools according
3621+! to the following scheme:
3622+!
3623+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3624+!! !
3625+!! imode:| actions performed by ctsxcut: !
3626+!! | !
3627+!! 0 | (dp_dir,dp_inv)-> dp_Atest -> stable -> (only if stable=.false.) ->!
3628+!! | (mp_dir,mp_inv)-> mp_Atest -> stable !
3629+!! 1 | (dp_dir) -> dp_Ntest -> stable !
3630+!! 2 | (dp_inv) -> dp_Ntest -> stable !
3631+!! 3 | (dp_dir,dp_inv)-> dp_Atest -> stable !
3632+!! 4 | (mp_dir) -> mp_Ntest -> stable !
3633+!! 5 | (mp_inv) -> mp_Ntest -> stable !
3634+!! 6 | (mp_dir,mp_inv)-> mp_Atest -> stable !
3635+!! !
3636+!! Legenda: !
3637+!! !
3638+!! dp_dir = compute amp in double precision with normal propagator order !
3639+!! dp_inv = compute amp in double precision with reversed propagator order !
3640+!! mp_dir = compute amp in multi precision with normal propagator order !
3641+!! mp_inv = compute amp in multi precision with reversed propagator order !
3642+!! dp_Atest = perform the A=A test in double precision !
3643+!! mp_Atest = perform the A=A test in multi precision !
3644+!! dp_Ntest = perform the N=N test in double precision !
3645+!! mp_Ntest = perform the N=N test in multi precision !
3646+!! -> stable = set stable=.true. or stable=.false. !
3647+!! according to the outcome of the test !
3648+!! !
3649+!! Tests: !
3650+!! !
3651+!! -The N=N test is a test on the reconstructed OPP integrand performed !
3652+!! by comparing original and reconstacted integrands at an arbirtary value !
3653+!! of the integration momentum. !
3654+!! !
3655+!! -The A=A test checks the 2 amplitudes obtained with dir and inv orders !
3656+!! of the propagators given in the input !
3657+!! Notes: !
3658+!! !
3659+!! a) imode= 0 is recommended, unless you really know what you are doing. !
3660+!! !
3661+!! b) When two determinations of amp are available, that one with more !
3662+!! accurate recounstructed numerator (coming from the N=N test) is used. !
3663+!! !
3664+!! c) When running in multi precision with scaloop= 3 (qcdloop), the loop !
3665+!! functions are computed in double precision only. A full multi !
3666+!! precision result can only be obtained with scaloop= 2 (OneLoop). !
3667+!! !
3668+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3669+!
3670+! real*8 rootsvalue -> the arbitrary OPP scale
3671+! set event by event.
3672+!
3673+! real*8 muscale -> the scale for the 1-loop integrals
3674+! set event by event.
3675+! It has dimension of an energy.
3676+!
3677+! integer number_propagators -> number of propagators.
3678+!
3679+! external test -> name of the subroutine
3680+! computing N(q).
3681+!
3682+! external mpfortest -> name of the subroutine
3683+! computing N(q) in
3684+! multi-precision (if absent
3685+! put dummy).
3686+!
3687+! integer rnk -> the maximum rank of N(q) (if
3688+! unknown put number_propagators).
3689+!
3690+! real*8 pp(0:3,0:number_propagators-1)
3691+! -> momenta flowing in the internal
3692+! propagators.
3693+!
3694+! complex*16 m2(0:number_propagators-1)
3695+! -> masses squared of the internal
3696+! propagators. When scaloop supports it,
3697+! they can be complex. When scaloop does
3698+! not support complex masses, only
3699+! the real part of m2 is used.
3700+!
3701+!
3702+! OUTPUT: complex*16 amp(0:2) -> Amplitude (without r2):
3703+! amp(0) is the total finite part
3704+! (INCLUDING R1!!!)
3705+! amp(1) is the coeff. of 1/eps pole
3706+! amp(2) is the coeff. of 1/eps^2 pole.
3707+!
3708+! complex*16 ampcc -> the Cut Constructible contribution
3709+! complex*16 ampr1 -> the R1 contribution
3710+! (NOTE that ampcc+ampr1 = amp(0))
3711+!
3712+! logical stable -> .false. if CutTools detects
3713+! numerical instabilities.
3714+!---------------------------------------------------------------------
3715+ call ctsxcut(imode,rootsvalue,muscale,number_propagators,test,
3716+ & mpfortest,rnk,pp,m2,amp,ampcc,ampr1,stable)
3717+ enddo
3718+ print*,' '
3719+!---------------------------------------------------------------------
3720+! To know the statistics of the run call ctsstatistics(discarded)
3721+!
3722+! INPUT : none
3723+!
3724+! OUTPUT: logical discarded -> .true. if there are discarded PS points
3725+!
3726+! Print out of the statistics of the run:
3727+!
3728+! n_mp -> n.of points evaluated in multi-precision.
3729+! n_disc -> n.of discarded points.
3730+! n_tot -> n.of calls to ctsxcut
3731+!---------------------------------------------------------------------
3732+ call ctsstatistics(discarded)
3733+ if (.not.discarded) then
3734+ print*,' '
3735+ print*,' '
3736+ print*,'Test on Multiprecision passed'
3737+ print*,' '
3738+ print*,' '
3739+ else
3740+ print*,' '
3741+ print*,' '
3742+ print*,'Test on Multiprecision NOT passed !!!'
3743+ print*,' '
3744+ print*,' '
3745+ endif
3746+ end program testmp
3747+
3748+
3749+
3750+
3751+
3752+
3753+
3754+
3755
3756=== added file 'loop_material/CutTools/makefile'
3757--- loop_material/CutTools/makefile 1970-01-01 00:00:00 +0000
3758+++ loop_material/CutTools/makefile 2012-02-27 13:42:21 +0000
3759@@ -0,0 +1,61 @@
3760+PRECISION= MP
3761+#PRECISION= QP
3762+CTS_VERSION = v1.7.0
3763+SRC = ./src
3764+EXE =
3765+FC = gfortran
3766+FFLAGS = -fno-automatic -O2 -funroll-all-loops
3767+BLD = includects
3768+CTS_DIR = cuttools_$(CTS_VERSION)
3769+CTS_TAR = $(CTS_DIR).tar.gz
3770+
3771+ARGS = \
3772+ EXE="$(EXE)" \
3773+ FC="$(FC)" \
3774+ FFLAGS="$(FFLAGS)" \
3775+
3776+ifeq ($(PRECISION),MP)
3777+#
3778+# For building of the version with internal multiprecision routines:
3779+#
3780+mp: cpmp clean$(BLD)
3781+else
3782+#
3783+# For building of the version with quadruple precision compiler (if present):
3784+#
3785+qp: cpqp clean$(BLD)
3786+endif
3787+
3788+cpmp:
3789+ cp -p ./src/cts/cts_mpr.in ./src/cts/cts_mpr.h
3790+ cp -p ./src/cts/cts_mpc.in ./src/cts/cts_mpc.h
3791+
3792+cpqp:
3793+ cp -p ./src/cts/cts_qpr.in ./src/cts/cts_mpr.h
3794+ cp -p ./src/cts/cts_qpc.in ./src/cts/cts_mpc.h
3795+
3796+clean$(BLD): default
3797+ rm -fr $(BLD)/*.f
3798+ rm -fr $(BLD)/*.f90
3799+ rm -fr $(BLD)/*.o
3800+ rm -fr $(BLD)/makefile
3801+
3802+default: force
3803+ cd $(BLD) && $(MAKE) $(ARGS) $@
3804+
3805+force: $(BLD)/version.h
3806+
3807+$(BLD)/version.h:
3808+ -mkdir -p $(BLD)
3809+ cp -p ./src/avh/* $(BLD)/
3810+ cp -p ./src/cts/* $(BLD)/
3811+ cp -p ./src/mpfun90/* $(BLD)/
3812+ cp -p ./src/qcdloop/* $(BLD)/
3813+ cp -p ./src/makefile $(BLD)/
3814+
3815+tar:
3816+ tar -czvf $(CTS_TAR) *
3817+
3818+clean:
3819+ rm -fr $(BLD) $(CTS_TAR)
3820+
3821
3822=== added directory 'loop_material/CutTools/src'
3823=== added directory 'loop_material/CutTools/src/avh'
3824=== added file 'loop_material/CutTools/src/avh/avh_olo.f90'
3825--- loop_material/CutTools/src/avh/avh_olo.f90 1970-01-01 00:00:00 +0000
3826+++ loop_material/CutTools/src/avh/avh_olo.f90 2012-02-27 13:42:21 +0000
3827@@ -0,0 +1,8454 @@
3828+!
3829+! Copyright (C) 2011 Andreas van Hameren.
3830+!
3831+! This is the package OneLOop-2.2.
3832+!
3833+! OneLOop-2.2 is free software: you can redistribute it and/or modify
3834+! it under the terms of the GNU General Public License as published by
3835+! the Free Software Foundation, either version 3 of the License, or
3836+! (at your option) any later version.
3837+!
3838+! OneLOop-2.2 is distributed in the hope that it will be useful,
3839+! but WITHOUT ANY WARRANTY; without even the implied warranty of
3840+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3841+! GNU General Public License for more details.
3842+!
3843+! You should have received a copy of the GNU General Public License
3844+! along with OneLOop-2.2. If not, see <http://www.gnu.org/licenses/>.
3845+!
3846+
3847+
3848+module avh_olo_xkind
3849+! use !XKIND_MODULE
3850+!
3851+ implicit none
3852+ private
3853+ public :: olo_xkind
3854+!
3855+ integer ,parameter :: olo_xkind=kind(1d0) !XKIND_SETPAR
3856+!
3857+end module
3858+
3859+
3860+module avh_olo_kinds
3861+ use avh_olo_xkind
3862+!
3863+ implicit none
3864+ private
3865+ public :: kindr2,kindc2 &
3866+ ,R0P0,R1P0,R5M1,TWOPI,SQRT2,C0P0,C1P0,CiP0
3867+!
3868+ integer ,parameter :: kindr2 = olo_xkind
3869+ integer ,parameter :: kindc2 = kindr2
3870+!
3871+ include 'cts_dpr.h'
3872+ ,parameter :: R0P0=0._kindr2
3873+ include 'cts_dpr.h'
3874+ ,parameter :: R1P0=1._kindr2
3875+ include 'cts_dpr.h'
3876+ ,parameter :: R5M1=0.5_kindr2
3877+! 1 2345678901234567890123456789012
3878+ include 'cts_dpr.h'
3879+ ,parameter :: TWOPI=6.2831853071795864769252867665590_kindr2
3880+ include 'cts_dpr.h'
3881+ ,parameter :: SQRT2=1.4142135623730950488016887242097_kindr2
3882+ include 'cts_dpc.h'
3883+ ,parameter :: C0P0 = (0._kindr2,0._kindr2)
3884+ include 'cts_dpc.h'
3885+ ,parameter :: C1P0 = (1._kindr2,0._kindr2)
3886+ include 'cts_dpc.h'
3887+ ,parameter :: CiP0 = (0._kindr2,1._kindr2)
3888+!
3889+end module
3890+
3891+
3892+module avh_olo_units
3893+ implicit none
3894+ integer :: eunit=6 !PROTECTED
3895+ integer :: wunit=6 !PROTECTED
3896+ integer :: munit=6 !PROTECTED
3897+ integer :: punit=0 !PROTECTED ! print all
3898+contains
3899+ subroutine set_unit( message ,val )
3900+!***********************************************************************
3901+! message is intended to be one of the following:
3902+! 'printall', 'message' ,'warning' ,'error'
3903+!***********************************************************************
3904+ character(*) ,intent(in) :: message
3905+ integer ,intent(in) :: val
3906+ if (.false.) then
3907+ elseif (message(1:8).eq.'printall') then ;punit=val
3908+ elseif (message(1:7).eq.'message' ) then ;munit=val
3909+ elseif (message(1:7).eq.'warning' ) then ;wunit=val
3910+ elseif (message(1:5).eq.'error' ) then ;eunit=val
3911+ else
3912+ eunit=val
3913+ wunit=val
3914+ munit=val
3915+ punit=0
3916+ endif
3917+ end subroutine
3918+end module
3919+
3920+
3921+module avh_olo_print
3922+ use avh_olo_kinds
3923+ implicit none
3924+ private
3925+ public :: myprint,init_print
3926+!
3927+ integer ,parameter :: noverh=10 !maximally 6 decimals for exponent
3928+ integer :: ndigits=19
3929+ integer :: nefrmt=19+noverh
3930+!
3931+ interface myprint
3932+ module procedure printr,printc,printi
3933+ end interface
3934+!
3935+contains
3936+!
3937+ subroutine init_print( ndig )
3938+ integer ,intent(in) :: ndig
3939+ ndigits = ndig+ndig/4+1
3940+ nefrmt = ndigits+noverh
3941+ end subroutine
3942+!
3943+ function printc( zz ) result(rslt)
3944+ include 'cts_dpc.h'
3945+ ,intent(in) :: zz
3946+ character(nefrmt*2+3) :: rslt
3947+ rslt = '('//trim(printr(real(zz))) &
3948+ //','//trim(printr(aimag(zz) )) &
3949+ //')'
3950+ rslt = adjustl(rslt)
3951+ end function
3952+!
3953+ function printr( xx ) result(rslt)
3954+ include 'cts_dpr.h'
3955+ ,intent(in) :: xx
3956+ character(nefrmt ) :: rslt
3957+ character(nefrmt+1) :: cc
3958+ character(10) :: aa,bb
3959+ write(aa,'(i10)') nefrmt+1 ;aa=adjustl(aa)
3960+ write(bb,'(i10)') ndigits ;bb=adjustl(bb)
3961+ aa = '(e'//trim(aa)//'.'//trim(bb)//')'
3962+ write(cc,aa) xx ;cc=adjustl(cc)
3963+ if (cc(1:2).eq.'-0') then ;rslt = '-'//cc(3:ndigits*2)
3964+ else ;rslt = ' '//cc(2:ndigits*2)
3965+ endif
3966+ end function
3967+!
3968+ function printi( ii ) result(rslt)
3969+ integer ,intent(in) :: ii
3970+ character(ndigits) :: rslt
3971+ character(ndigits) :: cc
3972+ character(10) :: aa
3973+ write(aa,'(i10)') ndigits ;aa=adjustl(aa)
3974+ aa = '(i'//trim(aa)//')'
3975+ write(cc,aa) ii ;cc=adjustl(cc)
3976+ if (cc(1:1).ne.'-') then ;rslt=' '//cc
3977+ else ;rslt=cc
3978+ endif
3979+ end function
3980+!
3981+end module
3982+
3983+
3984+module avh_olo_func
3985+ use avh_olo_kinds
3986+ use avh_olo_units
3987+!
3988+ implicit none
3989+!
3990+ type :: qmplx_type
3991+ include 'cts_dpc.h'
3992+ :: c
3993+ integer :: p
3994+ end type
3995+!
3996+ interface mysqrt
3997+ module procedure mysqrt_0,mysqrt_r,mysqrt_i
3998+ end interface
3999+!
4000+ interface qonv
4001+ module procedure qonv_r,qonv_0,qonv_i
4002+ end interface
4003+!
4004+ interface operator (*)
4005+ module procedure prduct,prduct_r
4006+ end interface
4007+ interface operator (/)
4008+ module procedure ratio,ratio_r
4009+ end interface
4010+!
4011+contains
4012+!
4013+!
4014+ function mysqrt_0(xx) result(rslt)
4015+!*******************************************************************
4016+! Returns the square-root of xx .
4017+! If Im(xx) is equal zero and Re(xx) is negative, the result is
4018+! negative imaginary.
4019+!*******************************************************************
4020+ include 'cts_dpc.h'
4021+ ,intent(in) :: xx
4022+ include 'cts_dpc.h'
4023+ :: rslt ,zz
4024+ include 'cts_dpr.h'
4025+ :: xim,xre
4026+ xim = aimag(xx)
4027+ if (xim.eq.R0P0) then
4028+ xre = real(xx)
4029+ if (xre.ge.R0P0) then
4030+ zz = cmplx(sqrt(xre),R0P0,kind=kindc2)
4031+ else
4032+ zz = cmplx(R0P0,-sqrt(-xre),kind=kindc2)
4033+ endif
4034+ else
4035+ zz = sqrt(xx)
4036+ endif
4037+ rslt = zz
4038+ end function
4039+
4040+ function mysqrt_r(xx,sgn) result(rslt)
4041+!*******************************************************************
4042+! Returns the square-root of xx .
4043+! If Im(xx) is equal zero and Re(xx) is negative, the result is
4044+! imaginary and has the same sign as sgn .
4045+!*******************************************************************
4046+ include 'cts_dpc.h'
4047+ ,intent(in) :: xx
4048+ include 'cts_dpr.h'
4049+ ,intent(in) :: sgn
4050+ include 'cts_dpc.h'
4051+ :: rslt ,zz
4052+ include 'cts_dpr.h'
4053+ :: xim,xre
4054+ xim = aimag(xx)
4055+ if (xim.eq.R0P0) then
4056+ xre = real(xx)
4057+ if (xre.ge.R0P0) then
4058+ zz = cmplx(sqrt(xre),R0P0,kind=kindc2)
4059+ else
4060+ zz = cmplx(R0P0,sign(sqrt(-xre),sgn),kind=kindc2)
4061+ endif
4062+ else
4063+ zz = sqrt(xx)
4064+ endif
4065+ rslt = zz
4066+ end function
4067+
4068+ function mysqrt_i(xx,sgn) result(rslt)
4069+!*******************************************************************
4070+! Returns the square-root of xx .
4071+! If Im(xx) is equal zero and Re(xx) is negative, the result is
4072+! imaginary and has the same sign as sgn .
4073+!*******************************************************************
4074+ include 'cts_dpc.h'
4075+ ,intent(in) :: xx
4076+ integer ,intent(in) :: sgn
4077+ include 'cts_dpc.h'
4078+ :: rslt ,zz
4079+ include 'cts_dpr.h'
4080+ :: xim,xre
4081+ xim = aimag(xx)
4082+ if (xim.eq.R0P0) then
4083+ xre = real(xx)
4084+ if (xre.ge.R0P0) then
4085+ zz = cmplx(sqrt(xre),R0P0,KIND=kindc2)
4086+ else
4087+ zz = cmplx(R0P0,sign(sqrt(-xre),real(sgn,KIND=kindr2)),KIND=kindc2)
4088+ endif
4089+ else
4090+ zz = sqrt(xx)
4091+ endif
4092+ rslt = zz
4093+ end function
4094+
4095+
4096+ subroutine solabc( x1,x2 ,dd ,aa,bb,cc ,imode )
4097+!*******************************************************************
4098+! Returns the solutions x1,x2 to the equation aa*x^2+bb*x+cc=0
4099+! Also returns dd = aa*(x1-x2)
4100+! If imode=/=0 it uses dd as input as value of sqrt(b^2-4*a*c)
4101+!*******************************************************************
4102+ include 'cts_dpc.h'
4103+ ,intent(out) :: x1,x2
4104+ include 'cts_dpc.h'
4105+ ,intent(inout) :: dd
4106+ include 'cts_dpc.h'
4107+ ,intent(in) :: aa,bb,cc
4108+ integer ,intent(in) :: imode
4109+ include 'cts_dpc.h'
4110+ :: qq,hh
4111+ include 'cts_dpr.h'
4112+ :: r1,r2
4113+!
4114+ if (aa.eq.C0P0) then
4115+ if (bb.eq.C0P0) then
4116+ if (eunit.gt.0) write(eunit,*) 'ERROR in OneLOop solabc: ' &
4117+ ,'no solutions, returning 0'
4118+ x1 = C0P0
4119+ x2 = C0P0
4120+ dd = C0P0
4121+ else
4122+ x1 = -cc/bb
4123+ x2 = x1
4124+ dd = bb
4125+ endif
4126+ elseif (cc.eq.C0P0) then
4127+ dd = -bb
4128+ x1 = dd/aa
4129+ x2 = C0P0
4130+ else
4131+ if (imode.eq.0) dd = sqrt(bb*bb - 4*aa*cc)
4132+ qq = -bb+dd
4133+ hh = -bb-dd
4134+ r1 = abs(qq)
4135+ r2 = abs(hh)
4136+ if (r1.ge.r2) then
4137+ x1 = qq/(2*aa)
4138+ x2 = (2*cc)/qq
4139+ else
4140+ qq = hh
4141+ x2 = qq/(2*aa)
4142+ x1 = (2*cc)/qq
4143+ endif
4144+ endif
4145+ end subroutine
4146+
4147+
4148+ subroutine rfun(rr,dd ,qq)
4149+!*******************************************************************
4150+! Returns rr such that qq = rr + 1/rr and Im(rr) has the same
4151+! sign as Im(qq) .
4152+! If Im(qq) is zero, then Im(rr) is negative or zero.
4153+! If Im(rr) is zero, then |rr| > 1/|rr| .
4154+! Also returns dd = rr - 1/rr .
4155+!*******************************************************************
4156+ include 'cts_dpc.h'
4157+ ,intent(out) :: rr,dd
4158+ include 'cts_dpc.h'
4159+ ,intent(in) :: qq
4160+ include 'cts_dpc.h'
4161+ :: r2
4162+ include 'cts_dpr.h'
4163+ :: aa,bb
4164+ integer :: ir,ik
4165+ include 'cts_dpc.h'
4166+ ,parameter :: two=2*C1P0,four=4*C1P0
4167+ dd = sqrt(qq*qq-four)
4168+ rr = qq+dd
4169+ r2 = qq-dd
4170+ aa = abs(rr)
4171+ bb = abs(r2)
4172+ if (bb.gt.aa) then
4173+ rr = r2
4174+ dd = -dd
4175+ endif
4176+ aa = aimag(qq)
4177+ bb = aimag(rr)
4178+ if (aa.eq.R0P0) then
4179+ if (bb.le.R0P0) then
4180+ rr = rr/two
4181+ else
4182+ rr = two/rr
4183+ dd = -dd
4184+ endif
4185+ else
4186+ ik = int(sign(R1P0,aa))
4187+ ir = int(sign(R1P0,bb))
4188+ if (ir.eq.ik) then
4189+ rr = rr/two
4190+ else
4191+ rr = two/rr
4192+ dd = -dd
4193+ endif
4194+ endif
4195+ end subroutine
4196+
4197+ subroutine rfun0(rr ,dd,qq)
4198+!*******************************************************************
4199+! Like rfun, but now dd is input, which may get a minus sign
4200+!*******************************************************************
4201+ include 'cts_dpc.h'
4202+ ,intent(out) :: rr
4203+ include 'cts_dpc.h'
4204+ ,intent(inout) :: dd
4205+ include 'cts_dpc.h'
4206+ ,intent(in) :: qq
4207+ include 'cts_dpc.h'
4208+ :: r2
4209+ include 'cts_dpr.h'
4210+ :: aa,bb
4211+ integer :: ir,ik
4212+ include 'cts_dpc.h'
4213+ ,parameter :: two=2*C1P0
4214+ rr = qq+dd
4215+ r2 = qq-dd
4216+ aa = abs(rr)
4217+ bb = abs(r2)
4218+ if (bb.gt.aa) then
4219+ rr = r2
4220+ dd = -dd
4221+ endif
4222+ aa = aimag(qq)
4223+ bb = aimag(rr)
4224+ if (aa.eq.R0P0) then
4225+ if (bb.le.R0P0) then
4226+ rr = rr/two
4227+ else
4228+ rr = two/rr
4229+ dd = -dd
4230+ endif
4231+ else
4232+ ik = int(sign(R1P0,aa))
4233+ ir = int(sign(R1P0,bb))
4234+ if (ir.eq.ik) then
4235+ rr = rr/two
4236+ else
4237+ rr = two/rr
4238+ dd = -dd
4239+ endif
4240+ endif
4241+ end subroutine
4242+
4243+
4244+ function qonv_r(xx,sgn) result(rslt)
4245+!*******************************************************************
4246+! zz=rslt%c ,iz=rslt%p
4247+! Determine zz,iz such that xx = zz*exp(iz*imag*pi) and Re(zz)
4248+! is positive. If Im(x)=0 and Re(x)<0 then iz becomes the
4249+! sign of sgn .
4250+!*******************************************************************
4251+ include 'cts_dpc.h'
4252+ ,intent(in) :: xx
4253+ include 'cts_dpr.h'
4254+ ,intent(in) :: sgn
4255+ type(qmplx_type) :: rslt
4256+ include 'cts_dpr.h'
4257+ :: xre,xim
4258+ xre = real(xx)
4259+ if (xre.ge.R0P0) then
4260+ rslt%c = xx
4261+ rslt%p = 0
4262+ else
4263+ xim = aimag(xx)
4264+ if (xim.eq.R0P0) then
4265+ rslt%c = cmplx(-xre,R0P0,kind=kindc2)
4266+ rslt%p = int(sign(R1P0,sgn))
4267+ else
4268+ rslt%c = -xx
4269+ rslt%p = int(sign(R1P0,xim)) ! xim = -Im(rslt%c)
4270+ endif
4271+ endif
4272+ end function
4273+!
4274+ function qonv_i(xx,sgn) result(rslt)
4275+!*******************************************************************
4276+! zz=rslt%c ,iz=rslt%p
4277+! Determine zz,iz such that xx = zz*exp(iz*imag*pi) and Re(zz)
4278+! is positive. If Im(x)=0 and Re(x)<0 then iz becomes the
4279+! sign of sgn .
4280+!*******************************************************************
4281+ include 'cts_dpc.h'
4282+ ,intent(in) :: xx
4283+ integer ,intent(in) :: sgn
4284+ type(qmplx_type) :: rslt
4285+ include 'cts_dpr.h'
4286+ :: xre,xim
4287+ xre = real(xx)
4288+ if (xre.ge.R0P0) then
4289+ rslt%c = xx
4290+ rslt%p = 0
4291+ else
4292+ xim = aimag(xx)
4293+ if (xim.eq.R0P0) then
4294+ rslt%c = cmplx(-xre,R0P0,kind=kindc2)
4295+ rslt%p = sign(1,sgn)
4296+ else
4297+ rslt%c = -xx
4298+ rslt%p = int(sign(R1P0,xim)) ! xim = -Im(rslt%c)
4299+ endif
4300+ endif
4301+ end function
4302+!
4303+ function qonv_0(xx) result(rslt)
4304+!*******************************************************************
4305+! zz=rslt%c ,iz=rslt%p
4306+! Determine zz,iz such that xx = zz*exp(iz*imag*pi) and Re(zz)
4307+! is positive. If Im(x)=0 and Re(x)<0 then iz=1
4308+!*******************************************************************
4309+ include 'cts_dpc.h'
4310+ ,intent(in) :: xx
4311+ type(qmplx_type) :: rslt
4312+ include 'cts_dpr.h'
4313+ :: xre,xim
4314+ xre = real(xx)
4315+ if (xre.ge.R0P0) then
4316+ rslt%c = xx
4317+ rslt%p = 0
4318+ else
4319+ xim = aimag(xx)
4320+ if (xim.eq.R0P0) then
4321+ if (eunit.gt.0) write(eunit,*) 'ERROR in OneLOop qonv: ' &
4322+ ,'negative input with undefined sign for the imaginary part, ' &
4323+ ,'putting +ieps'
4324+ rslt%c = cmplx(-xre,R0P0,kind=kindc2)
4325+ rslt%p = 1
4326+ else
4327+ rslt%c = -xx
4328+ rslt%p = int(sign(R1P0,xim)) ! xim = -Im(rslt%c)
4329+ endif
4330+ endif
4331+ end function
4332+!
4333+ function directly(xx,ix) result(rslt)
4334+!*******************************************************************
4335+!*******************************************************************
4336+ include 'cts_dpc.h'
4337+ ,intent(in) :: xx
4338+ integer ,intent(in) :: ix
4339+ type(qmplx_type) :: rslt
4340+ rslt%c = xx
4341+ rslt%p = ix
4342+ end function
4343+
4344+
4345+ function sheet(xx) result(ii)
4346+!*******************************************************************
4347+! Returns the number of the Riemann-sheet (times 2) for the complex
4348+! number xx*exp(ix*imag*pi) . The real part of xx is assumed to be
4349+! positive or zero. Examples:
4350+! xx=1+imag, ix=-1 -> ii= 0
4351+! xx=1+imag, ix= 1 -> ii= 2
4352+! xx=1-imag, ix=-1 -> ii=-2
4353+! xx=1-imag, ix= 1 -> ii= 0
4354+! xx=1 , ix= 1 -> ii= 0 convention that log(-1)=pi on
4355+! xx=1 , ix=-1 -> ii=-2 the principal Riemann-sheet
4356+!*******************************************************************
4357+ type(qmplx_type) ,intent(in) :: xx
4358+ integer :: ii,jj
4359+ include 'cts_dpr.h'
4360+ :: xim
4361+ ii = xx%p/2*2
4362+ jj = xx%p-ii
4363+ xim = aimag(xx%c)
4364+ if (xim.le.R0P0) then ! also xim=0 <==> log(-1)=pi, not -pi
4365+ if (jj.eq.-1) ii = ii-2
4366+ else
4367+ if (jj.eq. 1) ii = ii+2
4368+ endif
4369+ end function
4370+
4371+
4372+ function prduct(yy,xx) result(zz)
4373+!*******************************************************************
4374+! Return the product zz of yy and xx
4375+! keeping track of (the multiple of pi of) the phase %p such that
4376+! the real part of zz%c remains positive
4377+!*******************************************************************
4378+ type(qmplx_type) ,intent(in) :: yy,xx
4379+ type(qmplx_type) :: zz
4380+ zz%c = yy%c*xx%c
4381+ zz%p = yy%p+xx%p
4382+ if (real(zz%c).lt.R0P0) then
4383+ zz%p = zz%p + int(sign(R1P0,aimag(xx%c)))
4384+ zz%c = -zz%c
4385+ endif
4386+ end function
4387+
4388+ function prduct_r(yy,xx) result(zz)
4389+!*******************************************************************
4390+! Return the product zz of yy and xx
4391+! keeping track of (the multiple of pi of) the phase %p such that
4392+! the real part of zz%c remains positive
4393+!*******************************************************************
4394+ type(qmplx_type) ,intent(in) :: yy
4395+ include 'cts_dpr.h'
4396+ ,intent(in) :: xx
4397+ type(qmplx_type) :: zz
4398+ zz%c = yy%c*abs(xx)
4399+ zz%p = yy%p
4400+ end function
4401+
4402+ function ratio(yy,xx) result(zz)
4403+!*******************************************************************
4404+! Return the ratio zz of yy and xx
4405+! keeping track of (the multiple of pi of) the phase %p such that
4406+! the real part of zz%c remains positive
4407+!*******************************************************************
4408+ type(qmplx_type) ,intent(in) :: yy,xx
4409+ type(qmplx_type) :: zz
4410+ zz%c = yy%c/xx%c
4411+ zz%p = yy%p-xx%p
4412+ if (real(zz%c).lt.R0P0) then
4413+ zz%p = zz%p - int(sign(R1P0,aimag(xx%c)))
4414+ zz%c = -zz%c
4415+ endif
4416+ end function
4417+!
4418+ function ratio_r(yy,xx) result(zz)
4419+!*******************************************************************
4420+!*******************************************************************
4421+ type(qmplx_type) ,intent(in) :: yy
4422+ include 'cts_dpr.h'
4423+ ,intent(in) :: xx
4424+ type(qmplx_type) :: zz
4425+ zz%c = yy%c/abs(xx)
4426+ zz%p = yy%p
4427+ end function
4428+!
4429+!
4430+ function eta3( aa,sa ,bb,sb ,cc,sc ) result(rslt)
4431+!*******************************************************************
4432+! 2*pi*imag times the result of
4433+! theta(-Im(a))*theta(-Im(b))*theta( Im(c))
4434+! - theta( Im(a))*theta( Im(b))*theta(-Im(c))
4435+! where a,b,c are interpreted as a+i|eps|sa, b+i|eps|sb, c+i|eps|sc
4436+!*******************************************************************
4437+ include 'cts_dpc.h'
4438+ ,intent(in) :: aa,bb,cc
4439+ include 'cts_dpr.h'
4440+ ,intent(in) :: sa,sb,sc
4441+ include 'cts_dpc.h'
4442+ :: rslt
4443+ include 'cts_dpr.h'
4444+ :: ima,imb,imc
4445+ ima = aimag(aa)
4446+ imb = aimag(bb)
4447+ imc = aimag(cc)
4448+ if (ima.eq.R0P0) ima = sa
4449+ if (imb.eq.R0P0) imb = sb
4450+ if (imc.eq.R0P0) imc = sc
4451+ ima = sign(R1P0,ima)
4452+ imb = sign(R1P0,imb)
4453+ imc = sign(R1P0,imc)
4454+ if (ima.eq.imb.and.ima.ne.imc) then
4455+ rslt = cmplx(R0P0,imc*TWOPI,kind=kindc2)
4456+ else
4457+ rslt = R0P0
4458+ endif
4459+ end function
4460+
4461+ function eta2( aa,sa ,bb,sb ) result(rslt)
4462+!*******************************************************************
4463+! The same as eta3, but with c=a*b, so that
4464+! eta(a,b) = log(a*b) - log(a) - log(b)
4465+!*******************************************************************
4466+ include 'cts_dpc.h'
4467+ ,intent(in) :: aa,bb
4468+ include 'cts_dpr.h'
4469+ ,intent(in) :: sa,sb
4470+ include 'cts_dpr.h'
4471+ :: rslt ,rea,reb,ima,imb,imab
4472+ rea = real(aa) ;ima = aimag(aa)
4473+ reb = real(bb) ;imb = aimag(bb)
4474+ imab = rea*imb + reb*ima
4475+ if (ima.eq.R0P0) ima = sa
4476+ if (imb.eq.R0P0) imb = sb
4477+ if (imab.eq.R0P0) imab = sign(rea,sb) + sign(reb,sa)
4478+ ima = sign(R1P0,ima)
4479+ imb = sign(R1P0,imb)
4480+ imab = sign(R1P0,imab)
4481+ if (ima.eq.imb.and.ima.ne.imab) then
4482+ rslt = cmplx(R0P0,imab*TWOPI,kind=kindc2)
4483+ else
4484+ rslt = R0P0
4485+ endif
4486+ end function
4487+!
4488+end module
4489+
4490+
4491+module avh_olo_loga
4492+!*******************************************************************
4493+! log( |xx|*exp(imag*pi*iph) ) = log|xx| + imag*pi*iph
4494+!*******************************************************************
4495+ use avh_olo_kinds
4496+ use avh_olo_units
4497+ use avh_olo_func
4498+ implicit none
4499+ private
4500+ public :: loga
4501+ include 'cts_dpr.h'
4502+ ,parameter :: pi=TWOPI/2
4503+contains
4504+!
4505+ function loga(xx,iph) result(rslt)
4506+ include 'cts_dpr.h'
4507+ ,intent(in) :: xx
4508+ integer ,intent(in) :: iph
4509+ include 'cts_dpc.h'
4510+ :: rslt
4511+ include 'cts_dpr.h'
4512+ :: rr
4513+!
4514+ rr = abs(xx)
4515+ if (rr.eq.R0P0) then
4516+ if (eunit.gt.0) write(eunit,*) 'ERROR in OneLOop loga: ' &
4517+ ,'|xx|=',rr
4518+ endif
4519+ rslt = cmplx(log(rr),iph*pi,kind=kindc2)
4520+ end function
4521+!
4522+end module
4523+
4524+
4525+module avh_olo_bern
4526+!*******************************************************************
4527+! the first nn Bernoulli numbers
4528+!*******************************************************************
4529+ use avh_olo_kinds
4530+ implicit none
4531+ private
4532+ public :: init_bern,rbern,cbern
4533+ integer ,parameter :: nn=40
4534+ include 'cts_dpr.h'
4535+ :: rbern(nn) !PROTECTED
4536+ include 'cts_dpc.h'
4537+ :: cbern(nn) !PROTECTED
4538+ integer :: ndigits=0
4539+contains
4540+!
4541+ subroutine init_bern(ndig)
4542+ integer ,intent(in) :: ndig
4543+ integer :: jj
4544+ integer ,parameter :: d=kindr2
4545+ if (ndigits.eq.ndig) return ;ndigits=ndig
4546+ rbern(1:nn) = R0P0
4547+ rbern( 1) = -1._d/2._d
4548+ rbern( 2) = 1._d/6._d
4549+ rbern( 4) = -1._d/30._d
4550+ rbern( 6) = 1._d/42._d
4551+ rbern( 8) = -1._d/30._d
4552+ rbern(10) = 5._d/66._d
4553+ rbern(12) = -691._d/2730._d
4554+ rbern(14) = 7._d/6._d
4555+ rbern(16) = -3617._d/510._d
4556+ rbern(18) = 43867._d/798._d
4557+ rbern(20) = -174611._d/330._d
4558+ rbern(22) = 854513._d/138._d
4559+ rbern(24) = -236364091._d/2730._d
4560+ rbern(26) = 8553103._d/6._d
4561+ rbern(28) = -23749461029._d/870._d
4562+ rbern(30) = 8615841276005._d/14322._d
4563+ rbern(32) = -7709321041217._d/510._d
4564+ rbern(34) = 2577687858367._d/6._d
4565+ rbern(36) = -26315271553053477373._d/1919190._d
4566+ rbern(38) = 2929993913841559._d/6._d
4567+ rbern(40) = -261082718496449122051._d/13530._d
4568+ do jj=1,nn
4569+ cbern(jj) = cmplx(rbern(jj),kind=kindc2)
4570+ enddo
4571+ end subroutine
4572+!
4573+end module
4574+
4575+
4576+module avh_olo_li2a
4577+!*******************************************************************
4578+! /1 ln(1-zz*t)
4579+! avh_olo_li2a = - | dt ----------
4580+! /0 t
4581+! with zz = 1 - |xx|*exp(imag*pi*iph)
4582+! Examples:
4583+! In order to get the dilog of 1.1 use xx=1.1, iph=0
4584+! In order to get the dilog of -1.1 use xx=1.1, iph=1
4585+! Add multiples of 2 to iph in order to get the result on
4586+! different Riemann-sheets.
4587+!*******************************************************************
4588+ use avh_olo_kinds
4589+ use avh_olo_func
4590+ use avh_olo_bern
4591+ implicit none
4592+ private
4593+ public :: init_li2a,li2a
4594+ include 'cts_dpr.h'
4595+ ,parameter :: pi=TWOPI/2
4596+ include 'cts_dpc.h'
4597+ ,parameter :: pi2o6=C1P0*TWOPI*TWOPI/24
4598+ integer :: nn=16
4599+ integer :: ndigits=0
4600+contains
4601+!
4602+ subroutine init_li2a(ndig)
4603+ integer ,intent(in) :: ndig
4604+ if (ndigits.eq.ndig) return ;ndigits=ndig
4605+ call init_bern(ndigits)
4606+ if (ndigits.lt.24) then
4607+ nn = 16
4608+ else
4609+ nn = 30
4610+ endif
4611+ end subroutine
4612+
4613+ function li2a(xx,iph) result(rslt)
4614+ include 'cts_dpr.h'
4615+ ,intent(in) :: xx
4616+ integer ,intent(in) :: iph
4617+ include 'cts_dpc.h'
4618+ :: rslt
4619+ include 'cts_dpr.h'
4620+ :: rr,yy,lyy,loy,zz,z2,liox
4621+ integer :: ii,ntwo,ione
4622+ logical :: positive , r_gt_1 , y_lt_h
4623+!
4624+ rr = abs(xx)
4625+ ntwo = iph/2*2
4626+ ione = iph - ntwo
4627+ positive = (ione.eq.0)
4628+!
4629+ if (rr.eq.R0P0) then
4630+ rslt = pi2o6
4631+ elseif (rr.eq.R1P0.and.positive) then
4632+ rslt = C0P0
4633+ else
4634+ yy = rr
4635+ lyy = log(rr)
4636+ if (.not.positive) yy = -yy
4637+!
4638+ r_gt_1 = (rr.gt.R1P0)
4639+ if (r_gt_1) then
4640+ yy = R1P0/yy
4641+ lyy = -lyy
4642+ ntwo = -ntwo
4643+ ione = -ione
4644+ endif
4645+ loy = log(R1P0-yy) ! log(1-yy) is always real
4646+!
4647+ y_lt_h = (yy.lt.R5M1)
4648+ if (y_lt_h) then
4649+ zz = -loy ! log(1-yy) is real
4650+ else
4651+ zz = -lyy ! yy>0.5 => log(yy) is real
4652+ endif
4653+!
4654+ z2 = zz*zz
4655+ liox = rbern(nn)
4656+ do ii=nn,4,-2
4657+ liox = rbern(ii-2) + liox*z2/(ii*(ii+1))
4658+ enddo
4659+ liox = rbern(1) + liox*zz/3
4660+ liox = zz + liox*z2/2
4661+!
4662+ rslt = cmplx(liox,kind=kindc2)
4663+!
4664+ if (y_lt_h) then
4665+ rslt = pi2o6 - rslt - cmplx(loy*lyy,loy*pi*ione,kind=kindc2)
4666+ endif
4667+!
4668+ rslt = rslt + cmplx( R0P0 , -loy*pi*ntwo ,kind=kindc2)
4669+!
4670+ if (r_gt_1) rslt = -rslt - cmplx(-lyy,iph*pi,kind=kindc2)**2/2
4671+ endif
4672+ end function
4673+!
4674+end module
4675+
4676+
4677+module avh_olo_loga2
4678+!*******************************************************************
4679+! log(xx)/(1-xx) with xx = log|xx| + imag*pi*iph
4680+!*******************************************************************
4681+ use avh_olo_kinds
4682+ use avh_olo_units
4683+ use avh_olo_func
4684+ implicit none
4685+ private
4686+ public :: init_loga2,loga2
4687+ include 'cts_dpr.h'
4688+ :: thrs=epsilon(R1P0)
4689+ integer :: ndigits=0
4690+contains
4691+!
4692+ subroutine init_loga2(ndig)
4693+ integer ,intent(in) :: ndig
4694+ if (ndigits.eq.ndig) return ;ndigits=ndig
4695+ thrs = 10*thrs
4696+ end subroutine
4697+!
4698+ function loga2(xx,iph) result(rslt)
4699+ use avh_olo_loga ,only : loga
4700+ include 'cts_dpr.h'
4701+ ,intent(in) :: xx
4702+ integer ,intent(in) :: iph
4703+ include 'cts_dpc.h'
4704+ :: rslt
4705+ include 'cts_dpr.h'
4706+ :: omx
4707+!
4708+ if (mod(iph,2).eq.0) then
4709+ omx = R1P0-abs(xx)
4710+ else
4711+ omx = R1P0+abs(xx)
4712+ endif
4713+!
4714+ if (iph.ne.0) then
4715+ if (omx.eq.R0P0) then
4716+ if (eunit.gt.0) write(eunit,*) 'ERROR in OneLOop loga2: ' &
4717+ ,'1-xx,iph=',omx,iph
4718+ rslt = C0P0
4719+ else
4720+ rslt = loga(xx,iph)/cmplx(omx,kind=kindc2)
4721+ endif
4722+ else
4723+ if (abs(omx).lt.thrs) then
4724+ rslt = cmplx(-R1P0-omx/2,kind=kindc2)
4725+ else
4726+ rslt = loga(xx,iph)/cmplx(omx,kind=kindc2)
4727+ endif
4728+ endif
4729+ end function
4730+!
4731+end module
4732+
4733+
4734+module avh_olo_logc
4735+!*******************************************************************
4736+! Returns log( |Re(xx)| + imag*Im(xx) ) + imag*pi*iph
4737+!*******************************************************************
4738+ use avh_olo_kinds
4739+ use avh_olo_units
4740+ use avh_olo_func
4741+ implicit none
4742+ private
4743+ public :: logc
4744+ include 'cts_dpc.h'
4745+ ,parameter :: ipi=CiP0*TWOPI/2
4746+contains
4747+!
4748+ function logc(xx) result(rslt)
4749+ type(qmplx_type) ,intent(in) :: xx
4750+ include 'cts_dpc.h'
4751+ :: rslt
4752+ if (xx%c.eq.C0P0) then
4753+ if (eunit.gt.0) write(eunit,*) 'ERROR in OneLOop logc: xx%c =',xx%c
4754+ rslt = C0P0
4755+ else
4756+ rslt = log( cmplx(abs(real(xx%c)),aimag(xx%c),kind=kindc2) ) &
4757+ + ipi*xx%p
4758+ endif
4759+ end function
4760+!
4761+end module
4762+
4763+
4764+module avh_olo_li2c
4765+!*******************************************************************
4766+! /1 ln(1-zz*t)
4767+! avh_olo_li2c = - | dt ----------
4768+! /0 t
4769+! with zz = 1 - ( |Re(xx)| + imag*Im(xx) )*exp(imag*pi*iph)
4770+! Examples:
4771+! In order to get the dilog of 1+imag use xx=1+imag, iph= 0
4772+! In order to get the dilog of 1-imag use xx=1-imag, iph= 0
4773+! In order to get the dilog of -1+imag use xx=1-imag, iph= 1
4774+! In order to get the dilog of -1-imag use xx=1+imag, iph=-1
4775+! Add multiples of 2 to iph in order to get the result on
4776+! different Riemann-sheets.
4777+!*******************************************************************
4778+ use avh_olo_kinds
4779+ use avh_olo_func
4780+ use avh_olo_bern
4781+ use avh_olo_li2a
4782+ implicit none
4783+ private
4784+ public :: init_li2c,li2c
4785+ include 'cts_dpc.h'
4786+ ,parameter :: ipi=CiP0*TWOPI/2
4787+ include 'cts_dpc.h'
4788+ ,parameter :: pi2o6=C1P0*TWOPI*TWOPI/24
4789+ integer :: nn=18
4790+ integer :: ndigits=0
4791+contains
4792+!
4793+ subroutine init_li2c(ndig)
4794+ integer ,intent(in) :: ndig
4795+ if (ndigits.eq.ndig) return ;ndigits=ndig
4796+ call init_li2a(ndigits)
4797+ call init_bern(ndigits)
4798+ if (ndigits.lt.24) then
4799+ nn = 18
4800+ else
4801+ nn = 36
4802+ endif
4803+ end subroutine
4804+
4805+ function li2c(xx) result(rslt)
4806+ type(qmplx_type) :: xx
4807+ include 'cts_dpc.h'
4808+ :: rslt ,yy,lyy,loy,zz,z2
4809+ include 'cts_dpr.h'
4810+ :: rex,imx
4811+ integer :: ii,iyy
4812+ logical :: x_gt_1 , y_lt_h
4813+!
4814+ rex = real(xx%c)
4815+ imx = aimag(xx%c)
4816+!
4817+ if (imx.eq.R0P0) then
4818+ rslt = li2a(rex,xx%p)
4819+ else
4820+ rex = abs(rex)
4821+!
4822+ if (mod(xx%p,2).eq.0) then
4823+ yy = cmplx(rex,imx,kind=kindc2)
4824+ iyy = xx%p
4825+ else
4826+ yy = cmplx(-rex,-imx,kind=kindc2)
4827+! Notice that iyy=xx%p/2*2 does not deal correctly with the
4828+! situation when xx%p-xx%p/2*2 = sign(Im(xx%c)) . The following does:
4829+ iyy = xx%p + nint(sign(R1P0,imx))
4830+ endif
4831+!
4832+ x_gt_1 = (abs(xx%c).gt.R1P0)
4833+ if (x_gt_1) then
4834+ yy = C1P0/yy
4835+ iyy = -iyy
4836+ endif
4837+ lyy = log(yy)
4838+ loy = log(C1P0-yy)
4839+!
4840+ y_lt_h = (real(yy).lt.R5M1)
4841+ if (y_lt_h) then
4842+ zz = -loy
4843+ else
4844+ zz = -lyy
4845+ endif
4846+!
4847+ z2 = zz*zz
4848+ rslt = cbern(nn)
4849+ do ii=nn,4,-2
4850+ rslt = cbern(ii-2) + rslt*z2/(ii*(ii+1))
4851+ enddo
4852+ rslt = cbern(1) + rslt*zz/3
4853+ rslt = zz + rslt*z2/2
4854+!
4855+ if (y_lt_h) rslt = pi2o6 - rslt - loy*lyy
4856+!
4857+ rslt = rslt - loy*ipi*iyy
4858+!
4859+ if (x_gt_1) rslt = -rslt - (lyy + ipi*iyy)**2/2
4860+ endif
4861+ end function
4862+!
4863+end module
4864+
4865+
4866+module avh_olo_logc2
4867+!*******************************************************************
4868+! log(xx)/(1-xx)
4869+! with log(xx) = log( |Re(xx)| + imag*Im(xx) ) + imag*pi*iph
4870+!*******************************************************************
4871+ use avh_olo_kinds
4872+ use avh_olo_units
4873+ use avh_olo_func
4874+ implicit none
4875+ private
4876+ public :: init_logc2,logc2
4877+ include 'cts_dpr.h'
4878+ :: thrs=epsilon(R1P0)
4879+ integer :: ndigits=0
4880+contains
4881+!
4882+ subroutine init_logc2(ndig)
4883+ integer ,intent(in) :: ndig
4884+ if (ndigits.eq.ndig) return ;ndigits=ndig
4885+ thrs = 10*thrs
4886+ end subroutine
4887+!
4888+ function logc2(xx) result(rslt)
4889+ use avh_olo_logc ,only : logc
4890+ type(qmplx_type) ,intent(in) :: xx
4891+ include 'cts_dpc.h'
4892+ :: rslt ,omx
4893+ if (mod(xx%p,2).eq.0) then
4894+ omx = cmplx(1d0-abs(real(xx%c)),-aimag(xx%c),kind=kindc2)
4895+ else
4896+ omx = cmplx(1d0+abs(real(xx%c)), aimag(xx%c),kind=kindc2)
4897+ endif
4898+ if (xx%p.ne.0) then
4899+ if (omx.eq.C0P0) then
4900+ if (eunit.gt.0) write(eunit,*) 'ERROR in OneLOop logc2: ' &
4901+ ,'1-xx%c,xx%p=',omx,xx%p
4902+ rslt = C0P0
4903+ else
4904+ rslt = logc(xx)/omx
4905+ endif
4906+ else
4907+ if (abs(omx).lt.thrs) then
4908+ rslt = -C1P0-omx/2
4909+ else
4910+ rslt = logc(xx)/omx
4911+ endif
4912+ endif
4913+ end function
4914+!
4915+end module
4916+
4917+
4918+module avh_olo_li2c2
4919+!*******************************************************************
4920+! avh_olo_li2c2 = ( li2(x1) - li2(x2) )/(x1%c-x2%c)
4921+!
4922+! /1 ln(1-zz*t)
4923+! where li2(x1) = - | dt ----------
4924+! /0 t
4925+! with zz = 1 - ( |Re(x1%c)| + imag*Im(x1%c) )*exp(imag*pi*x1%p)
4926+! and similarly for li2(x2)
4927+!*******************************************************************
4928+ use avh_olo_kinds
4929+ use avh_olo_units
4930+ use avh_olo_func
4931+ use avh_olo_li2c
4932+ use avh_olo_logc2
4933+ implicit none
4934+ private
4935+ public :: init_li2c2,li2c2
4936+ include 'cts_dpc.h'
4937+ ,parameter :: ipi=CiP0*TWOPI/2
4938+ include 'cts_dpr.h'
4939+ ,parameter :: thrs1=epsilon(R1P0)
4940+ include 'cts_dpr.h'
4941+ :: thrs=0.11_kindr2
4942+ integer :: nmax=12
4943+ integer :: ndigits=0
4944+contains
4945+!
4946+ subroutine init_li2c2(ndig)
4947+ integer ,intent(in) :: ndig
4948+ if (ndigits.eq.ndig) return ;ndigits=ndig
4949+ call init_logc2(ndigits)
4950+ call init_li2c(ndigits)
4951+ if (ndigits.lt.16) then
4952+ thrs = 0.11_kindr2 ! double precision
4953+ nmax = 12
4954+ elseif (ndigits.lt.24) then
4955+ thrs = 0.02_kindr2 ! guess
4956+ nmax = 12
4957+ else
4958+ thrs = 0.008_kindr2 ! quadruple precision
4959+ nmax = 12
4960+ endif
4961+ end subroutine
4962+!
4963+ function li2c2(x1,x2) result(rslt)
4964+ type(qmplx_type) ,intent(in) :: x1,x2
4965+ include 'cts_dpc.h'
4966+ :: rslt
4967+ include 'cts_dpc.h'
4968+ :: x1r,x2r,delta,xx,xr,omx,del,hh,ff(0:20),zz
4969+ integer :: ih,ii
4970+!
4971+ if (mod(x1%p,2).eq.0) then
4972+ x1r = cmplx( abs(real(x1%c)), aimag(x1%c),kind=kindc2)
4973+ else
4974+ x1r = cmplx(-abs(real(x1%c)),-aimag(x1%c),kind=kindc2)
4975+ endif
4976+ if (mod(x2%p,2).eq.0) then
4977+ x2r = cmplx( abs(real(x2%c)), aimag(x2%c),kind=kindc2)
4978+ else
4979+ x2r = cmplx(-abs(real(x2%c)),-aimag(x2%c),kind=kindc2)
4980+ endif
4981+ delta = x1r-x2r
4982+!
4983+ if (x1%p.ne.x2%p) then
4984+ if (delta.eq.C0P0) then
4985+ if (eunit.gt.0) write(eunit,*) 'ERROR in OneLOop li2c2: ' &
4986+ ,'x1%p,x2%p,delta=',x1%p,x2%p,delta
4987+ rslt = C0P0
4988+ else
4989+ rslt = ( li2c(x1)-li2c(x2) )/delta
4990+ endif
4991+ else
4992+ if (abs(delta/x1%c).gt.thrs) then
4993+ rslt = ( li2c(x1)-li2c(x2) )/delta
4994+ else
4995+ xx = x1%c
4996+ xr = x1r
4997+ omx = C1P0-xr
4998+ del = delta
4999+ hh = C1P0-x2r
5000+ if (abs(hh).gt.abs(omx)) then
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches