1* 2* $Id$ 3* 4 subroutine renorm(n,x,xnorm) 5 implicit none 6 double precision x(*), xnorm, s 7 integer n, i 8c 9 if (n.gt.0) then 10 s = 0.0d0 11 do 10 i = 1,n 12 s = s + x(i)*x(i) 13 10 continue 14 if (s.ne.0.0d0) then 15 xnorm = sqrt(s) 16 s = 1.0d0/xnorm 17 do 20 i = 1,n 18 x(i) = x(i) * s 19 20 continue 20 else 21 write(6,*) ' null vector in renorm',n 22 xnorm = 0.0d0 23 endif 24 else 25 xnorm = 0.0d0 26 endif 27c 28 return 29 end 30