Skip to content

Commit

Permalink
Some small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
iolojz committed Jan 26, 2017
1 parent 6a99c1a commit c100d94
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions meta/EDM.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
SetEDMParticles::usage="Set the particles for which the EDMs shall be calculated.";

CreateParticles::usage="Returns the c++ code that contains all particle classes";
CreateEDMParticleFunctions::usage="Returns the c++ code that contains all EDM particle functions";
CreateChargeGetters::usage="Returns the c++ code that contains the charge functions for the different EDM particles.";
CreateDiagrams::usage="Returns the c++ code that contains all relevant diagram classes";
CreateVertexFunctionData::usage="Returns the c++ code that contains all relevant vertex function data";

Expand Down Expand Up @@ -73,7 +73,6 @@ If you add new kinds of vertices (e.g for new diagram types):
&) /@ particles, "\n"] <> "\n\n" <>
"// Special particle families\n" <>
"typedef " <> ParticleToCXXName @ GetPhoton[] <> " Photon;\n" <>
"typedef " <> ParticleToCXXName @ GetMuonFamily[] <> " MuonFamily;\n\n" <>

"// AntiFields\n" <>
"template<class P> struct anti : public Particle\n" <>
Expand Down Expand Up @@ -122,8 +121,7 @@ If you add new kinds of vertices (e.g for new diagram types):

CreateDiagrams[] :=
Module[{diagramTypes, diagramTypeHeads, code},
diagrams = contributingDiagramTypes;
diagramHeads = DeleteDuplicates @ (Head /@ diagrams);
diagramHeads = DeleteDuplicates @ (Head /@ contributingDiagramTypes);

code = "// The different diagram types that contribute to the muon magnetic moment\n";
code = (code <>
Expand All @@ -134,7 +132,7 @@ If you add new kinds of vertices (e.g for new diagram types):
code = (code <> "// Indexed diagram types\n" <>
StringJoin @ Riffle[("template<> class " <> SymbolName[Head[#]] <>
"<" <> ToString @ #[[1]] <> "> {};" &)
/@ diagrams, "\n"]);
/@ contributingDiagramTypes, "\n"]);

code = (code <> "\n\n" <>
StringJoin @ Riffle[CreateDiagramEvaluatorClass /@ contributingDiagramTypes, "\n\n"]);
Expand Down Expand Up @@ -243,16 +241,15 @@ If you add new kinds of vertices (e.g for new diagram types):
ParticleToSARAHString[SARAH`bar[p_]] := "bar" <> SymbolName[p];
ParticleToSARAHString[Susyno`LieGroups`conj[p_]] := "conj" <> SymbolName[p];

subIndexPattern = (ReplacePart[SARAH`subIndizes[[All, 1]], 0 -> Alternatives] -> ___);
subIndexPattern = (Alternatives @@ SARAH`subIndizes[[All, 1]] -> ___);
AddIndexPattern[SARAH`bar[p_]] := SARAH`bar[AddIndexPattern[p]];
AddIndexPattern[Susyno`LieGroups`conj[p_]] := Susyno`LieGroups`conj[AddIndexPattern[p]];
AddIndexPattern[particle_] := SARAH`getFull[SARAH`getBlank[particle]] /. subIndexPattern;

CachedVertex[particles_List] :=
Module[{
vertexPattern = ReplacePart[({#, ___} &) /@
vertexPattern = Alternatives @@ ({#, ___} &) /@
Permutations[AddIndexPattern /@ particles],
0 -> Alternatives],
vertexList = Symbol["SARAH`VertexList" <> ToString @ Length[particles]]},
FirstCase[vertexList, vertexPattern]
];
Expand Down Expand Up @@ -369,7 +366,7 @@ If you add new kinds of vertices (e.g for new diagram types):
CouplingsForParticles[particles_List] :=
Module[{vertexType, couplings},
vertexType = VertexTypeForParticles[particles];
couplings = {ReplacePart[particles, 0 -> SARAH`Cp]};
couplings = {SARAH`Cp @@ particles};

couplings = Switch[vertexType,
SingleComponentedVertex, couplings,
Expand Down Expand Up @@ -538,8 +535,8 @@ If you add new kinds of vertices (e.g for new diagram types):
/@ contributingDiagramTypes
, 1];
cachedContributingDiagrams = ({#, Union @
ReplacePart[Cases[cachedContributingDiagrams,
{#, diagrams_List} -> diagrams], 0 -> Sequence]} &) /@ edmParticles;
(Sequence @@ Cases[cachedContributingDiagrams,
{#, diagrams_List} -> diagrams])} &) /@ edmParticles;

Return[cachedContributingDiagrams];
];
Expand All @@ -553,7 +550,7 @@ If you add new kinds of vertices (e.g for new diagram types):
({#[[1]],
(("DiagramEvaluator<" <> SymbolName @ Head @ #[[1]] <> "<" <>
ToString @ #[[1,1]] <> ">, " <>
StringJoin @ (Riffle[ParticleToCXXName /@ ReplacePart[#[[2;;]], 0 -> List], ", "]) <>
StringJoin @ (Riffle[ParticleToCXXName /@ List @@ #[[2;;]], ", "]) <>
">" &)
/@ #[[2]]) } &) /@ ContributingDiagrams[];

Expand Down

0 comments on commit c100d94

Please sign in to comment.