c c===================================================================== c c VECTOR.F c c A collection of utility subroutines for doing vector operations c c normalize -- normalize a vector c dotprod -- dot product of two vectors c crossprod -- cross product of two vectors c c===================================================================== c===================================================================== c subroutine normalize(x,y,z) c implicit none c real x,y,z real r c r = sqrt(x*x + y*y + z*z) c x = x/r y = y/r z = z/r c end c c c c===================================================================== c===================================================================== c subroutine dotprod(x1,y1,z1,x2,y2,z2,result) c implicit none c real x1,y1,z1,x2,y2,z2,result c result = x1*x2 + y1*y2 + z1*z2 c end c c c c===================================================================== c===================================================================== c subroutine crossprod(x1,y1,z1,x2,y2,z2,xout,yout,zout) c implicit none c real x1,y1,z1,x2,y2,z2,xout,yout,zout c xout = y1*z2 - y2*z1 c yout = z1*x2 - z2*x1 c zout = x1*y2 - x2*y1 c end