gij=DiagonalMatrix[{Exp[a[r]], r^2, r^2 Sin[t]^2, -Exp[b[r]]}]


gijk=ConstantArray[0,{4,4,4}];
Do[ Do[ Do[
gijk[[i,j,k]]=Switch[k,1,D[gij[[i,j]],r],2,D[gij[[i,j]],t],3,D[gij[[i,j]],p],4,0],{k,4}],{j,4}],{i,4}]

gIJ=Inverse[gij]
Glik=ConstantArray[0,{4,4,4}];
Do[ Do[ Do[
sum=Sum[gIJ[[l,j]] (gijk[[i,j,k]]+gijk[[j,k,i]]-gijk[[k,i,j]]),{j,4}];
Glik[[l,i,k]]=FullSimplify[sum/2],{k,4}],{l,4}],{i,4}]

Glik[[1,All,All]]
                                                                2                  -a[r] + b[r]
          a'[r]                    r                     r Sin[t]                  E             b'[r]
Out[7]= {{-----, 0, 0, 0}, {0, -(-----), 0, 0}, {0, 0, -(---------), 0}, {0, 0, 0, -------------------}}
            2                     a[r]                      a[r]                            2
                                 E                         E                 2                                                                           3

Glik[[2,All,All]]
             1          1
Out[8]= {{0, -, 0, 0}, {-, 0, 0, 0}, {0, 0, -(Cos[t] Sin[t]), 0}, {0, 0, 0, 0}}
             r          r


Glik[[3,All,All]]
                1                          1
Out[9]= {{0, 0, -, 0}, {0, 0, Cot[t], 0}, {-, Cot[t], 0, 0}, {0, 0, 0, 0}}
                r                          r

Glik[[4,All,All]]
                    b'[r]                                b'[r]
Out[10]= {{0, 0, 0, -----}, {0, 0, 0, 0}, {0, 0, 0, 0}, {-----, 0, 0, 0}}
                      2                                    2

Glijk=ConstantArray[0,{4,4,4,4}];
Do[ Do[ Do[ Do [
Glijk[[l,i,j,k]]=Switch[k,1,D[Glik[[l,i,j]],r],2,D[Glik[[l,i,j]],t],3,D[Glik[[l,i,j]],p],4,0],{k,4}],{l,4}],{j,4}],{i,4}]

RDabc=ConstantArray[0,{4,4,4,4}];

Do[ Do[ Do[ Do [
sum1=Sum[Glik[[j,a1,b1]] Glik[[d1,c1,j]]-Glik[[j,a1,c1]] Glik[[d1,b1,j]],{j,4}];
RDabc[[d1,a1,b1,c1]]=-FullSimplify[sum1+Glijk[[d1,a1,b1,c1]]-Glijk[[d1,a1,c1,b1]] ],{a1,4}],{b1,4}],{c1,4}],{d1,4}]

Rab=ConstantArray[0,{4,4}];
Do[ Do[ 
Rab[[a1,b1]]=Sum[RDabc[[d1,a1,b1,d1]],{d1,4}],{a1,4}],{b1,4}]
Rab=Simplify[Rab]

                                            2
           -(a'[r] (4 + r b'[r])) + r (b'[r]  + 2 b''[r])
Out[17]= {{----------------------------------------------, 0, 0, 0},
                                4 r

                a[r]                                               2          a[r]
         2 - 2 E     - r a'[r] + r b'[r]                  1  Sin[t]  (-2 + 2 E     + r a'[r] - r b'[r])
>    {0, -------------------------------, 0, 0}, {0, 0, -(-) ------------------------------------------, 0},
                        a[r]                              2                     a[r]
                     2 E                                                       E

                -a[r] + b[r]                                2
               E             ((-4 + r a'[r]) b'[r] - r b'[r]  - 2 r b''[r])
>    {0, 0, 0, ------------------------------------------------------------}}
                                           4 r


R=Tr[Rab.Inverse[gij]]
                    a[r]                              a[r]
           1  -2 + 2 E     + r a'[r] - r b'[r]   2 - 2 E     - r a'[r] + r b'[r]
Out[18]= -(-) -------------------------------- + ------------------------------- -
           2               a[r]  2                            a[r]  2
                          E     r                          2 E     r

                                   2                                                 2
     (-4 + r a'[r]) b'[r] - r b'[r]  - 2 r b''[r]   -(a'[r] (4 + r b'[r])) + r (b'[r]  + 2 b''[r])
>    -------------------------------------------- + ----------------------------------------------
                         a[r]                                            a[r]
                      4 E     r                                       4 E     r

Rdabc=ConstantArray[0,{4,4,4,4}];
Do[ Do[ Do[ Do [
Rdabc[[d1,a1,b1,c1]]=Sum[gij[[d1,j]] RDabc[[j,a1,b1,c1]],{j,4}],{a1,4}],{b1,4}],{c1,4}],{d1,4}]

