1 to 1 process

[1]:
from smpl import io
[2]:
from pyfeyn2.interface.qgraf import style
import itertools as it
import re
[3]:
from pyqgraf import qgraf, model
qgraf.install("3.6.5")
xml_string = qgraf.run("nu_e[p1]", "nu_e[p1]",loops=3,loop_momentum="l",model = model.gws_UnitaryGauge_reduced, style=style)
/home/apn/data/de.neuwirthinformatik.Alexander/Development/git/pyqgraf/pyqgraf/qgraf.py:87: UserWarning:
        Please cite the following papers if you use this code:

      [1] Automatic Feynman graph generation J. Comput. Phys. 105 (1993) 279--289 https://doi.org/10.1006/jcph.1993.1074

      [2] Abusing Qgraf Nucl. Instrum. Methods Phys. Res. A 559 (2006) 220--223 https://doi.org/10.1016/j.nima.2005.11.151

      [3] Feynman graph generation and propagator mixing, I Comput. Phys. Commun. 269 (2021) 108103 https://doi.org/10.1016/j.cpc.2021.108103


  warnings.warn(


--------------------------------------------------------------------------------
-- Trying "Ninja" generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
Not searching for unused variables given on the command line.
-- The C compiler identification is GNU 11.3.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- The CXX compiler identification is GNU 11.3.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/tmp7gc7tmtq/_cmake_test_compile/build
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying "Ninja" generator - success
--------------------------------------------------------------------------------

Configuring Project
  Working directory:
    /tmp/tmp7gc7tmtq/_skbuild/linux-x86_64-3.9/cmake-build
  Command:
    cmake /tmp/tmp7gc7tmtq -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=/tmp/tmp7gc7tmtq/_skbuild/linux-x86_64-3.9/cmake-install -DPYTHON_VERSION_STRING:STRING=3.9.16 -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/home/apn/.cache/pypoetry/virtualenvs/pyfeyn2-CEvJ4jFG-py3.9/lib/python3.9/site-packages/skbuild/resources/cmake -DPYTHON_EXECUTABLE:PATH=/home/apn/.cache/pypoetry/virtualenvs/pyfeyn2-CEvJ4jFG-py3.9/bin/python -DPYTHON_INCLUDE_DIR:PATH=/usr/include/python3.9 -DPYTHON_LIBRARY:PATH=/usr/lib64/libpython3.9.so -DPython_EXECUTABLE:PATH=/home/apn/.cache/pypoetry/virtualenvs/pyfeyn2-CEvJ4jFG-py3.9/bin/python -DPython_ROOT_DIR:PATH=/home/apn/.cache/pypoetry/virtualenvs/pyfeyn2-CEvJ4jFG-py3.9 -DPython_INCLUDE_DIR:PATH=/usr/include/python3.9 -DPython_FIND_REGISTRY:STRING=NEVER -DPython_NumPy_INCLUDE_DIRS:PATH=/home/apn/.cache/pypoetry/virtualenvs/pyfeyn2-CEvJ4jFG-py3.9/lib/python3.9/site-packages/numpy/core/include -DPython3_EXECUTABLE:PATH=/home/apn/.cache/pypoetry/virtualenvs/pyfeyn2-CEvJ4jFG-py3.9/bin/python -DPython3_ROOT_DIR:PATH=/home/apn/.cache/pypoetry/virtualenvs/pyfeyn2-CEvJ4jFG-py3.9 -DPython3_INCLUDE_DIR:PATH=/usr/include/python3.9 -DPython3_FIND_REGISTRY:STRING=NEVER -DPython3_NumPy_INCLUDE_DIRS:PATH=/home/apn/.cache/pypoetry/virtualenvs/pyfeyn2-CEvJ4jFG-py3.9/lib/python3.9/site-packages/numpy/core/include -DCMAKE_INSTALL_PREFIX=/tmp/tmp7gc7tmtq

-- The Fortran compiler identification is GNU 11.3.1
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /usr/bin/gfortran - skipped
-- The C compiler identification is GNU 11.3.1
-- The CXX compiler identification is GNU 11.3.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/tmp7gc7tmtq/_skbuild/linux-x86_64-3.9/cmake-build
[1/5] Building Fortran preprocessed CMakeFiles/qgraf.dir/qgraf-3.6.5.f08-pp.f08
[2/5] Generating Fortran dyndep file CMakeFiles/qgraf.dir/Fortran.dd
CMake Warning:
  Manually-specified variables were not used by the project:

    PYTHON_EXECUTABLE
    PYTHON_INCLUDE_DIR
    PYTHON_LIBRARY
    PYTHON_VERSION_STRING
    Python3_EXECUTABLE
    Python3_FIND_REGISTRY
    Python3_INCLUDE_DIR
    Python3_NumPy_INCLUDE_DIRS
    Python3_ROOT_DIR
    Python_EXECUTABLE
    Python_FIND_REGISTRY
    Python_INCLUDE_DIR
    Python_NumPy_INCLUDE_DIRS
    Python_ROOT_DIR
    SKBUILD


[3/5] Building Fortran object CMakeFiles/qgraf.dir/qgraf-3.6.5.f08.o
[4/5] Linking Fortran executable qgraf
[4/5] Install the project...
-- Install configuration: ""
-- Installing: /tmp/tmp7gc7tmtq/bin/qgraf
/home/apn/.local/bin/qgraf-3.6.5 qgraf.dat

 --------------------------------------------------------------
                          qgraf-3.6.5
 --------------------------------------------------------------

  output= 'output.out' ;
  style= 'tmp.sty' ;
  model = 'tmp.model';
  in= nu_e[p1];
  out= nu_e[p1];
  loops= 3;
  loop_momentum= l;
  options= notadpole,onshell;

 --------------------------------------------------------------

   #loops    v-degrees          #diagrams

      3
              -   4^3     ....     0
             3^2  4^2     ....     3
             3^4  4^1     ....     36
             3^6   -      ....     365


        total =  404 connected diagrams

[4]:
from xsdata.formats.dataclass.parsers import XmlParser
from pyfeyn2.render.latex.feynmp import FeynmpRender
from pyfeyn2.render.latex.tikzfeynman import TikzFeynmanRender
from pyfeyn2.render.pyx.pyxrender import PyxRender
from pyfeyn2.feynmandiagram import FeynML

from pyfeyn2.auto.bend import auto_bend
from pyfeyn2.auto.label import auto_label
from pyfeyn2.auto.position import feynman_adjust_points

parser = XmlParser()
fml = parser.from_string(xml_string, FeynML)

def filter_diag(d):
    count = 0
    ecount = 0
    for p in d.propagators:
        if p.pdgid == 22:
            count +=1
        if p.pdgid == 11:
            ecount +=1
    if count ==1 and ecount >=2:
        return True
    return False

ccount=0
for d in fml.diagrams:
    if filter_diag(d):
        ccount +=1
print("single photon diags", ccount)

for d in fml.diagrams:
    if filter_diag(d):
        ccount +=1
        d.legs[0].with_xy(-2,0)
        d.legs[1].with_xy(2,0)
        d.get_vertex(d.legs[0].target).with_xy(-1,0)
        d.get_vertex(d.legs[1].target).with_xy(1,0)
        d = feynman_adjust_points(d,size=15,override_vertices=False)
        auto_bend(d)
        auto_label(d.propagators)
        auto_label(d.legs)
        #print(d)
        t = TikzFeynmanRender(d)
        #print(t.get_src())
        t.render(show=True)
        #break
single photon diags 99
../../../_images/interfaces_qgraf_1_to_1_qgraf_4_1.png
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
Cell In[4], line 46
     44 t = TikzFeynmanRender(d)
     45 #print(t.get_src())
---> 46 t.render(show=True)
     47 #break

File ~/data/de.neuwirthinformatik.Alexander/Development/git/pyfeyn2/pyfeyn2/render/latex/latex.py:55, in LatexRender.render(self, file, show, resolution, width, height, clean_up)
     53     file = "tmp"
     54 file = re.sub("\.pdf$", "", file.strip())
---> 55 self.generate_pdf(
     56     file,
     57     clean_tex=clean_up,
     58     compiler="lualatex",
     59     compiler_args=["-shell-escape"],
     60 )
     61 wi = WImage(
     62     filename=file + ".pdf", resolution=resolution, width=width, height=height
     63 )
     64 if delete:

File ~/.cache/pypoetry/virtualenvs/pyfeyn2-CEvJ4jFG-py3.9/lib/python3.9/site-packages/pylatex/document.py:250, in Document.generate_pdf(self, filepath, clean, clean_tex, compiler, compiler_args, silent)
    247 command = [compiler] + arguments + compiler_args + main_arguments
    249 try:
--> 250     output = subprocess.check_output(command,
    251                                      stderr=subprocess.STDOUT,
    252                                      **check_output_kwargs)
    253 except (OSError, IOError) as e:
    254     # Use FileNotFoundError when python 2 is dropped
    255     os_error = e

File /usr/lib/python3.9/subprocess.py:424, in check_output(timeout, *popenargs, **kwargs)
    421         empty = b''
    422     kwargs['input'] = empty
--> 424 return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
    425            **kwargs).stdout

File /usr/lib/python3.9/subprocess.py:507, in run(input, capture_output, timeout, check, *popenargs, **kwargs)
    505 with Popen(*popenargs, **kwargs) as process:
    506     try:
--> 507         stdout, stderr = process.communicate(input, timeout=timeout)
    508     except TimeoutExpired as exc:
    509         process.kill()

File /usr/lib/python3.9/subprocess.py:1121, in Popen.communicate(self, input, timeout)
   1119     self._stdin_write(input)
   1120 elif self.stdout:
-> 1121     stdout = self.stdout.read()
   1122     self.stdout.close()
   1123 elif self.stderr:

KeyboardInterrupt:
[ ]:
print(xml_string)
[ ]: