source: trunk/MagicSoft/Simulation/Corsika/Mmcs/mmol4.f@ 5138

Last change on this file since 5138 was 286, checked in by harald, 25 years ago
This is the start point for further developments of the Magic Monte Carlo Simulation written by Jose Carlos Gonzales. Now it is under control of one CVS repository for the whole collaboration. Everyone should use this CVS repository for further developments.
File size: 2.1 KB
Line 
1 SUBROUTINE MMOL4(Y,X,VAL,ARG,EPS,IER)
2
3C-----------------------------------------------------------------------
4C M(UON) MOL(IERE SCATTERING) 4 (POINT CONTINUED FRACT. INTERPOLATION)
5C
6C ROUTINE TAKEN FROM IBM SCIENTIFIC SUBROUTINE PACKAGE
7C ROUTINE TAKEN FROM GEANT321 (CERN)
8C 4 POINT CONTINUED FRACTION INTERPOLATION
9C THIS SUBROUTINE IS CALLED FROM MMOLIE
10C ARGUMENTS:
11C Y = INTERPOLATED VALUE FOR THE ARGUMENT X
12C X = ARGUMENT FOR Y
13C VAL = VALUE ARRAY
14C ARG = ARGUMENT ARRAY
15C EPS = DESIRED ACCURACY
16C IER = OUTPUT ERROR PARAMETER
17C 0 ACCURACY O.K.
18C 1 ACCURACY CAN NOT BE TESTED IN 4TH ORDER INTERPOLATION
19C 2 TWO IDENTICAL ELEMENTS IN THE ARGUMENT ARRAY
20C-----------------------------------------------------------------------
21
22 IMPLICIT NONE
23 REAL ARG(4),AUX,DELT,EPS,H,P1,P2,P3,Q1,Q2,Q3,VAL(4),X,Y,Z
24 INTEGER I,II,III,IER,J,JEND
25C-----------------------------------------------------------------------
26
27 IER = 1
28 Y = VAL(1)
29 P2 = 1.
30 P3 = Y
31 Q2 = 0.
32 Q3 = 1.
33 DO 16 I = 2,4
34 II = 0
35 P1 = P2
36 P2 = P3
37 Q1 = Q2
38 Q2 = Q3
39 Z = Y
40 JEND = I - 1
41 3 AUX = VAL(I)
42 DO 10 J = 1,JEND
43 H = VAL(I) - VAL(J)
44 IF ( ABS(H) .GT. 1.E-6*ABS(VAL(I)) ) GOTO 9
45 IF ( ARG(I) .EQ. ARG(J) ) GOTO 17
46 IF ( J .LT. JEND ) GOTO 8
47 II = II + 1
48 III = I + II
49 IF ( III .GT. 4 ) GOTO 19
50 VAL(I) = VAL(III)
51 VAL(III) = AUX
52 AUX = ARG(I)
53 ARG(I) = ARG(III)
54 ARG(III) = AUX
55 GO TO 3
56 8 VAL(I) = 1.E36
57 GO TO 10
58 9 VAL(I) = ( ARG(I)-ARG(J) ) / H
59 10 CONTINUE
60 P3 = VAL(I) * P2 + ( X - ARG(I-1) ) * P1
61 Q3 = VAL(I) * Q2 + ( X - ARG(I-1) ) * Q1
62 IF ( Q3. NE. 0. ) THEN
63 Y = P3 / Q3
64 ELSE
65 Y = 1.E36
66 ENDIF
67 DELT = ABS(Z-Y)
68 IF ( DELT .LE. EPS ) GOTO 19
69 16 CONTINUE
70 RETURN
71 17 IER = 2
72 RETURN
73 19 IER = 0
74 RETURN
75 END
Note: See TracBrowser for help on using the repository browser.