I have created this code to compute the perturbed Einstein tensor, but it is not giving any results. Can anyone help me to fix the errors so that it can run on Mathematica 12?
(*Load xAct packages*)<< xAct`xTensor`
<< xAct`xPert`
(*Define 4D spacetime manifold and chart*)
DefManifold[M4, 4, {a, b, c, d}]
DefChart[tcoord, {t, r, \[Theta], \[Phi]}, M4]
(*Define the metric*)
DefMetric[-1, g[-a, -b], CD, {";", "\[Del]"}]
DefScalarFunction[\[Phi], \[Lambda]]
(*Define background metric*)
gBack = {{-Exp[2 \[Phi][r]], 0, 0, 0}, {0, Exp[2 \[Lambda][r]], 0,
0}, {0, 0, r^2, 0}, {0, 0, 0, r^2 Sin[\[Theta]]^2}};
DefMetricFields[g[-a, -b], {tcoord}, gBack];
SetBackground[g, gBack]
(*Perturbation parameter and metric perturbation*)
DefParameter[\[CurlyEpsilon]]
DefMetricPerturbation[g, h, \[CurlyEpsilon]]
(*Scalar perturbation functions*)
DefScalarFunction[H0, H2, K]
(*Define Y_{20} and derivatives*)
Clear[Y20];
Y20[\[Theta]_] := Sqrt[5/(16 Pi)] (3 Cos[\[Theta]]^2 - 1);
Y20Prime[\[Theta]_] := D[Y20[\[Theta]], \[Theta]];
Y20DoublePrime[\[Theta]_] := D[Y20Prime[\[Theta]], \[Theta]];
DerivativeRules = {PD[-\[Theta]][Y20[\[Theta]]] :> Y20Prime[\[Theta]],
PD[-\[Theta]][PD[-\[Theta]][Y20[\[Theta]]]] :>
Y20DoublePrime[\[Theta]]};
(*Regge-Wheeler gauge perturbation rules*)
PerturbationRules = {h[LI[1], -t, -t] ->
Exp[2 \[Phi][r]] H0[r] Y20[\[Theta]],
h[LI[1], -r, -r] -> Exp[2 \[Lambda][r]] H2[r] Y20[\[Theta]],
h[LI[1], -\[Theta], -\[Theta]] -> r^2 K[r] Y20[\[Theta]],
h[LI[1], -\[Phi], -\[Phi]] ->
r^2 Sin[\[Theta]]^2 K[r] Y20[\[Theta]]};
(*Define perturbation of Einstein tensor*)
DefPerturbation[EinsteinCD[-a, -b]];
\[Delta]G = Perturbation[EinsteinCD[-a, -b], 1];
\[Delta]GExpanded = ExpandPerturbation[\[Delta]G];
(*Apply substitution rules*)
\[Delta]GSubstituted = \[Delta]GExpanded /. PerturbationRules /.
DerivativeRules /. {CD[-a_][Y20[\[Theta]]] :>
PD[-a][Y20[\[Theta]]]};
\[Delta]GSubstituted =
ToCanonical[ContractMetric[\[Delta]GSubstituted]];
(*Extract specific components*)
\[Delta]Gtt = ComponentValue[\[Delta]GSubstituted, {t, t}];
\[Delta]Grr = ComponentValue[\[Delta]GSubstituted, {r, r}];
\[Delta]G\[Theta]\[Theta] =
ComponentValue[\[Delta]GSubstituted, {\[Theta], \[Theta]}];
\[Delta]G\[Phi]\[Phi] =
ComponentValue[\[Delta]GSubstituted, {\[Phi], \[Phi]}];
(*Display output*)
{\[Delta]Gtt, \[Delta]Grr, \[Delta]G\[Theta]\[Theta], \[Delta]G\[Phi]\
\[Phi]}