2 c Creation/update of the database of conformations
8 cMS$ATTRIBUTES C :: proc_proc
11 include "DIMENSIONS.ZSCOPT"
12 include "DIMENSIONS.FREE"
15 integer IERROR,ERRCODE
18 include "COMMON.IOUNITS"
20 include "COMMON.CONTROL"
21 include "COMMON.ALLPARM"
23 double precision rr,x(max_paropt)
27 call MPI_Init( IERROR )
28 call MPI_Comm_rank( MPI_COMM_WORLD, me, IERROR )
29 call MPI_Comm_size( MPI_COMM_WORLD, nprocs, IERROR )
32 write(iout,*) "SEVERE ERROR - Can't initialize MPI."
33 call mpi_finalize(ierror)
36 if (nprocs.gt.MaxProcs+1) then
37 write (2,*) "Error - too many processors",
39 write (2,*) "Increase MaxProcs and recompile"
40 call MPI_Finalize(IERROR)
57 call read_general_data(*10)
62 write (iout,*) "Calling proc_groups"
64 write (iout,*) "proc_groups exited"
70 write (iout,*) "1,4 SCSC repulsive interactions sacled down by 10"
72 >>>>>>> e183793... Added src_MD-M-newcorr (Adasko's source) and src-NEWSC of WHAM (with Momo's SCSC potentials)
74 write (iout,*) "Calling parmread",ipar
75 call parmread(ipar,*10)
76 if (.not.separate_parset) then
78 write (iout,*) "Finished storing parameters",ipar
79 else if (ipar.eq.myparm) then
81 write (iout,*) "Finished storing parameters",ipar
86 write (iout,*) "Finished READ_EFREE"
88 call read_protein_data(*10)
89 write (iout,*) "Finished READ_PROTEIN_DATA"
94 call read_ref_structure(*10)
98 write (iout,*) "Begin read_database"
100 call read_database(*10)
101 write (iout,*) "Finished read_database"
103 if (separate_parset) nparmset=1
105 if (ntot(islice).gt.0) then
107 call work_partition(islice,.true.)
108 write (iout,*) "work_partition OK"
111 call enecalc(islice,*10)
112 write (iout,*) "enecalc OK"
116 write (iout,*) "Calling WHAM_calc"
118 >>>>>>> e183793... Added src_MD-M-newcorr (Adasko's source) and src-NEWSC of WHAM (with Momo's SCSC potentials)
119 call WHAM_CALC(islice,*10)
120 write (iout,*) "wham_calc OK"
122 call write_dbase(islice,*10)
123 write (iout,*) "write_dbase OK"
125 if (ensembles.gt.0) then
126 call make_ensembles(islice,*10)
127 write (iout,*) "make_ensembles OK"
133 call MPI_Finalize( IERROR )
136 10 write (iout,*) "Error termination of the program"
137 call MPI_Finalize( IERROR )
140 c------------------------------------------------------------------------------
142 subroutine proc_groups
143 C Split the processors into the Master and Workers group, if needed.
146 include "DIMENSIONS.ZSCOPT"
147 include "DIMENSIONS.FREE"
149 include "COMMON.IOUNITS"
151 include "COMMON.FREE"
152 integer n,chunk,i,j,ii,remainder
153 integer kolor,key,ierror,errcode
157 C Split the communicator if independent runs for different parameter
158 C sets will be performed.
160 if (nparmset.eq.1 .or. .not.separate_parset) then
161 WHAM_COMM = MPI_COMM_WORLD
162 else if (separate_parset) then
163 if (nprocs.lt.nparmset) then
165 & "*** Cannot split parameter sets for fewer processors than sets",
167 call MPI_Finalize(ierror)
170 write (iout,*) "nparmset",nparmset
171 nprocs = nprocs/nparmset
174 write (iout,*) "My old rank",me," kolor",kolor," key",key
175 call MPI_Comm_split(MPI_COMM_WORLD,kolor,key,WHAM_COMM,ierror)
176 call MPI_Comm_size(WHAM_COMM,nprocs,ierror)
177 call MPI_Comm_rank(WHAM_COMM,me,ierror)
178 write (iout,*) "My new rank",me," comm size",nprocs
179 write (iout,*) "MPI_COMM_WORLD",MPI_COMM_WORLD,
180 & " WHAM_COMM",WHAM_COMM
182 write (iout,*) "My parameter set is",myparm
191 c------------------------------------------------------------------------------
192 subroutine work_partition(islice,lprint)
193 c Split the conformations between processors
196 include "DIMENSIONS.ZSCOPT"
197 include "DIMENSIONS.FREE"
199 include "COMMON.IOUNITS"
201 include "COMMON.PROT"
203 integer n,chunk,i,j,ii,remainder
204 integer kolor,key,ierror,errcode
207 C Divide conformations between processors; the first and
208 C the last conformation to handle by ith processor is stored in
209 C indstart(i) and indend(i), respectively.
211 C First try to assign equal number of conformations to each processor.
214 write (iout,*) "n=",n
218 c print *,"i",0," indstart",indstart(0)," scount",
221 indstart(i)=chunk+indstart(i-1)
222 scount(i)=scount(i-1)
223 c print *,"i",i," indstart",indstart(i)," scount",
227 C Determine how many conformations remained yet unassigned.
229 remainder=N-(indstart(nprocs1-1)
230 & +scount(nprocs1-1)-1)
231 c print *,"remainder",remainder
233 C Assign the remainder conformations to consecutive processors, starting
234 C from the lowest rank; this continues until the list is exhausted.
236 if (remainder .gt. 0) then
238 scount(i-1) = scount(i-1) + 1
239 indstart(i) = indstart(i) + i
241 do i=remainder+1,nprocs1-1
242 indstart(i) = indstart(i) + remainder
246 indstart(nprocs1)=N+1
250 indend(i)=indstart(i)+scount(i)-1
251 idispl(i)=indstart(i)-1
256 N=N+indend(i)-indstart(i)+1
259 c print *,"N",n," NTOT",ntot(islice)
260 if (N.ne.ntot(islice)) then
261 write (iout,*) "!!! Checksum error on processor",me,
264 call MPI_Abort( MPI_COMM_WORLD, Ierror, Errcode )
268 write (iout,*) "Partition of work between processors"
270 write (iout,'(a,i5,a,i7,a,i7,a,i7)')
271 & "Processor",i," indstart",indstart(i),
272 & " indend",indend(i)," count",scount(i)