# Get rot from xparm

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

To be compiled with e.g.

```gfortran -C get_rot_from_xparm.f90 -o get_rot_from_xparm
```
```
! program to calculate rotations of unit cell axes with respect to detector axes, rotation axis, and beam.
! KD 9/2010
implicit none
integer i
real rotation(3),beam(3),detector_x(3),detector_y(3),x,xyz(3)
real, parameter :: r2d=57.2957795
character*1 :: axnam(3)=(/'a','b','c'/)

open(1,file='XPARM.XDS')

print*,' ROTATION_AXIS=',rotation
beam=beam*x
print*,' normalized INCIDENT_BEAM_DIRECTION=',beam
print*,' DIRECTION_OF_DETECTOR_X-AXIS=',detector_x
print*,' DIRECTION_OF_DETECTOR_Y-AXIS=',detector_y

do i=1,3
print*,' '
x=sqrt(xyz(1)**2 + xyz(2)**2 + xyz(3)**2)
xyz=xyz/x
x=dot_product(xyz,rotation)
print*,'angle between ',axnam(i),' axis and ROTATION_AXIS:          ',acos(x)*r2d
x=dot_product(xyz,detector_x)
print*,'angle between ',axnam(i),' axis and DETECTOR_X-AXIS:        ',acos(x)*r2d
x=dot_product(xyz,detector_y)
print*,'angle between ',axnam(i),' axis and DETECTOR_Y-AXIS:        ',acos(x)*r2d
x=dot_product(xyz,beam)
print*,'angle between ',axnam(i),' axis and INCIDENT_BEAM DIRECTION:',acos(x)*r2d
end do
end

```