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)
26 double precision xrange(maxvar,2)
27 integer number_of_variables
28 common /patch/ number_of_variables
30 Cf2py intent(out) nvarr
31 Cf2Py intent(out) xrange
33 c print *,"Starting..."
36 c print *,"Initializing MPI..."
37 call MPI_Init( IERROR )
38 ALL_COMM = MPI_COMM_WORLD
42 call MPI_Comm_rank( ALL_COMM, me, IERROR )
43 call MPI_Comm_size( ALL_COMM, nprocs, IERROR )
44 c print *,"Finished initializing MPI..."
47 c print *,"Me",me," Master",master," Ierror",ierror
50 write(iout,*) "SEVERE ERROR - Can't initialize MPI."
51 call mpi_finalize(ierror)
67 c print *,"calling openunits"
69 c print *,"openunits called"
70 call read_general_data(*10)
71 write (iout,'(80(1h-)/10x,
72 & "Maximum likelihood optimization of UNRES energy function",
73 & " v. 05/10/16"/80(1h-))')
77 write (iout,*) "Finished READ_GENERAL_DATA"
80 call parmread(iparm,*10)
82 write (iout,*) "Finished parmread"
84 call read_optim_parm(*10)
85 call print_general_data(*10)
86 call read_protein_data(*10)
87 write (iout,*) "Finished READ_PROTEIN_DATA"
89 call read_database(*10)
90 write (iout,*) "Finished READ_DATABASE"
93 c write (iout,*) Me,' calling PROC_GROUPS'
95 c write (iout,*) Me,' calling WORK_PARTITION_MAP'
96 c call work_partition_map(nvarr)
98 call proc_data(nvarr,x,*10)
100 number_of_variables=nvarr
105 write (iout,*) "xrange from MAXLIK_INIT"
107 write (iout,*) i,xrange(i,1),xrange(i,2)
109 write (iout,*) "================ maxlik intiialization completed"
114 10 write (iout,*) "Error termination of the program"
115 call MPI_Finalize( IERROR )
118 c------------------------------------------------------------------------
119 subroutine maxlik_optim(x,xmin,fmin)
120 c Optimize the UNRES energy function by minimization of a quartic target
121 c function or by the VMC method.
127 cMS$ATTRIBUTES C :: proc_proc
130 include "DIMENSIONS.ZSCOPT"
133 integer IERROR,ERRCODE,kolor,key
136 include "COMMON.IOUNITS"
137 include "COMMON.OPTIM"
138 integer nvarr,iparm,i
139 double precision rr,x(max_paropt),xmin(max_paropt),fmin
141 integer number_of_variables
142 common /patch/ number_of_variables
144 Cf2py intent(out) xmin
145 Cf2py intent(out) fmin
146 nvarr=number_of_variables
147 write (*,*) "MAXLIK_OPTIM: Variables from PYTHON:",nvarr
148 write (iout,*) "MAXLIK_OPTIM: Variables from PYTHON:",nvarr
150 write (iout,*) i,x(i)
154 if (me.eq.Master) then
156 call maxlikopt(nvarr,x,xmin,fmin)
157 write (iout,*) "fmin from MAXLIK_OPTIM:",fmin
159 call jebadelko(nvarr)
161 call jebadelko(nvarr)
165 write (iout,'(30(1h-),"Minimization completed",30(1h-))')
168 call MPI_Finalize( IERROR )