# Calculating e.g. Euler density or Riemann tensor's square for a given metric using xAct package

I have started to learn about the xAct package to do some general relativistic calculations and whereas there might be other codes available, I would like to get my answer in terms of this package's codes. As the title suggests, this is a very basic question, but I am having a hard time to get the answer. I have installed the package and all its components properly, so there're no issues there.

I started with

<< xActxTensor

<< xActxCoba

<< xActxTras


as I think these will be eventually needed. After that I am simply going ahead in the usual way to define the metric:

DefManifold[M, 4, IndexRange[a, q]]

DefMetric[-1, metric[-a, -b], CD, PrintAs -> "g"]

DefScalarFunction[σ]
DefScalarFunction[$N] DefScalarFunction[R] MatrixForm[fm = { {-E^(2 σ[z[]]), 0, 0, 0}, {0,$N[z[]]^2 E^(2 σ[z[]]), 0, 0},
{0, 0, R[z[]]^2  E^(2 σ[z[]]), 0},
{0, 0, 0, R[z[]]^2 Sin[θ[]]^2 E^(2 σ[z[]])}
}]

MetricInBasis[metric, -B, fm]

MetricCompute[metric, B, All, CVSimplify -> Simplify]


This defined the metric tensor and also assigns a basis vector. It also uses a particular matrix's elements as the metric tensor. So I have defined a given metric. The last input calculates several things together such as Riemann Tensor, Christoffel symbol and so on..

From here on, if I want I can compute Ricci scalar or any function of it. I can also e.g. find out what are the components of Riemann tensor e.g. But what I can't seem to compute is what is the value of $Rs=R_{abcd}R^{abcd}$ for this given metric.

I tried commands like

TensorValues[RiemannCD[-B, -B, -B, -B] RiemannCD[B, B, B, B]] //
ToValues[metric]


or

TensorValues[Rs] // ToBasis[B] // ToValues


but none of these are working. I also can't seem to find any such example anywhere!

DefChart[schwarzs, M, {0, 1, 2, 3}, {t[], r[], \[Theta][], \[Phi][]}, ChartColor -> Red],