<<xAct`xTensor`;
<< xAct`xCoba`;
<< xAct`xTras`;

$PrePrint=ScreenDollarIndices;
                                 
DefManifold[Md,4,{a,b,c,d,e,l,i,j,k,p,u,v}];
DefMetric[-1,g[-a,-b],CD,{";","∇"},WeightedWithBasis->AIndex];
PrintAs[RiemannCD]^="R";
PrintAs[RicciCD]^="R";
PrintAs[RicciScalarCD]^="R";
PrintAs[ChristoffelCD]^="Γ";
PrintAs[EinsteinCD]^="G";

DefTensor[φ[],Md];
DefTensor[A[-a],Md];
DefTensor[F[-a,-b],Md,Antisymmetric[{-a,-b}]]; (* Maxwell strength tensor*)
F[-a_,-b_]:=CD[-a][A[-b]]-CD[-b][A[-a]];
F[a_,b_]:=CD[a][A[b]]-CD[b][A[a]];

DefConstantSymbol[α]

LEH=RicciScalarCD[];
Lφ=2CD[-a]@φ[]CD[a]@φ[];
LF=Exp[-α (((φ[]))^2)]*F[a,b]F[-a,-b];

L=LEH+Lφ+LF

Eombg=VarL[g[a,b]][L]//ContractMetric//Simplification

Eomscalar=VarD[φ[],CD][L]//ContractMetric//Simplification

EomMaxell=VarD[A[-a],CD][L]//ContractMetric//Simplification

DefChart[Backg,Md,{0,1,2,3},{t[],r[],θ[],ϕ[]}];

DefScalarFunction/@{n ,δ};

gB=DiagonalMatrix[{-n[r[]]Exp[-2δ[r[]]],(1/(n[r[]])),((r[])^2),((r[])^2)((Sin[θ[]])^2)}];

(Metricgb=CTensor[DiagonalMatrix[{-n[r[]]Exp[-2δ[r[]]],(1/(n[r[]])),((r[])^2),((r[])^2)((Sin[θ[]])^2)}],{-Backg,-Backg}])[-a,-b]

MetricgbCD=CovDOfMetric[Metricgb]

DefScalarFunction[ϕ0,PrintAs->"(Subscript[ϕ, 0])"];

DefScalarFunction[V];
DefTensor[AAnsatz,Md];
AAnsatz={V[r[]],0,0,0}
FourPotentialAnsatz=CTensor[{V[r[]],0,0,0},{-Backg}]

AAnsatz[[1]]

ComponentValue[ComponentArray[A[b],FourPotentialAnsatz]]

ChangeComponents[A[-a],A[b]]

A[b,Backg]

ComponentValue[φ[],ϕ0[r[]]];
ComponentValue[A[a],FourPotentialAnsatz];

ruleA=A[a_]->FourPotentialAnsatz[[a]]

MetricInBasis[g,-Backg,gB];
MetricCompute[g,Backg,All,CVSimplify->Simplify];

A[2]/.ruleA//Simplify

EomcompG=Eombg//ToBasis[Backg]//ToBasis[Backg]//TraceBasisDummy//ComponentArray//ToValues//ToValues
EomcompG[[1,1]]==0
EomcompG[[2,2]]==0
EomcompG[[3,3]]==0
EomcompG[[4,4]]==0

EomscalarcompG=Eomscalar//SeparateMetric[g]//ToBasis[Backg]//ToBasis[Backg]//TraceBasisDummy//ToValues//ToValues

EomMaxellcompo=EomMaxell//ToBasis[Backg]