Page MenuHomeHEPForge

ScannerSInputPackage.m
No OneTemporary

ScannerSInputPackage.m

(* ::Package:: *)
(* ::Title:: *)
(*ScannerS Input file generator (Internal stuff)*)
(* ::Section:: *)
(*Routines to generate the file*)
FileWrite=OpenWrite[StringJoin[PathToScannerSDir,InputFileName]];
(* ::Subsection:: *)
(*Print out header of the file*)
(* ::Input:: *)
(*(*Number of real components*)*)
Write[FileWrite,Nreal]
(* ::Input:: *)
(*(*Vev ranges to scan *)*)
For[i=0,i<Nreal,++i,
Write[FileWrite,\[Phi]Min[i]//FortranForm];
Write[FileWrite,\[Phi]Max[i]//FortranForm];
]
(* ::Input:: *)
(*(*Number of Parametrized real components*)*)
If[NparamsVEVs>0,
Write[FileWrite,NparamsVEVs];
For[i=0,i<NparamsVEVs,++i,
Write[FileWrite,\[Phi]ParMin[i]//FortranForm];
Write[FileWrite,\[Phi]ParMax[i]//FortranForm];
\:ffff],
Write[FileWrite,0];
];
If[NparamsMixing>0,
Write[FileWrite,NparamsMixing];
For[i=0,i<NparamsMixing,++i,
Write[FileWrite,MixParMin[i]//FortranForm];
Write[FileWrite,MixParMax[i]//FortranForm];
\:ffff],
Write[FileWrite,0];
];
(* ::Input:: *)
(*(*Number of Parametrized Mass/Coupling components*)*)
If[NparamsMassL>0,
Write[FileWrite,NparamsMassL];
For[i=0,i<NparamsMassL,++i,
Write[FileWrite,MLParMin[i]//FortranForm];
Write[FileWrite,MLParMax[i]//FortranForm];
\:ffff],
Write[FileWrite,0];
];
(* ::Input:: *)
(*(*Number of couplings*)*)
Write[FileWrite,Ncoup]
(* ::Input:: *)
(*(* Coupling ranges to scan *)*)
For[i=0,i<Ncoup,++i,
Write[FileWrite,\[Lambda]Min[i]//FortranForm];
Write[FileWrite,\[Lambda]Max[i]//FortranForm];
]
(* ::Input:: *)
(*(* Number of fields again to read the mass ranges*)*)
Write[FileWrite,Nreal]
(* ::Input:: *)
(*(* Mass ranges to scan *)*)
For[i=0,i<Nreal,++i,
Write[FileWrite,massmin[i]//FortranForm];
Write[FileWrite,massmax[i]//FortranForm];
]
(* ::Subsection:: *)
(*Auxiliary functions to get powers and coefficients more easily*)
(* ::Text:: *)
(*This routine extracts the coefficient of the monomial given by Expression_ by replacing all fields by 1*)
GetCoeff[Expression_,Nphi_]:= Block[{Elocal,i},
Elocal=Expression;
For[i=0,i<Nphi,i++,Elocal=Elocal/.\[Phi][i]-> 1];
Elocal
]
(* ::Text:: *)
(*This routine extracts the power of the field j_ in the monomial by replacing all other fields by 1 and extracting the power from the Full Form*)
GetPower[Expression_,Nphi_,Coeff_,j_]:=Block[{Elocal,i,Pow,TestPow},
(*Normalise coefficient to 1*)
Elocal=Expand[Expression/Coeff];
(*Replace all other fields by 1*)
For[i=0,i<Nphi,i++,If[j!=i,Elocal=Elocal/.\[Phi][i]-> 1]];
(*Test variable to check if the power is 1 (Testpow=2) or zero (TestPow=1)*)
TestPow=Elocal/.\[Phi][j]-> 2;
Elocal=Apply[List,Elocal];
If[TestPow==1,Pow=0,
If[TestPow==2,Pow=1,Pow=Elocal[[2]]]];
Pow
]
(* ::Subsection:: *)
(*Creating operators, monomials and print out*)
For[i=0,i<Ncoup,i++,
(*Pick out ith operator*)
TempOperator=D[Vscalar,\[Lambda][i]];
(*Create the list of monomials*)
Htemp=TempOperator//Head;
(*Htemp can be the Times, Plus, Power or \[Phi]. Plus indicates that there is more than one element on the list, i.e. Plus applied to the list {2,0} is 2 whereas for Product it is zero and for Power it is 1. The extra Apply[Times,...] does nothing for these cases and produces 0 when Htemp is \[Phi] (since it will be applied to \[Phi][2,0]). So when not 2 it means there is only one element and the list needs to be redone. If the term is something like \[Phi][0], then the If statement does nothing*)
If[Apply[Times,Apply[Htemp,{2,0}]]!=2,
(*Single term case*)
MonomList[i]={TempOperator},
(*Sum of terms*)
MonomList[i]=Apply[List,TempOperator]
];
(*Determine number of monomials and print that number to the file*)
TempDim=Dimensions[MonomList[i]][[1]];
Write[FileWrite,TempDim];
(*Loop over monomials and print coefficients and list of powers*)
For[a=1,a<TempDim+1,a++,
(*First get the coefficient and print it out*)
Coeff=GetCoeff[MonomList[i][[a]],Nreal];
Write[FileWrite,N[Coeff]//FortranForm];
(*Next get the power for each field and Print out*)
For[j=0,j<Nreal,j++,
Write[FileWrite,GetPower[MonomList[i][[a]],Nreal,Coeff,j]]];
]
]
Close[FileWrite];

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 21, 4:05 PM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4018954
Default Alt Text
ScannerSInputPackage.m (3 KB)

Event Timeline