Skip to content

hao-wang/FeynmanDiagram

Repository files navigation

********************************************
* C Program for Feynman Diagram Generation 
*
* XIAO Bo (homenature@163.com), and	    
* WANG Hao (hwang.phy@gmail.com) 	   
*
* http://arxiv/abs/1209.0949
********************************************

                     *********************
                     *   introduction    *
                     *********************

This is the source code of a C program for automatic Feynman diagrams generation.
It is supposed to be used by the high energy particle physists.

Advantage of this program:
1. It is small in size and run fast:
   3860 Feynman diagrams of 'u + ubar --> t + tbar' at two loop order in QCD model 
   can be generated in 0.015 seconds in a normal PC.
2. Yet it is a totally general Feynman diagram generator: 
   it receives arbitrary user defined model and arbitrary process as input and 
   generates Feynman diagrams at any order.
3. Symmetry factors from identical fields and signs from fermion exchanging can 
   be naturely generated.

The physical background and the algorithm adopted in this C program
can be found at its companion paper:
http://arxiv/abs/1209.0949


                     *********************
                     *     how to use    *
                     *********************

1. Compile the source code and get an excutable file.
2. Put the excutable file and the input file "input.txt" in the same directory.
3. Modify the "input.txt" according to your needs (see below).
3. Run the excutable file.
4. The results are contained in the generated output file "output-feynman-diagrams.txt" (see below).


                     *********************
                     *   the input file  *
                     *********************

The user needs to modify the input file, named "input.txt", to describe the
the physical model, scattering process, and the interaction order (loops). 
For example, to generate the Feynman diagrams of the process of
  u + ubar --> t + tbar
at 1-loop order under the physical model of QED, the input file goes like:

### input file begin ###
============================================================================
             The physical model (i.e. the relevent interactions)
instructions:
'U' means a Boson having no charge, i.e. it has no antiparticle, e.g. photon
'C' means a Boson which has antiparticle, e.g. W+ and W-
'F' means a Fermion
============================================================================
total number of interactions >>>
2
list of the interactions >>>
3> F1 F-1 U1:1
3> F2 F-2 U1:1

============================================================================
                          The physical process
============================================================================
total number of incoming and outgoing particles >>>
4
the incoming and outgoing particles >>>
2> F1 F-1
2> F2 F-2
total loops >>>
1
### input file end ###

Explanations of the above input file:
1) The user needs to fill the informations under each label line "...>>>".
2) There are 2 interaction terms 'u-ubar-photon' and 't-tbar-photon'
   for the scattering process of 'u + ubar --> t + tbar' under QED.
   So, under the first label line "total number of interactions >>>" we
   write a "2".
3) Under the "list of the interactions >>>", we list the 2 interaction terms
   'u-ubar-photon' and 't-tbar-photon' one by one as "3> F1 F-1 U1:1" and 
   "3> F2 F-2 U1:1".
   3.1) '?>' at the front of a line is a pre-information to tell the program 
        how many 'word's follow in this line.
   3.2) 'F1' represents an u quark. The user can use an arbitary integer number
        in 'F?' to represents the u quark, e.g. F888, F123.
        'F-1' represents an anti u quark. The number in 'F-n' must be the same as
        the number in its anti partner 'Fn'.
        'F2' and 'F-2' represent t quark and anti t quark, where the number '2' 
        is also chosen at random.
   3.3) 'U1' represents an photon, where the number '1' is chosen at random.
        'Un' must be tightly followed by a ':m', where 'm' describe the multiplicity
        of 'Un' in an interaction term. In the interaction term 'u-ubar-photon', the
        multiplicity of the photon is '1', so 'Un:1' is written.
   3.4) A fermion 'Fn' is not allowed to be followed by a ':m'.
        If one wants to write an interaction term composed of multiple identical "fermion"s,
        for example, 'e- e- mu+ mu+', one should write the input as
        "4> F1 F1 F-2 F-2" instead of "2> F1:2 F-2:2".
        See "http://arxiv/abs/1209.0949" for explanations.
4) After telling the program that there are totally 4 external particles under the 
   label line "total number of incoming and outgoing particles >>>",
   the user should list the 4 incoming and outgoing particles under the label line
   "the incoming and outgoing particles >>>".
   The "2> F1 F-1" tells that there are two incoming particles u quark and anti u quark,
   The "2> F2 F-2" tells that there are two outgoing particles t quark and anti t quark.
5) Finally, the number of loops is given. 
   For tree-level, the total loops are set to be '0'.

One more example.
Generating the Feynman diagrams of the process of
u + ubar --> t + tbar
at 2-loop order with the physical model of QCD. The input file is:

### input file begin ###
============================================================================
             The physical model (i.e. the relevent interactions)
instructions:
'U' means a Boson having no charge, i.e. it has no antiparticle, e.g. photon
'C' means a Boson which has antiparticle, e.g. W+ and W-
'F' means a Fermion
============================================================================
total number of interactions >>>
9
list of the interactions >>>
3> F1 F-1 U1:1
3> F2 F-2 U1:1
3> F3 F-3 U1:1
3> F4 F-4 U1:1
3> F5 F-5 U1:1
3> F6 F-6 U1:1
1> U1:3
1> U1:4
3> U1:1 C1:1 C-1:1

============================================================================
                          The physical process
============================================================================
total number of incoming and outgoing particles >>>
4
the incoming and outgoing particles >>>
2> F1 F-1
2> F5 F-5
total loops >>>
2
### input file end ###

Explanations of the input file:
1) "1> U1:3" represents an three-gluon self interaction term.
2) "3> U1:1 C1:1 C-1:1" represents an 'gluon-ghost-ghost' interaction term.
3) The 9 interaction terms listed under "list of the interactions >>>"
   can be put in random order.
4) We use F1 to present u quark and F5 to present t quark.


                     *********************
                     *  the output file  *
                     *********************

An output file corresponding to the second input file example above is

### output file begin ###
============================================================================
             The physical model (i.e. the relevent interactions)
============================================================================
>>> the interactions
I1:	(F1,F-1,U1:1)
I2:	(F2,F-2,U1:1)
I3:	(F3,F-3,U1:1)
I4:	(F4,F-4,U1:1)
I5:	(F5,F-5,U1:1)
I6:	(F6,F-6,U1:1)
I7:	(U1:3)
I8:	(U1:4)
I9:	(U1:1,C1:1,C-1:1)

============================================================================
                          The physical process
============================================================================
>>> the external particles
P1:	(F-1)
P2:	(F1)
P3:	(F5)
P4:	(F-5)
>>> the internal vertices
H1
H2
H3
H4
H5
H6

============================================================================
                          The Feynman diagrams
============================================================================
(1)
P1-->H1 (I1.leg[2])
P2-->H1 (I1.leg[1])
P3-->H2 (I5.leg[1])
P4-->H2 (I5.leg[2])
H1-->H3 (I1.leg[3]-->I1.leg[3])
H2-->H4 (I5.leg[3]-->I1.leg[3])
H3-->H4 (I1.leg[1]-->I1.leg[2])
H3-->H5 (I1.leg[2]-->I1.leg[1])
H4-->H5 (I1.leg[1]-->I1.leg[2])
H5-->H6 (I1.leg[3]-->I1.leg[3])
H6-->H6 (I1.leg[1]-->I1.leg[2])
symmetryFactor = 1 
fermionSign=-1
------------------------------------------------
(2)
P1-->H1 (I1.leg[2])
P2-->H1 (I1.leg[1])
P3-->H2 (I5.leg[1])
P4-->H2 (I5.leg[2])
H1-->H3 (I1.leg[3]-->I1.leg[3])
H2-->H4 (I5.leg[3]-->I1.leg[3])
H3-->H4 (I1.leg[1]-->I1.leg[2])
H3-->H5 (I1.leg[2]-->I1.leg[1])
H4-->H5 (I1.leg[1]-->I1.leg[2])
H5-->H6 (I1.leg[3]-->I2.leg[3])
H6-->H6 (I2.leg[1]-->I2.leg[2])
symmetryFactor = 1 
fermionSign=-1
------------------------------------------------
...
### output file end ###

Explanations of the output file:
1) Firstly, the input information is reshown, 
   and
   each interaction term is labeled by 'I?',
   each external particle is labeled by 'P?',
   each internal vertex is labeled by 'H?'.
2) Then, all the Feynman diagrams are listed one by one.
   The topology of a Feynman diagram is expressed by the relations of the
   external particles and internal vertices.
   For example, the gragh form of the topology of Feynman diagram '(1)' is

   * P1                                                        P3 *
     *                                                          * 
       *                       * * * * *                      *
         *                   *           *                  *
           *               *               *              *
             H1 ~ ~ ~ ~ ~ H3               H4 ~ ~ ~ ~ ~ H2
           *               *               *              *
         *                   *           *                  *
       *                       * * H5* *                      *
     *                             ~                            * 
   * P2                            ~                           P4 *
                                   ~
                                 * H6*
                               *       *
                               *       *
                                 * * *

   The "I[?].leg[?]" in the bracket represents the interaction type of the vertex
   and the particle type of the line between the vertices.

About

C-program for Feynman diagram generation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published