From 7deccf59f23c4cb0a3422b29a93d81bf4e2f1ed1 Mon Sep 17 00:00:00 2001 From: Vladyslav Shtabovenko Date: Wed, 6 Jan 2016 03:05:59 +0100 Subject: [PATCH] Improved Uncontract to work with tensors (using DataType FCTensor) that are not defined in the Global` context. --- FeynCalc/Lorentz/TensorFunction.m | 2 ++ FeynCalc/Lorentz/Uncontract.m | 4 ++-- FeynCalc/Shared/DataType.m | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/FeynCalc/Lorentz/TensorFunction.m b/FeynCalc/Lorentz/TensorFunction.m index 9f1ed9d32..a196bec08 100755 --- a/FeynCalc/Lorentz/TensorFunction.m +++ b/FeynCalc/Lorentz/TensorFunction.m @@ -40,6 +40,8 @@ at = Last[ef], f = ef ]; + DataType[ef,FCTensor]=True; + With[ {tf = f}, If [at=!="", Which[ diff --git a/FeynCalc/Lorentz/Uncontract.m b/FeynCalc/Lorentz/Uncontract.m index edd741449..5801325b3 100755 --- a/FeynCalc/Lorentz/Uncontract.m +++ b/FeynCalc/Lorentz/Uncontract.m @@ -122,8 +122,8 @@ Pair[Momentum[c,dimSelect[d]], li] Pair[Momentum[pe,dimSelect[d]],lidr[li]])/;MemberQ[par,pe]} /. times -> Times; (* Uncontract tensor functions *) - If[ !FreeQ[nex, (tf_/;Context[tf]==="Global`")[___,Momentum[(q | Polarization[q,__]),___],___]], - nex = nex //. { (tf_/;Context[tf]==="Global`")[a___,Momentum[(c: q | Polarization[q,__]),d_:4],b___] :> + If[ !FreeQ[nex, (tf_/;DataType[tf,FCTensor])[___,Momentum[(q | Polarization[q,__]),___],___]], + nex = nex //. { (tf_/;DataType[tf,FCTensor])[a___,Momentum[(c: q | Polarization[q,__]),d_:4],b___] :> (li = LorentzIndex[a$AL[inc = inc+1],dimSelect[d]]; tf[a, li, b] Pair[Momentum[c,dimSelect[d]],lidr[li]])} ]; diff --git a/FeynCalc/Shared/DataType.m b/FeynCalc/Shared/DataType.m index 9c0175226..2b3f03b7a 100644 --- a/FeynCalc/Shared/DataType.m +++ b/FeynCalc/Shared/DataType.m @@ -25,6 +25,9 @@ PositiveNumber::usage = "PositiveNumber is a data type. E.g. \ DataType[Epsilon, PositiveNumber] = True (by default). "; +FCTensor::usage = "FCTensor is a data type. E.g. \ +DataType[R, FCTensor] = True. "; + DataType::usage = "DataType[exp, type] = True defines the object exp to have datatype type. \ DataType[exp1, exp2, ..., type] defines the objects exp1, exp2, ... to \