1 subroutine scan(nvar,x,f0,lprn)
4 include "DIMENSIONS.ZSCOPT"
5 include "COMMON.WEIGHTS"
7 include "COMMON.VMCPAR"
8 include "COMMON.IOUNITS"
9 include "COMMON.CLASSES"
10 include "COMMON.OPTIM"
11 include "COMMON.ENERGIES"
12 include "COMMON.TIME1"
13 integer i,ii,ibatch,j,iww,nweight,iter,nf,nvar,icycle
16 double precision x(max_paropt)
17 double precision viol,f0,f,tcpu,sstep
22 c Systematically scan the weights one by one
24 write (iout,*) "Enter the SCAN procedure"
25 write (iout,*) "Initial weights"
26 write(iout,'(9x,15(2x,a6))')(wname(i),i=1,n_ene)
27 write(iout,40)(ww(i),i=1,n_ene)
28 write(iout,*)'-----------------------------------'
30 call targetfun(nvar,x,nf,f0,uiparm)
31 write (iout,*) "Initial function value:",f0
35 if (imask(i).eq.1) then
43 write (iout,*) "maxstep_scan",maxstep_scan," step_scan",step_scan
44 DO ICYCLE = 1,NSCANCYCLE
45 write (iout,*) "========== Scan cycle",ICYCLE
47 if (imask(iww).eq.0) goto 1222
49 nazwa='scan.'//wname(iww)(:ilen(wname(iww)))
50 open(istat,file=nazwa)
55 if (step_scan.lt.0.0d0) then
56 sstep = (ww_up(iww)-ww_low(iww))/maxstep_scan
60 write(iout,*) "Variable",iww,"maxstep_scan",maxstep_scan,
62 do iter=1,maxstep_scan
63 ww(iww)=ww_low(iww)+iter*sstep
64 if (ww(iww).lt.ww_low(iww).or.ww(iww).gt.ww_up(iww)) goto 1221
67 if (imask(i).eq.1) then
72 c write (*,*) iww,iter,ww(iww)
73 call targetfun(nvar,x,nf,f,uiparm)
75 write (iout,'(2a,f10.5,2(1pe15.5))')
76 & "Lower function value found:",wname(iww),ww(iww),f,f0
83 write (istat,'(f8.3,5x,$)') ww(iww)
84 write (istat,'(1pe15.5)') f
94 if (imask(i).eq.1) then
100 write (iout,*) "Best function value:",f0
102 call targetfun(nvar,x,nf,f,uiparm)
103 if (lprn) call write_params(nvar,nf,x)
105 30 format(a2,i5,1x,14(f5.3,1x),a3,100f7.3)
106 40 format(13(f7.4,1x))