Nbody6
fchain.f
Go to the documentation of this file.
1  SUBROUTINE fchain(I,IR,XI,XIDOT,FIRR,FD)
2 *
3 *
4 * Irregular force & derivative due to chain.
5 * ------------------------------------------
6 *
7  include 'common6.h'
8  common/chainc/ xc(3,ncmax),uc(3,ncmax),bodyc(ncmax),ich,
9  & listc(lmax)
10  REAL*8 xi(3),xidot(3),dx(3),dv(3),firr(3),fd(3),xis(3),vis(3)
11 *
12 *
13 * Form terms for the original chain c.m. interaction.
14  dr2 = 0.0
15  drdv = 0.0
16  DO 5 k = 1,3
17  dx(k) = x(k,ich) - xi(k)
18  dv(k) = xdot(k,ich) - xidot(k)
19  dr2 = dr2 + dx(k)**2
20  drdv = drdv + dx(k)*dv(k)
21  5 CONTINUE
22  dr2i = 1.0/dr2
23  dr3i = body(ich)*dr2i*sqrt(dr2i)
24  drdv = 3.0*drdv*dr2i
25 *
26 * Subtract force and first derivative from current values.
27  DO 10 k = 1,3
28  firr(k) = firr(k) - dx(k)*dr3i
29  fd(k) = fd(k) - (dv(k) - dx(k)*drdv)*dr3i
30  10 CONTINUE
31 *
32 * Resolve chain coordinates & velocities using the predicted c.m.
33  IF (ir.EQ.0) THEN
34  CALL xcpred(0)
35  END IF
36 *
37 * Obtain contributions from all members of the chain.
38  DO 20 j = 1,nch
39  dr2 = 0.0
40  drdv = 0.0
41  DO 15 l = 1,3
42  dx(l) = xc(l,j) - xi(l)
43  dv(l) = uc(l,j) - xidot(l)
44  dr2 = dr2 + dx(l)**2
45  drdv = drdv + dx(l)*dv(l)
46  15 CONTINUE
47  dr2i = 1.0/dr2
48  dr3i = bodyc(j)*dr2i*sqrt(dr2i)
49  drdv = 3.0*drdv*dr2i
50 *
51 * Add force & first derivative.
52  DO 18 l = 1,3
53  firr(l) = firr(l) + dx(l)*dr3i
54  fd(l) = fd(l) + (dv(l) - dx(l)*drdv)*dr3i
55  18 CONTINUE
56  20 CONTINUE
57 *
58  RETURN
59 *
60  END