subroutine vectorrotation(vectold,tranmatrix,vectnew) implicit none !transform the three components of a vector from an old coordinate !system to an new coordinate system defined by the rotation matrix tranmatrix !tranmatrix(i,j): ith row, jth column double precision vectold(3),tranmatrix(3,3),vectnew(3) integer i,j do i=1,3 vectnew(i)=0.0d0 do j=1,3 vectnew(i)=vectnew(i)+ & tranmatrix(i,j)*vectold(j) enddo enddo end subroutine vectorrotation