Nbody6
 All Files Functions Variables
physks.f
Go to the documentation of this file.
1  SUBROUTINE physks(XR,PR,Q,P)
2 *
3 *
4 * Transformation from physical to KS variables.
5 * ---------------------------------------------
6 *
7  IMPLICIT REAL*8 (a-h,o-z)
8  REAL*8 xr(3),pr(3),q(4),p(4)
9 *
10 *
11 * Set the physical distance.
12  r2=xr(1)**2+xr(2)**2+xr(3)**2
13  r=sqrt(r2)
14 *
15 * Obtain regularized coordinates.
16  q(4)=0.0d0
17  a=r+abs(xr(1))
18  q(1)=sqrt(0.5d0*a)
19  b=1.0/(2.0d0*q(1))
20  q(2)=xr(2)*b
21  q(3)=xr(3)*b
22  IF(xr(1).LT.0.0d0)THEN
23  u1=q(1)
24  q(1)=q(2)
25  q(2)=u1
26  u3=q(3)
27  q(3)=q(4)
28  q(4)=u3
29  END IF
30 *
31 * Form regularized momenta.
32  p(1)=2.d0*(+q(1)*pr(1)+q(2)*pr(2)+q(3)*pr(3))
33  p(2)=2.d0*(-q(2)*pr(1)+q(1)*pr(2)+q(4)*pr(3))
34  p(3)=2.d0*(-q(3)*pr(1)-q(4)*pr(2)+q(1)*pr(3))
35  p(4)=2.d0*(+q(4)*pr(1)-q(3)*pr(2)+q(2)*pr(3))
36 *
37  RETURN
38  END