Nbody6
Main Page
Files
File List
File Members
All
Files
Functions
Variables
swcond.f
Go to the documentation of this file.
1
SUBROUTINE
swcond
(CHECK)
2
*
3
*
4
* Check switching conditions.
5
* ---------------------------
6
*
7
include
'commonc.h'
8
common/swcall/ ncall
9
LOGICAL
check
10
SAVE
nsw
11
DATA
nsw/20000/
12
*
13
*
14
check
=.false.
15
ncall=ncall+1
16
* Impose switch after every NSW steps.
17
IF
(ncall.GE.nsw)
THEN
18
ncall=0
19
check
=.true.
20
RETURN
21
END IF
22
*
23
* Inspect the chain structure (NOTE: Inverse values 1/r are used).
24
adisti=0.5*(n-1)/rsum
25
lri=n-1
26
DO
i=1,n-2
27
DO
j=i+2,n
28
lri=lri+1
29
*
30
* Do not inspect if 1/r is small.
31
IF
(rinv(lri).GT.adisti)
THEN
32
IF
(j-i.GT.2)
THEN
33
* Check for a dangerous long loop.
34
* RINVMX=MAX(RINV(I-1),RINV(I),RINV(J-1),RINV(J))
35
IF
(i.GT.1)
THEN
36
rinvmx=max(rinv(i-1),rinv(i))
37
ELSE
38
rinvmx=rinv(1)
39
END IF
40
rinvmx=max(rinvmx,rinv(j-1))
41
IF
(j.LT.n)rinvmx=max(rinvmx,rinv(j))
42
IF
(rinv(lri).GT.0.5*rinvmx)
THEN
43
check
=.true.
44
ncall=0
45
RETURN
46
END IF
47
ELSE
48
* See whether this is a triangle with smallest size not regularized.
49
IF
(rinv(lri).GT.max(rinv(i),rinv(i+1)))
THEN
50
check
=.true.
51
ncall=0
52
RETURN
53
END IF
54
*
55
END IF
56
END IF
57
END DO
58
END DO
59
*
60
RETURN
61
END
Nbody6
Chain
swcond.f
Generated on Sat Nov 30 2013 19:04:36 for Nbody6 by
1.8.2