finish the part for calculating the off-diagonal terms