subroutine calculate_residual_norm_ss(this)
type(davidson_ss), intent(inout) :: this
real(dp) :: residual_norm_tot
! This subroutine calculates the Euclidean norm of the reisudal vector, r:
! residual_norm^2 = \sum_i r_i^2
if (this%space_size_this_proc > 0) then
this%residual_norm = dot_product(this%residual, this%residual)
else
this%residual_norm = 0.0_dp
end if
call MPISumAll(this%residual_norm, residual_norm_tot)
this%residual_norm = sqrt(residual_norm_tot)
end subroutine calculate_residual_norm_ss