1 subroutine make_list(lprn,first_call,nvarr,x)
4 include "DIMENSIONS.ZSCOPT"
7 integer IERROR,ErrCode,Status(MPI_STATUS_SIZE,10)
8 integer req(10),msg_in(5),msg_out(5),address,size
9 character*1 buffer(8*(2*maxstr_proc*nntyp+8000))
12 include "COMMON.WEIGHTS"
13 include "COMMON.WEIGHTDER"
14 include "COMMON.ENERGIES"
15 include "COMMON.IOUNITS"
16 include "COMMON.VMCPAR"
17 include "COMMON.NAMES"
18 include "COMMON.INTERACT"
19 include "COMMON.TIME1"
20 include "COMMON.CHAIN"
21 include "COMMON.PROTFILES"
24 include "COMMON.OPTIM"
25 include "COMMON.CLASSES"
26 include "COMMON.COMPAR"
27 include "COMMON.TORSION"
28 C Define local variables
30 integer i,ii,iii,ibatch,kkk,jj,j,k,kk,l,iprot,ib,nn
31 integer ipass_conf,istart_conf,iend_conf,Previous,Next
32 double precision energia(0:max_ene)
33 double precision etoti,elowesti,dene
34 double precision tcpu_ini,tcpu_fin,tcpu
35 double precision elowest_t(2,maxT),etot_aux,enepsjk,
36 & emini,elowest_aux(2,maxT)
39 logical lprn,first_call
40 logical*1 lflag(maxstr)
41 integer ipermut(maxstr)
42 double precision x(nvarr)
43 double precision ftune_eps
46 write (iout,*) "Making the worklist of conformations."
47 write (iout,*) "enecut",(enecut(i),i=1,nprot)
48 write (iout,*) "first_call ",first_call," nvarr",nvarr
54 ntot_work(iprot)=ntot(iprot)
58 c Divide the whole database between processors
62 if (Previous.lt.0) Previous = Nprocs-1
63 if (Next.ge.Nprocs) Next = 0
64 call work_partition(lprn)
71 call restore_molinfo(iprot)
72 c write (iout,*) "Processor",me," iprot",iprot,
73 c & " indstart",indstart(me1,iprot)," indend",indend(me1,iprot),
74 c & " init_ene",init_ene," mod_fourier",mod_fourier(0),
75 c & " mod_elec",mod_elec," mod_scp",mod_scp
76 call restore_molinfo(iprot)
78 c Loop over the conformations of protein IPROT assigned to the current processor.
79 c The conformations are read off a DA scratchfile and processed in passes, each
80 c of which requires no more than MAXSTR_PROC conformations to be stored in memory
83 if (.not.init_ene .and. mod_fourier(nloctyp).eq.0
84 & .and. .not. mod_elec .and. .not. mod_scp) then
85 open (ientin,file=benefiles(iprot),status="old",
86 & form="unformatted",access="direct",recl=lenrec_ene(iprot))
88 open (icbase,file=bprotfiles(iprot),status="old",
89 & form="unformatted",access="direct",recl=lenrec(iprot))
90 open (ientout,file=benefiles(iprot),status="old",
91 & form="unformatted",access="direct",recl=lenrec_ene(iprot))
95 nchunk_ene(iprot) = iroof(scount(me1,iprot),maxstr)
96 nchunk_conf(iprot) = iroof(scount(me1,iprot),maxstr_proc)
97 write (iout,*)"Protein",iprot," energy evaluation in",
98 & nchunk_conf(iprot)," passes."
101 do i=indstart(me1,iprot),indend(me1,iprot),maxstr_proc
102 ipass_conf=ipass_conf+1
103 write (iout,*) "MAKE_LIST: Pass",ipass_conf
105 iend_conf=min0(i+maxstr_proc-1,indend(me1,iprot))
107 nchunk_ene(iprot) = iroof(ntot(iprot),maxstr)
108 nchunk_conf(iprot) = iroof(ntot(iprot),maxstr_proc)
109 write (iout,*)"Protein",iprot," energy evaluation in",
110 & nchunk_conf," passes."
112 do i=1,ntot(iprot),maxstr_proc
113 ipass_conf=ipass_conf+1
114 write (iout,*) "MAKE_LIST: Pass",ipass_conf
116 iend_conf=min0(i+maxstr_proc-1,ntot(iprot))
120 c Read the chunk of conformations off a DA scratchfile.
122 if (.not.init_ene .and. mod_fourier(nloctyp).eq.0
123 & .and. .not. mod_elec .and. .not. mod_scp) then
125 c If energy components have been pre-computed read them off a DA file.
127 call daread_ene(iprot,istart_conf,iend_conf)
128 do iii=istart_conf,iend_conf
132 enetb(ii,1,iprot)=0.0d0
135 enetb(ii,1,iprot)=enetb(ii,1,iprot)+ftune_eps(eps(j,k))*
136 & eneps(1,icant(j,k),ii,iprot)+
137 & eps(j,k)*eneps(2,icant(j,k),ii,iprot)
143 etot_aux=etot_aux+ww(j)*enetb(ii,j,iprot)
145 e_total(iii,iprot)=etot_aux
147 write (iout,'(i5,16(1pe12.4))') iii,
148 & (enetb(ii,j,iprot),j=1,n_ene),e_total(iii,iprot)
152 if (first_call .and. mod_side) then
153 write (iout,*) "Callig x2w"
155 call x2w(nvarr,x_orig)
156 write (iout,*) "After x2w"
159 do iii=istart_conf,iend_conf
161 enetb_oorig(ii,1,iprot)=0.0d0
164 enetb_oorig(ii,1,iprot)=enetb_oorig(ii,1,iprot)+
165 & ftune_eps(eps(j,k))*eneps(1,icant(j,k),ii,iprot)+
166 & eps(j,k)*eneps(2,icant(j,k),ii,iprot)
170 enetb_oorig(ii,j,iprot)=enetb(ii,j,iprot)
176 call daread_ccoords(iprot,istart_conf,iend_conf)
178 c Compute the energies of the conformations currently in memory and compute
179 c the lowest energies.
181 do iii=istart_conf,iend_conf
184 call restore_ccoords(iprot,ii)
185 call int_from_cart1(.false.)
187 write (iout,*) "Before etotal",iii,i
190 call etotal(energia(0))
192 write (iout,*) "After etotal",i
194 call enerprint(energia(0))
195 c write (iout,'(i5,16(1pe12.4))') i,
196 c & (energia(j),j=1,n_ene),energia(0)
200 write (iout,*) "Conformation:",i
201 write (iout,'(8f10.5)') ((c(l,k),l=1,3),k=1,nres)
202 write (iout,'(8f10.5)') ((c(l,k+nres),l=1,3),k=nnt,nct)
203 write (iout,'(8f10.4)') (vbld(k),k=2,nres)
204 write (iout,'(8f10.4)') (vbld(k+nres),k=nnt,nct)
205 write (iout,'(8f10.4)') (rad2deg*theta(k),k=3,nres)
206 write (iout,'(8f10.4)') (rad2deg*phi(k),k=4,nres)
207 write (iout,'(8f10.4)') (rad2deg*alph(k),k=2,nres-1)
208 write (iout,'(8f10.4)') (rad2deg*omeg(k),k=2,nres-1)
209 call enerprint(energia(0))
211 e_total(iii,iprot)=energia(0)
213 enetb(ii,j,iprot)=energia(j)
217 eneps(1,icant(j,k),ii,iprot)=eneps_temp(1,icant(j,k))
218 eneps(2,icant(j,k),ii,iprot)=eneps_temp(2,icant(j,k))
222 write (iout,'(i5,20(1pe12.4))') iii,
223 & (energia(j),j=1,n_ene),energia(0),eini(iii,iprot),
227 if (energia(0).ge.1.0d99) then
229 & "MAKE_LIST:CHUJ NASTAPIL in energy evaluation for",
230 & " point",i,". Probably NaNs in some of the energy components."
231 write (iout,*) "The components of the energy are:"
232 call enerprint(energia(0))
233 write (iout,*) "Conformation:",i
234 write (iout,'(8f10.5)') ((c(l,k),l=1,3),k=1,nres)
235 write (iout,'(8f10.5)') ((c(l,k+nres),l=1,3),k=nnt,nct)
236 write (iout,'(8f10.4)') (vbld(k),k=2,nres)
237 write (iout,'(8f10.4)') (vbld(k+nres),k=nnt,nct)
238 write (iout,'(8f10.4)') (rad2deg*theta(k),k=3,nres)
239 write (iout,'(8f10.4)') (rad2deg*phi(k),k=4,nres)
240 write (iout,'(8f10.4)') (rad2deg*alph(k),k=2,nres-1)
241 write (iout,'(8f10.4)') (rad2deg*omeg(k),k=2,nres-1)
242 write (iout,*) "Calculation terminated at this point.",
243 & " Check the database of conformations"
245 call MPI_Abort(MPI_COMM_WORLD,ErrCode,IERROR)
247 stop "SEVERE error in energy calculation"
251 do ii=1,iend_conf-istart_conf+1
253 enetb_orig(ii,j,iprot)=enetb(ii,j,iprot)
257 call x2w(nvarr,x_orig)
259 write (iout,*) "x,xorig"
261 write (iout,'(i5,2f10.5)') k,x(k),x_orig(k)
264 do iii=istart_conf,iend_conf
266 call restore_ccoords(iprot,ii)
267 call int_from_cart1(.false.)
268 call etotal(energia(0))
270 write (iout,*) "Conformation:",i
271 write (iout,'(8f10.5)') ((c(l,k),l=1,3),k=1,nres)
272 write (iout,'(8f10.5)') ((c(l,k+nres),l=1,3),k=nnt,nct)
273 write (iout,'(8f10.4)') (vbld(k),k=2,nres)
274 write (iout,'(8f10.4)') (vbld(k+nres),k=nnt,nct)
275 write (iout,'(8f10.4)') (rad2deg*theta(k),k=3,nres)
276 write (iout,'(8f10.4)') (rad2deg*phi(k),k=4,nres)
277 write (iout,'(8f10.4)') (rad2deg*alph(k),k=2,nres-1)
278 write (iout,'(8f10.4)') (rad2deg*omeg(k),k=2,nres-1)
279 call enerprint(energia(0))
282 enetb_oorig(ii,j,iprot)=energia(j)
285 write (iout,'(2i5,20(1pe12.4))') iii,ii,
286 & (energia(j),j=1,n_ene),energia(0)
287 write (iout,'(2i5,20(1pe12.4))') iii,ii,
288 & (enetb(ii,j,iprot),j=1,n_ene)
291 if (energia(0).ge.1.0d99) then
292 write (iout,*) "CHUJ NASTAPIL in energy evaluation for",
293 & " point",i,". Probably NaNs in some of the energy components."
294 write (iout,*) "The components of the energy are:"
295 call enerprint(energia(0))
296 write (iout,*) "Calculation terminated at this point.",
297 & " Check the database of conformations"
299 call MPI_Abort(MPI_COMM_WORLD,ErrCode,IERROR)
301 stop "SEVERE error in energy calculation"
304 write (iout,*) "MAKE_LIST Callig x2w"
307 write (iout,*) "After x2w"
310 write (iout,*) "make_list: calling dawrite_ene"
311 write (iout,*) "istart_conf",istart_conf,
312 & " iend_conf",iend_conf
313 call dawrite_ene(iprot,istart_conf,iend_conf,ientout)
315 c Distribute energy components through ring
316 call MPI_Barrier(WHAM_COMM,IERROR)
317 write (iout,*) "Processes synchronized in make_list"
319 msg_out(1)= 5*me1+1000*ipass_conf+1
320 msg_out(2)= 5*me1+1000*ipass_conf+2
321 msg_out(3)= 5*me1+1000*ipass_conf+3
322 msg_out(4)= 5*me1+1000*ipass_conf+4
323 msg_out(5)= 5*me1+1000*ipass_conf+5
325 c Send the current energy tables to the right neighbor
326 c Receive the energy tables produced by processor kkk from the left neighbor
327 kkk = mod(me1-iii+NProcs,Nprocs)
328 msg_in(1)= 5*kkk+1000*ipass_conf+1
329 msg_in(2)= 5*kkk+1000*ipass_conf+2
330 msg_in(3)= 5*kkk+1000*ipass_conf+3
331 msg_in(4)= 5*kkk+1000*ipass_conf+4
332 msg_in(5)= 5*kkk+1000*ipass_conf+5
333 write (iout,*) "me1",me1," iii",iii," Previous",Previous,
334 & " Next",Next," kkk",kkk
335 write (iout,*) "msg_in",msg_in
336 write (iout,*) "msg_out",msg_out
338 write (iout,*) "Processor",me1," Start Send and receive"
340 call MPI_Send(istart_conf,1,MPI_INTEGER,Next,msg_out(1),
342 write (iout,*) "Send",msg_out(1)," complete"
344 call MPI_Recv(istart_conf,1,MPI_INTEGER,Previous,
345 & msg_in(1),WHAM_COMM,STATUS(1,6),IERROR)
346 write (iout,*) "Recv",msg_in(1)," complete"
348 call MPI_Send(iend_conf,1,MPI_INTEGER,Next,msg_out(2),
350 write (iout,*) "Send",msg_out(2)," complete"
352 call MPI_Recv(iend_conf,1,MPI_INTEGER,Previous,
353 & msg_in(2),WHAM_COMM,STATUS(1,7),IERROR)
354 write (iout,*) "Recv",msg_in(2)," complete"
356 call MPI_Buffer_Attach(buffer(1),8*(2*maxstr_proc*n_ene+800),
358 call MPI_BSend(enetb(1,1,iprot),maxstr_proc*n_ene,
359 & MPI_DOUBLE_PRECISION,Next,msg_out(3),
361 write (iout,*) "Send",msg_out(3)," complete (enetb)"
363 call MPI_Recv(enetb(1,1,iprot),maxstr_proc*n_ene,
364 & MPI_DOUBLE_PRECISION,Previous,msg_in(3),WHAM_COMM,
365 & STATUS(1,8),IERROR)
366 write (iout,*) "Recv",msg_in(3)," complete (enetb)"
368 call MPI_Buffer_Detach(address,size,IERROR)
369 c write (iout,*) "MPI_Buffer_Detach complete (enetb)"
371 call MPI_Buffer_Attach(buffer(1),8*(2*maxstr_proc*nntyp+800),
373 c write (iout,*) "MPI_Buffer_Attach complete (eneps)"
375 call MPI_BSend(eneps(1,1,1,iprot),2*maxstr_proc*nntyp,
376 & MPI_DOUBLE_PRECISION,Next,msg_out(4),
378 write (iout,*) "Send",msg_out(4)," complete (eneps)"
380 call MPI_Recv(eneps(1,1,1,iprot),2*maxstr_proc*nntyp,
381 & MPI_DOUBLE_PRECISION,Previous,msg_in(4),WHAM_COMM,
382 & STATUS(1,9),IERROR)
383 write (iout,*) "Recv",msg_in(4)," complete (eneps)"
385 call MPI_Buffer_Detach(address,size,IERROR)
386 call MPI_Buffer_Attach(buffer(1),8*(2*maxstr_proc*maxnatlike
388 call MPI_BSend(nu(1,1,1,iprot),
389 & maxstr_proc*maxnatlike*maxdimnat,
390 & MPI_DOUBLE_PRECISION,Next,msg_out(5),
392 write (iout,*) "Send",msg_out(5)," complete (nu)"
394 call MPI_Recv(nu(1,1,1,iprot),
395 & maxstr_proc*maxnatlike*maxdimnat,
396 & MPI_DOUBLE_PRECISION,Previous,msg_in(5),WHAM_COMM,
397 & STATUS(1,10),IERROR)
398 write (iout,*) "Recv",msg_in(5)," complete (nu)"
400 call MPI_Buffer_Detach(address,size,IERROR)
401 write (iout,*) "Send and receive complete"
403 write (iout,*) "Processor",me1," calling dawrite_ene",
404 & " istart_conf",istart_conf," iend_conf",iend_conf
407 c write (iout,*) "assignment of enetb_orig"
408 do ii=1,iend_conf-istart_conf+1
410 enetb_orig(ii,j,iprot)=enetb(ii,j,iprot)
412 c write (iout,'(i5,20f8.2)')
413 c & ii,(enetb_orig(ii,j,iprot),j=1,n_ene)
416 call dawrite_ene(iprot,istart_conf,iend_conf,ientout)
424 if (.not.init_ene .and. mod_fourier(nloctyp).eq.0
425 & .and. .not. mod_elec .and. .not. mod_scp) then
434 c Lowest free energies of structural classes
438 IF (NCHUNK_CONF(IPROT).EQ.1) THEN
441 do i=1,ntot_work(iprot)
445 do i=indstart(me1,iprot),indend(me1,iprot)
449 istart_conf=indstart(me1,iprot)
450 iend_conf=indend(me1,iprot)
452 do i=1,ntot_work(iprot)
456 iend_conf=ntot_work(iprot)
459 write (iout,*) "i2ii at make_list"
460 do i=1,ntot_work(iprot)
461 write (iout,*) "i",i," i2ii",i2ii(i,iprot)
465 open (ientin,file=benefiles(iprot),status="old",
466 & form="unformatted",access="direct",recl=lenrec_ene(iprot))
467 call daread_ene(iprot,istart_conf,iend_conf)
468 call emin_search(iprot)
472 open (ientin,file=benefiles(iprot),status="old",
473 & form="unformatted",access="direct",recl=lenrec_ene(iprot))
476 do istart_conf=indstart(me1,iprot),indend(me1,iprot),maxstr_proc
477 iend_conf=min0(istart_conf+maxstr_proc-1,indend(me1,iprot))
479 do istart_conf=1,ntot_work(iprot),maxstr_proc
480 iend_conf=min0(istart_conf+maxstr_proc-1,ntot_work(iprot))
483 c Read the chunk of energies and derivatives off a DA scratchfile.
485 ipass_conf=ipass_conf+1
486 do i=1,ntot_work(iprot)
490 do i=istart_conf,iend_conf
495 write (iout,*) "ipass_conf",ipass_conf,
496 & " istart_conf",istart_conf," iend_conf",iend_conf
497 do i=1,ntot_work(iprot)
498 write (iout,*) "i",i," i2ii",i2ii(i,iprot)
502 call daread_ene(iprot,istart_conf,iend_conf)
503 call emin_search(iprot)
511 c Complete the calculation of the lowest energies over all classes and
512 c distribute the values to all procs
514 do ibatch=1,natlike(iprot)+2
516 do ib=1,nbeta(ibatch,iprot)
517 write (iout,'(7hELOWEST,3i3,f15.3,i12)') iprot,ibatch,ib,
518 & elowest(ib,ibatch,iprot),ind_lowest(ib,ibatch,iprot)
521 do ib=1,nbeta(ibatch,iprot)
522 elowest_aux(1,ib)=elowest(ib,ibatch,iprot)
523 elowest_aux(2,ib)=ind_lowest(ib,ibatch,iprot)
525 call MPI_Allreduce(elowest_aux(1,1),elowest_t(1,1),
526 & nbeta(ibatch,iprot),
527 & MPI_2DOUBLE_PRECISION, MPI_MINLOC, Comm1, IERROR)
529 do ib=1,nbeta(ibatch,iprot)
530 write (iout,*) "beta=",betaT(ib,ibatch,iprot)
531 write (iout,'(9helowest_t,10f15.3)')
532 & elowest_t(1,ib),elowest_t(2,ib)
534 write (iout,*) "Processor",me,me1," finished MPI_Reduce: 2"
536 do ib=1,nbeta(ibatch,iprot)
537 elowest(ib,ibatch,iprot)=elowest_t(1,ib)
538 ind_lowest(ib,ibatch,iprot)=elowest_t(2,ib)
543 do ibatch=1,natlike(iprot)+2
544 do ib=1,nbeta(ibatch,iprot)
545 write (iout,*) "iprot",iprot," ibatch",ibatch," ib",ib,
546 & " elowest",elowest(ib,ibatch,iprot)
551 c Allgather to provide all energies to all processors
554 call MPI_Allgatherv(e_total(indstart(me1,iprot),iprot),
555 & scount(me1,iprot),MPI_DOUBLE_PRECISION,e_total(1,iprot),
556 & scount(0,iprot),idispl(0,iprot),MPI_DOUBLE_PRECISION,
561 c Now determine which conformations will enter the database.
564 call restore_molinfo(iprot)
565 c Clear the list of conformations
566 do i=1,min0(ntot(iprot),maxstr)
572 c Make the list of conformations based on energy cut-off.
575 write (iout,*) "iprot",iprot," ibatch",ibatch," betmin",
576 & betmin(ibatch,iprot)
579 write (iout,*) "e_lowb",e_lowb(iprot)
580 write (iout,*) "t_lowb",t_lowb(iprot)
582 do ibatch=1,natlike(iprot)+2
586 c write (iout,*) "i",i," ii",ii," indstart",
587 c & indstart(me1,iprot)," indend",indend(me1,iprot)
588 if (i.ge.indstart(me1,iprot).and.i.le.indend(me1,iprot))
591 c write (iout,*) "i",i," ii",ii," kbatch",kbatch(i,iprot),
593 if (.not.lflag(i)) then
594 c if (eini(i,iprot).lt.e_lowb(iprot) .or.
595 c & entfac(i,iprot).lt.t_lowb(iprot)) then
597 c write (iout,*) "Conformation",i," eini",eini(i,iprot),
598 c & " entfac",entfac(i,iprot)," e_lowb",
600 c & " t_lowb",t_lowb(iprot)
605 do ib=1,nbeta(ibatch,iprot)
606 dene=betaT(ib,ibatch,iprot)*(e_total(i,iprot)
607 & -elowest(ib,ibatch,iprot))+entfac(i,iprot)
609 write (iout,*) "beta",betaT(ib,ibatch,iprot),
612 & " elowest",elowest(ib,ibatch,iprot)," dene",dene,
613 & " enecut",enecut(iprot)
615 if (dene.lt.enecut(iprot)) then
617 list_conf(nn,iprot)=i
630 if (nn.gt.maxstr) then
631 write (iout,*) "Error - after applying cutoff the number",
632 & " of conformations for protein ",i," exceeds MAXSTR:",
634 write (iout,*) "The calculation is terminating."
637 call MPI_Finalize(ierror)
641 call imysort(ntot_work(iprot),list_conf(1,iprot),ipermut)
642 write (iout,*) "Protein",iprot,ntot_work(iprot),
643 & " conformations within scaled energy cut-off=",enecut(iprot),
644 & " found at processor",me
647 c All workers get the complete list of conformations.
649 call MPI_Allgather(ntot_work(iprot),1,MPI_INTEGER,
650 & scount(0,iprot),1,MPI_INTEGER,Comm1,IERROR)
653 idispl(i,iprot)=idispl(i-1,iprot)+scount(i-1,iprot)
656 write (iout,*) "Protein",iprot," Scount and Idispl"
658 write (iout,*) i,scount(i,iprot),idispl(i,iprot)
660 write (iout,*) "Protein",i,
661 & " local list of conformations of processor",me
662 do i=1,ntot_work(iprot)
663 write(iout,*) i,list_conf(i,iprot)
665 write (iout,*) "Before REDUCE: ntot_work",ntot_work(iprot)
668 call MPI_Allreduce(ntot_work(iprot),nn,1,MPI_INTEGER,MPI_SUM,
672 write (iout,*) "After REDUCE: ntot_work",ntot_work(iprot)
675 call MPI_Allgatherv(list_conf(1,iprot),
676 & scount(me1,iprot),MPI_INTEGER,list_conf(1,iprot),
677 & scount(0,iprot),idispl(0,iprot),MPI_INTEGER,Comm1,IERROR)
679 write (iout,*) "Protein",i,
680 & " global list of conformations of processor",me
681 do i=1,ntot_work(iprot)
682 write(iout,'(2i5,e15.5,33f7.3)')i,list_conf(i,iprot),
683 & e_total(list_conf(i,iprot),iprot)
684 c & ,(nu(k,i,iprot),k=1,natlike(iprot))
690 c Construct the mapping of the new list to the original numbers of
696 do i=1,ntot_work(iprot)
697 tsil(list_conf(i,iprot),iprot)=i
700 write (iout,*) "Protein",i," List-to-conformation mapping"
702 write(iout,*) i,tsil(i,iprot)
707 c Divide the work again based on the current lists of conformations
709 call work_partition(.true.)
711 c If the conformations fit into memory, read them off a DA scratchfile.
714 call restore_molinfo(iprot)
716 nchunk_conf(iprot)=iroof(scount(me1,iprot),maxstr_proc)
718 nchunk_conf(iprot)=iroof(ntot_work(iprot),maxstr_proc)
720 if (nchunk_conf(iprot).eq.1) then
721 write (iout,*) "Protein",iprot,
722 & " in-memory storage of conformations."
723 if (init_ene .or. mod_fourier(nloctyp).gt.0
724 & .or. mod_elec .or. mod_scp) then
725 open (icbase,file=bprotfiles(iprot),status="old",
726 & form="unformatted",access="direct",recl=lenrec(iprot))
728 call daread_ccoords(iprot,indstart(me1,iprot),
731 call daread_ccoords(iprot,1,ntot_work(iprot))
735 open (ientin,file=benefiles(iprot),status="old",
736 & form="unformatted",access="direct",recl=lenrec_ene(iprot))
738 call daread_ene(iprot,indstart(me1,iprot),
741 call daread_ene(iprot,1,ntot_work(iprot))
744 open (icbase,file=bprotfiles(iprot),status="old",
745 & form="unformatted",access="direct",recl=lenrec(iprot))
747 call daread_ccoords(iprot,indstart(me1,iprot),
750 call daread_ccoords(iprot,1,ntot_work(iprot))
755 write (iout,*) "Protein",i,
756 & " global list of conformations of processor",me
757 do i=1,ntot_work(iprot)
758 write(iout,'(2i5,e15.5,33f7.3)')i,list_conf(i,iprot),
759 & e_total(list_conf(i,iprot),iprot)
763 write (iout,*) "Protein",iprot,
764 & " off-memory storage of conformations; ",
765 & "energy will be evaluated in",nchunk_conf(iprot)," passes."
773 write (iout,*) "E_TOTAL and ETOT_ORIG of protein",iprot
775 do i=1,ntot_work(iprot)
776 etot_orig(i,iprot)=e_total(list_conf(i,iprot),iprot)
778 write (iout,*) i,list_conf(i,iprot),
779 & e_total(list_conf(i,iprot),iprot),etot_orig(i,iprot)
782 do ibatch=1,natlike(iprot)+2
783 do ib=1,nbeta(ibatch,iprot)
784 emini = elowest(ib,ibatch,iprot)
785 if (elowest(ib,ibatch,iprot) .lt. emini)
786 & emini = elowest(ib,ibatch,iprot)
787 emin_orig(ib,ibatch,iprot)=emini
792 if (me1 .eq. Master) call write_conf_count
794 call write_conf_count
797 write (iout,*) "ELOWEST at the end of MAKE_LIST"
799 do ibatch=1,natlike(iprot)+2
800 do ib=1,nbeta(ibatch,iprot)
801 write (iout,*) "iprot",iprot," ibatch",ibatch," ib",ib,
802 & " elowest",elowest(ib,ibatch,iprot)
807 tcpu_fin = tcpu() - tcpu_ini
808 write (iout,*) "Time for creating list of conformations",tcpu_fin
810 t_func = t_func + tcpu_fin
813 c----------------------------------------------------------------------------
814 subroutine emin_search(iprot)
817 include "DIMENSIONS.ZSCOPT"
820 integer IERROR,ErrCode,Status(MPI_STATUS_SIZE,10)
821 integer req(10),msg_in(5),msg_out(5),address,size
822 character*1 buffer(8*(2*maxstr_proc*nntyp+8000))
825 include "COMMON.WEIGHTS"
826 include "COMMON.WEIGHTDER"
827 include "COMMON.COMPAR"
828 include "COMMON.ENERGIES"
829 include "COMMON.IOUNITS"
830 include "COMMON.VMCPAR"
831 include "COMMON.NAMES"
832 include "COMMON.INTERACT"
833 include "COMMON.TIME1"
834 include "COMMON.CHAIN"
835 include "COMMON.PROTFILES"
838 include "COMMON.CLASSES"
839 C Define local variables
840 integer i,ii,iii,kkk,jj,j,k,kk,l,iprot,ib,ibatch,nn
841 integer ipass_conf,istart_conf,iend_conf,Previous,Next
842 double precision energia(0:max_ene)
843 double precision etoti,elowesti,dene
844 double precision tcpu_ini,tcpu_fin,tcpu
845 double precision etot_aux,enepsjk,
846 & emini,elowest_aux(2,maxT)
851 do ibatch=1,natlike(iprot)+2
852 do ib=1,nbeta(ibatch,iprot)
853 elowest(ib,ibatch,iprot)=1.0d20
856 do ibatch=1,natlike(iprot)+2
862 do ib=1,nbeta(ibatch,iprot)
865 etoti=etoti+ww(kk)*enetb(jj,kk,iprot)
866 & *escal(kk,ib,ibatch,iprot)
868 if (ib.eq.1 .and. etoti.lt.elowest_ent(1,ibatch,iprot))
870 elowest_ent(1,ibatch,iprot)=etoti
871 elowest_ent(2,ibatch,iprot)=entfac(k,iprot)
874 c & etoti=etoti+entfac(k,iprot)/betaT(ib,ibatch,iprot)
875 etoti=etoti+entfac(k,iprot)/betaT(ib,ibatch,iprot)
876 if (etoti.lt.elowest(ib,ibatch,iprot)) then
877 elowest(ib,ibatch,iprot)=etoti
878 ind_lowest(ib,ibatch,iprot)=k
880 c write (iout,*) ib,betaT(ib,ibatch,iprot),etoti,
883 write (iout,'(2i5,2e15.5,f8.3)') k,jj,
884 & etoti,elowest(ib,ibatch,iprot),betaT(ib,ibatch,iprot)
888 write (iout,'(2i5,20f8.2)') j,jj,(enetb(jj,kk,iprot),