-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
719 additions
and
67 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,41 @@ | ||
from typing import List | ||
from feynamp import sympy | ||
from feynamp.form.form import sympy_to_form_string, sympyfy | ||
from feynamp.form.momentum import apply, get_kinematics, get_mandelstamm, get_onshell | ||
from feynamp.leg import ( | ||
color_vector_to_casimir, | ||
get_color_vector, | ||
get_leg_momentum, | ||
is_vector, | ||
) | ||
|
||
from feynml.leg import Leg | ||
|
||
from feynamp import sympy | ||
from feynamp.leg import color_vector_to_casimir, get_color_vector, get_leg_momentum | ||
def assert_spincorrelation(sympy_expr, fds, model): | ||
""" | ||
sympy_expr: sympy expression of sc/born | ||
Checks https://arxiv.org/pdf/1002.2581 Eq. 2.10 | ||
""" | ||
fd = fds[0] | ||
legs = fd.legs | ||
for j, leg in enumerate(legs): | ||
if is_vector(fd, leg, model): | ||
mom = get_leg_momentum(leg) | ||
sum = sympy_expr | ||
sum = sum.replace( | ||
sympy.parse_expr(f"spincorrelation({mom},scMuMu,scMuNu)"), 1 | ||
) | ||
for i, leg in enumerate(legs): | ||
mom = get_leg_momentum(leg) | ||
sum = sum.replace( | ||
sympy.parse_expr(f"spincorrelation({mom},scMuMu,scMuNu)"), 0 | ||
) | ||
sum = sum * sympy.parse_expr("d_(MuMu,MuNu)") | ||
st = sympy_to_form_string(sum) | ||
fs = "" | ||
fs += get_kinematics() | ||
fs += get_onshell(fds, model) | ||
fs += get_mandelstamm(fds, model) | ||
|
||
def assert_spincorrelation(sympy_expr, fd, legs: List[Leg], model): | ||
assert 1 == 1 | ||
rr = apply(st, fs) | ||
sr = sympyfy(rr) | ||
assert sr == sympy.parse_expr("-1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
tests/form/qcd/2_to_2/spincorrelation/test_spincorrelation_ee_aa.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_colorcorrelation_ee_aa(): | ||
fm = load_ufo_model("ufo_sm") | ||
qfm = feynmodel_to_qgraf(fm, True, False) | ||
|
||
qgraf.install() | ||
xml_string = qgraf.run( | ||
"e_minus[p1], e_plus[p2]", | ||
"gamma[p3], gamma[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) | ||
sc = compute_squared(fds, fm, spincorrelated=True) | ||
|
||
assert_spincorrelation(sc / born, fds, fm) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters