1 subroutine regularize(ncart,etot,rms,cref0,iretcode)
2 implicit real*8 (a-h,o-z)
4 include 'COMMON.SBRIDGE'
6 include 'COMMON.INTERACT'
7 include 'COMMON.HEADER'
8 include 'COMMON.IOUNITS'
10 double precision przes(3),obrot(3,3),fhpb0(maxdim),varia(maxvar)
11 double precision cref0(3,ncart)
12 double precision energia(0:n_ene)
19 print *,'Enter REGULARIZE: nnt=',nnt,' nct=',nct,' nsup=',nsup,
20 & ' nstart_seq=',nstart_seq,' nstart_sup',nstart_sup
21 write (iout,'(/a/)') 'Initial energies:'
22 call geom_to_var(nvar,varia)
24 call etotal(energia(0))
26 call enerprint(energia(0))
27 call fitsq(rms,c(1,nstart_seq),cref0(1,nstart_sup-1),
28 & nsup,przes,obrot,non_conv)
29 write (iout,'(a,f10.5)')
30 & 'Enter REGULARIZE: Initial RMS deviation:',dsqrt(dabs(rms))
32 & 'Enter REGULARIZE: Initial RMS deviation:',dsqrt(dabs(rms))
40 print *,'Regularization: pass:',it
41 C Minimize with distance constraints, gradually relieving the weight.
42 call minimize(etot,varia,iretcode,nfun)
44 if (iretcode.eq.11) return
45 call fitsq(rms,c(1,nstart_seq),cref0(1,nstart_sup-1),
46 & nsup,przes,obrot,non_conv)
48 write (iout,'(a,i2,a,f10.5,a,1pe14.5,a,i3/)')
49 & 'Finish pass',it,', RMS deviation:',rms,', energy',etot,
50 & ' SUMSL convergence',iretcode
52 forcon(i)=0.1D0*forcon(i)
55 C Turn off the distance constraints and re-minimize energy.
56 print *,'Final minimization ... '
60 link_end=min0(link_end,nss)
61 call minimize(etot,varia,iretcode,nfun)
63 call fitsq(rms,c(1,nstart_seq),cref0(1,nstart_sup-1),nsup,
64 & przes,obrot,non_conv)
66 write (iout,'(a,f10.5,a,1pe14.5,a,i3/)')
67 & 'Final RMS deviation:',rms,' energy',etot,' SUMSL convergence',
73 call var_to_geom(nvar,varia)