      SUBROUTINE SMATRIX2(P,ANS)
C     
C     Generated by MadGraph5_aMC@NLO v. 2.8.2, 2020-10-30
C     By the MadGraph5_aMC@NLO Development Team
C     Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch
C     
C     MadGraph5_aMC@NLO for Madevent Version
C     
C     Returns amplitude squared -- no average over initial
C      state/symmetry factor
C     and helicities
C     for the point in phase space P(0:3,NEXTERNAL)
C     
C     Process: c c~ > t t~ g g NP<=2 QCD<=4 QED=0 @2
C     
      USE DISCRETESAMPLER
      IMPLICIT NONE
C     
C     CONSTANTS
C     
      INCLUDE 'genps.inc'
      INCLUDE 'maxconfigs.inc'
      INCLUDE 'nexternal.inc'
      INCLUDE 'maxamps.inc'
      INTEGER                 NCOMB
      PARAMETER (             NCOMB=64)
      INTEGER    NGRAPHS
      PARAMETER (NGRAPHS=163)
      INTEGER    NDIAGS
      PARAMETER (NDIAGS=135)
      INTEGER    THEL
      PARAMETER (THEL=2*NCOMB)
C     
C     ARGUMENTS 
C     
      REAL*8 P(0:3,NEXTERNAL),ANS
C     
C     global (due to reading writting) 
C     
      LOGICAL GOODHEL(NCOMB,2)
      INTEGER NTRY(2)
      COMMON/BLOCK_GOODHEL/NTRY,GOODHEL

C     
C     LOCAL VARIABLES 
C     
      INTEGER NHEL(NEXTERNAL,NCOMB)
      INTEGER ISHEL(2)
      REAL*8 T,MATRIX2
      REAL*8 R,SUMHEL,TS(NCOMB)
      INTEGER I,IDEN
      INTEGER JC(NEXTERNAL),II
      REAL*8 HWGT, XTOT, XTRY, XREJ, XR, YFRAC(0:NCOMB)
      INTEGER NGOOD(2), IGOOD(NCOMB,2)
      INTEGER JHEL(2), J, JJ
      INTEGER THIS_NTRY(2)
      SAVE THIS_NTRY
      INTEGER NB_FAIL
      SAVE NB_FAIL
      DATA THIS_NTRY /0,0/
      DATA NB_FAIL /0/

C     
C     This is just to temporarily store the reference grid for
C      helicity of the DiscreteSampler so as to obtain its number of
C      entries with ref_helicity_grid%n_tot_entries
      TYPE(SAMPLEDDIMENSION) REF_HELICITY_GRID
C     
C     GLOBAL VARIABLES
C     
      DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW)
      COMMON/TO_AMPS/  AMP2,       JAMP2

      CHARACTER*101         HEL_BUFF
      COMMON/TO_HELICITY/  HEL_BUFF

      INTEGER NB_SPIN_STATE_IN(2)
      COMMON /NB_HEL_STATE/ NB_SPIN_STATE_IN

      INTEGER IMIRROR
      COMMON/TO_MIRROR/ IMIRROR

      REAL*8 POL(2)
      COMMON/TO_POLARIZATION/ POL

      DOUBLE PRECISION SMALL_WIDTH_TREATMENT
      COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT

      INTEGER          ISUM_HEL
      LOGICAL                    MULTI_CHANNEL
      COMMON/TO_MATRIX/ISUM_HEL, MULTI_CHANNEL
      INTEGER MAPCONFIG(0:LMAXCONFIGS), ICONFIG
      COMMON/TO_MCONFIGS/MAPCONFIG, ICONFIG
      INTEGER SUBDIAG(MAXSPROC),IB(2)
      COMMON/TO_SUB_DIAG/SUBDIAG,IB
      DATA XTRY, XREJ /0,0/
      DATA NGOOD /0,0/
      DATA ISHEL/0,0/
      SAVE YFRAC, IGOOD, JHEL
      DATA (NHEL(I,   1),I=1,6) / 1,-1,-1, 1,-1,-1/
      DATA (NHEL(I,   2),I=1,6) / 1,-1,-1, 1,-1, 1/
      DATA (NHEL(I,   3),I=1,6) / 1,-1,-1, 1, 1,-1/
      DATA (NHEL(I,   4),I=1,6) / 1,-1,-1, 1, 1, 1/
      DATA (NHEL(I,   5),I=1,6) / 1,-1,-1,-1,-1,-1/
      DATA (NHEL(I,   6),I=1,6) / 1,-1,-1,-1,-1, 1/
      DATA (NHEL(I,   7),I=1,6) / 1,-1,-1,-1, 1,-1/
      DATA (NHEL(I,   8),I=1,6) / 1,-1,-1,-1, 1, 1/
      DATA (NHEL(I,   9),I=1,6) / 1,-1, 1, 1,-1,-1/
      DATA (NHEL(I,  10),I=1,6) / 1,-1, 1, 1,-1, 1/
      DATA (NHEL(I,  11),I=1,6) / 1,-1, 1, 1, 1,-1/
      DATA (NHEL(I,  12),I=1,6) / 1,-1, 1, 1, 1, 1/
      DATA (NHEL(I,  13),I=1,6) / 1,-1, 1,-1,-1,-1/
      DATA (NHEL(I,  14),I=1,6) / 1,-1, 1,-1,-1, 1/
      DATA (NHEL(I,  15),I=1,6) / 1,-1, 1,-1, 1,-1/
      DATA (NHEL(I,  16),I=1,6) / 1,-1, 1,-1, 1, 1/
      DATA (NHEL(I,  17),I=1,6) / 1, 1,-1, 1,-1,-1/
      DATA (NHEL(I,  18),I=1,6) / 1, 1,-1, 1,-1, 1/
      DATA (NHEL(I,  19),I=1,6) / 1, 1,-1, 1, 1,-1/
      DATA (NHEL(I,  20),I=1,6) / 1, 1,-1, 1, 1, 1/
      DATA (NHEL(I,  21),I=1,6) / 1, 1,-1,-1,-1,-1/
      DATA (NHEL(I,  22),I=1,6) / 1, 1,-1,-1,-1, 1/
      DATA (NHEL(I,  23),I=1,6) / 1, 1,-1,-1, 1,-1/
      DATA (NHEL(I,  24),I=1,6) / 1, 1,-1,-1, 1, 1/
      DATA (NHEL(I,  25),I=1,6) / 1, 1, 1, 1,-1,-1/
      DATA (NHEL(I,  26),I=1,6) / 1, 1, 1, 1,-1, 1/
      DATA (NHEL(I,  27),I=1,6) / 1, 1, 1, 1, 1,-1/
      DATA (NHEL(I,  28),I=1,6) / 1, 1, 1, 1, 1, 1/
      DATA (NHEL(I,  29),I=1,6) / 1, 1, 1,-1,-1,-1/
      DATA (NHEL(I,  30),I=1,6) / 1, 1, 1,-1,-1, 1/
      DATA (NHEL(I,  31),I=1,6) / 1, 1, 1,-1, 1,-1/
      DATA (NHEL(I,  32),I=1,6) / 1, 1, 1,-1, 1, 1/
      DATA (NHEL(I,  33),I=1,6) /-1,-1,-1, 1,-1,-1/
      DATA (NHEL(I,  34),I=1,6) /-1,-1,-1, 1,-1, 1/
      DATA (NHEL(I,  35),I=1,6) /-1,-1,-1, 1, 1,-1/
      DATA (NHEL(I,  36),I=1,6) /-1,-1,-1, 1, 1, 1/
      DATA (NHEL(I,  37),I=1,6) /-1,-1,-1,-1,-1,-1/
      DATA (NHEL(I,  38),I=1,6) /-1,-1,-1,-1,-1, 1/
      DATA (NHEL(I,  39),I=1,6) /-1,-1,-1,-1, 1,-1/
      DATA (NHEL(I,  40),I=1,6) /-1,-1,-1,-1, 1, 1/
      DATA (NHEL(I,  41),I=1,6) /-1,-1, 1, 1,-1,-1/
      DATA (NHEL(I,  42),I=1,6) /-1,-1, 1, 1,-1, 1/
      DATA (NHEL(I,  43),I=1,6) /-1,-1, 1, 1, 1,-1/
      DATA (NHEL(I,  44),I=1,6) /-1,-1, 1, 1, 1, 1/
      DATA (NHEL(I,  45),I=1,6) /-1,-1, 1,-1,-1,-1/
      DATA (NHEL(I,  46),I=1,6) /-1,-1, 1,-1,-1, 1/
      DATA (NHEL(I,  47),I=1,6) /-1,-1, 1,-1, 1,-1/
      DATA (NHEL(I,  48),I=1,6) /-1,-1, 1,-1, 1, 1/
      DATA (NHEL(I,  49),I=1,6) /-1, 1,-1, 1,-1,-1/
      DATA (NHEL(I,  50),I=1,6) /-1, 1,-1, 1,-1, 1/
      DATA (NHEL(I,  51),I=1,6) /-1, 1,-1, 1, 1,-1/
      DATA (NHEL(I,  52),I=1,6) /-1, 1,-1, 1, 1, 1/
      DATA (NHEL(I,  53),I=1,6) /-1, 1,-1,-1,-1,-1/
      DATA (NHEL(I,  54),I=1,6) /-1, 1,-1,-1,-1, 1/
      DATA (NHEL(I,  55),I=1,6) /-1, 1,-1,-1, 1,-1/
      DATA (NHEL(I,  56),I=1,6) /-1, 1,-1,-1, 1, 1/
      DATA (NHEL(I,  57),I=1,6) /-1, 1, 1, 1,-1,-1/
      DATA (NHEL(I,  58),I=1,6) /-1, 1, 1, 1,-1, 1/
      DATA (NHEL(I,  59),I=1,6) /-1, 1, 1, 1, 1,-1/
      DATA (NHEL(I,  60),I=1,6) /-1, 1, 1, 1, 1, 1/
      DATA (NHEL(I,  61),I=1,6) /-1, 1, 1,-1,-1,-1/
      DATA (NHEL(I,  62),I=1,6) /-1, 1, 1,-1,-1, 1/
      DATA (NHEL(I,  63),I=1,6) /-1, 1, 1,-1, 1,-1/
      DATA (NHEL(I,  64),I=1,6) /-1, 1, 1,-1, 1, 1/
      DATA IDEN/72/

C     To be able to control when the matrix<i> subroutine can add
C      entries to the grid for the MC over helicity configuration
      LOGICAL ALLOW_HELICITY_GRID_ENTRIES
      COMMON/TO_ALLOW_HELICITY_GRID_ENTRIES/ALLOW_HELICITY_GRID_ENTRIES

C     ----------
C     BEGIN CODE
C     ----------

      NTRY(IMIRROR)=NTRY(IMIRROR)+1
      THIS_NTRY(IMIRROR) = THIS_NTRY(IMIRROR)+1
      DO I=1,NEXTERNAL
        JC(I) = +1
      ENDDO

      IF (MULTI_CHANNEL) THEN
        DO I=1,NDIAGS
          AMP2(I)=0D0
        ENDDO
        JAMP2(0)=12
        DO I=1,INT(JAMP2(0))
          JAMP2(I)=0D0
        ENDDO
      ENDIF
      ANS = 0D0
      WRITE(HEL_BUFF,'(20I5)') (0,I=1,NEXTERNAL)
      DO I=1,NCOMB
        TS(I)=0D0
      ENDDO

        !   If the helicity grid status is 0, this means that it is not yet initialized.
        !   If HEL_PICKED==-1, this means that calls to other matrix<i> where in initialization mode as well for the helicity.
      IF ((ISHEL(IMIRROR).EQ.0.AND.ISUM_HEL.EQ.0)
     $ .OR.(DS_GET_DIM_STATUS('Helicity').EQ.0).OR.(HEL_PICKED.EQ.-1))
     $  THEN
        DO I=1,NCOMB
          IF (GOODHEL(I,IMIRROR) .OR. NTRY(IMIRROR)
     $     .LE.MAXTRIES.OR.(ISUM_HEL.NE.0).OR.THIS_NTRY(IMIRROR).LE.2)
     $      THEN
            T=MATRIX2(P ,NHEL(1,I),JC(1))
            DO JJ=1,NINCOMING
              IF(POL(JJ).NE.1D0.AND.NHEL(JJ,I).EQ.INT(SIGN(1D0,POL(JJ))
     $         )) THEN
                T=T*ABS(POL(JJ))*NB_SPIN_STATE_IN(JJ)/2D0  ! NB_SPIN_STATE(JJ)/2d0 is added for polarised beam
              ELSE IF(POL(JJ).NE.1D0)THEN
                T=T*(2D0-ABS(POL(JJ)))*NB_SPIN_STATE_IN(JJ)/2D0
              ENDIF
            ENDDO
            IF (ISUM_HEL.NE.0.AND.DS_GET_DIM_STATUS('Helicity')
     $       .EQ.0.AND.ALLOW_HELICITY_GRID_ENTRIES) THEN
              CALL DS_ADD_ENTRY('Helicity',I,T)
            ENDIF
            ANS=ANS+DABS(T)
            TS(I)=T
          ENDIF
        ENDDO
        IF(NTRY(IMIRROR).EQ.(MAXTRIES+1)) THEN
          CALL RESET_CUMULATIVE_VARIABLE()  ! avoid biais of the initialization
        ENDIF
        IF (ISUM_HEL.NE.0) THEN
            !         We set HEL_PICKED to -1 here so that later on, the call to DS_add_point in dsample.f does not add anything to the grid since it was already done here.
          HEL_PICKED = -1
            !         For safety, hardset the helicity sampling jacobian to 0.0d0 to make sure it is not .
          HEL_JACOBIAN   = 1.0D0
            !         We don't want to re-update the helicity grid if it was already updated by another matrix<i>, so we make sure that the reference grid is empty.
          REF_HELICITY_GRID = DS_GET_DIMENSION(REF_GRID,'Helicity')
          IF((DS_GET_DIM_STATUS('Helicity').EQ.1)
     $     .AND.(REF_HELICITY_GRID%N_TOT_ENTRIES.EQ.0)) THEN
              !           If we finished the initialization we can update the grid so as to start sampling over it.
              !           However the grid will now be filled by dsample with different kind of weights (including pdf, flux, etc...) so by setting the grid_mode of the reference grid to 'initialization' we make sure it will be overwritten (as opposed to 'combined') by the running grid at the next update.
            CALL DS_UPDATE_GRID('Helicity')
            CALL DS_SET_GRID_MODE('Helicity','init')
          ENDIF
        ELSE
          JHEL(IMIRROR) = 1
          IF(NTRY(IMIRROR).LE.MAXTRIES.OR.THIS_NTRY(IMIRROR).LE.2)THEN
            DO I=1,NCOMB
              IF (.NOT.GOODHEL(I,IMIRROR) .AND. (DABS(TS(I)).GT.ANS
     $         *LIMHEL/NCOMB)) THEN
                GOODHEL(I,IMIRROR)=.TRUE.
                NGOOD(IMIRROR) = NGOOD(IMIRROR) +1
                IGOOD(NGOOD(IMIRROR),IMIRROR) = I
                PRINT *,'Added good helicity ',I,TS(I)*NCOMB/ANS,' in'
     $           //' event ',NTRY(IMIRROR), 'local:',THIS_NTRY(IMIRROR)
              ENDIF
            ENDDO
          ENDIF
          IF(NTRY(IMIRROR).EQ.MAXTRIES)THEN
            ISHEL(IMIRROR)=MIN(ISUM_HEL,NGOOD(IMIRROR))
          ENDIF
        ENDIF
      ELSE  ! random helicity 
C       The helicity configuration was chosen already by genps and put
C        in a common block defined in genps.inc.
        I = HEL_PICKED

        T=MATRIX2(P ,NHEL(1,I),JC(1))

        DO JJ=1,NINCOMING
          IF(POL(JJ).NE.1D0.AND.NHEL(JJ,I).EQ.INT(SIGN(1D0,POL(JJ))))
     $      THEN
            T=T*ABS(POL(JJ))
          ELSE IF(POL(JJ).NE.1D0)THEN
            T=T*(2D0-ABS(POL(JJ)))
          ENDIF
        ENDDO
C       Always one helicity at a time
        ANS = T
C       Include the Jacobian from helicity sampling
        ANS = ANS * HEL_JACOBIAN

        WRITE(HEL_BUFF,'(20i5)')(NHEL(II,I),II=1,NEXTERNAL)
      ENDIF
      IF (ANS.NE.0D0.AND.(ISUM_HEL .NE. 1.OR.HEL_PICKED.EQ.-1)) THEN
        CALL RANMAR(R)
        SUMHEL=0D0
        DO I=1,NCOMB
          SUMHEL=SUMHEL+DABS(TS(I))/ANS
          IF(R.LT.SUMHEL)THEN
            WRITE(HEL_BUFF,'(20i5)')(NHEL(II,I),II=1,NEXTERNAL)
C           Set right sign for ANS, based on sign of chosen helicity
            ANS=DSIGN(ANS,TS(I))
            GOTO 10
          ENDIF
        ENDDO
 10     CONTINUE
      ENDIF
      IF (MULTI_CHANNEL) THEN
        XTOT=0D0
        DO I=1,NDIAGS
          XTOT=XTOT+AMP2(I)
        ENDDO
        IF (XTOT.NE.0D0) THEN
          ANS=ANS*AMP2(SUBDIAG(2))/XTOT
        ELSE IF(ANS.NE.0D0) THEN
          IF(NB_FAIL.GE.10)THEN
            WRITE(*,*) 'Problem in the multi-channeling. All amp2 are'
     $       //' zero but not the total matrix-element'

            STOP 1
          ELSE
            NB_FAIL = NB_FAIL +1
          ENDIF
        ENDIF
      ENDIF
      ANS=ANS/DBLE(IDEN)
      END


      REAL*8 FUNCTION MATRIX2(P,NHEL,IC)
C     
C     Generated by MadGraph5_aMC@NLO v. 2.8.2, 2020-10-30
C     By the MadGraph5_aMC@NLO Development Team
C     Visit launchpad.net/madgraph5 and amcatnlo.web.cern.ch
C     
C     Returns amplitude squared summed/avg over colors
C     for the point with external lines W(0:6,NEXTERNAL)
C     
C     Process: c c~ > t t~ g g NP<=2 QCD<=4 QED=0 @2
C     
      IMPLICIT NONE
C     
C     CONSTANTS
C     
      INTEGER    NGRAPHS
      PARAMETER (NGRAPHS=163)
      INCLUDE 'genps.inc'
      INCLUDE 'nexternal.inc'
      INCLUDE 'maxamps.inc'
      INTEGER    NWAVEFUNCS,     NCOLOR
      PARAMETER (NWAVEFUNCS=29, NCOLOR=12)
      REAL*8     ZERO
      PARAMETER (ZERO=0D0)
      COMPLEX*16 IMAG1
      PARAMETER (IMAG1=(0D0,1D0))
      INTEGER NAMPSO, NSQAMPSO
      PARAMETER (NAMPSO=1, NSQAMPSO=1)
      LOGICAL CHOSEN_SO_CONFIGS(NSQAMPSO)
      DATA CHOSEN_SO_CONFIGS/.TRUE./
      SAVE CHOSEN_SO_CONFIGS
C     
C     ARGUMENTS 
C     
      REAL*8 P(0:3,NEXTERNAL)
      INTEGER NHEL(NEXTERNAL), IC(NEXTERNAL)
C     
C     LOCAL VARIABLES 
C     
      INTEGER I,J,M,N
      COMPLEX*16 ZTEMP
      REAL*8 DENOM(NCOLOR), CF(NCOLOR,NCOLOR)
      COMPLEX*16 AMP(NGRAPHS), JAMP(NCOLOR,NAMPSO)
      COMPLEX*16 W(6,NWAVEFUNCS)
C     Needed for v4 models
      COMPLEX*16 DUM0,DUM1
      DATA DUM0, DUM1/(0D0, 0D0), (1D0, 0D0)/

      DOUBLE PRECISION FK_ZERO
      SAVE FK_ZERO

      LOGICAL FIRST
      DATA FIRST /.TRUE./
      SAVE FIRST
C     
C     FUNCTION
C     
      INTEGER SQSOINDEX2
C     
C     GLOBAL VARIABLES
C     
      DOUBLE PRECISION AMP2(MAXAMPS), JAMP2(0:MAXFLOW)
      COMMON/TO_AMPS/  AMP2,       JAMP2
      INCLUDE 'coupl.inc'

      DOUBLE PRECISION SMALL_WIDTH_TREATMENT
      COMMON/NARROW_WIDTH/SMALL_WIDTH_TREATMENT
C     
C     COLOR DATA
C     
      DATA DENOM(1)/3/
      DATA (CF(I,  1),I=  1,  6) /   48,   -6,   16,   -2,   16,   -2/
      DATA (CF(I,  1),I=  7, 12) /    6,    6,    0,   -2,   16,    0/
C     1 T(2,1) T(5,6,3,4)
      DATA DENOM(2)/3/
      DATA (CF(I,  2),I=  1,  6) /   -6,   48,   -2,   16,   -2,   16/
      DATA (CF(I,  2),I=  7, 12) /    6,    6,    0,   16,   -2,    0/
C     1 T(2,1) T(6,5,3,4)
      DATA DENOM(3)/3/
      DATA (CF(I,  3),I=  1,  6) /   16,   -2,   48,   -6,    6,    6/
      DATA (CF(I,  3),I=  7, 12) /   16,   -2,   -2,    0,    0,   16/
C     1 T(2,4) T(5,6,3,1)
      DATA DENOM(4)/3/
      DATA (CF(I,  4),I=  1,  6) /   -2,   16,   -6,   48,    6,    6/
      DATA (CF(I,  4),I=  7, 12) /   -2,   16,   16,    0,    0,   -2/
C     1 T(2,4) T(6,5,3,1)
      DATA DENOM(5)/3/
      DATA (CF(I,  5),I=  1,  6) /   16,   -2,    6,    6,   48,   -6/
      DATA (CF(I,  5),I=  7, 12) /   16,   -2,   16,    0,    0,   -2/
C     1 T(3,1) T(5,6,2,4)
      DATA DENOM(6)/3/
      DATA (CF(I,  6),I=  1,  6) /   -2,   16,    6,    6,   -6,   48/
      DATA (CF(I,  6),I=  7, 12) /   -2,   16,   -2,    0,    0,   16/
C     1 T(3,1) T(6,5,2,4)
      DATA DENOM(7)/3/
      DATA (CF(I,  7),I=  1,  6) /    6,    6,   16,   -2,   16,   -2/
      DATA (CF(I,  7),I=  7, 12) /   48,   -6,    0,   16,   -2,    0/
C     1 T(3,4) T(5,6,2,1)
      DATA DENOM(8)/3/
      DATA (CF(I,  8),I=  1,  6) /    6,    6,   -2,   16,   -2,   16/
      DATA (CF(I,  8),I=  7, 12) /   -6,   48,    0,   -2,   16,    0/
C     1 T(3,4) T(6,5,2,1)
      DATA DENOM(9)/3/
      DATA (CF(I,  9),I=  1,  6) /    0,    0,   -2,   16,   16,   -2/
      DATA (CF(I,  9),I=  7, 12) /    0,    0,   48,   16,   16,    6/
C     1 T(5,2,1) T(6,3,4)
      DATA DENOM(10)/3/
      DATA (CF(I, 10),I=  1,  6) /   -2,   16,    0,    0,    0,    0/
      DATA (CF(I, 10),I=  7, 12) /   16,   -2,   16,   48,    6,   16/
C     1 T(5,2,4) T(6,3,1)
      DATA DENOM(11)/3/
      DATA (CF(I, 11),I=  1,  6) /   16,   -2,    0,    0,    0,    0/
      DATA (CF(I, 11),I=  7, 12) /   -2,   16,   16,    6,   48,   16/
C     1 T(5,3,1) T(6,2,4)
      DATA DENOM(12)/3/
      DATA (CF(I, 12),I=  1,  6) /    0,    0,   16,   -2,   -2,   16/
      DATA (CF(I, 12),I=  7, 12) /    0,    0,    6,   16,   16,   48/
C     1 T(5,3,4) T(6,2,1)
C     ----------
C     BEGIN CODE
C     ----------
      IF (FIRST) THEN
        FIRST=.FALSE.
        IF(ZERO.NE.0D0) FK_ZERO = SIGN(MAX(ABS(ZERO), ABS(ZERO
     $   *SMALL_WIDTH_TREATMENT)), ZERO)
        IF(ZERO.NE.0D0) FK_ZERO = SIGN(MAX(ABS(ZERO), ABS(MDL_MT
     $   *SMALL_WIDTH_TREATMENT)), ZERO)
      ENDIF


      CALL IXXXXX(P(0,1),ZERO,NHEL(1),+1*IC(1),W(1,1))
      CALL OXXXXX(P(0,2),ZERO,NHEL(2),-1*IC(2),W(1,2))
      CALL OXXXXX(P(0,3),MDL_MT,NHEL(3),+1*IC(3),W(1,3))
      CALL IXXXXX(P(0,4),MDL_MT,NHEL(4),-1*IC(4),W(1,4))
      CALL VXXXXX(P(0,5),ZERO,NHEL(5),+1*IC(5),W(1,5))
      CALL VXXXXX(P(0,6),ZERO,NHEL(6),+1*IC(6),W(1,6))
      CALL VVV8P0_1(W(1,5),W(1,6),GC_10,ZERO, FK_ZERO,W(1,7))
      CALL FFV87P0_3(W(1,4),W(1,3),GC_11,ZERO, FK_ZERO,W(1,8))
      CALL FFV57_1(W(1,2),W(1,7),GC_11,ZERO, FK_ZERO,W(1,9))
C     Amplitude(s) for diagram number 1
      CALL FFV57_0(W(1,1),W(1,9),W(1,8),GC_11,AMP(1))
      CALL FFV57_2(W(1,1),W(1,7),GC_11,ZERO, FK_ZERO,W(1,10))
C     Amplitude(s) for diagram number 2
      CALL FFV57_0(W(1,10),W(1,2),W(1,8),GC_11,AMP(2))
      CALL FFV110P0_3(W(1,4),W(1,3),GC_358,ZERO, FK_ZERO,W(1,11))
C     Amplitude(s) for diagram number 3
      CALL FFV57_0(W(1,1),W(1,9),W(1,11),GC_11,AMP(3))
C     Amplitude(s) for diagram number 4
      CALL FFV57_0(W(1,10),W(1,2),W(1,11),GC_11,AMP(4))
      CALL FFV57P0_3(W(1,1),W(1,2),GC_11,ZERO, FK_ZERO,W(1,10))
C     Amplitude(s) for diagram number 5
      CALL VVV8_0(W(1,7),W(1,8),W(1,10),GC_10,AMP(5))
C     Amplitude(s) for diagram number 6
      CALL VVV8_0(W(1,7),W(1,11),W(1,10),GC_10,AMP(6))
C     Amplitude(s) for diagram number 7
      CALL FFVV186_0(W(1,4),W(1,3),W(1,7),W(1,10),GC_360,AMP(7))
      CALL FFV87_1(W(1,3),W(1,7),GC_11,MDL_MT, FK_ZERO,W(1,9))
C     Amplitude(s) for diagram number 8
      CALL FFV87_0(W(1,4),W(1,9),W(1,10),GC_11,AMP(8))
C     Amplitude(s) for diagram number 9
      CALL FFV110_0(W(1,4),W(1,9),W(1,10),GC_358,AMP(9))
      CALL FFV110_1(W(1,3),W(1,7),GC_358,MDL_MT, FK_ZERO,W(1,9))
C     Amplitude(s) for diagram number 10
      CALL FFV87_0(W(1,4),W(1,9),W(1,10),GC_11,AMP(10))
      CALL FFV87_2(W(1,4),W(1,7),GC_11,MDL_MT, FK_ZERO,W(1,9))
C     Amplitude(s) for diagram number 11
      CALL FFV87_0(W(1,9),W(1,3),W(1,10),GC_11,AMP(11))
C     Amplitude(s) for diagram number 12
      CALL FFV110_0(W(1,9),W(1,3),W(1,10),GC_358,AMP(12))
      CALL FFV110_2(W(1,4),W(1,7),GC_358,MDL_MT, FK_ZERO,W(1,9))
C     Amplitude(s) for diagram number 13
      CALL FFV87_0(W(1,9),W(1,3),W(1,10),GC_11,AMP(13))
      CALL FFFF18_24_28_29_1(W(1,2),W(1,4),W(1,3),GC_31,GC_87,GC_109
     $ ,GC_112,ZERO, FK_ZERO,W(1,9))
      CALL FFFF18_24_28_29_1(W(1,2),W(1,4),W(1,3),GC_35,GC_88,GC_110
     $ ,GC_113,ZERO, FK_ZERO,W(1,12))
C     Amplitude(s) for diagram number 14
      CALL FFV57_0(W(1,1),W(1,9),W(1,7),GC_11,AMP(14))
      CALL FFV57_0(W(1,1),W(1,12),W(1,7),GC_11,AMP(15))
      CALL FFFF18_24_28_29_2(W(1,1),W(1,4),W(1,3),GC_31,GC_87,GC_109
     $ ,GC_112,ZERO, FK_ZERO,W(1,13))
      CALL FFFF18_24_28_29_2(W(1,1),W(1,4),W(1,3),GC_35,GC_88,GC_110
     $ ,GC_113,ZERO, FK_ZERO,W(1,14))
C     Amplitude(s) for diagram number 15
      CALL FFV57_0(W(1,13),W(1,2),W(1,7),GC_11,AMP(16))
      CALL FFV57_0(W(1,14),W(1,2),W(1,7),GC_11,AMP(17))
      CALL FFFF18_24_28_29_3(W(1,1),W(1,2),W(1,3),GC_31,GC_87,GC_109
     $ ,GC_112,MDL_MT, FK_ZERO,W(1,15))
      CALL FFFF18_24_28_29_3(W(1,1),W(1,2),W(1,3),GC_35,GC_88,GC_110
     $ ,GC_113,MDL_MT, FK_ZERO,W(1,16))
C     Amplitude(s) for diagram number 16
      CALL FFV87_0(W(1,4),W(1,15),W(1,7),GC_11,AMP(18))
      CALL FFV87_0(W(1,4),W(1,16),W(1,7),GC_11,AMP(19))
      CALL FFFF18_24_28_29_4(W(1,1),W(1,2),W(1,4),GC_31,GC_87,GC_109
     $ ,GC_112,MDL_MT, FK_ZERO,W(1,17))
      CALL FFFF18_24_28_29_4(W(1,1),W(1,2),W(1,4),GC_35,GC_88,GC_110
     $ ,GC_113,MDL_MT, FK_ZERO,W(1,18))
C     Amplitude(s) for diagram number 17
      CALL FFV87_0(W(1,17),W(1,3),W(1,7),GC_11,AMP(20))
      CALL FFV87_0(W(1,18),W(1,3),W(1,7),GC_11,AMP(21))
      CALL FFV87_1(W(1,3),W(1,5),GC_11,MDL_MT, FK_ZERO,W(1,7))
      CALL FFV87_2(W(1,4),W(1,6),GC_11,MDL_MT, FK_ZERO,W(1,19))
C     Amplitude(s) for diagram number 18
      CALL FFFF18_24_28_29_0(W(1,1),W(1,2),W(1,19),W(1,7),GC_31,GC_87
     $ ,GC_109,GC_112,AMP(22))
      CALL FFFF18_24_28_29_0(W(1,1),W(1,2),W(1,19),W(1,7),GC_35,GC_88
     $ ,GC_110,GC_113,AMP(23))
C     Amplitude(s) for diagram number 19
      CALL FFV87_0(W(1,19),W(1,7),W(1,10),GC_11,AMP(24))
C     Amplitude(s) for diagram number 20
      CALL FFV110_0(W(1,19),W(1,7),W(1,10),GC_358,AMP(25))
      CALL FFV110_2(W(1,4),W(1,6),GC_358,MDL_MT, FK_ZERO,W(1,20))
C     Amplitude(s) for diagram number 21
      CALL FFV87_0(W(1,20),W(1,7),W(1,10),GC_11,AMP(26))
      CALL FFV110_1(W(1,3),W(1,5),GC_358,MDL_MT, FK_ZERO,W(1,21))
C     Amplitude(s) for diagram number 22
      CALL FFV87_0(W(1,19),W(1,21),W(1,10),GC_11,AMP(27))
      CALL FFV57_1(W(1,2),W(1,6),GC_11,ZERO, FK_ZERO,W(1,22))
C     Amplitude(s) for diagram number 23
      CALL FFFF18_24_28_29_0(W(1,1),W(1,22),W(1,4),W(1,7),GC_31,GC_87
     $ ,GC_109,GC_112,AMP(28))
      CALL FFFF18_24_28_29_0(W(1,1),W(1,22),W(1,4),W(1,7),GC_35,GC_88
     $ ,GC_110,GC_113,AMP(29))
      CALL FFV87P0_3(W(1,4),W(1,7),GC_11,ZERO, FK_ZERO,W(1,23))
C     Amplitude(s) for diagram number 24
      CALL FFV57_0(W(1,1),W(1,22),W(1,23),GC_11,AMP(30))
      CALL FFV110P0_3(W(1,4),W(1,7),GC_358,ZERO, FK_ZERO,W(1,24))
C     Amplitude(s) for diagram number 25
      CALL FFV57_0(W(1,1),W(1,22),W(1,24),GC_11,AMP(31))
      CALL FFV87P0_3(W(1,4),W(1,21),GC_11,ZERO, FK_ZERO,W(1,25))
C     Amplitude(s) for diagram number 26
      CALL FFV57_0(W(1,1),W(1,22),W(1,25),GC_11,AMP(32))
      CALL FFV57_2(W(1,1),W(1,6),GC_11,ZERO, FK_ZERO,W(1,26))
C     Amplitude(s) for diagram number 27
      CALL FFFF18_24_28_29_0(W(1,26),W(1,2),W(1,4),W(1,7),GC_31,GC_87
     $ ,GC_109,GC_112,AMP(33))
      CALL FFFF18_24_28_29_0(W(1,26),W(1,2),W(1,4),W(1,7),GC_35,GC_88
     $ ,GC_110,GC_113,AMP(34))
C     Amplitude(s) for diagram number 28
      CALL FFV57_0(W(1,26),W(1,2),W(1,23),GC_11,AMP(35))
C     Amplitude(s) for diagram number 29
      CALL FFV57_0(W(1,26),W(1,2),W(1,24),GC_11,AMP(36))
C     Amplitude(s) for diagram number 30
      CALL FFV57_0(W(1,26),W(1,2),W(1,25),GC_11,AMP(37))
C     Amplitude(s) for diagram number 31
      CALL FFVV186_0(W(1,4),W(1,7),W(1,6),W(1,10),GC_360,AMP(38))
      CALL FFV87_1(W(1,7),W(1,6),GC_11,MDL_MT, FK_ZERO,W(1,27))
C     Amplitude(s) for diagram number 32
      CALL FFV87_0(W(1,4),W(1,27),W(1,10),GC_11,AMP(39))
C     Amplitude(s) for diagram number 33
      CALL FFV110_0(W(1,4),W(1,27),W(1,10),GC_358,AMP(40))
      CALL FFV110_1(W(1,7),W(1,6),GC_358,MDL_MT, FK_ZERO,W(1,27))
C     Amplitude(s) for diagram number 34
      CALL FFV87_0(W(1,4),W(1,27),W(1,10),GC_11,AMP(41))
C     Amplitude(s) for diagram number 35
      CALL VVV8_0(W(1,6),W(1,10),W(1,23),GC_10,AMP(42))
C     Amplitude(s) for diagram number 36
      CALL VVV8_0(W(1,6),W(1,10),W(1,24),GC_10,AMP(43))
      CALL FFV87_1(W(1,21),W(1,6),GC_11,MDL_MT, FK_ZERO,W(1,24))
C     Amplitude(s) for diagram number 37
      CALL FFV87_0(W(1,4),W(1,24),W(1,10),GC_11,AMP(44))
C     Amplitude(s) for diagram number 38
      CALL VVV8_0(W(1,6),W(1,10),W(1,25),GC_10,AMP(45))
C     Amplitude(s) for diagram number 39
      CALL FFV87_0(W(1,17),W(1,7),W(1,6),GC_11,AMP(46))
      CALL FFV87_0(W(1,18),W(1,7),W(1,6),GC_11,AMP(47))
      CALL FFV87_2(W(1,4),W(1,5),GC_11,MDL_MT, FK_ZERO,W(1,7))
      CALL FFV87_1(W(1,3),W(1,6),GC_11,MDL_MT, FK_ZERO,W(1,25))
C     Amplitude(s) for diagram number 40
      CALL FFFF18_24_28_29_0(W(1,1),W(1,2),W(1,7),W(1,25),GC_31,GC_87
     $ ,GC_109,GC_112,AMP(48))
      CALL FFFF18_24_28_29_0(W(1,1),W(1,2),W(1,7),W(1,25),GC_35,GC_88
     $ ,GC_110,GC_113,AMP(49))
C     Amplitude(s) for diagram number 41
      CALL FFV87_0(W(1,7),W(1,25),W(1,10),GC_11,AMP(50))
C     Amplitude(s) for diagram number 42
      CALL FFV110_0(W(1,7),W(1,25),W(1,10),GC_358,AMP(51))
      CALL FFV110_1(W(1,3),W(1,6),GC_358,MDL_MT, FK_ZERO,W(1,24))
C     Amplitude(s) for diagram number 43
      CALL FFV87_0(W(1,7),W(1,24),W(1,10),GC_11,AMP(52))
      CALL FFV110_2(W(1,4),W(1,5),GC_358,MDL_MT, FK_ZERO,W(1,21))
C     Amplitude(s) for diagram number 44
      CALL FFV87_0(W(1,21),W(1,25),W(1,10),GC_11,AMP(53))
C     Amplitude(s) for diagram number 45
      CALL FFFF18_24_28_29_0(W(1,1),W(1,22),W(1,7),W(1,3),GC_31,GC_87
     $ ,GC_109,GC_112,AMP(54))
      CALL FFFF18_24_28_29_0(W(1,1),W(1,22),W(1,7),W(1,3),GC_35,GC_88
     $ ,GC_110,GC_113,AMP(55))
      CALL FFV87P0_3(W(1,7),W(1,3),GC_11,ZERO, FK_ZERO,W(1,23))
C     Amplitude(s) for diagram number 46
      CALL FFV57_0(W(1,1),W(1,22),W(1,23),GC_11,AMP(56))
      CALL FFV110P0_3(W(1,7),W(1,3),GC_358,ZERO, FK_ZERO,W(1,27))
C     Amplitude(s) for diagram number 47
      CALL FFV57_0(W(1,1),W(1,22),W(1,27),GC_11,AMP(57))
      CALL FFV87P0_3(W(1,21),W(1,3),GC_11,ZERO, FK_ZERO,W(1,28))
C     Amplitude(s) for diagram number 48
      CALL FFV57_0(W(1,1),W(1,22),W(1,28),GC_11,AMP(58))
C     Amplitude(s) for diagram number 49
      CALL FFFF18_24_28_29_0(W(1,26),W(1,2),W(1,7),W(1,3),GC_31,GC_87
     $ ,GC_109,GC_112,AMP(59))
      CALL FFFF18_24_28_29_0(W(1,26),W(1,2),W(1,7),W(1,3),GC_35,GC_88
     $ ,GC_110,GC_113,AMP(60))
C     Amplitude(s) for diagram number 50
      CALL FFV57_0(W(1,26),W(1,2),W(1,23),GC_11,AMP(61))
C     Amplitude(s) for diagram number 51
      CALL FFV57_0(W(1,26),W(1,2),W(1,27),GC_11,AMP(62))
C     Amplitude(s) for diagram number 52
      CALL FFV57_0(W(1,26),W(1,2),W(1,28),GC_11,AMP(63))
C     Amplitude(s) for diagram number 53
      CALL FFVV186_0(W(1,7),W(1,3),W(1,6),W(1,10),GC_360,AMP(64))
      CALL FFV87_2(W(1,7),W(1,6),GC_11,MDL_MT, FK_ZERO,W(1,29))
C     Amplitude(s) for diagram number 54
      CALL FFV87_0(W(1,29),W(1,3),W(1,10),GC_11,AMP(65))
C     Amplitude(s) for diagram number 55
      CALL FFV110_0(W(1,29),W(1,3),W(1,10),GC_358,AMP(66))
      CALL FFV110_2(W(1,7),W(1,6),GC_358,MDL_MT, FK_ZERO,W(1,29))
C     Amplitude(s) for diagram number 56
      CALL FFV87_0(W(1,29),W(1,3),W(1,10),GC_11,AMP(67))
C     Amplitude(s) for diagram number 57
      CALL VVV8_0(W(1,6),W(1,10),W(1,23),GC_10,AMP(68))
C     Amplitude(s) for diagram number 58
      CALL VVV8_0(W(1,6),W(1,10),W(1,27),GC_10,AMP(69))
      CALL FFV87_2(W(1,21),W(1,6),GC_11,MDL_MT, FK_ZERO,W(1,27))
C     Amplitude(s) for diagram number 59
      CALL FFV87_0(W(1,27),W(1,3),W(1,10),GC_11,AMP(70))
C     Amplitude(s) for diagram number 60
      CALL VVV8_0(W(1,6),W(1,10),W(1,28),GC_10,AMP(71))
C     Amplitude(s) for diagram number 61
      CALL FFV87_0(W(1,7),W(1,15),W(1,6),GC_11,AMP(72))
      CALL FFV87_0(W(1,7),W(1,16),W(1,6),GC_11,AMP(73))
      CALL FFV57_1(W(1,2),W(1,5),GC_11,ZERO, FK_ZERO,W(1,7))
C     Amplitude(s) for diagram number 62
      CALL FFFF18_24_28_29_0(W(1,1),W(1,7),W(1,4),W(1,25),GC_31,GC_87
     $ ,GC_109,GC_112,AMP(74))
      CALL FFFF18_24_28_29_0(W(1,1),W(1,7),W(1,4),W(1,25),GC_35,GC_88
     $ ,GC_110,GC_113,AMP(75))
      CALL FFV57P0_3(W(1,1),W(1,7),GC_11,ZERO, FK_ZERO,W(1,28))
C     Amplitude(s) for diagram number 63
      CALL FFV87_0(W(1,4),W(1,25),W(1,28),GC_11,AMP(76))
C     Amplitude(s) for diagram number 64
      CALL FFV110_0(W(1,4),W(1,25),W(1,28),GC_358,AMP(77))
C     Amplitude(s) for diagram number 65
      CALL FFV87_0(W(1,4),W(1,24),W(1,28),GC_11,AMP(78))
C     Amplitude(s) for diagram number 66
      CALL FFFF18_24_28_29_0(W(1,1),W(1,7),W(1,19),W(1,3),GC_31,GC_87
     $ ,GC_109,GC_112,AMP(79))
      CALL FFFF18_24_28_29_0(W(1,1),W(1,7),W(1,19),W(1,3),GC_35,GC_88
     $ ,GC_110,GC_113,AMP(80))
C     Amplitude(s) for diagram number 67
      CALL FFV87_0(W(1,19),W(1,3),W(1,28),GC_11,AMP(81))
C     Amplitude(s) for diagram number 68
      CALL FFV110_0(W(1,19),W(1,3),W(1,28),GC_358,AMP(82))
C     Amplitude(s) for diagram number 69
      CALL FFV87_0(W(1,20),W(1,3),W(1,28),GC_11,AMP(83))
C     Amplitude(s) for diagram number 70
      CALL FFFF18_24_28_29_0(W(1,26),W(1,7),W(1,4),W(1,3),GC_31,GC_87
     $ ,GC_109,GC_112,AMP(84))
      CALL FFFF18_24_28_29_0(W(1,26),W(1,7),W(1,4),W(1,3),GC_35,GC_88
     $ ,GC_110,GC_113,AMP(85))
C     Amplitude(s) for diagram number 71
      CALL FFV57_0(W(1,26),W(1,7),W(1,8),GC_11,AMP(86))
C     Amplitude(s) for diagram number 72
      CALL FFV57_0(W(1,26),W(1,7),W(1,11),GC_11,AMP(87))
      CALL FFV57_1(W(1,7),W(1,6),GC_11,ZERO, FK_ZERO,W(1,27))
C     Amplitude(s) for diagram number 73
      CALL FFV57_0(W(1,1),W(1,27),W(1,8),GC_11,AMP(88))
C     Amplitude(s) for diagram number 74
      CALL VVV8_0(W(1,6),W(1,8),W(1,28),GC_10,AMP(89))
C     Amplitude(s) for diagram number 75
      CALL FFV57_0(W(1,1),W(1,27),W(1,11),GC_11,AMP(90))
C     Amplitude(s) for diagram number 76
      CALL VVV8_0(W(1,6),W(1,11),W(1,28),GC_10,AMP(91))
      CALL FFVV186P0_3(W(1,4),W(1,3),W(1,6),GC_360,ZERO, FK_ZERO,W(1
     $ ,28))
C     Amplitude(s) for diagram number 77
      CALL FFV57_0(W(1,1),W(1,7),W(1,28),GC_11,AMP(92))
C     Amplitude(s) for diagram number 78
      CALL FFV57_0(W(1,13),W(1,7),W(1,6),GC_11,AMP(93))
      CALL FFV57_0(W(1,14),W(1,7),W(1,6),GC_11,AMP(94))
      CALL FFV57_2(W(1,1),W(1,5),GC_11,ZERO, FK_ZERO,W(1,7))
C     Amplitude(s) for diagram number 79
      CALL FFFF18_24_28_29_0(W(1,7),W(1,2),W(1,4),W(1,25),GC_31,GC_87
     $ ,GC_109,GC_112,AMP(95))
      CALL FFFF18_24_28_29_0(W(1,7),W(1,2),W(1,4),W(1,25),GC_35,GC_88
     $ ,GC_110,GC_113,AMP(96))
      CALL FFV57P0_3(W(1,7),W(1,2),GC_11,ZERO, FK_ZERO,W(1,27))
C     Amplitude(s) for diagram number 80
      CALL FFV87_0(W(1,4),W(1,25),W(1,27),GC_11,AMP(97))
C     Amplitude(s) for diagram number 81
      CALL FFV110_0(W(1,4),W(1,25),W(1,27),GC_358,AMP(98))
C     Amplitude(s) for diagram number 82
      CALL FFV87_0(W(1,4),W(1,24),W(1,27),GC_11,AMP(99))
C     Amplitude(s) for diagram number 83
      CALL FFFF18_24_28_29_0(W(1,7),W(1,2),W(1,19),W(1,3),GC_31,GC_87
     $ ,GC_109,GC_112,AMP(100))
      CALL FFFF18_24_28_29_0(W(1,7),W(1,2),W(1,19),W(1,3),GC_35,GC_88
     $ ,GC_110,GC_113,AMP(101))
C     Amplitude(s) for diagram number 84
      CALL FFV87_0(W(1,19),W(1,3),W(1,27),GC_11,AMP(102))
C     Amplitude(s) for diagram number 85
      CALL FFV110_0(W(1,19),W(1,3),W(1,27),GC_358,AMP(103))
C     Amplitude(s) for diagram number 86
      CALL FFV87_0(W(1,20),W(1,3),W(1,27),GC_11,AMP(104))
C     Amplitude(s) for diagram number 87
      CALL FFFF18_24_28_29_0(W(1,7),W(1,22),W(1,4),W(1,3),GC_31,GC_87
     $ ,GC_109,GC_112,AMP(105))
      CALL FFFF18_24_28_29_0(W(1,7),W(1,22),W(1,4),W(1,3),GC_35,GC_88
     $ ,GC_110,GC_113,AMP(106))
C     Amplitude(s) for diagram number 88
      CALL FFV57_0(W(1,7),W(1,22),W(1,8),GC_11,AMP(107))
C     Amplitude(s) for diagram number 89
      CALL FFV57_0(W(1,7),W(1,22),W(1,11),GC_11,AMP(108))
      CALL FFV57_2(W(1,7),W(1,6),GC_11,ZERO, FK_ZERO,W(1,21))
C     Amplitude(s) for diagram number 90
      CALL FFV57_0(W(1,21),W(1,2),W(1,8),GC_11,AMP(109))
C     Amplitude(s) for diagram number 91
      CALL VVV8_0(W(1,6),W(1,8),W(1,27),GC_10,AMP(110))
C     Amplitude(s) for diagram number 92
      CALL FFV57_0(W(1,21),W(1,2),W(1,11),GC_11,AMP(111))
C     Amplitude(s) for diagram number 93
      CALL VVV8_0(W(1,6),W(1,11),W(1,27),GC_10,AMP(112))
C     Amplitude(s) for diagram number 94
      CALL FFV57_0(W(1,7),W(1,2),W(1,28),GC_11,AMP(113))
C     Amplitude(s) for diagram number 95
      CALL FFV57_0(W(1,7),W(1,9),W(1,6),GC_11,AMP(114))
      CALL FFV57_0(W(1,7),W(1,12),W(1,6),GC_11,AMP(115))
C     Amplitude(s) for diagram number 96
      CALL FFVV186_0(W(1,4),W(1,25),W(1,5),W(1,10),GC_360,AMP(116))
      CALL FFV87_1(W(1,25),W(1,5),GC_11,MDL_MT, FK_ZERO,W(1,7))
C     Amplitude(s) for diagram number 97
      CALL FFV87_0(W(1,4),W(1,7),W(1,10),GC_11,AMP(117))
C     Amplitude(s) for diagram number 98
      CALL FFV110_0(W(1,4),W(1,7),W(1,10),GC_358,AMP(118))
      CALL FFV110_1(W(1,25),W(1,5),GC_358,MDL_MT, FK_ZERO,W(1,7))
C     Amplitude(s) for diagram number 99
      CALL FFV87_0(W(1,4),W(1,7),W(1,10),GC_11,AMP(119))
      CALL VVV8P0_1(W(1,5),W(1,10),GC_10,ZERO, FK_ZERO,W(1,7))
C     Amplitude(s) for diagram number 100
      CALL FFV87_0(W(1,4),W(1,25),W(1,7),GC_11,AMP(120))
C     Amplitude(s) for diagram number 101
      CALL FFV110_0(W(1,4),W(1,25),W(1,7),GC_358,AMP(121))
      CALL FFV87_1(W(1,24),W(1,5),GC_11,MDL_MT, FK_ZERO,W(1,27))
C     Amplitude(s) for diagram number 102
      CALL FFV87_0(W(1,4),W(1,27),W(1,10),GC_11,AMP(122))
C     Amplitude(s) for diagram number 103
      CALL FFV87_0(W(1,4),W(1,24),W(1,7),GC_11,AMP(123))
C     Amplitude(s) for diagram number 104
      CALL FFV87_0(W(1,17),W(1,25),W(1,5),GC_11,AMP(124))
      CALL FFV87_0(W(1,18),W(1,25),W(1,5),GC_11,AMP(125))
C     Amplitude(s) for diagram number 105
      CALL FFVV186_0(W(1,19),W(1,3),W(1,5),W(1,10),GC_360,AMP(126))
      CALL FFV87_2(W(1,19),W(1,5),GC_11,MDL_MT, FK_ZERO,W(1,25))
C     Amplitude(s) for diagram number 106
      CALL FFV87_0(W(1,25),W(1,3),W(1,10),GC_11,AMP(127))
C     Amplitude(s) for diagram number 107
      CALL FFV110_0(W(1,25),W(1,3),W(1,10),GC_358,AMP(128))
      CALL FFV110_2(W(1,19),W(1,5),GC_358,MDL_MT, FK_ZERO,W(1,25))
C     Amplitude(s) for diagram number 108
      CALL FFV87_0(W(1,25),W(1,3),W(1,10),GC_11,AMP(129))
C     Amplitude(s) for diagram number 109
      CALL FFV87_0(W(1,19),W(1,3),W(1,7),GC_11,AMP(130))
C     Amplitude(s) for diagram number 110
      CALL FFV110_0(W(1,19),W(1,3),W(1,7),GC_358,AMP(131))
      CALL FFV87_2(W(1,20),W(1,5),GC_11,MDL_MT, FK_ZERO,W(1,25))
C     Amplitude(s) for diagram number 111
      CALL FFV87_0(W(1,25),W(1,3),W(1,10),GC_11,AMP(132))
C     Amplitude(s) for diagram number 112
      CALL FFV87_0(W(1,20),W(1,3),W(1,7),GC_11,AMP(133))
C     Amplitude(s) for diagram number 113
      CALL FFV87_0(W(1,19),W(1,15),W(1,5),GC_11,AMP(134))
      CALL FFV87_0(W(1,19),W(1,16),W(1,5),GC_11,AMP(135))
      CALL FFV57_1(W(1,22),W(1,5),GC_11,ZERO, FK_ZERO,W(1,19))
C     Amplitude(s) for diagram number 114
      CALL FFV57_0(W(1,1),W(1,19),W(1,8),GC_11,AMP(136))
      CALL VVV8P0_1(W(1,5),W(1,8),GC_10,ZERO, FK_ZERO,W(1,16))
C     Amplitude(s) for diagram number 115
      CALL FFV57_0(W(1,1),W(1,22),W(1,16),GC_11,AMP(137))
C     Amplitude(s) for diagram number 116
      CALL FFV57_0(W(1,1),W(1,19),W(1,11),GC_11,AMP(138))
      CALL VVV8P0_1(W(1,5),W(1,11),GC_10,ZERO, FK_ZERO,W(1,19))
C     Amplitude(s) for diagram number 117
      CALL FFV57_0(W(1,1),W(1,22),W(1,19),GC_11,AMP(139))
C     Amplitude(s) for diagram number 118
      CALL FFV57_0(W(1,13),W(1,22),W(1,5),GC_11,AMP(140))
      CALL FFV57_0(W(1,14),W(1,22),W(1,5),GC_11,AMP(141))
      CALL FFV57_2(W(1,26),W(1,5),GC_11,ZERO, FK_ZERO,W(1,14))
C     Amplitude(s) for diagram number 119
      CALL FFV57_0(W(1,14),W(1,2),W(1,8),GC_11,AMP(142))
C     Amplitude(s) for diagram number 120
      CALL FFV57_0(W(1,26),W(1,2),W(1,16),GC_11,AMP(143))
C     Amplitude(s) for diagram number 121
      CALL FFV57_0(W(1,14),W(1,2),W(1,11),GC_11,AMP(144))
C     Amplitude(s) for diagram number 122
      CALL FFV57_0(W(1,26),W(1,2),W(1,19),GC_11,AMP(145))
C     Amplitude(s) for diagram number 123
      CALL FFV57_0(W(1,26),W(1,9),W(1,5),GC_11,AMP(146))
      CALL FFV57_0(W(1,26),W(1,12),W(1,5),GC_11,AMP(147))
C     Amplitude(s) for diagram number 124
      CALL VVVV16_0(W(1,5),W(1,6),W(1,8),W(1,10),GC_12,AMP(148))
      CALL VVVV19_0(W(1,5),W(1,6),W(1,8),W(1,10),GC_12,AMP(149))
      CALL VVVV20_0(W(1,5),W(1,6),W(1,8),W(1,10),GC_12,AMP(150))
C     Amplitude(s) for diagram number 125
      CALL VVV8_0(W(1,6),W(1,10),W(1,16),GC_10,AMP(151))
C     Amplitude(s) for diagram number 126
      CALL VVV8_0(W(1,6),W(1,8),W(1,7),GC_10,AMP(152))
C     Amplitude(s) for diagram number 127
      CALL VVVV16_0(W(1,5),W(1,6),W(1,11),W(1,10),GC_12,AMP(153))
      CALL VVVV19_0(W(1,5),W(1,6),W(1,11),W(1,10),GC_12,AMP(154))
      CALL VVVV20_0(W(1,5),W(1,6),W(1,11),W(1,10),GC_12,AMP(155))
C     Amplitude(s) for diagram number 128
      CALL VVV8_0(W(1,6),W(1,10),W(1,19),GC_10,AMP(156))
C     Amplitude(s) for diagram number 129
      CALL VVV8_0(W(1,6),W(1,11),W(1,7),GC_10,AMP(157))
      CALL FFVV186_1(W(1,3),W(1,5),W(1,6),GC_360,MDL_MT, FK_ZERO,W(1,7)
     $ )
C     Amplitude(s) for diagram number 130
      CALL FFV87_0(W(1,4),W(1,7),W(1,10),GC_11,AMP(158))
      CALL FFVV186_2(W(1,4),W(1,5),W(1,6),GC_360,MDL_MT, FK_ZERO,W(1,7)
     $ )
C     Amplitude(s) for diagram number 131
      CALL FFV87_0(W(1,7),W(1,3),W(1,10),GC_11,AMP(159))
      CALL FFVV186P0_3(W(1,4),W(1,3),W(1,5),GC_360,ZERO, FK_ZERO,W(1,7)
     $ )
C     Amplitude(s) for diagram number 132
      CALL FFV57_0(W(1,1),W(1,22),W(1,7),GC_11,AMP(160))
C     Amplitude(s) for diagram number 133
      CALL FFV57_0(W(1,26),W(1,2),W(1,7),GC_11,AMP(161))
C     Amplitude(s) for diagram number 134
      CALL VVV8_0(W(1,7),W(1,6),W(1,10),GC_10,AMP(162))
C     Amplitude(s) for diagram number 135
      CALL VVV8_0(W(1,5),W(1,28),W(1,10),GC_10,AMP(163))
C     JAMPs contributing to orders ALL_ORDERS=1
      JAMP(1,1)=-1D0/6D0*IMAG1*AMP(8)-1D0/6D0*IMAG1*AMP(9)-1D0/6D0
     $ *IMAG1*AMP(10)-1D0/6D0*IMAG1*AMP(11)-1D0/6D0*IMAG1*AMP(12)-1D0
     $ /6D0*IMAG1*AMP(13)+IMAG1*AMP(18)-1D0/6D0*IMAG1*AMP(19)+IMAG1
     $ *AMP(20)-1D0/6D0*IMAG1*AMP(21)-AMP(22)+1D0/6D0*AMP(23)+1D0/6D0
     $ *AMP(24)+1D0/6D0*AMP(25)+1D0/6D0*AMP(26)+1D0/6D0*AMP(27)+1D0
     $ /6D0*AMP(39)+1D0/6D0*AMP(40)+1D0/6D0*AMP(41)+1D0/6D0*AMP(44)
     $ -AMP(46)+1D0/6D0*AMP(47)+1D0/6D0*AMP(127)+1D0/6D0*AMP(128)+1D0
     $ /6D0*AMP(129)+1D0/6D0*AMP(132)-AMP(134)+1D0/6D0*AMP(135)-1D0
     $ /6D0*IMAG1*AMP(158)-1D0/6D0*IMAG1*AMP(159)
      JAMP(2,1)=+1D0/6D0*IMAG1*AMP(8)+1D0/6D0*IMAG1*AMP(9)+1D0/6D0
     $ *IMAG1*AMP(10)+1D0/6D0*IMAG1*AMP(11)+1D0/6D0*IMAG1*AMP(12)+1D0
     $ /6D0*IMAG1*AMP(13)-IMAG1*AMP(18)+1D0/6D0*IMAG1*AMP(19)-IMAG1
     $ *AMP(20)+1D0/6D0*IMAG1*AMP(21)-AMP(48)+1D0/6D0*AMP(49)+1D0/6D0
     $ *AMP(50)+1D0/6D0*AMP(51)+1D0/6D0*AMP(52)+1D0/6D0*AMP(53)+1D0
     $ /6D0*AMP(65)+1D0/6D0*AMP(66)+1D0/6D0*AMP(67)+1D0/6D0*AMP(70)
     $ -AMP(72)+1D0/6D0*AMP(73)+1D0/6D0*AMP(117)+1D0/6D0*AMP(118)+1D0
     $ /6D0*AMP(119)+1D0/6D0*AMP(122)-AMP(124)+1D0/6D0*AMP(125)+1D0
     $ /6D0*IMAG1*AMP(158)+1D0/6D0*IMAG1*AMP(159)
      JAMP(3,1)=+1D0/2D0*(+IMAG1*AMP(2)+IMAG1*AMP(4)-AMP(5)-AMP(6)
     $ +AMP(7)+IMAG1*AMP(8)+IMAG1*AMP(9)+IMAG1*AMP(10)+IMAG1*AMP(15)
     $ +IMAG1*AMP(21)-AMP(34)-AMP(35)-AMP(36)-AMP(37)+IMAG1*AMP(38)
     $ -AMP(39)-AMP(40)-AMP(41)+IMAG1*AMP(42)+IMAG1*AMP(43)-AMP(44)
     $ +IMAG1*AMP(45)-AMP(47)-AMP(142)-IMAG1*AMP(143)-AMP(144)-IMAG1
     $ *AMP(145)-AMP(147)-AMP(148)-AMP(149)-AMP(151)-AMP(153)-AMP(154)
     $ -AMP(156)+IMAG1*AMP(158)-IMAG1*AMP(161)-AMP(162))
      JAMP(4,1)=+1D0/2D0*(-IMAG1*AMP(2)-IMAG1*AMP(4)+AMP(5)+AMP(6)
     $ -AMP(7)-IMAG1*AMP(8)-IMAG1*AMP(9)-IMAG1*AMP(10)-IMAG1*AMP(15)
     $ -IMAG1*AMP(21)-AMP(96)-AMP(97)-AMP(98)-AMP(99)-AMP(109)-IMAG1
     $ *AMP(110)-AMP(111)-IMAG1*AMP(112)-IMAG1*AMP(113)-AMP(115)+IMAG1
     $ *AMP(116)-AMP(117)-AMP(118)-AMP(119)+IMAG1*AMP(120)+IMAG1
     $ *AMP(121)-AMP(122)+IMAG1*AMP(123)-AMP(125)+AMP(148)-AMP(150)
     $ -AMP(152)+AMP(153)-AMP(155)-AMP(157)-IMAG1*AMP(158)+AMP(163))
      JAMP(5,1)=+1D0/2D0*(+IMAG1*AMP(1)+IMAG1*AMP(3)+AMP(5)+AMP(6)
     $ -AMP(7)+IMAG1*AMP(11)+IMAG1*AMP(12)+IMAG1*AMP(13)+IMAG1*AMP(17)
     $ +IMAG1*AMP(19)-AMP(80)-AMP(81)-AMP(82)-AMP(83)-AMP(88)+IMAG1
     $ *AMP(89)-AMP(90)+IMAG1*AMP(91)+IMAG1*AMP(92)-AMP(94)-IMAG1
     $ *AMP(126)-AMP(127)-AMP(128)-AMP(129)-IMAG1*AMP(130)-IMAG1
     $ *AMP(131)-AMP(132)-IMAG1*AMP(133)-AMP(135)+AMP(148)-AMP(150)
     $ -AMP(152)+AMP(153)-AMP(155)-AMP(157)+IMAG1*AMP(159)+AMP(163))
      JAMP(6,1)=+1D0/2D0*(-IMAG1*AMP(1)-IMAG1*AMP(3)-AMP(5)-AMP(6)
     $ +AMP(7)-IMAG1*AMP(11)-IMAG1*AMP(12)-IMAG1*AMP(13)-IMAG1*AMP(17)
     $ -IMAG1*AMP(19)-AMP(55)-AMP(56)-AMP(57)-AMP(58)-IMAG1*AMP(64)
     $ -AMP(65)-AMP(66)-AMP(67)-IMAG1*AMP(68)-IMAG1*AMP(69)-AMP(70)
     $ -IMAG1*AMP(71)-AMP(73)-AMP(136)+IMAG1*AMP(137)-AMP(138)+IMAG1
     $ *AMP(139)-AMP(141)-AMP(148)-AMP(149)-AMP(151)-AMP(153)-AMP(154)
     $ -AMP(156)-IMAG1*AMP(159)+IMAG1*AMP(160)-AMP(162))
      JAMP(7,1)=-1D0/6D0*IMAG1*AMP(1)-1D0/6D0*IMAG1*AMP(2)-1D0/6D0
     $ *IMAG1*AMP(3)-1D0/6D0*IMAG1*AMP(4)+IMAG1*AMP(14)-1D0/6D0*IMAG1
     $ *AMP(15)+IMAG1*AMP(16)-1D0/6D0*IMAG1*AMP(17)-AMP(84)+1D0/6D0
     $ *AMP(85)+1D0/6D0*AMP(86)+1D0/6D0*AMP(87)+1D0/6D0*AMP(88)+1D0
     $ /6D0*AMP(90)-AMP(93)+1D0/6D0*AMP(94)+1D0/6D0*AMP(142)+1D0/6D0
     $ *AMP(144)-AMP(146)+1D0/6D0*AMP(147)
      JAMP(8,1)=+1D0/6D0*IMAG1*AMP(1)+1D0/6D0*IMAG1*AMP(2)+1D0/6D0
     $ *IMAG1*AMP(3)+1D0/6D0*IMAG1*AMP(4)-IMAG1*AMP(14)+1D0/6D0*IMAG1
     $ *AMP(15)-IMAG1*AMP(16)+1D0/6D0*IMAG1*AMP(17)-AMP(105)+1D0/6D0
     $ *AMP(106)+1D0/6D0*AMP(107)+1D0/6D0*AMP(108)+1D0/6D0*AMP(109)
     $ +1D0/6D0*AMP(111)-AMP(114)+1D0/6D0*AMP(115)+1D0/6D0*AMP(136)
     $ +1D0/6D0*AMP(138)-AMP(140)+1D0/6D0*AMP(141)
      JAMP(9,1)=-AMP(74)+1D0/6D0*AMP(75)+1D0/6D0*AMP(76)+1D0/6D0
     $ *AMP(77)+1D0/6D0*AMP(78)-AMP(79)+1D0/6D0*AMP(80)+1D0/6D0*AMP(81)
     $ +1D0/6D0*AMP(82)+1D0/6D0*AMP(83)-AMP(95)+1D0/6D0*AMP(96)+1D0
     $ /6D0*AMP(97)+1D0/6D0*AMP(98)+1D0/6D0*AMP(99)-AMP(100)+1D0/6D0
     $ *AMP(101)+1D0/6D0*AMP(102)+1D0/6D0*AMP(103)+1D0/6D0*AMP(104)
      JAMP(10,1)=+1D0/2D0*(-AMP(49)-AMP(50)-AMP(51)-AMP(52)-AMP(53)
     $ -AMP(60)-AMP(61)-AMP(62)-AMP(63)+IMAG1*AMP(64)+IMAG1*AMP(68)
     $ +IMAG1*AMP(69)+IMAG1*AMP(71)-AMP(75)-AMP(76)-AMP(77)-AMP(78)
     $ -AMP(85)-AMP(86)-AMP(87)-IMAG1*AMP(89)-IMAG1*AMP(91)-IMAG1
     $ *AMP(92)-IMAG1*AMP(116)-IMAG1*AMP(120)-IMAG1*AMP(121)-IMAG1
     $ *AMP(123)+IMAG1*AMP(143)+IMAG1*AMP(145)+AMP(149)+AMP(150)
     $ +AMP(151)+AMP(152)+AMP(154)+AMP(155)+AMP(156)+AMP(157)+IMAG1
     $ *AMP(161)+AMP(162)-AMP(163))
      JAMP(11,1)=+1D0/2D0*(-AMP(23)-AMP(24)-AMP(25)-AMP(26)-AMP(27)
     $ -AMP(29)-AMP(30)-AMP(31)-AMP(32)-IMAG1*AMP(38)-IMAG1*AMP(42)
     $ -IMAG1*AMP(43)-IMAG1*AMP(45)-AMP(101)-AMP(102)-AMP(103)-AMP(104)
     $ -AMP(106)-AMP(107)-AMP(108)+IMAG1*AMP(110)+IMAG1*AMP(112)+IMAG1
     $ *AMP(113)+IMAG1*AMP(126)+IMAG1*AMP(130)+IMAG1*AMP(131)+IMAG1
     $ *AMP(133)-IMAG1*AMP(137)-IMAG1*AMP(139)+AMP(149)+AMP(150)
     $ +AMP(151)+AMP(152)+AMP(154)+AMP(155)+AMP(156)+AMP(157)-IMAG1
     $ *AMP(160)+AMP(162)-AMP(163))
      JAMP(12,1)=-AMP(28)+1D0/6D0*AMP(29)+1D0/6D0*AMP(30)+1D0/6D0
     $ *AMP(31)+1D0/6D0*AMP(32)-AMP(33)+1D0/6D0*AMP(34)+1D0/6D0*AMP(35)
     $ +1D0/6D0*AMP(36)+1D0/6D0*AMP(37)-AMP(54)+1D0/6D0*AMP(55)+1D0
     $ /6D0*AMP(56)+1D0/6D0*AMP(57)+1D0/6D0*AMP(58)-AMP(59)+1D0/6D0
     $ *AMP(60)+1D0/6D0*AMP(61)+1D0/6D0*AMP(62)+1D0/6D0*AMP(63)

      MATRIX2 = 0.D0
      DO M = 1, NAMPSO
        DO I = 1, NCOLOR
          ZTEMP = (0.D0,0.D0)
          DO J = 1, NCOLOR
            ZTEMP = ZTEMP + CF(J,I)*JAMP(J,M)
          ENDDO
          DO N = 1, NAMPSO
            IF (CHOSEN_SO_CONFIGS(SQSOINDEX2(M,N))) THEN
              MATRIX2 = MATRIX2 + ZTEMP*DCONJG(JAMP(I,N))/DENOM(I)
            ENDIF
          ENDDO
        ENDDO
      ENDDO

      AMP2(1)=AMP2(1)+(AMP(1)+AMP(3))*DCONJG(AMP(1)+AMP(3))
      AMP2(2)=AMP2(2)+(AMP(2)+AMP(4))*DCONJG(AMP(2)+AMP(4))
      AMP2(5)=AMP2(5)+(AMP(5)+AMP(6))*DCONJG(AMP(5)+AMP(6))
      AMP2(8)=AMP2(8)+(AMP(8)+AMP(9)+AMP(10))*DCONJG(AMP(8)+AMP(9)
     $ +AMP(10))
      AMP2(11)=AMP2(11)+(AMP(11)+AMP(12)+AMP(13))*DCONJG(AMP(11)
     $ +AMP(12)+AMP(13))
      AMP2(19)=AMP2(19)+(AMP(24)+AMP(25)+AMP(26)+AMP(27))
     $ *DCONJG(AMP(24)+AMP(25)+AMP(26)+AMP(27))
      AMP2(24)=AMP2(24)+(AMP(30)+AMP(31)+AMP(32))*DCONJG(AMP(30)
     $ +AMP(31)+AMP(32))
      AMP2(28)=AMP2(28)+(AMP(35)+AMP(36)+AMP(37))*DCONJG(AMP(35)
     $ +AMP(36)+AMP(37))
      AMP2(32)=AMP2(32)+(AMP(39)+AMP(40)+AMP(41)+AMP(44))
     $ *DCONJG(AMP(39)+AMP(40)+AMP(41)+AMP(44))
      AMP2(35)=AMP2(35)+(AMP(42)+AMP(43)+AMP(45))*DCONJG(AMP(42)
     $ +AMP(43)+AMP(45))
      AMP2(41)=AMP2(41)+(AMP(50)+AMP(51)+AMP(52)+AMP(53))
     $ *DCONJG(AMP(50)+AMP(51)+AMP(52)+AMP(53))
      AMP2(46)=AMP2(46)+(AMP(56)+AMP(57)+AMP(58))*DCONJG(AMP(56)
     $ +AMP(57)+AMP(58))
      AMP2(50)=AMP2(50)+(AMP(61)+AMP(62)+AMP(63))*DCONJG(AMP(61)
     $ +AMP(62)+AMP(63))
      AMP2(54)=AMP2(54)+(AMP(65)+AMP(66)+AMP(67)+AMP(70))
     $ *DCONJG(AMP(65)+AMP(66)+AMP(67)+AMP(70))
      AMP2(57)=AMP2(57)+(AMP(68)+AMP(69)+AMP(71))*DCONJG(AMP(68)
     $ +AMP(69)+AMP(71))
      AMP2(63)=AMP2(63)+(AMP(76)+AMP(77)+AMP(78))*DCONJG(AMP(76)
     $ +AMP(77)+AMP(78))
      AMP2(67)=AMP2(67)+(AMP(81)+AMP(82)+AMP(83))*DCONJG(AMP(81)
     $ +AMP(82)+AMP(83))
      AMP2(71)=AMP2(71)+(AMP(86)+AMP(87))*DCONJG(AMP(86)+AMP(87))
      AMP2(73)=AMP2(73)+(AMP(88)+AMP(90))*DCONJG(AMP(88)+AMP(90))
      AMP2(74)=AMP2(74)+(AMP(89)+AMP(91))*DCONJG(AMP(89)+AMP(91))
      AMP2(80)=AMP2(80)+(AMP(97)+AMP(98)+AMP(99))*DCONJG(AMP(97)
     $ +AMP(98)+AMP(99))
      AMP2(84)=AMP2(84)+(AMP(102)+AMP(103)+AMP(104))*DCONJG(AMP(102)
     $ +AMP(103)+AMP(104))
      AMP2(88)=AMP2(88)+(AMP(107)+AMP(108))*DCONJG(AMP(107)+AMP(108))
      AMP2(90)=AMP2(90)+(AMP(109)+AMP(111))*DCONJG(AMP(109)+AMP(111))
      AMP2(91)=AMP2(91)+(AMP(110)+AMP(112))*DCONJG(AMP(110)+AMP(112))
      AMP2(97)=AMP2(97)+(AMP(117)+AMP(118)+AMP(119)+AMP(122))
     $ *DCONJG(AMP(117)+AMP(118)+AMP(119)+AMP(122))
      AMP2(100)=AMP2(100)+(AMP(120)+AMP(121)+AMP(123))*DCONJG(AMP(120)
     $ +AMP(121)+AMP(123))
      AMP2(106)=AMP2(106)+(AMP(127)+AMP(128)+AMP(129)+AMP(132))
     $ *DCONJG(AMP(127)+AMP(128)+AMP(129)+AMP(132))
      AMP2(109)=AMP2(109)+(AMP(130)+AMP(131)+AMP(133))*DCONJG(AMP(130)
     $ +AMP(131)+AMP(133))
      AMP2(114)=AMP2(114)+(AMP(136)+AMP(138))*DCONJG(AMP(136)+AMP(138))
      AMP2(115)=AMP2(115)+(AMP(137)+AMP(139))*DCONJG(AMP(137)+AMP(139))
      AMP2(119)=AMP2(119)+(AMP(142)+AMP(144))*DCONJG(AMP(142)+AMP(144))
      AMP2(120)=AMP2(120)+(AMP(143)+AMP(145))*DCONJG(AMP(143)+AMP(145))
      AMP2(125)=AMP2(125)+(AMP(151)+AMP(156))*DCONJG(AMP(151)+AMP(156))
      AMP2(126)=AMP2(126)+(AMP(152)+AMP(157))*DCONJG(AMP(152)+AMP(157))
      DO I = 1, NCOLOR
        DO M = 1, NAMPSO
          DO N = 1, NAMPSO
            IF (CHOSEN_SO_CONFIGS(SQSOINDEX2(M,N))) THEN
              JAMP2(I)=JAMP2(I)+DABS(DBLE(JAMP(I,M)*DCONJG(JAMP(I,N))))
            ENDIF
          ENDDO
        ENDDO
      ENDDO

      END

C     Set of functions to handle the array indices of the split orders


      INTEGER FUNCTION SQSOINDEX2(ORDERINDEXA, ORDERINDEXB)
C     
C     This functions plays the role of the interference matrix. It can
C      be hardcoded or 
C     made more elegant using hashtables if its execution speed ever
C      becomes a relevant
C     factor. From two split order indices, it return the
C      corresponding index in the squared 
C     order canonical ordering.
C     
C     CONSTANTS
C     

      INTEGER    NSO, NSQUAREDSO, NAMPSO
      PARAMETER (NSO=1, NSQUAREDSO=1, NAMPSO=1)
C     
C     ARGUMENTS
C     
      INTEGER ORDERINDEXA, ORDERINDEXB
C     
C     LOCAL VARIABLES
C     
      INTEGER I, SQORDERS(NSO)
      INTEGER AMPSPLITORDERS(NAMPSO,NSO)
      DATA (AMPSPLITORDERS(  1,I),I=  1,  1) /    1/
      COMMON/AMPSPLITORDERS2/AMPSPLITORDERS
C     
C     FUNCTION
C     
      INTEGER SOINDEX_FOR_SQUARED_ORDERS2
C     
C     BEGIN CODE
C     
      DO I=1,NSO
        SQORDERS(I)=AMPSPLITORDERS(ORDERINDEXA,I)
     $   +AMPSPLITORDERS(ORDERINDEXB,I)
      ENDDO
      SQSOINDEX2=SOINDEX_FOR_SQUARED_ORDERS2(SQORDERS)
      END

      INTEGER FUNCTION SOINDEX_FOR_SQUARED_ORDERS2(ORDERS)
C     
C     This functions returns the integer index identifying the squared
C      split orders list passed in argument which corresponds to the
C      values of the following list of couplings (and in this order).
C     []
C     
C     CONSTANTS
C     
      INTEGER    NSO, NSQSO, NAMPSO
      PARAMETER (NSO=1, NSQSO=1, NAMPSO=1)
C     
C     ARGUMENTS
C     
      INTEGER ORDERS(NSO)
C     
C     LOCAL VARIABLES
C     
      INTEGER I,J
      INTEGER SQSPLITORDERS(NSQSO,NSO)
      DATA (SQSPLITORDERS(  1,I),I=  1,  1) /    2/
      COMMON/SQPLITORDERS2/SQPLITORDERS
C     
C     BEGIN CODE
C     
      DO I=1,NSQSO
        DO J=1,NSO
          IF (ORDERS(J).NE.SQSPLITORDERS(I,J)) GOTO 1009
        ENDDO
        SOINDEX_FOR_SQUARED_ORDERS2 = I
        RETURN
 1009   CONTINUE
      ENDDO

      WRITE(*,*) 'ERROR:: Stopping in function'
      WRITE(*,*) 'SOINDEX_FOR_SQUARED_ORDERS2'
      WRITE(*,*) 'Could not find squared orders ',(ORDERS(I),I=1,NSO)
      STOP

      END

      SUBROUTINE GET_NSQSO_BORN2(NSQSO)
C     
C     Simple subroutine returning the number of squared split order
C     contributions returned when calling smatrix_split_orders 
C     

      INTEGER    NSQUAREDSO
      PARAMETER  (NSQUAREDSO=1)

      INTEGER NSQSO

      NSQSO=NSQUAREDSO

      END

C     This is the inverse subroutine of SOINDEX_FOR_SQUARED_ORDERS.
C      Not directly useful, but provided nonetheless.
      SUBROUTINE GET_SQUARED_ORDERS_FOR_SOINDEX2(SOINDEX,ORDERS)
C     
C     This functions returns the orders identified by the squared
C      split order index in argument. Order values correspond to
C      following list of couplings (and in this order):
C     []
C     
C     CONSTANTS
C     
      INTEGER    NSO, NSQSO
      PARAMETER (NSO=1, NSQSO=1)
C     
C     ARGUMENTS
C     
      INTEGER SOINDEX, ORDERS(NSO)
C     
C     LOCAL VARIABLES
C     
      INTEGER I
      INTEGER SQPLITORDERS(NSQSO,NSO)
      COMMON/SQPLITORDERS2/SQPLITORDERS
C     
C     BEGIN CODE
C     
      IF (SOINDEX.GT.0.AND.SOINDEX.LE.NSQSO) THEN
        DO I=1,NSO
          ORDERS(I) =  SQPLITORDERS(SOINDEX,I)
        ENDDO
        RETURN
      ENDIF

      WRITE(*,*) 'ERROR:: Stopping function'
     $ //' GET_SQUARED_ORDERS_FOR_SOINDEX2'
      WRITE(*,*) 'Could not find squared orders index ',SOINDEX
      STOP

      END SUBROUTINE

C     This is the inverse subroutine of getting amplitude SO orders.
C      Not directly useful, but provided nonetheless.
      SUBROUTINE GET_ORDERS_FOR_AMPSOINDEX2(SOINDEX,ORDERS)
C     
C     This functions returns the orders identified by the split order
C      index in argument. Order values correspond to following list of
C      couplings (and in this order):
C     []
C     
C     CONSTANTS
C     
      INTEGER    NSO, NAMPSO
      PARAMETER (NSO=1, NAMPSO=1)
C     
C     ARGUMENTS
C     
      INTEGER SOINDEX, ORDERS(NSO)
C     
C     LOCAL VARIABLES
C     
      INTEGER I
      INTEGER AMPSPLITORDERS(NAMPSO,NSO)
      COMMON/AMPSPLITORDERS2/AMPSPLITORDERS
C     
C     BEGIN CODE
C     
      IF (SOINDEX.GT.0.AND.SOINDEX.LE.NAMPSO) THEN
        DO I=1,NSO
          ORDERS(I) =  AMPSPLITORDERS(SOINDEX,I)
        ENDDO
        RETURN
      ENDIF

      WRITE(*,*) 'ERROR:: Stopping function GET_ORDERS_FOR_AMPSOINDEX2'
      WRITE(*,*) 'Could not find amplitude split orders index ',SOINDEX
      STOP

      END SUBROUTINE

C     This function is not directly useful, but included for
C      completeness
      INTEGER FUNCTION SOINDEX_FOR_AMPORDERS2(ORDERS)
C     
C     This functions returns the integer index identifying the
C      amplitude split orders passed in argument which correspond to
C      the values of the following list of couplings (and in this
C      order):
C     []
C     
C     CONSTANTS
C     
      INTEGER    NSO, NAMPSO
      PARAMETER (NSO=1, NAMPSO=1)
C     
C     ARGUMENTS
C     
      INTEGER ORDERS(NSO)
C     
C     LOCAL VARIABLES
C     
      INTEGER I,J
      INTEGER AMPSPLITORDERS(NAMPSO,NSO)
      COMMON/AMPSPLITORDERS2/AMPSPLITORDERS
C     
C     BEGIN CODE
C     
      DO I=1,NAMPSO
        DO J=1,NSO
          IF (ORDERS(J).NE.AMPSPLITORDERS(I,J)) GOTO 1009
        ENDDO
        SOINDEX_FOR_AMPORDERS2 = I
        RETURN
 1009   CONTINUE
      ENDDO

      WRITE(*,*) 'ERROR:: Stopping function SOINDEX_FOR_AMPORDERS2'
      WRITE(*,*) 'Could not find squared orders ',(ORDERS(I),I=1,NSO)
      STOP

      END

