33 IMPLICIT DOUBLE PRECISION (a-h,o-z)
35 dimension p(41,41),cn(41),sn(41),tn(41)
36 dimension xs(3),xt(3),xm(3),xn(3),vb(3)
37 common/option/l,m,ires,isun,imoon,iephem,idrag,idens,isrp,iorb
39 common/timecmn/ti,tf,tr
40 common/pltcon/ge,
re,rate,pm,aj2,ellip,ratm
41 common/atmcon/rdens,rht,sht,altmax,wt
42 common/spccon/aread,areas,scmass,cdrag,csrp
43 common/suncon/gs,es(7),et(7)
44 common/muncon/gm,em(7),en(7)
45 common/harmon/c(41,41),s(41,41)
46 DATA tpi/6.283185307179586d0/
47 DATA zero,half,one,two,trhalf/0.d0,0.5d0,1.d0,2.d0,1.5d0/
48 r2=x(1)**2+x(2)**2+x(3)**2
56 IF (l.EQ.0.AND.m.EQ.0)
GO TO 200
57 IF (l.EQ.2.AND.m.EQ.0)
GO TO 100
65 amda=datan2(x(2),x(1))-dmod(pm+rate*(t-tr),tpi)
69 CALL angles(m,amda,phi,cn,sn,tn)
81 IF (im.GT.m)
GO TO 130
84 d3=c(il1,im1)*cn(im1)+s(il1,im1)*sn(im1)
86 IF (im2.LE.il1)
f2=
f2+d3*(p(il1,im2)-tn(im1)*p(il1,im1))
87 IF (im2.GT.il1)
f2=
f2-d3*tn(im1)*p(il1,im1)
89 xf3=
f3+im*(s(il1,im1)*cn(im1)-c(il1,im1)*sn(im1))*p(il1,im1)
104 dx(4)=dx(4)+(d1-d2)*x(1)-d3*x(2)
105 dx(5)=dx(5)+(d1-d2)*x(2)+d3*x(1)
106 dx(6)=dx(6)+d1*x(3)+sr1*e2/r2
114 d1=-trhalf*aj2*
re*
re*ge/r5
115 d2=one-5.d0*x(3)**2/r2
116 dx(4)=dx(4)+x(1)*d1*d2
117 dx(5)=dx(5)+x(2)*d1*d2
118 dx(6)=dx(6)+x(3)*d1*(d2+two)
123 IF (iephem.EQ.0)
THEN
126 IF (isun.EQ.1.OR.imoon.EQ.1.OR.isrp.EQ.1)
127 1
CALL ephem(isun,imoon,isrp,t,es,em)
133 IF (isun.EQ.0)
GO TO 300
134 CALL xthird(t,trf,es,et,xs)
135 rs=dsqrt(xs(1)**2+xs(2)**2+xs(3)**2)
139 rt=dsqrt(xt(1)**2+xt(2)**2+xt(3)**2)
142 220 dx(i+3)=dx(i+3)-gs*(xt(i)/rt3+xs(i)/rs3)
147 IF (isrp.EQ.0)
GO TO 400
149 CALL xthird(t,trf,es,et,xs)
150 rs=dsqrt(xs(1)**2+xs(2)**2+xs(3)**2)
157 rdrs=x(1)*xs(1)+x(2)*xs(2)+x(3)*xs(3)
158 IF (rdrs.GE.zero)
GO TO 320
160 IF (r1*dsin(theta).LT.ratm)
GO TO 400
163 330 dx(i+3)=dx(i+3)-csrp*areas*xs(i)/scmass
168 IF (imoon.EQ.0)
GO TO 500
169 IF (iephem.EQ.1)
CALL setthd(em,en)
170 CALL xthird(t,trf,em,en,xm)
171 rm=(xm(1)**2+xm(2)**2+xm(3)**2)**trhalf
174 rn=(xn(1)**2+xn(2)**2+xn(3)**2)**trhalf
176 420 dx(i+3)=dx(i+3)-gm*(xn(i)/rn+xm(i)/rm)
181 IF (idrag.EQ.0)
GO TO 600
182 IF (ellip.EQ.zero)
THEN
186 ealt=r1-dsqrt(
re**2*(one-ellip**2)/(one-(ellip*dcos(phi))**2))
188 IF (ealt.GT.altmax)
GO TO 600
193 IF (idens.EQ.0) dens=rdens*dexp((rht-ealt)/sht)
194 IF (idens.EQ.1)
CALL dens76(ealt,dens)
200 vbm2=vb(1)**2+vb(2)**2+vb(3)**2
205 520 dx(i+3)=dx(i+3)-half*cdrag*aread/scmass*dens*vbm2*vb(i)
211 610 dx(i+3)=dx(i+3)-ge*x(i)/r3