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)
112 10 write (iout,*) "Error termination of the program"
113 call MPI_Finalize( IERROR )
116 c------------------------------------------------------------------------
117 subroutine maxlik_optim(x,fmin)
118 c Optimize the UNRES energy function by minimization of a quartic target
119 c function or by the VMC method.
125 cMS$ATTRIBUTES C :: proc_proc
128 include "DIMENSIONS.ZSCOPT"
131 integer IERROR,ERRCODE,kolor,key
134 include "COMMON.IOUNITS"
135 include "COMMON.OPTIM"
136 integer nvarr,iparm,i
137 double precision rr,x(max_paropt),fmin
139 integer number_of_variables
140 common /patch/ number_of_variables
141 Cf2py intent(inout) x
142 Cf2py intent(out) fmin
143 nvarr=number_of_variables
144 write (*,*) "MAXLIK_OPTIM: Variables from PYTHON:",nvarr
145 write (iout,*) "MAXLIK_OPTIM: Variables from PYTHON:",nvarr
147 write (iout,*) i,x(i)
151 if (me.eq.Master) then
153 call maxlikopt(nvarr,x,fmin)
154 write (iout,*) "fmin from MAXLIK_OPTIM:",fmin
156 call jebadelko(nvarr)
158 call jebadelko(nvarr)
161 call MPI_Finalize( IERROR )