Import  packages

Block[{Print},<<xAct`xTras`];
Block[{Print},<<xAct`xPert`];
Block[{Print},<<xAct`xPand`];

Definitions

DefManifold[M,4,{α,β,γ,δ,μ,ν,λ,σ}]

(* Define Metric *)
DefMetric[-1,g[-μ,-ν],CD,{";","∇"}]

SetAttributes[{αp,κ},Constant]

Calculation

Block[{Print},<<xAct`xCoba`]

DefChart[ϕ1,M,{0,1,2,3},{t[],r[],θ1[],θ2[]},ChartColor->Red]

Matric4d=DiagonalMatrix[{-Α[r[]],(1/(Β[r[]])),((r[])^2),((r[])^2)((Sin[θ1[]])^2)}];
Matric4d//MatrixForm

Block[{Print},MatrixForm@MetricInBasis[g,-ϕ1,Matric4d]]

Block[{Print},MetricCompute[g,ϕ1,All,Verbose->True]]

Example 1 :  Einstein-Hilbert action with Lambda

DefConstantSymbol[Λ]

L1 = (RicciScalarCD[]-2Λ)

eom1=FullSimplification[]@VarL[g[α,β]]@L1

eomEHsol=eom1//ToBasis[ϕ1]//ComponentArray//ToValues//Simplify

eomEHsol[[1,1]]

Example 2 : Einstein-Hilbert action with Lambda With (R^2) correction

L =αp(RicciScalarCD[]-2Λ)+κ( RicciScalarCD[]RicciScalarCD[])

eom1=FullSimplification[]@VarL[g[α,β]]@L

eomsol=eom1//ToBasis[ϕ1]//ComponentArray

eomEHsol//ToValues//FullSimplify