2 implicit real*8 (a-h,o-z)
4 parameter (liv=60,lv=(77+maxvar*(maxvar+17)/2))
6 include 'COMMON.IOUNITS'
9 external func,gradient,fdum
11 include 'COMMON.SETUP'
13 include 'COMMON.CHAIN'
14 include 'COMMON.FFIELD'
15 dimension muster(mpi_status_size)
16 dimension var(maxvar),erg(mxch*(mxch+1)/2+1)
17 double precision d(maxvar),v(1:lv+1),garbage(maxvar)
20 dimension idum(1),rdum(1)
21 double precision przes(3),obrot(3,3)
23 data rad /1.745329252d-2/
24 common /przechowalnia/ v
29 call mpi_recv(indx,6,mpi_integer,king,idint,CG_COMM,
31 if (indx(1).eq.0) return
32 c print *, 'worker ',me,' received order ',n,ichuj
33 call mpi_recv(var,nvar,mpi_double_precision,
34 * king,idreal,CG_COMM,muster,ierr)
35 call mpi_recv(ene0,1,mpi_double_precision,
36 * king,idreal,CG_COMM,muster,ierr)
37 c print *, 'worker ',me,' var read '
40 call deflt(2,iv,liv,lv,v)
41 * 12 means fresh start, dont call deflt
43 * max num of fun calls
44 if (maxfun.eq.0) maxfun=500
46 * max num of iterations
47 if (maxmin.eq.0) maxmin=1000
54 * 1 means to print out result
56 * 1 means to print out summary stats
58 * 1 means to print initial x and d
60 * min val for v(radfac) default is 0.1
62 * max val for v(radfac) default is 4.0
64 * check false conv if (act fnctn decrease) .lt. v(26)*(exp decrease)
65 * the sumsl default is 0.1
67 * false conv if (act fnctn decrease) .lt. v(34)
68 * the sumsl default is 100*machep
70 * absolute convergence
71 if (tolf.eq.0.0D0) tolf=1.0D-4
73 * relative convergence
74 if (rtolf.eq.0.0D0) rtolf=1.0D-4
76 * controls initial step size
78 * large vals of d correspond to small components of step
87 call func(nvar,var,nf,eee,idum,rdum,fdum)
88 if(eee.gt.1.0d18) then
89 c print *,'MINIM_JLEE: ',me,' CHUJ NASTAPIL'
90 c print *,' energy before SUMSL =',eee
91 c print *,' aborting local minimization'
98 call sumsl(nvar,d,var,func,gradient,iv,liv,lv,v,idum,rdum,fdum)
99 c find which conformation was returned from sumsl
102 c total # of ftn evaluations (for iwf=0, it includes all minimizations).
107 call mpi_send(indx,6,mpi_integer,king,idint,CG_COMM,
109 c print '(a5,i3,15f10.5)', 'ENEX0',indx(1),v(10)
110 call mpi_send(var,nvar,mpi_double_precision,
111 * king,idreal,CG_COMM,ierr)
112 call mpi_send(eee,1,mpi_double_precision,king,idreal,
114 call mpi_send(ene0,1,mpi_double_precision,king,idreal,