1 subroutine read_general_data(*)
4 include "DIMENSIONS.ZSCOPT"
5 include "DIMENSIONS.FREE"
6 include "COMMON.TORSION"
7 include "COMMON.INTERACT"
8 include "COMMON.IOUNITS"
11 include "COMMON.PROTFILES"
12 include "COMMON.CHAIN"
13 include "COMMON.NAMES"
14 include "COMMON.FFIELD"
15 include "COMMON.ENEPS"
16 include "COMMON.WEIGHTS"
18 include "COMMON.CONTROL"
19 include "COMMON.ENERGIES"
20 include "COMMON.SPLITELE"
21 include "COMMON.SBRIDGE"
22 include "COMMON.SHIELD"
23 character*800 controlcard
24 integer i,j,k,ii,n_ene_found
25 integer ind,itype1,itype2,itypf,itypsc,itypp
32 call card_concat(controlcard,.true.)
33 call readi(controlcard,"N_ENE",n_ene,max_ene)
34 if (n_ene.gt.max_ene) then
35 write (iout,*) "Error: parameter out of range: N_ENE",n_ene,
39 call readi(controlcard,"NPARMSET",nparmset,1)
40 separate_parset = index(controlcard,"SEPARATE_PARSET").gt.0
41 call readi(controlcard,"IPARMPRINT",iparmprint,1)
42 write (iout,*) "PARMPRINT",iparmprint
43 if (nparmset.gt.max_parm) then
44 write (iout,*) "Error: parameter out of range: NPARMSET",
48 call readi(controlcard,"MAXIT",maxit,5000)
49 call reada(controlcard,"FIMIN",fimin,1.0d-3)
50 call readi(controlcard,"ENSEMBLES",ensembles,0)
51 hamil_rep=index(controlcard,"HAMIL_REP").gt.0
52 write (iout,*) "Number of energy parameter sets",nparmset
53 call multreadi(controlcard,"ISAMPL",isampl,nparmset,1)
55 if (isampl(i).eq.0) then
56 write (iout,*) "ERROR: isampl is 0 for parmset",i
61 write (iout,*) "MaxSlice",MaxSlice
62 call readi(controlcard,"NSLICE",nslice,1)
64 if (nslice.gt.MaxSlice) then
65 write (iout,*) "Error: parameter out of range: NSLICE",nslice,
69 write (iout,*) "Frequency of storing conformations",
70 & (isampl(i),i=1,nparmset)
71 write (iout,*) "Maxit",maxit," Fimin",fimin
72 call readi(controlcard,"NQ",nQ,1)
74 write (iout,*) "Error: parameter out of range: NQ",nq,
79 energy_dec=(index(controlcard,'ENERGY_DEC').gt.0)
80 if (index(controlcard,"CLASSIFY").gt.0) indpdb=1
81 call reada(controlcard,"DELTA",delta,1.0d-2)
82 call readi(controlcard,"EINICHECK",einicheck,2)
83 call reada(controlcard,"DELTRMS",deltrms,5.0d-2)
84 call reada(controlcard,"DELTRGY",deltrgy,5.0d-2)
85 call readi(controlcard,"RESCALE",rescale_mode,1)
86 check_conf=index(controlcard,"NO_CHECK_CONF").eq.0
87 call readi(controlcard,'TORMODE',tor_mode,0)
88 write(iout,*) "torsional and valence angle mode",tor_mode
89 call reada(controlcard,'DISTCHAINMAX',distchainmax,50.0d0)
90 call reada(controlcard,'BOXX',boxxsize,100.0d0)
91 call reada(controlcard,'BOXY',boxysize,100.0d0)
92 call reada(controlcard,'BOXZ',boxzsize,100.0d0)
93 c Cutoff range for interactions
94 call reada(controlcard,"R_CUT",r_cut,15.0d0)
95 call reada(controlcard,"LAMBDA",rlamb,0.3d0)
96 call reada(controlcard,"LIPTHICK",lipthick,0.0d0)
97 call reada(controlcard,"LIPAQBUF",lipbufthick,0.0d0)
98 if (lipthick.gt.0.0d0) then
99 bordliptop=(boxzsize+lipthick)/2.0
100 bordlipbot=bordliptop-lipthick
102 if ((bordliptop.gt.boxzsize).or.(bordlipbot.lt.0.0))
103 & write(iout,*) "WARNING WRONG SIZE OF LIPIDIC PHASE"
104 buflipbot=bordlipbot+lipbufthick
105 bufliptop=bordliptop-lipbufthick
106 if ((lipbufthick*2.0d0).gt.lipthick)
107 &write(iout,*) "WARNING WRONG SIZE OF LIP AQ BUF"
109 write(iout,*) "bordliptop=",bordliptop
110 write(iout,*) "bordlipbot=",bordlipbot
111 write(iout,*) "bufliptop=",bufliptop
112 write(iout,*) "buflipbot=",buflipbot
113 call readi(controlcard,'SYM',symetr,1)
114 write (iout,*) "DISTCHAINMAX",distchainmax
115 write (iout,*) "delta",delta
116 write (iout,*) "einicheck",einicheck
117 write (iout,*) "rescale_mode",rescale_mode
119 bxfile=index(controlcard,"BXFILE").gt.0
120 cxfile=index(controlcard,"CXFILE").gt.0
121 if (nslice .eq. 1 .and. .not.bxfile .and. .not.cxfile)
123 histfile=index(controlcard,"HISTFILE").gt.0
124 histout=index(controlcard,"HISTOUT").gt.0
125 entfile=index(controlcard,"ENTFILE").gt.0
126 zscfile=index(controlcard,"ZSCFILE").gt.0
127 with_dihed_constr = index(controlcard,"WITH_DIHED_CONSTR").gt.0
128 write (iout,*) "with_dihed_constr ",with_dihed_constr
129 with_theta_constr = index(controlcard,"WITH_THETA_CONSTR").gt.0
130 write (iout,*) "with_theta_constr ",with_theta_constr
131 call readi(controlcard,'SHIELD',shield_mode,0)
132 write(iout,*) "shield_mode",shield_mode
134 call readi(controlcard,'TORMODE',tor_mode,0)
135 write(iout,*) "torsional and valence angle mode",tor_mode
136 if (shield_mode.gt.0) then
138 C VSolvSphere the volume of solving sphere
140 C rpp(1,1) is the energy r0 for peptide group contact and will be used for it
141 C there will be no distinction between proline peptide group and normal peptide
142 C group in case of shielding parameters
143 VSolvSphere=4.0/3.0*pi*rpp(1,1)**3
144 VSolvSphere_div=VSolvSphere-4.0/3.0*pi*(rpp(1,1)/2.0)**3
145 write (iout,*) VSolvSphere,VSolvSphere_div
146 C long axis of side chain
148 C long_r_sidechain(i)=vbldsc0(1,i)
149 C short_r_sidechain(i)=sigma0(i)
154 call readi(controlcard,'CONSTR_DIST',constr_dist,0)
155 dyn_ss=index(controlcard,"DYN_SS").gt.0
156 adaptive = index(controlcard,"ADAPTIVE").gt.0
157 call readi(controlcard,'NSAXS',nsaxs,0)
158 call readi(controlcard,'SAXS_MODE',saxs_mode,0)
159 call reada(controlcard,'SCAL_RAD',scal_rad,1.0d0)
160 call reada(controlcard,'SAXS_CUTOFF',saxs_cutoff,1.0d0)
161 write (iout,*) "Number of SAXS restraints",NSAXS," SAXS_MODE",
162 & SAXS_MODE," SCAL_RAD",scal_rad,"SAXS_CUTOFF",saxs_cutoff
165 c------------------------------------------------------------------------------
166 subroutine read_efree(*)
168 C Read molecular data
172 include 'DIMENSIONS.ZSCOPT'
173 include 'DIMENSIONS.COMPAR'
174 include 'DIMENSIONS.FREE'
175 include 'COMMON.IOUNITS'
176 include 'COMMON.TIME1'
177 include 'COMMON.SBRIDGE'
178 include 'COMMON.CONTROL'
179 include 'COMMON.CHAIN'
180 include 'COMMON.HEADER'
182 include 'COMMON.FREE'
183 character*320 controlcard,ucase
184 integer iparm,ib,i,j,npars
196 call card_concat(controlcard,.true.)
197 call readi(controlcard,'NT',nT_h(iparm),1)
198 write (iout,*) "iparm",iparm," nt",nT_h(iparm)
200 if (nT_h(iparm).gt.MaxT_h) then
201 write (iout,*) "Error: parameter out of range: NT",nT_h(iparm),
205 replica(iparm)=index(controlcard,"REPLICA").gt.0
206 umbrella(iparm)=index(controlcard,"UMBRELLA").gt.0
207 read_iset(iparm)=index(controlcard,"READ_ISET").gt.0
208 write (iout,*) "nQ",nQ," nT",nT_h(iparm)," replica ",
209 & replica(iparm)," umbrella ",umbrella(iparm),
210 & " read_iset",read_iset(iparm)
213 call card_concat(controlcard,.true.)
214 call readi(controlcard,'NR',nR(ib,iparm),1)
215 if (umbrella(iparm)) then
218 nRR(ib,iparm)=nR(ib,iparm)
220 if (nR(ib,iparm).gt.MaxR) then
221 write (iout,*) "Error: parameter out of range: NR",
225 call reada(controlcard,'TEMP',beta_h(ib,iparm),298.0d0)
226 beta_h(ib,iparm)=1.0d0/(beta_h(ib,iparm)*1.987D-3)
227 call multreada(controlcard,'FI',f(1,ib,iparm),nR(ib,iparm),
230 call card_concat(controlcard,.true.)
231 call multreada(controlcard,'KH',KH(1,i,ib,iparm),nQ,
233 call multreada(controlcard,'Q0',Q0(1,i,ib,iparm),nQ,
238 write (iout,*) "ib",ib," beta_h",
239 & 1.0d0/(0.001987*beta_h(ib,iparm))
240 write (iout,*) "nR",nR(ib,iparm)
241 write (iout,*) "fi",(f(i,ib,iparm),i=1,nR(ib,iparm))
243 write (iout,*) "i",i," Kh",(Kh(j,i,ib,iparm),j=1,nQ),
244 & "q0",(q0(j,i,ib,iparm),j=1,nQ)
256 nR(ib,iparm)=nR(ib,1)
257 if (umbrella(iparm)) then
260 nRR(ib,iparm)=nR(ib,1)
262 beta_h(ib,iparm)=beta_h(ib,1)
264 f(i,ib,iparm)=f(i,ib,1)
266 KH(j,i,ib,iparm)=KH(j,i,ib,1)
267 Q0(j,i,ib,iparm)=Q0(j,i,ib,1)
270 replica(iparm)=replica(1)
271 umbrella(iparm)=umbrella(1)
272 read_iset(iparm)=read_iset(1)
280 c-----------------------------------------------------------------------------
281 subroutine read_protein_data(*)
284 include "DIMENSIONS.ZSCOPT"
285 include "DIMENSIONS.FREE"
288 integer IERROR,ERRCODE,STATUS(MPI_STATUS_SIZE)
291 include "COMMON.CHAIN"
292 include "COMMON.IOUNITS"
293 include "COMMON.PROT"
294 include "COMMON.PROTFILES"
295 include "COMMON.NAMES"
296 include "COMMON.FREE"
297 include "COMMON.OBCINKA"
299 character*16000 controlcard
300 integer i,ii,ib,iR,iparm,ilen,iroof,nthr,npars
310 C Read names of files with conformation data.
311 if (replica(iparm)) then
317 do ii=1,nRR(ib,iparm)
318 write (iout,*) "Parameter set",iparm," temperature",ib,
321 call card_concat(controlcard,.true.)
322 write (iout,*) controlcard(:ilen(controlcard))
323 call readi(controlcard,"NFILE_BIN",nfile_bin(ii,ib,iparm),0)
324 call readi(controlcard,"NFILE_ASC",nfile_asc(ii,ib,iparm),0)
325 call readi(controlcard,"NFILE_CX",nfile_cx(ii,ib,iparm),0)
326 call readi(controlcard,"REC_START",rec_start(ii,ib,iparm),1)
327 call readi(controlcard,"REC_END",rec_end(ii,ib,iparm),
328 & maxstr*isampl(iparm)+rec_start(ii,ib,iparm)-1)
329 call reada(controlcard,"TIME_START",
330 & time_start_collect(ii,ib,iparm),0.0d0)
331 call reada(controlcard,"TIME_END",time_end_collect(ii,ib,iparm),
333 write (iout,*) "rec_start",rec_start(ii,ib,iparm),
334 & " rec_end",rec_end(ii,ib,iparm)
335 write (iout,*) "time_start",time_start_collect(ii,ib,iparm),
336 & " time_end",time_end_collect(ii,ib,iparm)
338 if (replica(iparm)) then
339 call readi(controlcard,"TOTRAJ",totraj(ii,iparm),1)
340 write (iout,*) "Number of trajectories",totraj(ii,iparm)
343 if (nfile_bin(ii,ib,iparm).lt.2
344 & .and. nfile_asc(ii,ib,iparm).eq.0
345 & .and. nfile_cx(ii,ib,iparm).eq.0) then
346 write (iout,*) "Error - no action specified!"
349 if (nfile_bin(ii,ib,iparm).gt.0) then
350 call card_concat(controlcard,.false.)
351 call split_string(controlcard,protfiles(1,1,ii,ib,iparm),
352 & maxfile_prot,nfile_bin(ii,ib,iparm))
354 write(iout,*)"nfile_bin",nfile_bin(ii,ib,iparm)
355 write(iout,*) (protfiles(i,1,ii,ib,iparm),
356 & i=1,nfile_bin(ii,ib,iparm))
359 if (nfile_asc(ii,ib,iparm).gt.0) then
360 call card_concat(controlcard,.false.)
361 call split_string(controlcard,protfiles(1,2,ii,ib,iparm),
362 & maxfile_prot,nfile_asc(ii,ib,iparm))
364 write(iout,*) "nfile_asc(ii,ib,iparm)",nfile_asc(ii,ib,iparm)
365 write(iout,*) (protfiles(i,2,ii,ib,iparm),
366 & i=1,nfile_asc(ii,ib,iparm))
368 else if (nfile_cx(ii,ib,iparm).gt.0) then
369 call card_concat(controlcard,.false.)
370 call split_string(controlcard,protfiles(1,2,ii,ib,iparm),
371 & maxfile_prot,nfile_cx(ii,ib,iparm))
373 write(iout,*) "nfile_cx(ii,ib,iparm)",nfile_cx(ii,ib,iparm)
374 write(iout,*) (protfiles(i,2,ii,ib,iparm),
375 & i=1,nfile_cx(ii,ib,iparm))
386 c-------------------------------------------------------------------------------
387 subroutine opentmp(islice,iunit,bprotfile_temp)
390 include "DIMENSIONS.ZSCOPT"
391 include "DIMENSIONS.FREE"
394 integer IERROR,ERRCODE,STATUS(MPI_STATUS_SIZE)
397 include "COMMON.IOUNITS"
398 include "COMMON.PROTFILES"
399 include "COMMON.PROT"
400 include "COMMON.FREE"
401 character*64 bprotfile_temp
402 character*3 liczba,liczba2
409 write (liczba1,'(bz,i2.2)') islice
410 write (liczba,'(bz,i3.3)') me
412 c write (iout,*) "separate_parset ",separate_parset,
414 if (separate_parset) then
415 write (liczba2,'(bz,i3.3)') myparm
416 bprotfile_temp = scratchdir(:ilen(scratchdir))//"/"//
417 & prefix(:ilen(prefix))//liczba//"_"//liczba2//".xbin.tmp"//liczba1
418 open (iunit,file=bprotfile_temp,status="unknown",
419 & form="unformatted",access="direct",recl=lenrec)
421 bprotfile_temp = scratchdir(:ilen(scratchdir))//"/"//
422 & prefix(:ilen(prefix))//liczba//".xbin.tmp"//liczba1
423 open (iunit,file=bprotfile_temp,status="unknown",
424 & form="unformatted",access="direct",recl=lenrec)
427 bprotfile_temp = scratchdir(:ilen(scratchdir))//
428 & "/"//prefix(:ilen(prefix))//".xbin.tmp"//liczba1
429 open (iunit,file=bprotfile_temp,status="unknown",
430 & form="unformatted",access="direct",recl=lenrec)
432 c write (iout,*) "OpenTmp iunit",iunit," bprotfile_temp",
437 c-------------------------------------------------------------------------------
438 subroutine read_database(*)
441 include "DIMENSIONS.ZSCOPT"
442 include "DIMENSIONS.FREE"
445 integer IERROR,ERRCODE,STATUS(MPI_STATUS_SIZE)
448 include "COMMON.CHAIN"
449 include "COMMON.IOUNITS"
450 include "COMMON.PROTFILES"
451 include "COMMON.NAMES"
454 include "COMMON.ENEPS"
455 include "COMMON.PROT"
456 include "COMMON.INTERACT"
457 include "COMMON.FREE"
458 include "COMMON.SBRIDGE"
459 include "COMMON.OBCINKA"
460 real*4 csingle(3,maxres2)
461 character*64 nazwa,bprotfile_temp
464 integer i,j,ii,jj(maxslice),k,kk(maxslice),l,
465 & ll(maxslice),mm(maxslice),if
466 integer nrec,nlines,iscor,iunit,islice
467 double precision energ
470 double precision rmsdev,energia(0:max_ene),efree,eini,temp
471 double precision prop(maxQ)
472 integer ntot_all(maxslice,0:maxprocs-1), maxslice_buff
473 integer iparm,ib,iib,ir,nprop,nthr,npars
474 double precision etot,time
478 lenrec1=12*(nres+nct-nnt+1)+4*(2*nss+2)+24
479 lenrec2=12*(nres+nct-nnt+1)+4*(2*nss+2)+24+8*nQ
481 write (iout,*) "lenrec",lenrec," lenrec1",lenrec1,
491 write (iout,*) "nparmset",nparmset
499 if (replica(iparm)) then
506 do iR=1,nRR(ib,iparm)
508 write (iout,*) "iparm",iparm," ib",ib," iR",iR," nQ",nQ
514 IF (NFILE_BIN(iR,ib,iparm).GT.0) THEN
515 c Read conformations from binary DA files (one per batch) and write them to
516 c a binary DA scratchfile.
517 write (liczba,'(bz,i3.3)') me
518 do if=1,nfile_bin(iR,ib,iparm)
519 nazwa=protfiles(if,1,iR,ib,iparm)
520 & (:ilen(protfiles(if,1,iR,ib,iparm)))//".bx"
521 open (ientin,file=nazwa,status="old",form="unformatted",
522 & access="direct",recl=lenrec2,err=1111)
525 call opentmp(islice,ientout,bprotfile_temp)
526 call bxread(nazwa,ii,jj(islice),kk(islice),ll(islice),
527 & mm(islice),iR,ib,iparm)
534 IF (NFILE_ASC(iR,ib,iparm).GT.0) THEN
535 c Read conformations from multiple ASCII int files and write them to a binary
537 do if=1,nfile_asc(iR,ib,iparm)
538 nazwa=protfiles(if,2,iR,ib,iparm)
539 & (:ilen(protfiles(if,2,iR,ib,iparm)))//".x"
540 open(unit=ientin,file=nazwa,status='old',err=1111)
541 write(iout,*) "reading ",nazwa(:ilen(nazwa))
543 call xread(nazwa,ii,jj,kk,ll,mm,iR,ib,iparm)
546 IF (NFILE_CX(iR,ib,iparm).gt.0) THEN
547 c Read conformations from cx files and write them to a binary
549 do if=1,nfile_cx(iR,ib,iparm)
550 nazwa=protfiles(if,2,iR,ib,iparm)
551 & (:ilen(protfiles(if,2,iR,ib,iparm)))//".cx"
552 write(iout,*) "reading ",nazwa(:ilen(nazwa))
554 print *,"Calling cxread"
555 call cxread(nazwa,ii,jj,kk,ll,mm,iR,ib,iparm,
558 write (iout,*) "exit cxread"
564 stot(islice)=stot(islice)+jj(islice)
569 write (iout,*) "IPARM",iparm
572 if (nslice.eq.1) then
574 write (liczba,'(bz,i3.3)') me
575 bprotfile_temp = scratchdir(:ilen(scratchdir))//"/"//
576 & prefix(:ilen(prefix))//liczba//".xbin.tmp"
578 bprotfile_temp = scratchdir(:ilen(scratchdir))//
579 & "/"//prefix(:ilen(prefix))//".xbin.tmp"
581 write(iout,*) mm(1)," conformations read",ll(1),
582 & " conformations written to ",
583 & bprotfile_temp(:ilen(bprotfile_temp))
586 write (liczba1,'(bz,i2.2)') islice
588 write (liczba,'(bz,i3.3)') me
589 bprotfile_temp = scratchdir(:ilen(scratchdir))//"/"//
590 & prefix(:ilen(prefix))//liczba//".xbin.tmp"//liczba1
592 bprotfile_temp = scratchdir(:ilen(scratchdir))//
593 & "/"//prefix(:ilen(prefix))//".xbin.tmp"//liczba1
595 write(iout,*) mm(islice)," conformations read",ll(islice),
596 & " conformations written to ",
597 & bprotfile_temp(:ilen(bprotfile_temp))
602 c Check if everyone has the same number of conformations
604 c call MPI_ALLgather(MPI_IN_PLACE,stot(1),MPI_DATATYPE_NULL,
605 c & ntot_all(1,0),maxslice,MPI_INTEGER,MPI_Comm_World,IERROR)
607 maxslice_buff=maxslice
609 call MPI_Allgather(stot(1),maxslice_buff,MPI_INTEGER,
610 & ntot_all(1,0),maxslice,MPI_INTEGER,MPI_Comm_World,IERROR)
615 if (stot(islice).ne.ntot_all(islice,i)) then
616 write (iout,*) "Number of conformations at processor",i,
617 & " differs from that at processor",me,
618 & stot(islice),ntot_all(islice,i)," slice",islice
626 write (iout,*) "Numbers of conformations read by processors"
629 write (iout,'(8i10)') i,(ntot_all(islice,i),islice=1,nslice)
631 write (iout,*) "Calculation terminated."
636 ntot(islice)=stot(islice)
640 1111 write(iout,*) "Error opening coordinate file ",nazwa(:ilen(nazwa))
644 c------------------------------------------------------------------------------
645 subroutine card_concat(card,to_upper)
647 include 'DIMENSIONS.ZSCOPT'
648 include "COMMON.IOUNITS"
650 character*80 karta,ucase
654 read (inp,'(a)') karta
655 if (to_upper) karta=ucase(karta)
657 do while (karta(80:80).eq.'&')
658 card=card(:ilen(card)+1)//karta(:79)
659 read (inp,'(a)') karta
660 if (to_upper) karta=ucase(karta)
662 card=card(:ilen(card)+1)//karta
665 c------------------------------------------------------------------------------
666 subroutine readi(rekord,lancuch,wartosc,default)
668 character*(*) rekord,lancuch
669 integer wartosc,default
672 iread=index(rekord,lancuch(:ilen(lancuch))//"=")
677 iread=iread+ilen(lancuch)+1
678 read (rekord(iread:),*) wartosc
681 c----------------------------------------------------------------------------
682 subroutine reada(rekord,lancuch,wartosc,default)
684 character*(*) rekord,lancuch
686 double precision wartosc,default
689 iread=index(rekord,lancuch(:ilen(lancuch))//"=")
694 iread=iread+ilen(lancuch)+1
695 read (rekord(iread:),*) wartosc
698 c----------------------------------------------------------------------------
699 subroutine multreadi(rekord,lancuch,tablica,dim,default)
702 integer tablica(dim),default
703 character*(*) rekord,lancuch
710 iread=index(rekord,lancuch(:ilen(lancuch))//"=")
711 if (iread.eq.0) return
712 iread=iread+ilen(lancuch)+1
713 read (rekord(iread:),*,end=10,err=10) (tablica(i),i=1,dim)
716 c----------------------------------------------------------------------------
717 subroutine multreada(rekord,lancuch,tablica,dim,default)
720 double precision tablica(dim),default
721 character*(*) rekord,lancuch
728 iread=index(rekord,lancuch(:ilen(lancuch))//"=")
729 if (iread.eq.0) return
730 iread=iread+ilen(lancuch)+1
731 read (rekord(iread:),*,end=10,err=10) (tablica(i),i=1,dim)
734 c----------------------------------------------------------------------------
735 subroutine reads(rekord,lancuch,wartosc,default)
737 character*(*) rekord,lancuch,wartosc,default
739 integer ilen,lenlan,lenrec,iread,ireade
745 iread=index(rekord,lancuch(:lenlan)//"=")
746 c print *,"rekord",rekord," lancuch",lancuch
747 c print *,"iread",iread," lenlan",lenlan," lenrec",lenrec
753 c print *,"iread",iread
754 c print *,"|",rekord(iread:iread),"|",iblnk(rekord(iread:iread))
755 do while (iread.le.lenrec .and. iblnk(rekord(iread:iread)))
757 c print *,"|",rekord(iread:iread),"|",iblnk(rekord(iread:iread))
759 c print *,"iread",iread
760 if (iread.gt.lenrec) then
765 c print *,"ireade",ireade
766 do while (ireade.lt.lenrec .and.
767 & .not.iblnk(rekord(ireade:ireade)))
770 wartosc=rekord(iread:ireade)
773 c----------------------------------------------------------------------------
774 subroutine multreads(rekord,lancuch,tablica,dim,default)
777 character*(*) rekord,lancuch,tablica(dim),default
779 integer ilen,lenlan,lenrec,iread,ireade
788 iread=index(rekord,lancuch(:lenlan)//"=")
789 c print *,"rekord",rekord," lancuch",lancuch
790 c print *,"iread",iread," lenlan",lenlan," lenrec",lenrec
791 if (iread.eq.0) return
794 c print *,"iread",iread
795 c print *,"|",rekord(iread:iread),"|",iblnk(rekord(iread:iread))
796 do while (iread.le.lenrec .and. iblnk(rekord(iread:iread)))
798 c print *,"|",rekord(iread:iread),"|",iblnk(rekord(iread:iread))
800 c print *,"iread",iread
801 if (iread.gt.lenrec) return
803 c print *,"ireade",ireade
804 do while (ireade.lt.lenrec .and.
805 & .not.iblnk(rekord(ireade:ireade)))
808 tablica(i)=rekord(iread:ireade)
812 c----------------------------------------------------------------------------
813 subroutine split_string(rekord,tablica,dim,nsub)
815 integer dim,nsub,i,ii,ll,kk
816 character*(*) tablica(dim)
827 C Find the start of term name
829 do while (ii.le.ll .and. rekord(ii:ii).eq." ")
832 C Parse the name into TABLICA(i) until blank found
833 do while (ii.le.ll .and. rekord(ii:ii).ne." ")
835 tablica(i)(kk:kk)=rekord(ii:ii)
838 if (kk.gt.0) nsub=nsub+1
843 c--------------------------------------------------------------------------------
844 integer function iroof(n,m)
846 if (ii*m .lt. n) ii=ii+1
850 c-------------------------------------------------------------------------------
851 subroutine read_dist_constr
852 implicit real*8 (a-h,o-z)
854 include 'COMMON.CONTROL'
855 include 'COMMON.CHAIN'
856 include 'COMMON.IOUNITS'
857 include 'COMMON.SBRIDGE'
858 integer ifrag_(2,100),ipair_(2,100)
859 double precision wfrag_(100),wpair_(100)
860 character*500 controlcard
861 logical normalize,next
863 double precision xlink(4,0:4) /
865 & 0.0d0,0.0d0,0.0d0,0.0d0, ! default, no xlink potential
866 & 0.00305218d0,9.46638d0,4.68901d0,4.74347d0, ! ZL
867 & 0.00214928d0,12.7517d0,0.00375009d0,6.13477d0, ! ADH
868 & 0.00184547d0,11.2678d0,0.00140292d0,7.00868d0, ! PDH
869 & 0.000161786d0,6.29273d0,4.40993d0,7.13956d0 / ! DSS
870 write (iout,*) "Calling read_dist_constr"
871 c write (iout,*) "nres",nres," nstart_sup",nstart_sup," nsup",nsup
877 call card_concat(controlcard,.true.)
878 next = index(controlcard,"NEXT").gt.0
879 call readi(controlcard,"RESTR_TYPE",restr_type,constr_dist)
880 write (iout,*) "restr_type",restr_type
881 call readi(controlcard,"NFRAG",nfrag_,0)
882 call readi(controlcard,"NFRAG",nfrag_,0)
883 call readi(controlcard,"NPAIR",npair_,0)
884 call readi(controlcard,"NDIST",ndist_,0)
885 call reada(controlcard,'DIST_CUT',dist_cut,5.0d0)
886 if (restr_type.eq.10)
887 & call reada(controlcard,'WBOLTZD',wboltzd,0.591d0)
888 if (restr_type.eq.12)
889 & call reada(controlcard,'SCAL_PEAK',scal_peak,5.0d0)
890 call multreadi(controlcard,"IFRAG",ifrag_(1,1),2*nfrag_,0)
891 call multreadi(controlcard,"IPAIR",ipair_(1,1),2*npair_,0)
892 call multreada(controlcard,"WFRAG",wfrag_(1),nfrag_,0.0d0)
893 call multreada(controlcard,"WPAIR",wpair_(1),npair_,0.0d0)
894 normalize = index(controlcard,"NORMALIZE").gt.0
895 write (iout,*) "WBOLTZD",wboltzd
896 write (iout,*) "SCAL_PEAK",scal_peak
897 c write (iout,*) "NFRAG",nfrag_," NPAIR",npair_," NDIST",ndist_
898 c write (iout,*) "IFRAG"
900 c write (iout,*) i,ifrag_(1,i),ifrag_(2,i),wfrag_(i)
902 c write (iout,*) "IPAIR"
904 c write (iout,*) i,ipair_(1,i),ipair_(2,i),wpair_(i)
906 if (nfrag_.gt.0) then
908 read(inp,'(a)') pdbfile
910 & "Distance restraints will be constructed from structure ",pdbfile
911 open(ipdbin,file=pdbfile,status='old',err=11)
917 if (ifrag_(1,i).lt.nstart_sup) ifrag_(1,i)=nstart_sup
918 if (ifrag_(2,i).gt.nstart_sup+nsup-1)
919 & ifrag_(2,i)=nstart_sup+nsup-1
920 c write (iout,*) i,ifrag_(1,i),ifrag_(2,i),wfrag_(i)
922 if (wfrag_(i).eq.0.0d0) cycle
923 do j=ifrag_(1,i),ifrag_(2,i)-1
925 c write (iout,*) "j",j," k",k
927 if (restr_type.eq.1) then
933 forcon(nhpb)=wfrag_(i)
934 else if (constr_dist.eq.2) then
935 if (ddjk.le.dist_cut) then
941 forcon(nhpb)=wfrag_(i)
943 else if (restr_type.eq.3) then
949 forcon(nhpb)=wfrag_(i)*dexp(-0.5d0*(ddjk/dist_cut)**2)
951 write (iout,'(a,3i5,f8.2,1pe12.2)') "+dist.restr ",
952 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
957 if (wpair_(i).eq.0.0d0) cycle
965 do j=ifrag_(1,ii),ifrag_(2,ii)
966 do k=ifrag_(1,jj),ifrag_(2,jj)
968 if (restr_type.eq.1) then
974 forcon(nhpb)=wpair_(i)
975 else if (constr_dist.eq.2) then
976 if (ddjk.le.dist_cut) then
982 forcon(nhpb)=wpair_(i)
984 else if (restr_type.eq.3) then
990 forcon(nhpb)=wpair_(i)*dexp(-0.5d0*(ddjk/dist_cut)**2)
992 write (iout,'(a,3i5,f8.2,f10.1)') "+dist.restr ",
993 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
999 write (iout,*) "Distance restraints as read from input"
1001 if (restr_type.eq.12) then
1002 read (inp,*) ihpb_peak(nhpb_peak+1),jhpb_peak(nhpb_peak+1),
1003 & dhpb_peak(nhpb_peak+1),dhpb1_peak(nhpb_peak+1),
1004 & ibecarb_peak(nhpb_peak+1),forcon_peak(nhpb_peak+1),
1005 & fordepth_peak(nhpb_peak+1),npeak
1006 c write(iout,*) ihpb_peak(nhpb_peak+1),jhpb_peak(nhpb_peak+1),
1007 c & dhpb_peak(nhpb_peak+1),dhpb1_peak(nhpb_peak+1),
1008 c & ibecarb_peak(nhpb_peak+1),forcon_peak(nhpb_peak+1),
1009 c & fordepth_peak(nhpb_peak+1),npeak
1010 if (forcon_peak(nhpb_peak+1).le.0.0d0.or.
1011 & fordepth_peak(nhpb_peak+1).le.0.0d0)cycle
1012 nhpb_peak=nhpb_peak+1
1013 irestr_type_peak(nhpb_peak)=12
1014 if (ipeak(1,npeak).eq.0) ipeak(1,npeak)=i
1016 write (iout,'(a,5i5,2f8.2,2f10.5,i5)') "+dist.restr ",
1017 & nhpb_peak,ihpb_peak(nhpb_peak),jhpb_peak(nhpb_peak),
1018 & ibecarb_peak(nhpb_peak),npeak,dhpb_peak(nhpb_peak),
1019 & dhpb1_peak(nhpb_peak),forcon_peak(nhpb_peak),
1020 & fordepth_peak(nhpb_peak),irestr_type_peak(nhpb_peak)
1021 if (ibecarb_peak(nhpb_peak).gt.0) then
1022 ihpb_peak(nhpb_peak)=ihpb_peak(nhpb_peak)+nres
1023 jhpb_peak(nhpb_peak)=jhpb_peak(nhpb_peak)+nres
1025 else if (restr_type.eq.11) then
1026 read (inp,*) ihpb(nhpb+1),jhpb(nhpb+1),dhpb(nhpb+1),
1027 & dhpb1(nhpb+1),ibecarb(i),forcon(nhpb+1),fordepth(nhpb+1)
1028 c fordepth(nhpb+1)=fordepth(nhpb+1)/forcon(nhpb+1)
1029 if (forcon(nhpb+1).le.0.0d0.or.fordepth(nhpb+1).le.0.0d0)cycle
1031 irestr_type(nhpb)=11
1032 write (iout,'(a,4i5,2f8.2,2f10.5,i5)') "+dist.restr ",
1033 & nhpb,ihpb(nhpb),jhpb(nhpb),ibecarb(nhpb),dhpb(nhpb),
1034 & dhpb1(nhpb),forcon(nhpb),fordepth(nhpb),irestr_type(nhpb)
1035 if (ibecarb(nhpb).gt.0) then
1036 ihpb(nhpb)=ihpb(nhpb)+nres
1037 jhpb(nhpb)=jhpb(nhpb)+nres
1039 else if (restr_type.eq.10) then
1040 c Cross-lonk Markov-like potential
1041 call card_concat(controlcard,.true.)
1042 call readi(controlcard,"ILINK",ihpb(nhpb+1),0)
1043 call readi(controlcard,"JLINK",jhpb(nhpb+1),0)
1045 if (index(controlcard,"BETA").gt.0) ibecarb(nhpb+1)=1
1046 if (ihpb(nhpb+1).eq.0 .or. jhpb(nhpb+1).eq.0) cycle
1047 if (index(controlcard,"ZL").gt.0) then
1049 else if (index(controlcard,"ADH").gt.0) then
1051 else if (index(controlcard,"PDH").gt.0) then
1053 else if (index(controlcard,"DSS").gt.0) then
1058 call reada(controlcard,"AXLINK",dhpb(nhpb+1),
1059 & xlink(1,link_type))
1060 call reada(controlcard,"BXLINK",dhpb1(nhpb+1),
1061 & xlink(2,link_type))
1062 call reada(controlcard,"CXLINK",fordepth(nhpb+1),
1063 & xlink(3,link_type))
1064 call reada(controlcard,"SIGMA",forcon(nhpb+1),
1065 & xlink(4,link_type))
1066 call reada(controlcard,"SCORE",xlscore(nhpb+1),1.0d0)
1067 c read (inp,*) ihpb(nhpb+1),jhpb(nhpb+1),ibecarb(nhpb+1),
1068 c & dhpb(nhpb+1),dhpb1(nhpb+1),forcon(nhpb+1),fordepth(nhpb+1)
1069 if (forcon(nhpb+1).le.0.0d0 .or.
1070 & (dhpb(nhpb+1).eq.0 .and. dhpb1(nhpb+1).eq.0)) cycle
1072 irestr_type(nhpb)=10
1073 if (ibecarb(nhpb).gt.0) then
1074 ihpb(nhpb)=ihpb(nhpb)+nres
1075 jhpb(nhpb)=jhpb(nhpb)+nres
1077 write (iout,'(a,4i5,2f8.2,3f10.5,i5)') "+dist.restr ",
1078 & nhpb,ihpb(nhpb),jhpb(nhpb),ibecarb(nhpb),dhpb(nhpb),
1079 & dhpb1(nhpb),forcon(nhpb),fordepth(nhpb),xlscore(nhpb),
1083 read (inp,*) ihpb(nhpb+1),jhpb(nhpb+1),dhpb(nhpb+1),
1084 & dhpb1(nhpb+1),ibecarb(nhpb+1),forcon(nhpb+1)
1085 if (forcon(nhpb+1).gt.0.0d0) then
1087 if (dhpb1(nhpb).eq.0.0d0) then
1092 if (ibecarb(nhpb).gt.0) then
1093 ihpb(nhpb)=ihpb(nhpb)+nres
1094 jhpb(nhpb)=jhpb(nhpb)+nres
1096 if (dhpb(nhpb).eq.0.0d0)
1097 & dhpb(nhpb)=dist(ihpb(nhpb),jhpb(nhpb))
1099 write (iout,'(a,4i5,f8.2,f10.1)') "+dist.restr ",
1100 & nhpb,ihpb(nhpb),jhpb(nhpb),ibecarb(i),dhpb(nhpb),forcon(nhpb)
1102 C read (inp,*) ihpb(nhpb+1),jhpb(nhpb+1),forcon(nhpb+1)
1103 C if (forcon(nhpb+1).gt.0.0d0) then
1105 C dhpb(nhpb)=dist(ihpb(nhpb),jhpb(nhpb))
1113 if (irestr_type(i).eq.11.and.fordepth(i).gt.fordepthmax)
1114 & fordepthmax=fordepth(i)
1117 if (irestr_type(i).eq.11) fordepth(i)=fordepth(i)/fordepthmax
1120 if (nhpb.gt.nss) then
1121 write (iout,'(/a,i5,a/4a5,2a8,3a10,a5)')
1122 & "The following",nhpb-nss,
1123 & " distance restraints have been imposed:",
1124 & " Nr"," res1"," res2"," beta"," d1"," d2"," k"," V",
1127 write (iout,'(4i5,2f8.2,3f10.5,i5)')i-nss,ihpb(i),jhpb(i),
1128 & ibecarb(i),dhpb(i),dhpb1(i),forcon(i),fordepth(i),xlscore(i),
1136 11 write (iout,*)"read_dist_restr: error reading reference structure"