Nbody6
 All Files Functions Variables
ksphys.f
Go to the documentation of this file.
1  SUBROUTINE ksphys(Q,P,XR,PR)
2 *
3 *
4 * Transformation from KS to physical variables.
5 * ---------------------------------------------
6 *
7  IMPLICIT REAL*8 (a-h,o-z)
8  REAL*8 q(4),p(4),xr(3),pr(3)
9 *
10 *
11 * Obtain physical coordinates & momenta from KS.
12  xr(1)=q(1)**2-q(2)**2-q(3)**2+q(4)**2
13  xr(2)=2.d0*(q(1)*q(2)-q(3)*q(4))
14  xr(3)=2.d0*(q(1)*q(3)+q(2)*q(4))
15 *
16  r=q(1)**2+q(2)**2+q(3)**2+q(4)**2
17  a=0.5d0/r
18  pr(1)=(q(1)*p(1)-q(2)*p(2)-q(3)*p(3)+q(4)*p(4))*a
19  pr(2)=(q(2)*p(1)+q(1)*p(2)-q(4)*p(3)-q(3)*p(4))*a
20  pr(3)=(q(3)*p(1)+q(4)*p(2)+q(1)*p(3)+q(2)*p(4))*a
21 *
22  RETURN
23  END