1 subroutine maxlik_init(nvarr,xrange,comm)
2 c Optimize the UNRES energy function by minimization of a quartic target
3 c function or by the VMC method.
9 cMS$ATTRIBUTES C :: proc_proc
12 include "DIMENSIONS.ZSCOPT"
15 integer IERROR,ERRCODE,kolor,key,comm
18 include "COMMON.IOUNITS"
19 include "COMMON.OPTIM"
20 include "COMMON.XBOUND"
22 double precision rr,x(max_paropt)
25 double precision xrange(maxvar,2)
26 integer number_of_variables
27 common /patch/ number_of_variables
30 Cf2py intent(out) nvarr
31 Cf2Py intent(out) xrange
36 c print *,"Initializing MPI..."
37 call MPI_Init( IERROR )
38 ALL_COMM = MPI_COMM_WORLD
43 print *,"Before MPI_Comm_rank"
44 call MPI_Comm_rank( ALL_COMM, me, IERROR )
45 print *,"After MPI_Comm_rank"
46 call MPI_Comm_size( ALL_COMM, nprocs, IERROR )
47 print *,"Finished initializing MPI... nprocs",nprocs
50 c print *,"Me",me," Master",master," Ierror",ierror
52 if (me.eq.Master .and. ierror.gt.0) then
53 write(iout,*) "SEVERE ERROR - Can't initialize MPI."
54 call mpi_finalize(ierror)
70 c print *,"calling openunits"
72 c print *,"openunits called"
73 call read_general_data(*10)
74 if (me.eq.Master) then
75 write (iout,'(80(1h-)/10x,
76 & "Maximum likelihood optimization of UNRES energy function",
77 & " v. 05/10/16"/80(1h-))')
82 if (me.eq.Master)write (iout,*) "Finished READ_GENERAL_DATA"
85 call parmread(iparm,*10)
87 if (me.eq.Master) write (iout,*) "Finished parmread"
89 call read_optim_parm(*10)
90 call print_general_data(*10)
91 call read_protein_data(*10)
92 if (me.eq.Master) write (iout,*) "Finished READ_PROTEIN_DATA"
94 call read_database(*10)
95 if (me.eq.Master) write (iout,*) "Finished READ_DATABASE"
98 c write (iout,*) Me,' calling PROC_GROUPS'
100 c write (iout,*) Me,' calling WORK_PARTITION_MAP'
101 c call work_partition_map(nvarr)
103 call proc_data(nvarr,x,*10)
105 number_of_variables=nvarr
110 if (me.eq.Master) write (iout,*) "xrange from MAXLIK_INIT"
112 if (me.eq.Master) write (iout,*) i,xrange(i,1),xrange(i,2)
115 & write (iout,*) "================ maxlik intiialization completed"
120 10 if (me.eq.Master)write (iout,*) "Error termination of the program"
121 call MPI_Finalize( IERROR )
124 c------------------------------------------------------------------------
125 subroutine maxlik_optim(x,xmin,fmin)
126 c Optimize the UNRES energy function by minimization of a quartic target
127 c function or by the VMC method.
133 cMS$ATTRIBUTES C :: proc_proc
136 include "DIMENSIONS.ZSCOPT"
139 integer IERROR,ERRCODE,kolor,key
142 include "COMMON.IOUNITS"
143 include "COMMON.OPTIM"
144 integer nvarr,iparm,i
145 double precision rr,x(max_paropt),xmin(max_paropt),fmin
146 double precision tcpu,t1,t1w,t1_ini,t1w_ini
147 integer number_of_variables
148 common /patch/ number_of_variables
149 nvarr=number_of_variables
152 Cf2py intent(out) xmin
153 Cf2py intent(out) fmin
154 if (me.eq.Master) then
155 write (*,*) "MAXLIK_OPTIM: Variables from PYTHON:",nvarr
156 write (iout,*) "MAXLIK_OPTIM: Variables from PYTHON:",nvarr
158 write (iout,*) i,x(i)
162 if (me.eq.Master) then
163 write (*,*) "MAXLIK_OPTIM: Variables from maxlik_init:",nvarr
164 write (iout,*) "MAXLIK_OPTIM: Variables from maxlik_init:",nvarr
166 write (iout,*) i,x(i)
171 if (me.eq.Master) then
172 t1w_ini = MPI_WTIME()
175 call maxlikopt(nvarr,x,xmin,fmin)
176 write (iout,*) "fmin from MAXLIK_OPTIM:",fmin
178 call jebadelko(nvarr)
180 call jebadelko(nvarr)
183 if (me.eq.Master) then
184 t1w = mpi_wtime() - t1w_ini
187 write (iout,*) "CPU time",t1," wall clock time",t1w
192 & write (iout,'(30(1h-),"Minimization completed",30(1h-))')
195 call MPI_Finalize( IERROR )