1 | DOUBLE PRECISION FUNCTION AMOTRY(P,Y,PSUM,MP,NP,NDIM,FUNK,IHI,FAC)
|
---|
2 |
|
---|
3 | C-----------------------------------------------------------------------
|
---|
4 | C
|
---|
5 | C REFERENCE : NUMERICAL RECIPES, W.H. PRESS ET AL.,
|
---|
6 | C CAMBRIDGE UNIVERSITY PRESS, 1992 ISBN 0 521 43064 X
|
---|
7 | C ADAPTED FOR DOUBLE PRECISION
|
---|
8 | C THIS SUBROUTINE IS CALLED FROM AMOEBA
|
---|
9 | C-----------------------------------------------------------------------
|
---|
10 |
|
---|
11 | IMPLICIT NONE
|
---|
12 | *KEEP,RUNPAR.
|
---|
13 | COMMON /RUNPAR/ FIXHEI,THICK0,HILOECM,HILOELB,
|
---|
14 | * STEPFC,NRRUN,NSHOW,PATAPE,MONIIN,
|
---|
15 | * MONIOU,MDEBUG,NUCNUC,
|
---|
16 | * CETAPE,
|
---|
17 | * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
|
---|
18 | * N1STTR,MDBASE,
|
---|
19 | * DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
|
---|
20 | * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
|
---|
21 | * ,GHEISH,GHESIG
|
---|
22 | COMMON /RUNPAC/ DSN,HOST,USER
|
---|
23 | DOUBLE PRECISION FIXHEI,THICK0,HILOECM,HILOELB
|
---|
24 | REAL STEPFC
|
---|
25 | INTEGER NRRUN,NSHOW,PATAPE,MONIIN,MONIOU,MDEBUG,NUCNUC,
|
---|
26 | * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
|
---|
27 | * N1STTR,MDBASE
|
---|
28 | INTEGER CETAPE
|
---|
29 | CHARACTER*79 DSN
|
---|
30 | CHARACTER*20 HOST,USER
|
---|
31 |
|
---|
32 | LOGICAL DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
|
---|
33 | * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
|
---|
34 | * ,GHEISH,GHESIG
|
---|
35 | *KEND.
|
---|
36 |
|
---|
37 | INTEGER MP,NP,NMAX
|
---|
38 | PARAMETER (NMAX=20)
|
---|
39 | DOUBLE PRECISION FAC,P(MP,NP),PSUM(NP),Y(MP),FUNK
|
---|
40 | DOUBLE PRECISION FAC1,FAC2,YTRY,PTRY(NMAX)
|
---|
41 | INTEGER IHI,NDIM,J
|
---|
42 | EXTERNAL FUNK
|
---|
43 | CU USES FUNK
|
---|
44 | C-----------------------------------------------------------------------
|
---|
45 |
|
---|
46 | IF ( DEBUG ) WRITE(MDEBUG,*) 'AMOTRY:'
|
---|
47 |
|
---|
48 | FAC1 = (1.D0-FAC)/NDIM
|
---|
49 | FAC2 = FAC1-FAC
|
---|
50 | DO 11 J=1,NDIM
|
---|
51 | PTRY(J) = PSUM(J) * FAC1 - P(IHI,J) * FAC2
|
---|
52 | 11 CONTINUE
|
---|
53 | YTRY = FUNK(PTRY)
|
---|
54 | IF ( YTRY .LT. Y(IHI) ) THEN
|
---|
55 | Y(IHI) = YTRY
|
---|
56 | DO 12 J=1,NDIM
|
---|
57 | PSUM(J) = PSUM(J) - P(IHI,J) + PTRY(J)
|
---|
58 | P(IHI,J) = PTRY(J)
|
---|
59 | 12 CONTINUE
|
---|
60 | ENDIF
|
---|
61 | AMOTRY = YTRY
|
---|
62 | RETURN
|
---|
63 | END
|
---|