1 subroutine enecalc(islice,*)
4 include "DIMENSIONS.ZSCOPT"
5 include "DIMENSIONS.FREE"
8 integer IERROR,ERRCODE,STATUS(MPI_STATUS_SIZE)
11 include "COMMON.CHAIN"
12 include "COMMON.IOUNITS"
13 include "COMMON.PROTFILES"
14 include "COMMON.NAMES"
16 include "COMMON.SBRIDGE"
18 include "COMMON.FFIELD"
19 include "COMMON.ENEPS"
20 include "COMMON.LOCAL"
21 include "COMMON.WEIGHTS"
22 include "COMMON.INTERACT"
24 include "COMMON.ENERGIES"
25 include "COMMON.CONTROL"
26 include "COMMON.TORCNSTR"
30 double precision qwolynes
32 integer errmsg_count,maxerrmsg_count /100/
33 double precision rmsnat,gyrate
34 external rmsnat,gyrate
35 double precision tole /1.0d-1/
36 integer i,itj,ii,iii,j,k,l,licz
37 integer ir,ib,ipar,iparm
38 integer iscor,islice,scount_buff(0:99)
39 real*4 csingle(3,maxres2)
40 double precision energ
44 double precision energia(0:max_ene),rmsdev,efree,eini
45 double precision fT(6),quot,quotl,kfacl,kfac /2.4d0/,T0 /3.0d2/
47 integer snk_p(MaxR,MaxT_h,Max_parm)
49 character*64 bprotfile_temp
50 call opentmp(islice,ientout,bprotfile_temp)
54 c write (iout,*) "enecalc: nparmset ",nparmset
55 c write (iout,*) "enecalc: tormode ",tor_mode
64 write (iout,*) "indstart(me1),indend(me1)"
65 &,indstart(me1),indend(me1)
66 do i=indstart(me1),indend(me1)
78 read(ientout,rec=i,err=101)
79 & ((csingle(l,k),l=1,3),k=1,nres),
80 & ((csingle(l,k+nres),l=1,3),k=nnt,nct),
81 & nss,(ihpb(k),jhpb(k),k=1,nss),
82 & eini,efree,rmsdev,(q(j,iii+1),j=1,nQ),iR,ib,ipar
91 c(l,k+nres)=csingle(l,k+nres)
94 anatemp= 1.0d0/(beta_h(ib,ipar)*1.987D-3)
95 q(nQ+1,iii+1)=rmsnat(iii+1)
97 q(nQ+2,iii+1)=gyrate(iii+1)
98 c fT=T0*beta_h(ib,ipar)*1.987D-3
99 c ft=2.0d0/(1.0d0+1.0d0/(T0*beta_h(ib,ipar)*1.987D-3))
100 if (rescale_mode.eq.1) then
101 quot=1.0d0/(T0*beta_h(ib,ipar)*1.987D-3)
103 tt = 1.0d0/(beta_h(ib,ipar)*1.987D-3)
104 ft(6)=(320.0+80.0*dtanh((tt-320.0)/80.0))/320.0
115 fT(l)=kfacl/(kfacl-1.0d0+quotl)
117 else if (rescale_mode.eq.2) then
118 quot=1.0d0/(T0*beta_h(ib,ipar)*1.987D-3)
120 tt = 1.0d0/(beta_h(ib,ipar)*1.987D-3)
121 ft(6)=(320.0+80.0*dtanh((tt-320.0)/80.0))/320.0
130 fT(l)=1.12692801104297249644d0/
131 & dlog(dexp(quotl)+dexp(-quotl))
133 else if (rescale_mode.eq.0) then
138 write (iout,*) "Error in ECECALC: wrong RESCALE_MODE",
144 c write (iout,*) "T",1.0d0/(beta_h(ib,ipar)*1.987D-3)," T0",T0,
145 c & " kfac",kfac,"quot",quot," fT",fT
151 call int_from_cart1(.false.)
155 call restore_parm(iparm)
157 write (iout,*) wsc,wscp,welec,wvdwpp,wang,wtor,wscloc,
158 & wcorr,wcorr5,wcorr6,wturn4,wturn3,wturn6,wel_loc,
159 & wtor_d,wsccor,wbond
161 C write (iout,*) "tuz przed energia"
162 call etotal(energia(0),fT)
163 C write (iout,*) "tuz za energia"
165 write (iout,*) "Conformation",i
166 write (iout,'(8f10.5)') ((c(l,k),l=1,3),k=1,nres),
167 & ((c(l,k+nres),l=1,3),k=nnt,nct)
168 call enerprint(energia(0),fT)
169 c write (iout,'(2i5,21f8.2)') i,iparm,(energia(k),k=1,21)
170 c write (iout,*) "ftors(1)",ftors(1)
171 c call briefout(i,energia(0))
172 c temp=1.0d0/(beta_h(ib,ipar)*1.987D-3)
173 c write (iout,*) "temp", temp
174 c call pdbout(i,temp,energia(0),energia(0),0.0d0,0.0d0)
176 if (energia(0).ge.1.0d20) then
177 write (iout,*) "NaNs detected in some of the energy",
178 & " components for conformation",ii+1
179 write (iout,*) "The Cartesian geometry is:"
180 write (iout,'(8f10.5)') ((c(l,k),l=1,3),k=1,nres)
181 write (iout,'(8f10.5)') ((c(l,k+nres),l=1,3),k=nnt,nct)
182 write (iout,*) "The internal geometry is:"
184 c call pdbout(ii+1,beta_h(ib,ipar),efree,energia(0),0.0d0,rmsdev)
185 write (iout,'(8f10.4)') (vbld(k),k=nnt+1,nct)
186 write (iout,'(8f10.4)') (vbld(k),k=nres+nnt,nres+nct)
187 write (iout,'(8f10.4)') (rad2deg*theta(k),k=3,nres)
188 write (iout,'(8f10.4)') (rad2deg*phi(k),k=4,nres)
189 write (iout,'(8f10.4)') (rad2deg*alph(k),k=2,nres-1)
190 write (iout,'(8f10.4)') (rad2deg*omeg(k),k=2,nres-1)
191 write (iout,*) "The components of the energy are:"
192 call enerprint(energia(0),fT)
194 & "This conformation WILL NOT be added to the database."
199 if (ipar.eq.iparm) write (iout,*) i,iparm,
200 & 1.0d0/(beta_h(ib,ipar)*1.987D-3),eini,energia(0)
202 if (ipar.eq.iparm .and. einicheck.gt.0 .and.
203 & dabs(eini-energia(0)).gt.tole) then
204 if (errmsg_count.le.maxerrmsg_count) then
205 write (iout,'(2a,2e15.5,a,2i8,a,f8.1)')
206 & "Warning: energy differs remarkably from ",
207 & " the value read in: ",energia(0),eini," point",
208 & iii+1,indstart(me1)+iii," T",
209 & 1.0d0/(1.987D-3*beta_h(ib,ipar))
210 write (iout,'(8f10.5)') ((c(l,k),l=1,3),k=1,nres),
211 & ((c(l,k+nres),l=1,3),k=nnt,nct)
213 call pdbout(indstart(me1)+iii,
214 & 1.0d0/(1.987D-3*beta_h(ib,ipar)),
215 &energia(0),eini,0.0d0,0.0d0)
216 call enerprint(energia(0),fT)
217 errmsg_count=errmsg_count+1
218 if (errmsg_count.gt.maxerrmsg_count)
219 & write (iout,*) "Too many warning messages"
220 if (einicheck.gt.1) then
221 write (iout,*) "Calculation stopped."
224 call MPI_Abort(WHAM_COMM,IERROR,ERRCODE)
231 C write (iout,*) "Czy tu dochodze"
232 potE(iii+1,iparm)=energia(0)
234 enetb(k,iii+1,iparm)=energia(k)
237 write (iout,'(2i5,f10.1,3e15.5)') i,iii,
238 & 1.0d0/(beta_h(ib,ipar)*1.987D-3),energia(0),eini,efree
239 c call enerprint(energia(0),fT)
242 write (iout,'(8f10.5)') ((c(l,k),l=1,3),k=1,nres)
243 write (iout,'(8f10.5)') ((c(l,k+nres),l=1,3),k=nnt,nct)
244 write (iout,'(8f10.4)') (vbld(k),k=nnt+1,nct)
245 write (iout,'(8f10.4)') (vbld(k),k=nres+nnt,nres+nct)
246 write (iout,'(8f10.4)') (rad2deg*theta(k),k=3,nres)
247 write (iout,'(8f10.4)') (rad2deg*phi(k),k=4,nres)
248 write (iout,'(8f10.4)') (rad2deg*alph(k),k=2,nres-1)
249 write (iout,'(8f10.4)') (rad2deg*omeg(k),k=2,nres-1)
250 write (iout,'(16i5)') nss,(ihpb(k),jhpb(k),k=1,nss)
251 write (iout,'(8f10.5)') (q(k,iii+1),k=1,nQ)
252 write (iout,'(f10.5,i10)') rmsdev,iscor
253 call enerprint(energia(0),fT)
254 call pdbout(ii+1,beta_h(ib,ipar),efree,energia(0),0.0d0,rmsdev)
261 if (q(1,iii).le.0.0d0 .and. indpdb.gt.0) q(1,iii)=qwolynes(0,0)
262 write (ientout,rec=iii)
263 & ((csingle(l,k),l=1,3),k=1,nres),
264 & ((csingle(l,k+nres),l=1,3),k=nnt,nct),
265 & nss,(ihpb(k),jhpb(k),k=1,nss),
266 & potE(iii,ipar),efree,rmsdev,(q(k,iii),k=1,nQ),iR,ib,ipar
267 c write (iout,'(2i5,2e15.5)') ii,iii,potE(iii,ipar),efree
269 if (separate_parset) then
270 snk_p(iR,ib,1)=snk_p(iR,ib,1)+1
272 snk_p(iR,ib,ipar)=snk_p(iR,ib,ipar)+1
274 c write (iout,*) "iii",iii," iR",iR," ib",ib," ipar",ipar,
275 c & " snk",snk_p(iR,ib,ipar)
277 snk(iR,ib,ipar,islice)=snk(iR,ib,ipar,islice)+1
283 write (iout,*) "Me",me," scount_buff",scount_buff(me)
285 c Master gathers updated numbers of conformations written by all procs.
286 c call MPI_AllGather(MPI_IN_PLACE,1,MPI_DATATYPE_NULL,scount(0),1,
287 c & MPI_INTEGER, WHAM_COMM, IERROR)
288 call MPI_AllGather( scount_buff(me), 1, MPI_INTEGER, scount(0), 1,
289 & MPI_INTEGER, WHAM_COMM, IERROR)
294 indstart(i)=indend(i-1)+1
295 indend(i)=indstart(i)+scount(i)-1
298 write (iout,*) "Revised conformation counts"
300 write (iout,'(a,i5,a,i7,a,i7,a,i7)')
301 & "Processor",i," indstart",indstart(i),
302 & " indend",indend(i)," count",scount(i)
305 call MPI_AllReduce(snk_p(1,1,1),snk(1,1,1,islice),
306 & MaxR*MaxT_h*nParmSet,
307 & MPI_INTEGER,MPI_SUM,WHAM_COMM,IERROR)
313 stot(islice)=stot(islice)+snk(i,ib,iparm,islice)
317 write (iout,*) "Revised SNK"
320 write (iout,'("Param",i3," Temp",f6.1,3x,32i8)')
321 & iparm,1.0d0/(1.987D-3*beta_h(ib,iparm)),
322 & (snk(i,ib,iparm,islice),i=1,nR(ib,iparm))
323 write (iout,*) "snk_p",(snk_p(i,ib,iparm),i=1,nR(ib,iparm))
326 write (iout,'("Total",i10)') stot(islice)
329 101 write (iout,*) "Error in scratchfile."
333 c------------------------------------------------------------------------------
334 subroutine write_dbase(islice,*)
337 include "DIMENSIONS.ZSCOPT"
338 include "DIMENSIONS.FREE"
339 include "DIMENSIONS.COMPAR"
342 integer IERROR,ERRCODE,STATUS(MPI_STATUS_SIZE)
345 include "COMMON.CONTROL"
346 include "COMMON.CHAIN"
347 include "COMMON.IOUNITS"
348 include "COMMON.PROTFILES"
349 include "COMMON.NAMES"
351 include "COMMON.SBRIDGE"
353 include "COMMON.FFIELD"
354 include "COMMON.ENEPS"
355 include "COMMON.LOCAL"
356 include "COMMON.WEIGHTS"
357 include "COMMON.INTERACT"
358 include "COMMON.FREE"
359 include "COMMON.ENERGIES"
360 include "COMMON.COMPAR"
361 include "COMMON.PROT"
362 include "COMMON.CONTACTS1"
364 character*80 bxname,cxname
365 character*64 bprotfile_temp
366 character*3 liczba,licz
368 integer i,itj,ii,iii,j,k,l
371 double precision rmsdev,efree,eini
372 real*4 csingle(3,maxres2)
373 double precision energ
376 integer ir,ib,iparm, scount_buff(0:99)
377 integer isecstr(maxres)
378 write (licz2,'(bz,i2.2)') islice
379 call opentmp(islice,ientout,bprotfile_temp)
380 write (iout,*) "bprotfile_temp ",bprotfile_temp
382 if (.not.bxfile .and. .not. cxfile .and. indpdb.eq.0
383 & .and. ensembles.eq.0) then
384 close(ientout,status="delete")
388 write (liczba,'(bz,i3.3)') me
389 if (bxfile .or. cxfile .or. ensembles.gt.0) then
390 if (.not.separate_parset) then
391 bxname = prefix(:ilen(prefix))//liczba//".bx"
393 write (licz,'(bz,i3.3)') myparm
394 bxname = prefix(:ilen(prefix))//liczba//"_par"//licz//".bx"
396 open (ientin,file=bxname,status="unknown",
397 & form="unformatted",access="direct",recl=lenrec1)
400 if (bxfile .or. cxfile .or. ensembles.gt.0) then
401 if (nslice.eq.1) then
402 bxname = prefix(:ilen(prefix))//".bx"
404 bxname = prefix(:ilen(prefix))//
405 & "_slice_"//licz2//".bx"
407 open (ientin,file=bxname,status="unknown",
408 & form="unformatted",access="direct",recl=lenrec1)
409 write (iout,*) "Calculating energies; writing geometry",
410 & " and energy components to ",bxname(:ilen(bxname))
412 #if (defined(AIX) && !defined(JUBL))
413 call xdrfopen_(ixdrf,cxname, "w", iret)
415 call xdrfopen(ixdrf,cxname, "w", iret)
418 write (iout,*) "Error opening cxfile ",cxname(:ilen(cxname))
423 if (indpdb.gt.0) then
424 if (nslice.eq.1) then
426 if (.not.separate_parset) then
427 statname=prefix(:ilen(prefix))//'_'//pot(:ilen(pot))
430 write (licz,'(bz,i3.3)') myparm
431 statname=prefix(:ilen(prefix))//'_par'//licz//'_'//
432 & pot(:ilen(pot))//liczba//'.stat'
436 statname=prefix(:ilen(prefix))//'_'//pot(:ilen(pot))//'.stat'
440 if (.not.separate_parset) then
441 statname=prefix(:ilen(prefix))//'_'//pot(:ilen(pot))//
442 & "_slice_"//licz2//liczba//'.stat'
444 write (licz,'(bz,i3.3)') myparm
445 statname=prefix(:ilen(prefix))//'_'//pot(:ilen(pot))//
446 & '_par'//licz//"_slice_"//licz2//liczba//'.stat'
449 statname=prefix(:ilen(prefix))//'_'//pot(:ilen(pot))
450 & //"_slice_"//licz2//'.stat'
453 open(istat,file=statname,status="unknown")
461 read(ientout,rec=i,err=101)
462 & ((csingle(l,k),l=1,3),k=1,nres),
463 & ((csingle(l,k+nres),l=1,3),k=nnt,nct),
464 & nss,(ihpb(k),jhpb(k),k=1,nss),
465 & eini,efree,rmsdev,(q(k,i),k=1,nQ),iR,ib,iparm
466 c write (iout,*) iR,ib,iparm,eini,efree
472 call int_from_cart1(.false.)
474 c write (iout,*) "Calling conf_compar",i
476 anatemp= 1.0d0/(beta_h(ib,iparm)*1.987D-3)
477 if (indpdb.gt.0) then
478 call conf_compar(i,.false.,.true.)
480 c call elecont(.false.,ncont,icont,nnt,nct)
481 c call secondary2(.false.,.false.,ncont,icont,isecstr)
483 c write (iout,*) "Exit conf_compar",i
485 if (bxfile .or.cxfile .or. ensembles.gt.0) write (ientin,rec=i)
486 & ((csingle(l,k),l=1,3),k=1,nres),
487 & ((csingle(l,k+nres),l=1,3),k=nnt,nct),
488 & nss,(ihpb(k),jhpb(k),k=1,nss),
489 c & potE(i,iparm),-entfac(i),rms_nat,iscore
490 & potE(i,nparmset),-entfac(i),rms_nat,iscore
491 c write (iout,'(2i5,3e15.5)') i,me,potE(i,iparm),-entfac(i)
493 if (cxfile) call cxwrite(ixdrf,csingle,potE(i,nparmset),
494 & -entfac(i),rms_nat,iscore)
497 close(ientout,status="delete")
499 if (bxfile .or. cxfile .or. ensembles.gt.0) close(ientin)
501 call MPI_Barrier(WHAM_COMM,IERROR)
502 if (me.ne.Master .or. .not.bxfile .and. .not. cxfile
503 & .and. ensembles.eq.0) return
505 if (bxfile .or. ensembles.gt.0) then
506 if (nslice.eq.1) then
507 if (.not.separate_parset) then
508 bxname = prefix(:ilen(prefix))//".bx"
510 write (licz,'(bz,i3.3)') myparm
511 bxname = prefix(:ilen(prefix))//"_par"//licz//".bx"
514 if (.not.separate_parset) then
515 bxname = prefix(:ilen(prefix))//"_slice_"//licz2//".bx"
517 write (licz,'(bz,i3.3)') myparm
518 bxname = prefix(:ilen(prefix))//"par_"//licz//
519 & "_slice_"//licz2//".bx"
522 open (ientout,file=bxname,status="unknown",
523 & form="unformatted",access="direct",recl=lenrec1)
524 write (iout,*) "Master is creating binary database ",
525 & bxname(:ilen(bxname))
528 if (nslice.eq.1) then
529 if (.not.separate_parset) then
530 cxname = prefix(:ilen(prefix))//".cx"
532 cxname = prefix(:ilen(prefix))//"_par"//licz//".cx"
535 if (.not.separate_parset) then
536 cxname = prefix(:ilen(prefix))//
537 & "_slice_"//licz2//".cx"
539 cxname = prefix(:ilen(prefix))//"_par"//licz//
540 & "_slice_"//licz2//".cx"
543 #if (defined(AIX) && !defined(JUBL))
544 call xdrfopen_(ixdrf,cxname, "w", iret)
546 call xdrfopen(ixdrf,cxname, "w", iret)
549 write (iout,*) "Error opening cxfile ",cxname(:ilen(cxname))
554 write (liczba,'(bz,i3.3)') j
555 if (separate_parset) then
556 write (licz,'(bz,i3.3)') myparm
557 bxname = prefix(:ilen(prefix))//liczba//"_par"//licz//".bx"
559 bxname = prefix(:ilen(prefix))//liczba//".bx"
561 open (ientin,file=bxname,status="unknown",
562 & form="unformatted",access="direct",recl=lenrec1)
563 write (iout,*) "Master is reading conformations from ",
564 & bxname(:ilen(bxname))
566 c write (iout,*) "j",j," indstart",indstart(j)," indend",indend(j)
568 do i=indstart(j),indend(j)
570 read(ientin,rec=iii,err=101)
571 & ((csingle(l,k),l=1,3),k=1,nres),
572 & ((csingle(l,k+nres),l=1,3),k=nnt,nct),
573 & nss,(ihpb(k),jhpb(k),k=1,nss),
574 & eini,efree,rmsdev,iscor
575 if (bxfile .or. ensembles.gt.0) then
576 write (ientout,rec=i)
577 & ((csingle(l,k),l=1,3),k=1,nres),
578 & ((csingle(l,k+nres),l=1,3),k=nnt,nct),
579 & nss,(ihpb(k),jhpb(k),k=1,nss),
580 & eini,efree,rmsdev,iscor
582 if(cxfile)call cxwrite(ixdrf,csingle,eini,efree,rmsdev,iscor)
589 call int_from_cart1(.false.)
590 write (iout,'(2i5,3e15.5)') i,iii,eini,efree
591 write (iout,*) "The Cartesian geometry is:"
592 write (iout,'(8f10.5)') ((c(l,k),l=1,3),k=1,nres)
593 write (iout,'(8f10.5)') ((c(l,k+nres),l=1,3),k=nnt,nct)
594 write (iout,*) "The internal geometry is:"
595 write (iout,'(8f10.4)') (vbld(k),k=nnt+1,nct)
596 write (iout,'(8f10.4)') (vbld(k),k=nres+nnt,nres+nct)
597 write (iout,'(8f10.4)') (rad2deg*theta(k),k=3,nres)
598 write (iout,'(8f10.4)') (rad2deg*phi(k),k=4,nres)
599 write (iout,'(8f10.4)') (rad2deg*alph(k),k=2,nres-1)
600 write (iout,'(8f10.4)') (rad2deg*omeg(k),k=2,nres-1)
601 write (iout,'(16i5)') nss,(ihpb(k),jhpb(k),k=1,nss)
602 write (iout,'(f10.5,i5)') rmsdev,iscor
605 write (iout,*) iii," conformations (from",indstart(j)," to",
606 & indend(j),") read from ",
607 & bxname(:ilen(bxname))
608 close (ientin,status="delete")
610 if (bxfile .or. cxfile .or. ensembles.gt.0) close (ientout)
611 #if (defined(AIX) && !defined(JUBL))
612 if (cxfile) call xdrfclose_(ixdrf,cxname,iret)
614 if (cxfile) call xdrfclose(ixdrf,cxname,iret)
618 101 write (iout,*) "Error in scratchfile."
622 c-------------------------------------------------------------------------------
623 subroutine cxwrite(ixdrf,csingle,eini,efree,rmsdev,iscor)
626 include "DIMENSIONS.ZSCOPT"
627 include "DIMENSIONS.FREE"
628 include "DIMENSIONS.COMPAR"
631 integer IERROR,ERRCODE,STATUS(MPI_STATUS_SIZE)
634 include "COMMON.CONTROL"
635 include "COMMON.CHAIN"
636 include "COMMON.IOUNITS"
637 include "COMMON.PROTFILES"
638 include "COMMON.NAMES"
640 include "COMMON.SBRIDGE"
642 include "COMMON.FFIELD"
643 include "COMMON.ENEPS"
644 include "COMMON.LOCAL"
645 include "COMMON.WEIGHTS"
646 include "COMMON.INTERACT"
647 include "COMMON.FREE"
648 include "COMMON.ENERGIES"
649 include "COMMON.COMPAR"
650 include "COMMON.PROT"
651 integer i,j,itmp,iscor,iret,ixdrf
652 double precision rmsdev,efree,eini
653 real*4 csingle(3,maxres2),xoord(3,maxres2+2)
656 c write (iout,*) "cxwrite"
661 xoord(j,i)=csingle(j,i)
666 xoord(j,nres+i-nnt+1)=csingle(j,i+nres)
672 c write (iout,*) "itmp",itmp
674 #if (defined(AIX) && !defined(JUBL))
675 call xdrf3dfcoord_(ixdrf, xoord, itmp, prec, iret)
677 c write (iout,*) "xdrf3dfcoord"
679 call xdrfint_(ixdrf, nss, iret)
682 call xdrfint(ixdrf, idssb(j)+nres, iret)
683 call xdrfint(ixdrf, jdssb(j)+nres, iret)
685 call xdrfint_(ixdrf, ihpb(j), iret)
686 call xdrfint_(ixdrf, jhpb(j), iret)
689 call xdrffloat_(ixdrf,real(eini),iret)
690 call xdrffloat_(ixdrf,real(efree),iret)
691 call xdrffloat_(ixdrf,real(rmsdev),iret)
692 call xdrfint_(ixdrf,iscor,iret)
694 call xdrf3dfcoord(ixdrf, xoord, itmp, prec, iret)
696 call xdrfint(ixdrf, nss, iret)
699 call xdrfint(ixdrf, idssb(j)+nres, iret)
700 call xdrfint(ixdrf, jdssb(j)+nres, iret)
702 call xdrfint(ixdrf, ihpb(j), iret)
703 call xdrfint(ixdrf, jhpb(j), iret)
706 call xdrffloat(ixdrf,real(eini),iret)
707 call xdrffloat(ixdrf,real(efree),iret)
708 call xdrffloat(ixdrf,real(rmsdev),iret)
709 call xdrfint(ixdrf,iscor,iret)
714 c------------------------------------------------------------------------------
715 logical function conf_check(ii,iprint)
718 include "DIMENSIONS.ZSCOPT"
719 include "DIMENSIONS.FREE"
722 integer IERROR,ERRCODE,STATUS(MPI_STATUS_SIZE)
725 include "COMMON.CHAIN"
726 include "COMMON.IOUNITS"
727 include "COMMON.PROTFILES"
728 include "COMMON.NAMES"
730 include "COMMON.SBRIDGE"
732 include "COMMON.FFIELD"
733 include "COMMON.ENEPS"
734 include "COMMON.LOCAL"
735 include "COMMON.WEIGHTS"
736 include "COMMON.INTERACT"
737 include "COMMON.FREE"
738 include "COMMON.ENERGIES"
739 include "COMMON.CONTROL"
740 include "COMMON.TORCNSTR"
741 integer j,k,l,ii,itj,iprint
742 c if (.not.check_conf) then
746 call int_from_cart1(.false.)
748 if (itype(j-1).ne.ntyp1 .and. itype(j).ne.ntyp1 .and.
749 & (vbld(j).lt.2.0d0 .or. vbld(j).gt.6.5d0)) then
751 & write (iout,*) "Bad CA-CA bond length",j," ",vbld(j),
752 & " for conformation",ii
753 if (iprint.gt.1) then
754 write (iout,*) "The Cartesian geometry is:"
755 write (iout,'(8f10.5)') ((c(l,k),l=1,3),k=1,nres)
756 write (iout,'(8f10.5)') ((c(l,k+nres),l=1,3),k=nnt,nct)
757 write (iout,*) "The internal geometry is:"
758 write (iout,'(8f10.4)') (vbld(k),k=nnt+1,nct)
759 write (iout,'(8f10.4)') (vbld(k),k=nres+nnt,nres+nct)
760 write (iout,'(8f10.4)') (rad2deg*theta(k),k=3,nres)
761 write (iout,'(8f10.4)') (rad2deg*phi(k),k=4,nres)
762 write (iout,'(8f10.4)') (rad2deg*alph(k),k=2,nres-1)
763 write (iout,'(8f10.4)') (rad2deg*omeg(k),k=2,nres-1)
765 if (iprint.gt.0) write (iout,*)
766 & "This conformation WILL NOT be added to the database."
773 if (itype(j).ne.10 .and.itype(j).ne.ntyp1 .and.
774 & (vbld(nres+j)-dsc(iabs(itj))).gt.2.0d0) then
776 & write (iout,*) "Bad CA-SC bond length",j," ",vbld(nres+j),
777 & " for conformation",ii
778 if (iprint.gt.1) then
779 write (iout,*) "The Cartesian geometry is:"
780 write (iout,'(8f10.5)') ((c(l,k),l=1,3),k=1,nres)
781 write (iout,'(8f10.5)') ((c(l,k+nres),l=1,3),k=nnt,nct)
782 write (iout,*) "The internal geometry is:"
783 write (iout,'(8f10.4)') (vbld(k),k=nnt+1,nct)
784 write (iout,'(8f10.4)') (vbld(k),k=nres+nnt,nres+nct)
785 write (iout,'(8f10.4)') (rad2deg*theta(k),k=3,nres)
786 write (iout,'(8f10.4)') (rad2deg*phi(k),k=4,nres)
787 write (iout,'(8f10.4)') (rad2deg*alph(k),k=2,nres-1)
788 write (iout,'(8f10.4)') (rad2deg*omeg(k),k=2,nres-1)
790 if (iprint.gt.0) write (iout,*)
791 & "This conformation WILL NOT be added to the database."
797 if (theta(j).le.0.0d0) then
799 & write (iout,*) "Zero theta angle(s) in conformation",ii
800 if (iprint.gt.1) then
801 write (iout,*) "The Cartesian geometry is:"
802 write (iout,'(8f10.5)') ((c(l,k),l=1,3),k=1,nres)
803 write (iout,'(8f10.5)') ((c(l,k+nres),l=1,3),k=nnt,nct)
804 write (iout,*) "The internal geometry is:"
805 write (iout,'(8f10.4)') (vbld(k),k=nnt+1,nct)
806 write (iout,'(8f10.4)') (vbld(k),k=nres+nnt,nres+nct)
807 write (iout,'(8f10.4)') (rad2deg*theta(k),k=3,nres)
808 write (iout,'(8f10.4)') (rad2deg*phi(k),k=4,nres)
809 write (iout,'(8f10.4)') (rad2deg*alph(k),k=2,nres-1)
810 write (iout,'(8f10.4)') (rad2deg*omeg(k),k=2,nres-1)
812 if (iprint.gt.0) write (iout,*)
813 & "This conformation WILL NOT be added to the database."
817 if (theta(j).gt.179.97*deg2rad) theta(j)=179.97*deg2rad
820 c write (iout,*) "conf_check passed",ii