************************************************************************ ************************************************************************ * * Real function VLEN * * Function: * Calculate length in Angstrom of vector u. * * Comment: * The vector is reduced to the interval -0.5 - 0.5. * * Arguments : * U (i) 3 x 1 vector (fractional) * Cell (i) cell parameters in angstrom and degrees * Cosang (i) cosines of the cell angles * * * History: * November 24 1991 sdk * Changed from s/r to function * November 8 1991 sdk * Much simplified, now just straight distance from fractional * coordinates * November 1988 sdk * Flag argument added * Written March 1988 S. Knight ************************************************************************ real function vlen ( u , cell , cosang ) implicit none * Arguments real u(3) , cell(6) , cosang(3) * Local variables integer i real v(3) real d(3) *----------------------------------------------------------------------- do i = 1 , 3 v( i ) = u( i ) if ( v( i ) .gt. 0.5 ) v( i ) = v( i ) - 1.0 if ( v( i ) .lt. -0.5 ) v( i ) = v( i ) + 1.0 d( i ) = v( i ) * cell( i ) end do vlen = sqrt ( d(1)**2 + d(2)**2 + d(3)**2 + & d(1) * d(2) * cosang(3) + & d(1) * d(3) * cosang(2) + & d(2) * d(3) * cosang(1) ) return end