Skip to content

Commit

Permalink
fix: colorcorrelation of gluons
Browse files Browse the repository at this point in the history
  • Loading branch information
APN-Pucky committed May 28, 2024
1 parent 9303693 commit e4042b8
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 4 deletions.
2 changes: 1 addition & 1 deletion feynamp/leg.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def color_vector_to_casimir(color_vector: str) -> str:

def color_vector_to_operator(color_vector):
if color_vector == "VA":
return "complex(0,1)*f"
return "(-1)*i_*f"
if color_vector == "VC":
return "T"
return None
Expand Down
7 changes: 6 additions & 1 deletion feynamp/test/colorcorrelation.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def assert_colorcorrelation(sympy_expr, fds, model):
if vec is not None:
casimir = color_vector_to_casimir(vec)
sum = sympy_expr
print(f"{sum=}", f"{j=}")
for i in range(len(legs)):
momi = get_leg_momentum(legs[i])
momj = get_leg_momentum(legs[j])
Expand All @@ -25,6 +26,7 @@ def assert_colorcorrelation(sympy_expr, fds, model):
sympy.parse_expr(f"colorcorrelation({momj},{momi})"),
1,
)
print(f"{sum=}")
# TODO can be optimized
for k in range(len(legs)):
for l in range(len(legs)):
Expand All @@ -39,4 +41,7 @@ def assert_colorcorrelation(sympy_expr, fds, model):
0,
)
# replace all remaining colorcorrelation(mom,mom) with 0
assert sum.equals(sympy.parse_expr(casimir))
sum = sum.subs("Nc", 3).subs("Cf", "4/3").simplify()
casimir = casimir.replace("Nc", "3").replace("Cf", "4/3").replace("Ca", "3")
print(f"{sum=}", f"{casimir=}")
assert sum.equals(sympy.parse_expr(casimir)), f"{sum=} {casimir=}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import logging

import equation_database.isbn_9780511628788 as ref
import sympy
from feynml.interface.qgraf import style
from feynmodel.interface.qgraf import feynmodel_to_qgraf
from feynmodel.interface.ufo import load_ufo_model
from pyfeyn2.feynmandiagram import FeynML
from pyqgraf import qgraf
from xsdata.formats.dataclass.parsers import XmlParser

from feynamp.form import compute_squared
from feynamp.test.colorcorrelation import assert_colorcorrelation

logger = logging.getLogger("feynamp")
logger.setLevel(logging.DEBUG)


def test_colorcorrelation_gg_qq():
fm = load_ufo_model("ufo_sm")
qfm = feynmodel_to_qgraf(fm, True, False)

qgraf.install()
xml_string = qgraf.run(
"g[p1], g[p2]",
"u[p3], u_bar[p4]",
loops=0,
loop_momentum="l",
model=qfm,
style=style,
)

parser = XmlParser()
fml = parser.from_string(xml_string, FeynML)
fds = [fml.diagrams[0]]
born = compute_squared(fds, fm, colorcorrelated=False)
cc = compute_squared(fds, fm, colorcorrelated=True)

assert_colorcorrelation(cc / born, fds, fm)
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
logger.setLevel(logging.DEBUG)


def test_colorcorrelation_ee_aa():
def test_spincorrelation_ee_aa():
fm = load_ufo_model("ufo_sm")
qfm = feynmodel_to_qgraf(fm, True, False)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
logger.setLevel(logging.DEBUG)


def test_colorcorrelation_ee_qq():
def test_spincorrelation_ee_qq():
fm = load_ufo_model("ufo_sm")
qfm = feynmodel_to_qgraf(fm, True, False)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import logging

import equation_database.isbn_9780511628788 as ref
import sympy
from feynml.interface.qgraf import style
from feynmodel.interface.qgraf import feynmodel_to_qgraf
from feynmodel.interface.ufo import load_ufo_model
from pyfeyn2.feynmandiagram import FeynML
from pyqgraf import qgraf
from xsdata.formats.dataclass.parsers import XmlParser

from feynamp.form import compute_squared
from feynamp.test.colorcorrelation import assert_colorcorrelation
from feynamp.test.spincorrelation import assert_spincorrelation

logger = logging.getLogger("feynamp")
logger.setLevel(logging.DEBUG)


def test_spincorrelation_gg_qq():
fm = load_ufo_model("ufo_sm")
qfm = feynmodel_to_qgraf(fm, True, False)

qgraf.install()
xml_string = qgraf.run(
"g[p1], g[p2]",
"u[p3], u_bar[p4]",
loops=0,
loop_momentum="l",
model=qfm,
style=style,
)

parser = XmlParser()
fml = parser.from_string(xml_string, FeynML)
fds = [fml.diagrams[0]]
born = compute_squared(fds, fm, colorcorrelated=False)
sc = compute_squared(fds, fm, spincorrelated=True)

assert_spincorrelation(sc / born, fds, fm)

0 comments on commit e4042b8

Please sign in to comment.