~maddevelopers/mg5amcnlo/laser_beam_option

« back to all changes in this revision

Viewing changes to tests/unit_tests/various/test_aloha.py

  • Committer: olivier Mattelaer
  • Date: 2013-03-05 18:52:27 UTC
  • mfrom: (239.1.31 mg5_1_5_8)
  • Revision ID: olivier.mattelaer@uclouvain.be-20130305185227-h1358ux804s2wc26
Pass to 1.5.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
3456
3456
        for out,sol in zip(ufo_value,solution):
3457
3457
            self.assertAlmostEqual(out, sol)
3458
3458
 
 
3459
    def test_aloha_expr_VVS1(self):
 
3460
        """Test analytical expression for VVS from SILH. 
 
3461
        This checks that P(-1,1)**2 is correct."""
 
3462
        
 
3463
        
 
3464
        aloha_lib.KERNEL.clean()
 
3465
        from models.mssm.object_library import Lorentz
 
3466
        VVS1 = Lorentz(name = 'VVS1',
 
3467
                 spins = [ 3, 3, 1 ],
 
3468
                 structure = 'P(1,1)*P(2,1) - P(-1,1)**2*Metric(1,2)')
 
3469
        builder = create_aloha.AbstractRoutineBuilder(VVS1)
 
3470
        amp = builder.compute_routine(0)
 
3471
 
 
3472
        solution = """subroutine VVS1_0(V1, V2, S3, COUP,vertex)
 
3473
implicit none
 
3474
 complex*16 CI
 
3475
 parameter (CI=(0d0,1d0))
 
3476
 complex*16 V2(*)
 
3477
 complex*16 TMP2
 
3478
 complex*16 S3(*)
 
3479
 complex*16 TMP1
 
3480
 real*8 P1(0:3)
 
3481
 complex*16 TMP0
 
3482
 complex*16 vertex
 
3483
 complex*16 COUP
 
3484
 complex*16 V1(*)
 
3485
 complex*16 TMP3
 
3486
P1(0) = dble(V1(1))
 
3487
P1(1) = dble(V1(2))
 
3488
P1(2) = dimag(V1(2))
 
3489
P1(3) = dimag(V1(1))
 
3490
 TMP1 = (P1(0)*V1(3)-P1(1)*V1(4)-P1(2)*V1(5)-P1(3)*V1(6))
 
3491
 TMP0 = (V2(3)*P1(0)-V2(4)*P1(1)-V2(5)*P1(2)-V2(6)*P1(3))
 
3492
 TMP3 = (P1(0)*P1(0)-P1(1)*P1(1)-P1(2)*P1(2)-P1(3)*P1(3))
 
3493
 TMP2 = (V2(3)*V1(3)-V2(4)*V1(4)-V2(5)*V1(5)-V2(6)*V1(6))
 
3494
 vertex = COUP*S3(3)*(-CI*(TMP0*TMP1)+CI*(TMP2*TMP3))
 
3495
end
 
3496
 
 
3497
 
 
3498
"""
 
3499
        routine = amp.write(output_dir=None, language='Fortran')
 
3500
        split_solution = [l.strip() for l in solution.split('\n')]
 
3501
        split_routine = [l.strip() for l in routine.split('\n')]
 
3502
        self.assertEqual(split_solution, split_routine)
 
3503
        self.assertEqual(len(split_routine), len(split_solution))
 
3504
 
 
3505
 
 
3506
        V1_1, V1_2, V1_3, V1_4 = 1,2,3,4
 
3507
        V2_1, V2_2, V2_3, V2_4 = 5,5,6,7
 
3508
        S3_1, S3_2, S3_3, S3_4 = 10,20,32,44
 
3509
        P1_0, P1_1, P1_2, P1_3 = 1,2,3,6
 
3510
        M1 = P1_0**2 - P1_1**2 - P1_2**2 - P1_3**2
 
3511
        # For V4:
 
3512
        cImag = complex(0,1)
 
3513
 
 
3514
        for name, expr in amp.contracted.items():
 
3515
            exec('%s = %s' % (name,expr))       
 
3516
 
 
3517
 
 
3518
        ufo_value = eval(str(amp.expr.get_rep([0])))
 
3519
        self.assertAlmostEqual(ufo_value, 1080j)
 
3520
 
 
3521
 
3459
3522
        
3460
3523
    def test_aloha_expr_FFV2C1(self):
3461
3524
        """Test analytical expression for fermion clash routine"""