COSMOS v7.655  COSMOSv7655
(AirShowerMC)
mnseek.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine mnseek (FCN, FUTIL)
 

Function/Subroutine Documentation

◆ mnseek()

subroutine mnseek ( external  FCN,
external  FUTIL 
)

Definition at line 10 of file mnseek.f.

References a, b, c, d, e, f, g, h, softenpik::half, i, j, m, maxp, mnamin(), mndxdi(), mninex(), mnprin(), mnrn15(), n, o, p, parameter(), up(), x, xs, and z.

Referenced by mnexcm().

10 *
11 * $Id: d506dp.inc,v 1.1.1.1 1996/03/07 14:31:32 mclareni Exp $
12 *
13 * $Log: d506dp.inc,v $
14 * Revision 1.1.1.1 1996/03/07 14:31:32 mclareni
15 * Minuit
16 *
17 *
18 *
19 *
20 * d506dp.inc
21 *
22 C ************ DOUBLE PRECISION VERSION *************
23  IMPLICIT DOUBLE PRECISION (a-h,o-z)
24 CC Performs a rough (but global) minimization by monte carlo search.
25 CC Each time a new minimum is found, the search area is shifted
26 CC to be centered at the best value. Random points are chosen
27 CC uniformly over a hypercube determined by current step sizes.
28 CC The Metropolis algorithm accepts a worse point with probability
29 CC exp(-d/UP), where d is the degradation. Improved points
30 CC are of course always accepted. Actual steps are random
31 CC multiples of the nominal steps (DIRIN).
32 CC
33 *
34 * $Id: d506cm.inc,v 1.1.1.1 1996/03/07 14:31:32 mclareni Exp $
35 *
36 * $Log: d506cm.inc,v $
37 * Revision 1.1.1.1 1996/03/07 14:31:32 mclareni
38 * Minuit
39 *
40 *
41 *
42 *
43 * d506cm.inc
44 *
45  parameter(mne=100 , mni=50)
46  parameter(mnihl=mni*(mni+1)/2)
47  CHARACTER*10 cpnam
48  COMMON
49  1/mn7nam/ cpnam(mne)
50  2/mn7ext/ u(mne) ,alim(mne) ,blim(mne)
51  3/mn7err/ erp(mni) ,ern(mni) ,werr(mni) ,globcc(mni)
52  4/mn7inx/ nvarl(mne) ,niofex(mne),nexofi(mni)
53  5/mn7int/ x(mni) ,xt(mni) ,dirin(mni)
54  6/mn7fx2/ xs(mni) ,xts(mni) ,dirins(mni)
55  7/mn7der/ grd(mni) ,g2(mni) ,gstep(mni) ,gin(mne) ,dgrd(mni)
56  8/mn7fx3/ grds(mni) ,g2s(mni) ,gsteps(mni)
57  9/mn7fx1/ ipfix(mni) ,npfix
58  a/mn7var/ vhmat(mnihl)
59  b/mn7vat/ vthmat(mnihl)
60  c/mn7sim/ p(mni,mni+1),pstar(mni),pstst(mni) ,pbar(mni),prho(mni)
61 C
62  parameter(maxdbg=10, maxstk=10, maxcwd=20, maxp=30, maxcpt=101)
63  parameter(zero=0.0, one=1.0, half=0.5)
64  COMMON
65  d/mn7npr/ maxint ,npar ,maxext ,nu
66  e/mn7iou/ isysrd ,isyswr ,isyssa ,npagwd ,npagln ,newpag
67  e/mn7io2/ istkrd(maxstk) ,nstkrd ,istkwr(maxstk) ,nstkwr
68  f/mn7tit/ cfrom ,cstatu ,ctitl ,cword ,cundef ,cvrsn ,covmes
69  g/mn7flg/ isw(7) ,idbg(0:maxdbg) ,nblock ,icomnd
70  h/mn7min/ amin ,up ,edm ,fval3 ,epsi ,apsi ,dcovar
71  i/mn7cnv/ nfcn ,nfcnmx ,nfcnlc ,nfcnfr ,itaur,istrat,nwrmes(2)
72  j/mn7arg/ word7(maxp)
73  k/mn7log/ lwarn ,lrepor ,limset ,lnolim ,lnewmn ,lphead
74  l/mn7cns/ epsmac ,epsma2 ,vlimlo ,vlimhi ,undefi ,bigedm,updflt
75  m/mn7rpt/ xpt(maxcpt) ,ypt(maxcpt)
76  n/mn7cpt/ chpt(maxcpt)
77  o/mn7xcr/ xmidcr ,ymidcr ,xdircr ,ydircr ,ke1cr ,ke2cr
78  CHARACTER ctitl*50, cword*(maxcwd), cundef*10, cfrom*8,
79  + cvrsn*6, covmes(0:3)*22, cstatu*10, chpt*1
80  LOGICAL lwarn, lrepor, limset, lnolim, lnewmn, lphead
81  EXTERNAL fcn,futil
82  parameter(twopi=2.0*3.141593)
83  dimension xbest(mni), xmid(mni)
84  mxfail = word7(1)
85  IF (mxfail .LE. 0) mxfail=100+20*npar
86  mxstep = 10*mxfail
87  IF (amin .EQ. undefi) CALL mnamin(fcn,futil)
88  alpha = word7(2)
89  IF (alpha .LE. zero) alpha=3.
90  IF (isw(5) .GE. 1) WRITE (isyswr, 3) mxfail,mxstep,alpha
91  3 FORMAT (' MNSEEK: MONTE CARLO MINIMIZATION USING METROPOLIS',
92  + ' ALGORITHM'/' TO STOP AFTER',i6,' SUCCESSIVE FAILURES, OR',
93  + i7,' STEPS'/' MAXIMUM STEP SIZE IS',f9.3,' ERROR BARS.')
94  cstatu= 'INITIAL '
95  IF (isw(5) .GE. 2) CALL mnprin(2,amin)
96  cstatu = 'UNCHANGED '
97  ifail = 0
98  rnum = zero
99  rnum1 = zero
100  rnum2 = zero
101  nparx = npar
102  flast = amin
103 C set up step sizes, starting values
104  DO 10 ipar = 1, npar
105  iext = nexofi(ipar)
106  dirin(ipar) = 2.0*alpha*werr(ipar)
107  IF (nvarl(iext) .GT. 1) THEN
108 C parameter with limits
109  CALL mndxdi(x(ipar),ipar,dxdi)
110  IF (dxdi .EQ. zero) dxdi=1.
111  dirin(ipar) = 2.0*alpha*werr(ipar)/dxdi
112  IF (abs(dirin(ipar)).GT.twopi) dirin(ipar)=twopi
113  ENDIF
114  xmid(ipar) = x(ipar)
115  10 xbest(ipar) = x(ipar)
116 C search loop
117  DO 500 istep= 1, mxstep
118  IF (ifail .GE. mxfail) GO TO 600
119  DO 100 ipar= 1, npar
120  CALL mnrn15(rnum1,iseed)
121  CALL mnrn15(rnum2,iseed)
122  100 x(ipar) = xmid(ipar) + 0.5*(rnum1+rnum2-1.)*dirin(ipar)
123  CALL mninex(x)
124  CALL fcn(nparx,gin,ftry,u,4,futil)
125  nfcn = nfcn + 1
126  IF (ftry .LT. flast) THEN
127  IF (ftry .LT. amin) THEN
128  cstatu = 'IMPROVEMNT'
129  amin = ftry
130  DO 200 ib= 1, npar
131  200 xbest(ib) = x(ib)
132  ifail = 0
133  IF (isw(5) .GE. 2) CALL mnprin(2,amin)
134  ENDIF
135  GO TO 300
136  ELSE
137  ifail = ifail + 1
138 C Metropolis algorithm
139  bar = (amin-ftry)/up
140  CALL mnrn15(rnum,iseed)
141  IF (bar .LT. log(rnum)) GO TO 500
142  ENDIF
143 C Accept new point, move there
144  300 CONTINUE
145  DO 350 j= 1, npar
146  xmid(j) = x(j)
147  350 CONTINUE
148  flast = ftry
149  500 CONTINUE
150 C end search loop
151  600 CONTINUE
152  IF (isw(5) .GT. 1) WRITE (isyswr,601) ifail
153  601 FORMAT(' MNSEEK:',i5,' SUCCESSIVE UNSUCCESSFUL TRIALS.')
154  DO 700 ib= 1, npar
155  700 x(ib) = xbest(ib)
156  CALL mninex(x)
157  IF (isw(5) .GE. 1) CALL mnprin(2,amin)
158  IF (isw(5) .EQ. 0) CALL mnprin(0,amin)
159  RETURN
integer npitbl real *nx parameter(n=101, npitbl=46, nx=n-1) real *8 uconst
nodes z
block data include Zlatfit h c fitting region data data data data data d0 data data d0 data data h g *is for param c g data up(2, 1)/7.0d0/
dE dx *! Nuc Int sampling table e
Definition: cblkMuInt.h:130
nodes i
real(4), dimension(:), allocatable, save h
Definition: cNRLAtmos.f:28
subroutine mnprin(INKODE, FVAL)
Definition: mnprin.f:10
! constants thru Cosmos real ! if multiplied to deg radian Torad ! light velocity m sec ! infinty ! kg m2 *Togpcm2 g cm2 ! g cm2 *Tokgpm2 kg m2 ! cm *Tom m ! m *Tocm cm ! g cm3 *Tokgpm3 kg m3 ! kg m3 *Togpcm3 g cm3 ! sec *Tonsec nsec ! Tesla m ! Avogadro *A2deninv ! mfp *n * xs
Definition: Zglobalc.h:18
subroutine mnamin(FCN, FUTIL)
Definition: mnamin.f:10
********************block data cblkHeavy ********************integer j data *HeavyG2symbol p
Definition: cblkHeavy.h:7
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kiron data j
Definition: cblkHeavy.h:36
struct ob o[NpMax]
Definition: Zprivate.h:34
subroutine mndxdi(PINT, IPAR, DXDI)
Definition: mndxdi.f:10
subroutine mninex(PINT)
Definition: mninex.f:10
dE dx *! Nuc Int sampling table d
Definition: cblkMuInt.h:130
block data include Zlatfit h c fitting region data data data data data d0 data data d0 data data m
Definition: ZlatfitBD.h:35
real(4), save a
Definition: cNRLAtmos.f:20
dE dx *! Nuc Int sampling table g
Definition: cblkMuInt.h:130
real(4), save b
Definition: cNRLAtmos.f:21
!onst int maxp
Definition: Zprivate.h:3
subroutine mnrn15(VAL, INSEED)
Definition: mnrn15.f:10
integer n
Definition: Zcinippxc.h:1
integer, parameter half
Definition: csoftenPiK.f:108
! structure defining a particle at production ! Basic idea of what is to be contained in ! the particle structue is that dynamical ones should be included those derivable from the particle code ! is not included ******************************************************type fmom momentum sequence union map real e endmap map real * x
Definition: Zptcl.h:21
dE dx *! Nuc Int sampling table f
Definition: cblkMuInt.h:130
dE dx *! Nuc Int sampling table c
Definition: cblkMuInt.h:130
Here is the call graph for this function:
Here is the caller graph for this function: