Nbody6
Main Page
Files
File List
File Members
All
Files
Functions
Variables
newsys.f
Go to the documentation of this file.
1
SUBROUTINE
newsys
(X,XD,M,NP,ENERGY,GAM)
2
*
3
*
4
* Total energy of subsystem.
5
* --------------------------
6
*
7
IMPLICIT
REAL*8
(a-h,o-z)
8
REAL*8
m(*),x(*),xd(*)
9
*
10
*
11
* Calculate total energy in physical units.
12
t = 0.0d0
13
v = 0.0d0
14
DO
10 i = 1,np
15
k1 = 3*(i - 1) + 1
16
k2 = k1 + 1
17
k3 = k2 + 1
18
t = t + 0.5d0*m(i)*(xd(k1)**2 + xd(k2)**2 + xd(k3)**2)
19
IF
(i.EQ.np) go to 10
20
j1 = i + 1
21
DO
9 j = j1,np
22
ki = 3*(i - 1)
23
kj = 3*(j - 1)
24
r2 = 0.0d0
25
DO
8 k = 1,3
26
ki = ki + 1
27
kj = kj + 1
28
r2 = r2 + (x(ki) - x(kj))**2
29
8
CONTINUE
30
v = v - m(i)*m(j)/sqrt(r2)
31
9
CONTINUE
32
10
CONTINUE
33
*
34
energy
= t + v
35
gam = t - v
36
*
37
RETURN
38
*
39
END
Nbody6
Ncode
newsys.f
Generated on Sat Nov 30 2013 19:04:37 for Nbody6 by
1.8.2