2 implicit real*8 (a-h,o-z)
8 include 'COMMON.CONTROL'
9 include 'COMMON.SBRIDGE'
10 include 'COMMON.IOUNITS'
12 C Read force-field parameters except weights
14 C Read job setup parameters
16 C Read control parameters for energy minimzation if required
17 if (minim) call read_minim
18 C Read MCM control parameters if required
19 c if (modecalc.eq.3 .or. modecalc.eq.6) call mcmread
20 C Read MD control parameters if reqjuired
21 c if (modecalc.eq.12) call read_MDpar
22 C Read MREMD control parameters if required
23 c if (modecalc.eq.14) then
27 C Read MUCA control parameters if required
28 c if (lmuca) call read_muca
29 C Read CSA control parameters if required (from fort.40 if exists
30 C otherwise from general input file)
31 c if (modecalc.eq.8) then
32 c inquire (file="fort.40",exist=file_exist)
33 c if (.not.file_exist) call csaread
35 cfmc if (modecalc.eq.10) call mcmfread
36 C Read molecule information, molecule geometry, energy-term weights, and
37 C restraints if requested
39 C Print restraint information
41 if (.not. out1file .or. me.eq.king) then
44 &write (iout,'(a,i5,a)') "The following",nhpb-nss,
45 & " distance constraints have been imposed"
47 write (iout,'(3i6,f10.5)') i-nss,ihpb(i),jhpb(i),forcon(i)
52 c print *,"Processor",myrank," leaves READRTNS"
55 C-------------------------------------------------------------------------------
56 subroutine read_control
60 implicit real*8 (a-h,o-z)
64 logical OKRandom, prng_restart
67 include 'COMMON.IOUNITS'
68 include 'COMMON.TIME1'
69 include 'COMMON.SBRIDGE'
70 include 'COMMON.CONTROL'
72 include 'COMMON.HEADER'
73 include 'COMMON.CHAIN'
74 include 'COMMON.FFIELD'
75 include 'COMMON.SETUP'
76 COMMON /MACHSW/ KDIAG,ICORFL,IXDR
77 character*8 diagmeth(0:3) /'Library','EVVRSP','Givens','Jacobi'/
79 character*320 controlcard
84 read (INP,'(a)') titel
85 call card_concat(controlcard)
86 c out1file=index(controlcard,'OUT1FILE').gt.0 .or. fg_rank.gt.0
87 c print *,"Processor",me," fg_rank",fg_rank," out1file",out1file
88 call reada(controlcard,'SEED',seed,0.0D0)
89 call random_init(seed)
90 C Set up the time limit (caution! The time must be input in minutes!)
91 read_cart=index(controlcard,'READ_CART').gt.0
92 call readi(controlcard,'CONSTR_DIST',constr_dist,0)
93 call reada(controlcard,'TIMLIM',timlim,960.0D0) ! default 16 hours
94 unres_pdb = index(controlcard,'UNRES_PDB') .gt. 0
95 call reada(controlcard,'SAFETY',safety,30.0D0) ! default 30 minutes
96 call reada(controlcard,'RMSDBC',rmsdbc,3.0D0)
97 call reada(controlcard,'RMSDBC1',rmsdbc1,0.5D0)
98 call reada(controlcard,'RMSDBC1MAX',rmsdbc1max,1.5D0)
99 call reada(controlcard,'RMSDBCM',rmsdbcm,3.0D0)
100 call reada(controlcard,'DRMS',drms,0.1D0)
101 if(me.eq.king .or. .not. out1file .and. fg_rank.eq.0) then
102 write (iout,'(a,f10.1)')'RMSDBC = ',rmsdbc
103 write (iout,'(a,f10.1)')'RMSDBC1 = ',rmsdbc1
104 write (iout,'(a,f10.1)')'RMSDBC1MAX = ',rmsdbc1max
105 write (iout,'(a,f10.1)')'DRMS = ',drms
106 write (iout,'(a,f10.1)')'RMSDBCM = ',rmsdbcm
107 write (iout,'(a,f10.1)') 'Time limit (min):',timlim
109 call readi(controlcard,'NZ_START',nz_start,0)
110 call readi(controlcard,'NZ_END',nz_end,0)
111 call readi(controlcard,'IZ_SC',iz_sc,0)
113 safety = 60.0d0*safety
116 call reada(controlcard,"T_BATH",t_bath,300.0d0)
117 minim=(index(controlcard,'MINIMIZE').gt.0)
118 dccart=(index(controlcard,'CART').gt.0)
119 overlapsc=(index(controlcard,'OVERLAP').gt.0)
120 overlapsc=.not.overlapsc
121 searchsc=(index(controlcard,'SEARCHSC').gt.0)
122 sideadd=(index(controlcard,'SIDEADD').gt.0)
123 energy_dec=(index(controlcard,'ENERGY_DEC').gt.0)
124 outpdb=(index(controlcard,'PDBOUT').gt.0)
125 outmol2=(index(controlcard,'MOL2OUT').gt.0)
126 pdbref=(index(controlcard,'PDBREF').gt.0)
127 refstr=pdbref .or. (index(controlcard,'REFSTR').gt.0)
128 indpdb=index(controlcard,'PDBSTART')
129 extconf=(index(controlcard,'EXTCONF').gt.0)
130 call readi(controlcard,'IPRINT',iprint,0)
131 call readi(controlcard,'MAXGEN',maxgen,10000)
132 call readi(controlcard,'MAXOVERLAP',maxoverlap,1000)
133 call readi(controlcard,"KDIAG",kdiag,0)
134 call readi(controlcard,"RESCALE_MODE",rescale_mode,0)
135 if(me.eq.king .or. .not. out1file .and. fg_rank.eq.0)
136 & write (iout,*) "RESCALE_MODE",rescale_mode
137 split_ene=index(controlcard,'SPLIT_ENE').gt.0
138 if (index(controlcard,'REGULAR').gt.0.0D0) then
139 call reada(controlcard,'WEIDIS',weidis,0.1D0)
143 if (index(controlcard,'CHECKGRAD').gt.0) then
145 if (index(controlcard,'CART').gt.0) then
147 elseif (index(controlcard,'CARINT').gt.0) then
152 elseif (index(controlcard,'THREAD').gt.0) then
154 call readi(controlcard,'THREAD',nthread,0)
155 if (nthread.gt.0) then
156 call reada(controlcard,'WEIDIS',weidis,0.1D0)
159 & write (iout,'(a)')'A number has to follow the THREAD keyword.'
160 stop 'Error termination in Read_Control.'
162 else if (index(controlcard,'MCMA').gt.0) then
164 else if (index(controlcard,'MCEE').gt.0) then
166 else if (index(controlcard,'MULTCONF').gt.0) then
168 else if (index(controlcard,'MAP').gt.0) then
170 call readi(controlcard,'MAP',nmap,0)
171 else if (index(controlcard,'CSA').gt.0) then
173 crc else if (index(controlcard,'ZSCORE').gt.0) then
175 crc ZSCORE is rm from UNRES, modecalc=9 is available
178 cfcm else if (index(controlcard,'MCMF').gt.0) then
180 else if (index(controlcard,'SOFTREG').gt.0) then
182 else if (index(controlcard,'CHECK_BOND').gt.0) then
184 else if (index(controlcard,'TEST').gt.0) then
186 else if (index(controlcard,'MD').gt.0) then
188 else if (index(controlcard,'RE ').gt.0) then
192 lmuca=index(controlcard,'MUCA').gt.0
193 call readi(controlcard,'MUCADYN',mucadyn,0)
194 call readi(controlcard,'MUCASMOOTH',muca_smooth,0)
195 if (lmuca .and. (me.eq.king .or. .not.out1file ))
197 write (iout,*) 'MUCADYN=',mucadyn
198 write (iout,*) 'MUCASMOOTH=',muca_smooth
201 iscode=index(controlcard,'ONE_LETTER')
202 indphi=index(controlcard,'PHI')
203 indback=index(controlcard,'BACK')
204 iranconf=index(controlcard,'RAND_CONF')
205 i2ndstr=index(controlcard,'USE_SEC_PRED')
206 gradout=index(controlcard,'GRADOUT').gt.0
207 gnorm_check=index(controlcard,'GNORM_CHECK').gt.0
209 if(me.eq.king.or..not.out1file)
210 & write (iout,'(2a)') diagmeth(kdiag),
211 & ' routine used to diagonalize matrices.'
214 c------------------------------------------------------------------------------
217 C Read molecular data.
219 implicit real*8 (a-h,o-z)
225 include 'COMMON.IOUNITS'
228 include 'COMMON.INTERACT'
229 include 'COMMON.LOCAL'
230 include 'COMMON.NAMES'
231 include 'COMMON.CHAIN'
232 include 'COMMON.FFIELD'
233 include 'COMMON.SBRIDGE'
234 include 'COMMON.HEADER'
235 include 'COMMON.CONTROL'
236 c include 'COMMON.DBASE'
237 c include 'COMMON.THREAD'
238 include 'COMMON.CONTACTS'
239 include 'COMMON.TORCNSTR'
240 include 'COMMON.TIME1'
241 include 'COMMON.BOUNDS'
242 c include 'COMMON.MD'
243 c include 'COMMON.REMD'
244 include 'COMMON.SETUP'
245 character*4 sequence(maxres)
247 double precision x(maxvar)
248 character*256 pdbfile
249 character*320 weightcard
250 character*80 weightcard_t,ucase
251 dimension itype_pdb(maxres)
252 common /pizda/ itype_pdb
253 logical seq_comp,fail
254 double precision energia(0:n_ene)
260 C Read weights of the subsequent energy terms.
262 call card_concat(weightcard)
263 call reada(weightcard,'WLONG',wlong,1.0D0)
264 call reada(weightcard,'WSC',wsc,wlong)
265 call reada(weightcard,'WSCP',wscp,wlong)
266 call reada(weightcard,'WELEC',welec,1.0D0)
267 call reada(weightcard,'WVDWPP',wvdwpp,welec)
268 call reada(weightcard,'WEL_LOC',wel_loc,1.0D0)
269 call reada(weightcard,'WCORR4',wcorr4,0.0D0)
270 call reada(weightcard,'WCORR5',wcorr5,0.0D0)
271 call reada(weightcard,'WCORR6',wcorr6,0.0D0)
272 call reada(weightcard,'WTURN3',wturn3,1.0D0)
273 call reada(weightcard,'WTURN4',wturn4,1.0D0)
274 call reada(weightcard,'WTURN6',wturn6,1.0D0)
275 call reada(weightcard,'WSCCOR',wsccor,1.0D0)
276 call reada(weightcard,'WSTRAIN',wstrain,1.0D0)
277 call reada(weightcard,'WBOND',wbond,1.0D0)
278 call reada(weightcard,'WTOR',wtor,1.0D0)
279 call reada(weightcard,'WTORD',wtor_d,1.0D0)
280 call reada(weightcard,'WANG',wang,1.0D0)
281 call reada(weightcard,'WSCLOC',wscloc,1.0D0)
282 call reada(weightcard,'SCAL14',scal14,0.4D0)
283 call reada(weightcard,'SCALSCP',scalscp,1.0d0)
284 call reada(weightcard,'CUTOFF',cutoff_corr,7.0d0)
285 call reada(weightcard,'DELT_CORR',delt_corr,0.5d0)
286 call reada(weightcard,'TEMP0',temp0,300.0d0)
287 if (index(weightcard,'SOFT').gt.0) ipot=6
288 C 12/1/95 Added weight for the multi-body term WCORR
289 call reada(weightcard,'WCORRH',wcorr,1.0D0)
290 if (wcorr4.gt.0.0d0) wcorr=wcorr4
311 if(me.eq.king.or..not.out1file)
312 & write (iout,10) wsc,wscp,welec,wvdwpp,wbond,wang,wscloc,wtor,
313 & wtor_d,wstrain,wel_loc,wcorr,wcorr5,wcorr6,wsccor,wturn3,
315 10 format (/'Energy-term weights (unscaled):'//
316 & 'WSCC= ',f10.6,' (SC-SC)'/
317 & 'WSCP= ',f10.6,' (SC-p)'/
318 & 'WELEC= ',f10.6,' (p-p electr)'/
319 & 'WVDWPP= ',f10.6,' (p-p VDW)'/
320 & 'WBOND= ',f10.6,' (stretching)'/
321 & 'WANG= ',f10.6,' (bending)'/
322 & 'WSCLOC= ',f10.6,' (SC local)'/
323 & 'WTOR= ',f10.6,' (torsional)'/
324 & 'WTORD= ',f10.6,' (double torsional)'/
325 & 'WSTRAIN=',f10.6,' (SS bridges & dist. cnstr.)'/
326 & 'WEL_LOC=',f10.6,' (multi-body 3-rd order)'/
327 & 'WCORR4= ',f10.6,' (multi-body 4th order)'/
328 & 'WCORR5= ',f10.6,' (multi-body 5th order)'/
329 & 'WCORR6= ',f10.6,' (multi-body 6th order)'/
330 & 'WSCCOR= ',f10.6,' (back-scloc correlation)'/
331 & 'WTURN3= ',f10.6,' (turns, 3rd order)'/
332 & 'WTURN4= ',f10.6,' (turns, 4th order)'/
333 & 'WTURN6= ',f10.6,' (turns, 6th order)')
334 if(me.eq.king.or..not.out1file)then
335 if (wcorr4.gt.0.0d0) then
336 write (iout,'(/2a/)') 'Local-electrostatic type correlation ',
337 & 'between contact pairs of peptide groups'
338 write (iout,'(2(a,f5.3/))')
339 & 'Cutoff on 4-6th order correlation terms: ',cutoff_corr,
340 & 'Range of quenching the correlation terms:',2*delt_corr
341 else if (wcorr.gt.0.0d0) then
342 write (iout,'(/2a/)') 'Hydrogen-bonding correlation ',
343 & 'between contact pairs of peptide groups'
345 write (iout,'(a,f8.3)')
346 & 'Scaling factor of 1,4 SC-p interactions:',scal14
347 write (iout,'(a,f8.3)')
348 & 'General scaling factor of SC-p interactions:',scalscp
350 r0_corr=cutoff_corr-delt_corr
352 aad(i,1)=scalscp*aad(i,1)
353 aad(i,2)=scalscp*aad(i,2)
354 bad(i,1)=scalscp*bad(i,1)
355 bad(i,2)=scalscp*bad(i,2)
357 c call rescale_weights(t_bath)
358 if(me.eq.king.or..not.out1file)
359 & write (iout,22) wsc,wscp,welec,wvdwpp,wbond,wang,wscloc,wtor,
360 & wtor_d,wstrain,wel_loc,wcorr,wcorr5,wcorr6,wsccor,wturn3,
362 22 format (/'Energy-term weights (scaled):'//
363 & 'WSCC= ',f10.6,' (SC-SC)'/
364 & 'WSCP= ',f10.6,' (SC-p)'/
365 & 'WELEC= ',f10.6,' (p-p electr)'/
366 & 'WVDWPP= ',f10.6,' (p-p VDW)'/
367 & 'WBOND= ',f10.6,' (stretching)'/
368 & 'WANG= ',f10.6,' (bending)'/
369 & 'WSCLOC= ',f10.6,' (SC local)'/
370 & 'WTOR= ',f10.6,' (torsional)'/
371 & 'WTORD= ',f10.6,' (double torsional)'/
372 & 'WSTRAIN=',f10.6,' (SS bridges & dist. cnstr.)'/
373 & 'WEL_LOC=',f10.6,' (multi-body 3-rd order)'/
374 & 'WCORR4= ',f10.6,' (multi-body 4th order)'/
375 & 'WCORR5= ',f10.6,' (multi-body 5th order)'/
376 & 'WCORR6= ',f10.6,' (multi-body 6th order)'/
377 & 'WSCCOR= ',f10.6,' (back-scloc correlatkion)'/
378 & 'WTURN3= ',f10.6,' (turns, 3rd order)'/
379 & 'WTURN4= ',f10.6,' (turns, 4th order)'/
380 & 'WTURN6= ',f10.6,' (turns, 6th order)')
381 if(me.eq.king.or..not.out1file)
382 & write (iout,*) "Reference temperature for weights calculation:",
384 call reada(weightcard,"D0CM",d0cm,3.78d0)
385 call reada(weightcard,"AKCM",akcm,15.1d0)
386 call reada(weightcard,"AKTH",akth,11.0d0)
387 call reada(weightcard,"AKCT",akct,12.0d0)
388 call reada(weightcard,"V1SS",v1ss,-1.08d0)
389 call reada(weightcard,"V2SS",v2ss,7.61d0)
390 call reada(weightcard,"V3SS",v3ss,13.7d0)
391 call reada(weightcard,"EBR",ebr,-5.50D0)
392 if(me.eq.king.or..not.out1file) then
393 write (iout,*) "Parameters of the SS-bond potential:"
394 write (iout,*) "D0CM",d0cm," AKCM",akcm," AKTH",akth,
396 write (iout,*) "V1SS",v1ss," V2SS",v2ss," V3SS",v3ss
397 write (iout,*) "EBR",ebr
398 print *,'indpdb=',indpdb,' pdbref=',pdbref
400 if (indpdb.gt.0 .or. pdbref) then
401 read(inp,'(a)') pdbfile
402 if(me.eq.king.or..not.out1file)
403 & write (iout,'(2a)') 'PDB data will be read from file ',
404 & pdbfile(:ilen(pdbfile))
405 open(ipdbin,file=pdbfile,status='old',err=33)
407 33 write (iout,'(a)') 'Error opening PDB file.'
410 c print *,'Begin reading pdb data'
412 c print *,'Finished reading pdb data'
413 if(me.eq.king.or..not.out1file)
414 & write (iout,'(a,i3,a,i3)')'nsup=',nsup,
415 & ' nstart_sup=',nstart_sup
417 itype_pdb(i)=itype(i)
421 nct=nstart_sup+nsup-1
422 c call contact(.false.,ncont_ref,icont_ref,co)
425 C Following 2 lines for diagnostics; comment out if not needed
426 write (iout,*) "Before sideadd"
428 if(me.eq.king.or..not.out1file)
429 & write(iout,*)'Adding sidechains'
436 do while (fail.and.nsi.le.maxsi)
437 call gen_side(iti,theta(i+1),alph(i),omeg(i),fail)
440 if(fail) write(iout,*)'Adding sidechain failed for res ',
441 & i,' after ',nsi,' trials'
444 C 9/29/12 Adam: Recalculate coordinates with new side chain positions
447 C Following 2 lines for diagnostics; comment out if not needed
448 write (iout,*) "After sideadd"
451 if (indpdb.eq.0) then
452 C Read sequence if not taken from the pdb file.
454 c print *,'nres=',nres
455 if (iscode.gt.0) then
456 read (inp,'(80a1)') (sequence(i)(1:1),i=1,nres)
458 read (inp,'(20(1x,a3))') (sequence(i),i=1,nres)
460 C Convert sequence to numeric code
462 itype(i)=rescode(i,sequence(i),iscode)
464 C Assign initial virtual bond lengths
470 vbld(i+nres)=dsc(itype(i))
471 vbld_inv(i+nres)=dsc_inv(itype(i))
472 c write (iout,*) "i",i," itype",itype(i),
473 c & " dsc",dsc(itype(i))," vbld",vbld(i),vbld(i+nres)
477 c print '(20i4)',(itype(i),i=1,nres)
480 if (itype(i).eq.21 .or. itype(i+1).eq.21) then
482 if (itype(i).eq.21) then
486 else if (itype(i+1).ne.20) then
488 else if (itype(i).ne.20) then
495 if(me.eq.king.or..not.out1file)then
496 write (iout,*) "ITEL"
498 write (iout,*) i,itype(i),itel(i)
500 print *,'Call Read_Bridge.'
503 C 8/13/98 Set limits to generating the dihedral angles
508 read (inp,*) ndih_constr
509 if (ndih_constr.gt.0) then
511 read (inp,*) (idih_constr(i),phi0(i),drange(i),i=1,ndih_constr)
512 if(me.eq.king.or..not.out1file)then
514 & 'There are',ndih_constr,' constraints on phi angles.'
516 write (iout,'(i5,2f8.3)') idih_constr(i),phi0(i),drange(i)
520 phi0(i)=deg2rad*phi0(i)
521 drange(i)=deg2rad*drange(i)
523 if(me.eq.king.or..not.out1file)
524 & write (iout,*) 'FTORS',ftors
527 phibound(1,ii) = phi0(i)-drange(i)
528 phibound(2,ii) = phi0(i)+drange(i)
535 write (iout,'(a)') 'Boundaries in phi angle sampling:'
537 write (iout,'(a3,i5,2f10.1)')
538 & restyp(itype(i)),i,phibound(1,i)*rad2deg,phibound(2,i)*rad2deg
544 cd print *,'NNT=',NNT,' NCT=',NCT
545 if (itype(1).eq.21) nnt=2
546 if (itype(nres).eq.21) nct=nct-1
548 if(me.eq.king.or..not.out1file)
549 & write (iout,'(a,i3)') 'nsup=',nsup
551 if (nsup.le.(nct-nnt+1)) then
552 do i=0,nct-nnt+1-nsup
553 if (seq_comp(itype(nnt+i),itype_pdb(nstart_sup),nsup)) then
559 & 'Error - sequences to be superposed do not match.'
562 do i=0,nsup-(nct-nnt+1)
563 if (seq_comp(itype(nnt),itype_pdb(nstart_sup+i),nct-nnt+1))
565 nstart_sup=nstart_sup+i
571 & 'Error - sequences to be superposed do not match.'
574 if (nsup.eq.0) nsup=nct-nnt
575 if (nstart_sup.eq.0) nstart_sup=nnt
576 if (nstart_seq.eq.0) nstart_seq=nnt
577 if(me.eq.king.or..not.out1file)
578 & write (iout,*) 'nsup=',nsup,' nstart_sup=',nstart_sup,
579 & ' nstart_seq=',nstart_seq
581 c--- Zscore rms -------
582 if (nz_start.eq.0) nz_start=nnt
583 if (nz_end.eq.0 .and. nsup.gt.0) then
585 else if (nz_end.eq.0) then
588 if(me.eq.king.or..not.out1file)then
589 write (iout,*) 'NZ_START=',nz_start,' NZ_END=',nz_end
590 write (iout,*) 'IZ_SC=',iz_sc
592 c----------------------
595 if (.not.pdbref) then
596 call read_angles(inp,*38)
598 38 write (iout,'(a)') 'Error reading reference structure.'
600 call MPI_Finalize(MPI_COMM_WORLD,IERROR)
601 stop 'Error reading reference structure'
605 czscore call geom_to_var(nvar,coord_exp_zs(1,1))
614 c call contact(.true.,ncont_ref,icont_ref,co)
616 c write (iout,*) "constr_dist",constr_dist,nstart_sup,nsup
618 if (constr_dist.gt.0) call read_dist_constr
619 c write (iout,*) "After read_dist_constr nhpb",nhpb
621 if(me.eq.king.or..not.out1file)
622 & write (iout,*) 'Contact order:',co
624 if(me.eq.king.or..not.out1file)
625 & write (2,*) 'Shifting contacts:',nstart_seq,nstart_sup
628 icont_ref(j,i)=icont_ref(j,i)+nstart_seq-nstart_sup
630 if(me.eq.king.or..not.out1file)
631 & write (2,*) i,' ',restyp(itype(icont_ref(1,i))),' ',
632 & icont_ref(1,i),' ',
633 & restyp(itype(icont_ref(2,i))),' ',icont_ref(2,i)
637 if (indpdb.eq.0 .and. modecalc.ne.2 .and. modecalc.ne.4
638 & .and. modecalc.ne.8 .and. modecalc.ne.9 .and.
639 & modecalc.ne.10) then
640 C If input structure hasn't been supplied from the PDB file read or generate
642 if (iranconf.eq.0 .and. .not. extconf) then
643 if(me.eq.king.or..not.out1file .and.fg_rank.eq.0)
644 & write (iout,'(a)') 'Initial geometry will be read in.'
646 read(inp,'(8f10.5)',end=36,err=36)
647 & ((c(l,k),l=1,3),k=1,nres),
648 & ((c(l,k+nres),l=1,3),k=nnt,nct)
649 call int_from_cart1(.false.)
652 dc(j,i)=c(j,i+1)-c(j,i)
653 dc_norm(j,i)=dc_norm(j,i)*vbld_inv(i+1)
657 if (itype(i).ne.10) then
659 dc(j,i+nres)=c(j,i+nres)-c(j,i)
660 dc_norm(j,i+nres)=dc_norm(j,i+nres)*vbld_inv(i+nres)
666 call read_angles(inp,*36)
669 36 write (iout,'(a)') 'Error reading angle file.'
671 call mpi_finalize( MPI_COMM_WORLD,IERR )
673 stop 'Error reading angle file.'
675 else if (extconf) then
676 if(me.eq.king.or..not.out1file .and. fg_rank.eq.0)
677 & write (iout,'(a)') 'Extended chain initial geometry.'
679 theta(i)=90d0*deg2rad
685 alph(i)=110d0*deg2rad
688 omeg(i)=-120d0*deg2rad
691 if(me.eq.king.or..not.out1file)
692 & write (iout,'(a)') 'Random-generated initial geometry.'
696 if (me.eq.king .or. fg_rank.eq.0 .and. (
697 & modecalc.eq.12 .or. modecalc.eq.14) ) then
701 call gen_rand_conf(itmp,*30)
703 30 write (iout,*) 'Failed to generate random conformation',
705 write (*,*) 'Processor:',me,
706 & ' Failed to generate random conformation',
716 write (iout,'(a,i3,a)') 'Processor:',me,
717 & ' error in generating random conformation.'
718 write (*,'(a,i3,a)') 'Processor:',me,
719 & ' error in generating random conformation.'
722 call MPI_Abort(mpi_comm_world,error_msg,ierrcode)
728 call gen_rand_conf(itmp,*31)
730 31 write (iout,*) 'Failed to generate random conformation',
732 write (*,*) 'Failed to generate random conformation',
735 write (iout,'(a,i3,a)') 'Processor:',me,
736 & ' error in generating random conformation.'
737 write (*,'(a,i3,a)') 'Processor:',me,
738 & ' error in generating random conformation.'
743 elseif (modecalc.eq.4) then
744 read (inp,'(a)') intinname
745 open (intin,file=intinname,status='old',err=333)
746 if (me.eq.king .or. .not.out1file.and.fg_rank.eq.0)
747 & write (iout,'(a)') 'intinname',intinname
748 write (*,'(a)') 'Processor',myrank,' intinname',intinname
750 333 write (iout,'(2a)') 'Error opening angle file ',intinname
752 call MPI_Finalize(MPI_COMM_WORLD,IERR)
754 stop 'Error opening angle file.'
758 C Generate distance constraints, if the PDB structure is to be regularized.
759 c if (nthread.gt.0) then
760 c call read_threadbase
763 if (me.eq.king .or. .not. out1file)
765 if (ns.gt.0 .and. (me.eq.king .or. .not.out1file) ) then
766 write (iout,'(/a,i3,a)')
767 & 'The chain contains',ns,' disulfide-bridging cysteines.'
768 write (iout,'(20i4)') (iss(i),i=1,ns)
769 write (iout,'(/a/)') 'Pre-formed links are:'
775 if (me.eq.king.or..not.out1file)
776 & write (iout,'(2a,i3,3a,i3,a,3f10.3)')
777 & restyp(it1),'(',i1,') -- ',restyp(it2),'(',i2,')',dhpb(i),
782 c if (i2ndstr.gt.0) call secstrp2dihc
783 c call geom_to_var(nvar,x)
784 c call etotal(energia(0))
785 c call enerprint(energia(0))
786 c call briefout(0,etot)
788 cd write (iout,'(2(a,i3))') 'NNT',NNT,' NCT',NCT
789 cd write (iout,'(a)') 'Variable list:'
790 cd write (iout,'(i4,f10.5)') (i,rad2deg*x(i),i=1,nvar)
792 if (me.eq.king .or. (fg_rank.eq.0 .and. .not.out1file))
793 & write (iout,'(//80(1h*)/20x,a,i4,a/80(1h*)//)')
794 & 'Processor',myrank,': end reading molecular data.'
798 c--------------------------------------------------------------------------
799 logical function seq_comp(itypea,itypeb,length)
801 integer length,itypea(length),itypeb(length)
804 if (itypea(i).ne.itypeb(i)) then
812 c-----------------------------------------------------------------------------
813 subroutine read_bridge
814 C Read information about disulfide bridges.
815 implicit real*8 (a-h,o-z)
820 include 'COMMON.IOUNITS'
823 include 'COMMON.INTERACT'
824 include 'COMMON.LOCAL'
825 include 'COMMON.NAMES'
826 include 'COMMON.CHAIN'
827 include 'COMMON.FFIELD'
828 include 'COMMON.SBRIDGE'
829 include 'COMMON.HEADER'
830 include 'COMMON.CONTROL'
831 c include 'COMMON.DBASE'
832 c include 'COMMON.THREAD'
833 include 'COMMON.TIME1'
834 include 'COMMON.SETUP'
835 C Read bridging residues.
836 read (inp,*) ns,(iss(i),i=1,ns)
838 if(me.eq.king.or..not.out1file)
839 & write (iout,*) 'ns=',ns,' iss:',(iss(i),i=1,ns)
840 C Check whether the specified bridging residues are cystines.
842 if (itype(iss(i)).ne.1) then
843 if (me.eq.king.or..not.out1file) write (iout,'(2a,i3,a)')
844 & 'Do you REALLY think that the residue ',restyp(iss(i)),i,
845 & ' can form a disulfide bridge?!!!'
846 write (*,'(2a,i3,a)')
847 & 'Do you REALLY think that the residue ',restyp(iss(i)),i,
848 & ' can form a disulfide bridge?!!!'
850 call MPI_Finalize(MPI_COMM_WORLD,ierror)
855 C Read preformed bridges.
857 read (inp,*) nss,(ihpb(i),jhpb(i),i=1,nss)
858 write (iout,*) 'nss=',nss,' ihpb,jhpb: ',(ihpb(i),jhpb(i),i=1,nss)
861 C Check if the residues involved in bridges are in the specified list of
865 if (ihpb(i).eq.ihpb(j).or.ihpb(i).eq.jhpb(j)
866 & .or.jhpb(i).eq.ihpb(j).or.jhpb(i).eq.jhpb(j)) then
867 write (iout,'(a,i3,a)') 'Disulfide pair',i,
868 & ' contains residues present in other pairs.'
869 write (*,'(a,i3,a)') 'Disulfide pair',i,
870 & ' contains residues present in other pairs.'
872 call MPI_Finalize(MPI_COMM_WORLD,ierror)
878 if (ihpb(i).eq.iss(j)) goto 10
880 write (iout,'(a,i3,a)') 'Pair',i,' contains unknown cystine.'
883 if (jhpb(i).eq.iss(j)) goto 20
885 write (iout,'(a,i3,a)') 'Pair',i,' contains unknown cystine.'
898 c----------------------------------------------------------------------------
899 subroutine read_x(kanal,*)
900 implicit real*8 (a-h,o-z)
904 include 'COMMON.CHAIN'
905 include 'COMMON.IOUNITS'
906 include 'COMMON.CONTROL'
907 include 'COMMON.LOCAL'
908 include 'COMMON.INTERACT'
909 c Read coordinates from input
911 read(kanal,'(8f10.5)',end=10,err=10)
912 & ((c(l,k),l=1,3),k=1,nres),
913 & ((c(l,k+nres),l=1,3),k=nnt,nct)
916 c(j,2*nres)=c(j,nres)
918 call int_from_cart1(.false.)
921 dc(j,i)=c(j,i+1)-c(j,i)
922 dc_norm(j,i)=dc(j,i)*vbld_inv(i+1)
926 if (itype(i).ne.10) then
928 dc(j,i+nres)=c(j,i+nres)-c(j,i)
929 dc_norm(j,i+nres)=dc(j,i+nres)*vbld_inv(i+nres)
937 c------------------------------------------------------------------------------
939 implicit real*8 (a-h,o-z)
941 include 'COMMON.IOUNITS'
944 include 'COMMON.INTERACT'
945 include 'COMMON.LOCAL'
946 include 'COMMON.NAMES'
947 include 'COMMON.CHAIN'
948 include 'COMMON.FFIELD'
949 include 'COMMON.SBRIDGE'
950 include 'COMMON.HEADER'
951 include 'COMMON.CONTROL'
952 c include 'COMMON.DBASE'
953 c include 'COMMON.THREAD'
954 include 'COMMON.TIME1'
955 C Set up variable list.
961 if (itype(i).ne.10) then
963 ialph(i,1)=nvar+nside
967 if (indphi.gt.0) then
969 else if (indback.gt.0) then
974 cd write (iout,'(3i4)') (i,ialph(i,1),ialph(i,2),i=2,nres-1)
977 c----------------------------------------------------------------------------
978 subroutine gen_dist_constr
979 C Generate CA distance constraints.
980 implicit real*8 (a-h,o-z)
982 include 'COMMON.IOUNITS'
985 include 'COMMON.INTERACT'
986 include 'COMMON.LOCAL'
987 include 'COMMON.NAMES'
988 include 'COMMON.CHAIN'
989 include 'COMMON.FFIELD'
990 include 'COMMON.SBRIDGE'
991 include 'COMMON.HEADER'
992 include 'COMMON.CONTROL'
993 c include 'COMMON.DBASE'
994 c include 'COMMON.THREAD'
995 include 'COMMON.TIME1'
996 dimension itype_pdb(maxres)
997 common /pizda/ itype_pdb
999 cd print *,'gen_dist_constr: nnt=',nnt,' nct=',nct
1000 cd write (2,*) 'gen_dist_constr: nnt=',nnt,' nct=',nct,
1001 cd & ' nstart_sup',nstart_sup,' nstart_seq',nstart_seq,
1003 do i=nstart_sup,nstart_sup+nsup-1
1004 cd write (2,*) 'i',i,' seq ',restyp(itype(i+nstart_seq-nstart_sup)),
1005 cd & ' seq_pdb', restyp(itype_pdb(i))
1006 do j=i+2,nstart_sup+nsup-1
1008 ihpb(nhpb)=i+nstart_seq-nstart_sup
1009 jhpb(nhpb)=j+nstart_seq-nstart_sup
1011 dhpb(nhpb)=dist(i,j)
1014 cd write (iout,'(a)') 'Distance constraints:'
1019 cd if (ii.gt.nres) then
1024 cd write (iout,'(a,1x,a,i4,3x,a,1x,a,i4,2f10.3)')
1025 cd & restyp(itype(ii)),iden,ii,restyp(itype(jj)),iden,jj,
1026 cd & dhpb(i),forcon(i)
1031 subroutine read_minim
1032 implicit real*8 (a-h,o-z)
1033 include 'DIMENSIONS'
1034 include 'COMMON.MINIM'
1035 include 'COMMON.IOUNITS'
1037 character*320 minimcard
1038 call card_concat(minimcard)
1039 call readi(minimcard,'MAXMIN',maxmin,2000)
1040 call readi(minimcard,'MAXFUN',maxfun,5000)
1041 call readi(minimcard,'MINMIN',minmin,maxmin)
1042 call readi(minimcard,'MINFUN',minfun,maxmin)
1043 call reada(minimcard,'TOLF',tolf,1.0D-2)
1044 call reada(minimcard,'RTOLF',rtolf,1.0D-4)
1045 print_min_stat=min0(index(minimcard,'PRINT_MIN_STAT'),1)
1046 print_min_res=min0(index(minimcard,'PRINT_MIN_RES'),1)
1047 print_min_ini=min0(index(minimcard,'PRINT_MIN_INI'),1)
1048 write (iout,'(/80(1h*)/20x,a/80(1h*))')
1049 & 'Options in energy minimization:'
1050 write (iout,'(4(a,i5),a,1pe14.5,a,1pe14.5)')
1051 & 'MaxMin:',MaxMin,' MaxFun:',MaxFun,
1052 & 'MinMin:',MinMin,' MinFun:',MinFun,
1053 & ' TolF:',TolF,' RTolF:',RTolF
1056 c----------------------------------------------------------------------------
1057 subroutine read_angles(kanal,*)
1058 implicit real*8 (a-h,o-z)
1059 include 'DIMENSIONS'
1060 include 'COMMON.GEO'
1061 include 'COMMON.VAR'
1062 include 'COMMON.CHAIN'
1063 include 'COMMON.IOUNITS'
1064 include 'COMMON.CONTROL'
1065 c Read angles from input
1067 read (kanal,*,err=10,end=10) (theta(i),i=3,nres)
1068 read (kanal,*,err=10,end=10) (phi(i),i=4,nres)
1069 read (kanal,*,err=10,end=10) (alph(i),i=2,nres-1)
1070 read (kanal,*,err=10,end=10) (omeg(i),i=2,nres-1)
1073 c 9/7/01 avoid 180 deg valence angle
1074 if (theta(i).gt.179.99d0) theta(i)=179.99d0
1076 theta(i)=deg2rad*theta(i)
1077 phi(i)=deg2rad*phi(i)
1078 alph(i)=deg2rad*alph(i)
1079 omeg(i)=deg2rad*omeg(i)
1084 c----------------------------------------------------------------------------
1085 subroutine reada(rekord,lancuch,wartosc,default)
1087 character*(*) rekord,lancuch
1088 double precision wartosc,default
1091 iread=index(rekord,lancuch)
1092 if (iread.eq.0) then
1096 iread=iread+ilen(lancuch)+1
1097 read (rekord(iread:),*,err=10,end=10) wartosc
1102 c----------------------------------------------------------------------------
1103 subroutine readi(rekord,lancuch,wartosc,default)
1105 character*(*) rekord,lancuch
1106 integer wartosc,default
1109 iread=index(rekord,lancuch)
1110 if (iread.eq.0) then
1114 iread=iread+ilen(lancuch)+1
1115 read (rekord(iread:),*,err=10,end=10) wartosc
1120 c----------------------------------------------------------------------------
1121 subroutine multreadi(rekord,lancuch,tablica,dim,default)
1124 integer tablica(dim),default
1125 character*(*) rekord,lancuch
1132 iread=index(rekord,lancuch(:ilen(lancuch))//"=")
1133 if (iread.eq.0) return
1134 iread=iread+ilen(lancuch)+1
1135 read (rekord(iread:),*,end=10,err=10) (tablica(i),i=1,dim)
1138 c----------------------------------------------------------------------------
1139 subroutine multreada(rekord,lancuch,tablica,dim,default)
1142 double precision tablica(dim),default
1143 character*(*) rekord,lancuch
1150 iread=index(rekord,lancuch(:ilen(lancuch))//"=")
1151 if (iread.eq.0) return
1152 iread=iread+ilen(lancuch)+1
1153 read (rekord(iread:),*,end=10,err=10) (tablica(i),i=1,dim)
1156 c----------------------------------------------------------------------------
1157 subroutine openunits
1158 implicit real*8 (a-h,o-z)
1159 include 'DIMENSIONS'
1162 character*16 form,nodename
1165 include 'COMMON.SETUP'
1166 include 'COMMON.IOUNITS'
1167 c include 'COMMON.MD'
1168 include 'COMMON.CONTROL'
1169 integer lenpre,lenpot,ilen,lentmp
1171 character*3 out1file_text,ucase
1174 c print *,"Processor",myrank,"fg_rank",fg_rank," entered openunits"
1175 call getenv_loc("PREFIX",prefix)
1177 call getenv_loc("POT",pot)
1178 call getenv_loc("DIRTMP",tmpdir)
1179 call getenv_loc("CURDIR",curdir)
1180 call getenv_loc("OUT1FILE",out1file_text)
1181 c print *,"Processor",myrank,"fg_rank",fg_rank," did GETENV"
1182 out1file_text=ucase(out1file_text)
1183 if (out1file_text(1:1).eq."Y") then
1186 out1file=fg_rank.gt.0
1191 if (lentmp.gt.0) then
1192 write (*,'(80(1h!))')
1193 write (*,'(a,19x,a,19x,a)') "!"," A T T E N T I O N ","!"
1194 write (*,'(80(1h!))')
1195 write (*,*)"All output files will be on node /tmp directory."
1197 call MPI_GET_PROCESSOR_NAME( nodename, nodelen, IERROR )
1198 if (me.eq.king) then
1199 write (*,*) "The master node is ",nodename
1200 else if (fg_rank.eq.0) then
1201 write (*,*) "I am the CG slave node ",nodename
1203 write (*,*) "I am the FG slave node ",nodename
1206 PREFIX = tmpdir(:lentmp)//'/'//prefix(:lenpre)
1207 lenpre = lentmp+lenpre+1
1209 entname=prefix(:lenpre)//'_'//pot(:lenpot)//'.entr'
1210 C Get the names and open the input files
1211 #if defined(WINIFL) || defined(WINPGI)
1212 open(1,file=pref_orig(:ilen(pref_orig))//
1213 & '.inp',status='old',readonly,shared)
1214 open (9,file=prefix(:ilen(prefix))//'.intin',status='unknown')
1215 C open (18,file=prefix(:ilen(prefix))//'.entin',status='unknown')
1216 C Get parameter filenames and open the parameter files.
1217 call getenv_loc('BONDPAR',bondname)
1218 open (ibond,file=bondname,status='old',readonly,shared)
1219 call getenv_loc('THETPAR',thetname)
1220 open (ithep,file=thetname,status='old',readonly,shared)
1222 call getenv_loc('THETPARPDB',thetname_pdb)
1223 open (ithep_pdb,file=thetname_pdb,status='old',readonly,shared)
1225 call getenv_loc('ROTPAR',rotname)
1226 open (irotam,file=rotname,status='old',readonly,shared)
1228 call getenv_loc('ROTPARPDB',rotname_pdb)
1229 open (irotam_pdb,file=rotname_pdb,status='old',readonly,shared)
1231 call getenv_loc('TORPAR',torname)
1232 open (itorp,file=torname,status='old',readonly,shared)
1233 call getenv_loc('TORDPAR',tordname)
1234 open (itordp,file=tordname,status='old',readonly,shared)
1235 call getenv_loc('FOURIER',fouriername)
1236 open (ifourier,file=fouriername,status='old',readonly,shared)
1237 call getenv_loc('ELEPAR',elename)
1238 open (ielep,file=elename,status='old',readonly,shared)
1239 call getenv_loc('SIDEPAR',sidename)
1240 open (isidep,file=sidename,status='old',readonly,shared)
1241 #elif (defined CRAY) || (defined AIX)
1242 open(1,file=pref_orig(:ilen(pref_orig))//'.inp',status='old',
1244 c print *,"Processor",myrank," opened file 1"
1245 open (9,file=prefix(:ilen(prefix))//'.intin',status='unknown')
1246 c print *,"Processor",myrank," opened file 9"
1247 C open (18,file=prefix(:ilen(prefix))//'.entin',status='unknown')
1248 C Get parameter filenames and open the parameter files.
1249 call getenv_loc('BONDPAR',bondname)
1250 open (ibond,file=bondname,status='old',action='read')
1251 c print *,"Processor",myrank," opened file IBOND"
1252 call getenv_loc('THETPAR',thetname)
1253 open (ithep,file=thetname,status='old',action='read')
1254 c print *,"Processor",myrank," opened file ITHEP"
1256 call getenv_loc('THETPARPDB',thetname_pdb)
1257 open (ithep_pdb,file=thetname_pdb,status='old',action='read')
1259 call getenv_loc('ROTPAR',rotname)
1260 open (irotam,file=rotname,status='old',action='read')
1261 c print *,"Processor",myrank," opened file IROTAM"
1263 call getenv_loc('ROTPARPDB',rotname_pdb)
1264 open (irotam_pdb,file=rotname_pdb,status='old',action='read')
1266 call getenv_loc('TORPAR',torname)
1267 open (itorp,file=torname,status='old',action='read')
1268 c print *,"Processor",myrank," opened file ITORP"
1269 call getenv_loc('TORDPAR',tordname)
1270 open (itordp,file=tordname,status='old',action='read')
1271 c print *,"Processor",myrank," opened file ITORDP"
1272 call getenv_loc('SCCORPAR',sccorname)
1273 open (isccor,file=sccorname,status='old',action='read')
1274 c print *,"Processor",myrank," opened file ISCCOR"
1275 call getenv_loc('FOURIER',fouriername)
1276 open (ifourier,file=fouriername,status='old',action='read')
1277 c print *,"Processor",myrank," opened file IFOURIER"
1278 call getenv_loc('ELEPAR',elename)
1279 open (ielep,file=elename,status='old',action='read')
1280 c print *,"Processor",myrank," opened file IELEP"
1281 call getenv_loc('SIDEPAR',sidename)
1282 open (isidep,file=sidename,status='old',action='read')
1283 c print *,"Processor",myrank," opened file ISIDEP"
1284 c print *,"Processor",myrank," opened parameter files"
1286 open(1,file=pref_orig(:ilen(pref_orig))//'.inp',status='old')
1287 open (9,file=prefix(:ilen(prefix))//'.intin',status='unknown')
1288 C open (18,file=prefix(:ilen(prefix))//'.entin',status='unknown')
1289 C Get parameter filenames and open the parameter files.
1290 call getenv_loc('BONDPAR',bondname)
1291 open (ibond,file=bondname,status='old')
1292 call getenv_loc('THETPAR',thetname)
1293 open (ithep,file=thetname,status='old')
1295 call getenv_loc('THETPARPDB',thetname_pdb)
1296 open (ithep_pdb,file=thetname_pdb,status='old')
1298 call getenv_loc('ROTPAR',rotname)
1299 open (irotam,file=rotname,status='old')
1301 call getenv_loc('ROTPARPDB',rotname_pdb)
1302 open (irotam_pdb,file=rotname_pdb,status='old')
1304 call getenv_loc('TORPAR',torname)
1305 open (itorp,file=torname,status='old')
1306 call getenv_loc('TORDPAR',tordname)
1307 open (itordp,file=tordname,status='old')
1308 call getenv_loc('SCCORPAR',sccorname)
1309 open (isccor,file=sccorname,status='old')
1310 call getenv_loc('FOURIER',fouriername)
1311 open (ifourier,file=fouriername,status='old')
1312 call getenv_loc('ELEPAR',elename)
1313 open (ielep,file=elename,status='old')
1314 call getenv_loc('SIDEPAR',sidename)
1315 open (isidep,file=sidename,status='old')
1317 open(1,file=pref_orig(:ilen(pref_orig))//'.inp',status='old',
1319 open (9,file=prefix(:ilen(prefix))//'.intin',status='unknown')
1320 C open (18,file=prefix(:ilen(prefix))//'.entin',status='unknown')
1321 C Get parameter filenames and open the parameter files.
1322 call getenv_loc('BONDPAR',bondname)
1323 open (ibond,file=bondname,status='old',readonly)
1324 call getenv_loc('THETPAR',thetname)
1325 open (ithep,file=thetname,status='old',readonly)
1327 call getenv_loc('THETPARPDB',thetname_pdb)
1328 print *,"thetname_pdb ",thetname_pdb
1329 open (ithep_pdb,file=thetname_pdb,status='old',readonly)
1330 print *,ithep_pdb," opened"
1332 call getenv_loc('ROTPAR',rotname)
1333 open (irotam,file=rotname,status='old',readonly)
1335 call getenv_loc('ROTPARPDB',rotname_pdb)
1336 open (irotam_pdb,file=rotname_pdb,status='old',readonly)
1338 call getenv_loc('TORPAR',torname)
1339 open (itorp,file=torname,status='old',readonly)
1340 call getenv_loc('TORDPAR',tordname)
1341 open (itordp,file=tordname,status='old',readonly)
1342 call getenv_loc('SCCORPAR',sccorname)
1343 open (isccor,file=sccorname,status='old',readonly)
1344 call getenv_loc('FOURIER',fouriername)
1345 open (ifourier,file=fouriername,status='old',readonly)
1346 call getenv_loc('ELEPAR',elename)
1347 open (ielep,file=elename,status='old',readonly)
1348 call getenv_loc('SIDEPAR',sidename)
1349 open (isidep,file=sidename,status='old',readonly)
1353 C 8/9/01 In the newest version SCp interaction constants are read from a file
1354 C Use -DOLDSCP to use hard-coded constants instead.
1356 call getenv_loc('SCPPAR',scpname)
1357 #if defined(WINIFL) || defined(WINPGI)
1358 open (iscpp,file=scpname,status='old',readonly,shared)
1359 #elif (defined CRAY) || (defined AIX)
1360 open (iscpp,file=scpname,status='old',action='read')
1362 open (iscpp,file=scpname,status='old')
1364 open (iscpp,file=scpname,status='old',readonly)
1367 call getenv_loc('PATTERN',patname)
1368 #if defined(WINIFL) || defined(WINPGI)
1369 open (icbase,file=patname,status='old',readonly,shared)
1370 #elif (defined CRAY) || (defined AIX)
1371 open (icbase,file=patname,status='old',action='read')
1373 open (icbase,file=patname,status='old')
1375 open (icbase,file=patname,status='old',readonly)
1378 C Open output file only for CG processes
1379 c print *,"Processor",myrank," fg_rank",fg_rank
1380 if (fg_rank.eq.0) then
1382 if (nodes.eq.1) then
1385 npos = dlog10(dfloat(nodes-1))+1
1387 if (npos.lt.3) npos=3
1388 write (liczba,'(i1)') npos
1389 form = '(bz,i'//liczba(:ilen(liczba))//'.'//liczba(:ilen(liczba))
1391 write (liczba,form) me
1392 outname=prefix(:lenpre)//'.out_'//pot(:lenpot)//
1393 & liczba(:ilen(liczba))
1394 intname=prefix(:lenpre)//'_'//pot(:lenpot)//liczba(:ilen(liczba))
1396 pdbname=prefix(:lenpre)//'_'//pot(:lenpot)//liczba(:ilen(liczba))
1398 mol2name=prefix(:lenpre)//'_'//pot(:lenpot)//
1399 & liczba(:ilen(liczba))//'.mol2'
1400 statname=prefix(:lenpre)//'_'//pot(:lenpot)//
1401 & liczba(:ilen(liczba))//'.stat'
1403 & call copy_to_tmp(pref_orig(:ilen(pref_orig))//'_'//pot(:lenpot)
1404 & //liczba(:ilen(liczba))//'.stat')
1405 rest2name=prefix(:ilen(prefix))//"_"//liczba(:ilen(liczba))
1408 c qname=prefix(:lenpre)//'_'//pot(:lenpot)//
1409 c & liczba(:ilen(liczba))//'.const'
1414 outname=prefix(:lenpre)//'.out_'//pot(:lenpot)
1415 intname=prefix(:lenpre)//'_'//pot(:lenpot)//'.int'
1416 pdbname=prefix(:lenpre)//'_'//pot(:lenpot)//'.pdb'
1417 mol2name=prefix(:lenpre)//'_'//pot(:lenpot)//'.mol2'
1418 statname=prefix(:lenpre)//'_'//pot(:lenpot)//'.stat'
1420 & call copy_to_tmp(pref_orig(:ilen(pref_orig))//'_'//pot(:lenpot)//
1422 rest2name=prefix(:ilen(prefix))//'.rst'
1424 c qname=prefix(:lenpre)//'_'//pot(:lenpot)//'.const'
1427 #if defined(AIX) || defined(PGI)
1428 if (me.eq.king .or. .not. out1file)
1429 & open(iout,file=outname,status='unknown')
1431 if (fg_rank.gt.0) then
1432 write (liczba,'(i3.3)') myrank/nfgtasks
1433 write (ll,'(bz,i3.3)') fg_rank
1434 open(iout,file="debug"//liczba(:ilen(liczba))//"."//ll,
1439 open(igeom,file=intname,status='unknown',position='append')
1440 open(ipdb,file=pdbname,status='unknown')
1441 open(imol2,file=mol2name,status='unknown')
1442 open(istat,file=statname,status='unknown',position='append')
1444 c1out open(iout,file=outname,status='unknown')
1447 if (me.eq.king .or. .not.out1file)
1448 & open(iout,file=outname,status='unknown')
1450 if (fg_rank.gt.0) then
1451 write (liczba,'(i3.3)') myrank/nfgtasks
1452 write (ll,'(bz,i3.3)') fg_rank
1453 open(iout,file="debug"//liczba(:ilen(liczba))//"."//ll,
1458 open(igeom,file=intname,status='unknown',access='append')
1459 open(ipdb,file=pdbname,status='unknown')
1460 open(imol2,file=mol2name,status='unknown')
1461 open(istat,file=statname,status='unknown',access='append')
1463 c1out open(iout,file=outname,status='unknown')
1466 csa_rbank=prefix(:lenpre)//'.CSA.rbank'
1467 csa_seed=prefix(:lenpre)//'.CSA.seed'
1468 csa_history=prefix(:lenpre)//'.CSA.history'
1469 csa_bank=prefix(:lenpre)//'.CSA.bank'
1470 csa_bank1=prefix(:lenpre)//'.CSA.bank1'
1471 csa_alpha=prefix(:lenpre)//'.CSA.alpha'
1472 csa_alpha1=prefix(:lenpre)//'.CSA.alpha1'
1473 c!bankt csa_bankt=prefix(:lenpre)//'.CSA.bankt'
1474 csa_int=prefix(:lenpre)//'.int'
1475 csa_bank_reminimized=prefix(:lenpre)//'.CSA.bank_reminimized'
1476 csa_native_int=prefix(:lenpre)//'.CSA.native.int'
1477 csa_in=prefix(:lenpre)//'.CSA.in'
1478 c print *,"Processor",myrank,"fg_rank",fg_rank," opened files"
1481 write (iout,'(80(1h-))')
1482 write (iout,'(30x,a)') "FILE ASSIGNMENT"
1483 write (iout,'(80(1h-))')
1484 write (iout,*) "Input file : ",
1485 & pref_orig(:ilen(pref_orig))//'.inp'
1486 write (iout,*) "Output file : ",
1487 & outname(:ilen(outname))
1489 write (iout,*) "Sidechain potential file : ",
1490 & sidename(:ilen(sidename))
1492 write (iout,*) "SCp potential file : ",
1493 & scpname(:ilen(scpname))
1495 write (iout,*) "Electrostatic potential file : ",
1496 & elename(:ilen(elename))
1497 write (iout,*) "Cumulant coefficient file : ",
1498 & fouriername(:ilen(fouriername))
1499 write (iout,*) "Torsional parameter file : ",
1500 & torname(:ilen(torname))
1501 write (iout,*) "Double torsional parameter file : ",
1502 & tordname(:ilen(tordname))
1503 write (iout,*) "SCCOR parameter file : ",
1504 & sccorname(:ilen(sccorname))
1505 write (iout,*) "Bond & inertia constant file : ",
1506 & bondname(:ilen(bondname))
1507 write (iout,*) "Bending parameter file : ",
1508 & thetname(:ilen(thetname))
1509 write (iout,*) "Rotamer parameter file : ",
1510 & rotname(:ilen(rotname))
1511 write (iout,*) "Threading database : ",
1512 & patname(:ilen(patname))
1514 &write (iout,*)" DIRTMP : ",
1516 write (iout,'(80(1h-))')
1520 c----------------------------------------------------------------------------
1521 subroutine card_concat(card)
1522 implicit real*8 (a-h,o-z)
1523 include 'DIMENSIONS'
1524 include 'COMMON.IOUNITS'
1526 character*80 karta,ucase
1528 read (inp,'(a)') karta
1531 do while (karta(80:80).eq.'&')
1532 card=card(:ilen(card)+1)//karta(:79)
1533 read (inp,'(a)') karta
1536 card=card(:ilen(card)+1)//karta
1540 subroutine read_dist_constr
1541 implicit real*8 (a-h,o-z)
1542 include 'DIMENSIONS'
1546 include 'COMMON.SETUP'
1547 include 'COMMON.CONTROL'
1548 include 'COMMON.CHAIN'
1549 include 'COMMON.IOUNITS'
1550 include 'COMMON.SBRIDGE'
1551 integer ifrag_(2,100),ipair_(2,100)
1552 double precision wfrag_(100),wpair_(100)
1553 character*500 controlcard
1554 c write (iout,*) "Calling read_dist_constr"
1555 c write (iout,*) "nres",nres," nstart_sup",nstart_sup," nsup",nsup
1557 call card_concat(controlcard)
1558 call readi(controlcard,"NFRAG",nfrag_,0)
1559 call readi(controlcard,"NPAIR",npair_,0)
1560 call readi(controlcard,"NDIST",ndist_,0)
1561 call reada(controlcard,'DIST_CUT',dist_cut,5.0d0)
1562 call multreadi(controlcard,"IFRAG",ifrag_(1,1),2*nfrag_,0)
1563 call multreadi(controlcard,"IPAIR",ipair_(1,1),2*npair_,0)
1564 call multreada(controlcard,"WFRAG",wfrag_(1),nfrag_,0.0d0)
1565 call multreada(controlcard,"WPAIR",wpair_(1),npair_,0.0d0)
1566 c write (iout,*) "NFRAG",nfrag_," NPAIR",npair_," NDIST",ndist_
1567 c write (iout,*) "IFRAG"
1569 c write (iout,*) i,ifrag_(1,i),ifrag_(2,i),wfrag_(i)
1571 c write (iout,*) "IPAIR"
1573 c write (iout,*) i,ipair_(1,i),ipair_(2,i),wpair_(i)
1577 if (ifrag_(1,i).lt.nstart_sup) ifrag_(1,i)=nstart_sup
1578 if (ifrag_(2,i).gt.nstart_sup+nsup-1)
1579 & ifrag_(2,i)=nstart_sup+nsup-1
1580 c write (iout,*) i,ifrag_(1,i),ifrag_(2,i),wfrag_(i)
1582 if (wfrag_(i).gt.0.0d0) then
1583 do j=ifrag_(1,i),ifrag_(2,i)-1
1584 do k=j+1,ifrag_(2,i)
1585 write (iout,*) "j",j," k",k
1587 if (constr_dist.eq.1) then
1592 forcon(nhpb)=wfrag_(i)
1593 else if (constr_dist.eq.2) then
1594 if (ddjk.le.dist_cut) then
1599 forcon(nhpb)=wfrag_(i)
1606 forcon(nhpb)=wfrag_(i)*dexp(-0.5d0*(ddjk/dist_cut)**2)
1609 if (.not.out1file .or. me.eq.king)
1610 & write (iout,'(a,3i5,f8.2,1pe12.2)') "+dist.constr ",
1611 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
1613 write (iout,'(a,3i5,f8.2,1pe12.2)') "+dist.constr ",
1614 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
1621 if (wpair_(i).gt.0.0d0) then
1629 do j=ifrag_(1,ii),ifrag_(2,ii)
1630 do k=ifrag_(1,jj),ifrag_(2,jj)
1634 forcon(nhpb)=wpair_(i)
1635 dhpb(nhpb)=dist(j,k)
1637 if (.not.out1file .or. me.eq.king)
1638 & write (iout,'(a,3i5,f8.2,f10.1)') "+dist.constr ",
1639 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
1641 write (iout,'(a,3i5,f8.2,f10.1)') "+dist.constr ",
1642 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
1649 read (inp,*) ihpb(nhpb+1),jhpb(nhpb+1),forcon(nhpb+1)
1650 if (forcon(nhpb+1).gt.0.0d0) then
1652 dhpb(nhpb)=dist(ihpb(nhpb),jhpb(nhpb))
1654 if (.not.out1file .or. me.eq.king)
1655 & write (iout,'(a,3i5,f8.2,f10.1)') "+dist.constr ",
1656 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
1658 write (iout,'(a,3i5,f8.2,f10.1)') "+dist.constr ",
1659 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
1666 c-------------------------------------------------------------------------------
1668 subroutine flush(iu)
1673 subroutine flush(iu)
1678 c------------------------------------------------------------------------------
1679 subroutine copy_to_tmp(source)
1680 include "DIMENSIONS"
1681 include "COMMON.IOUNITS"
1682 character*(*) source
1683 character* 256 tmpfile
1687 tmpfile=curdir(:ilen(curdir))//"/"//source(:ilen(source))
1688 inquire(file=tmpfile,exist=ex)
1690 write (*,*) "Copying ",tmpfile(:ilen(tmpfile)),
1691 & " to temporary directory..."
1692 write (*,*) "/bin/cp "//tmpfile(:ilen(tmpfile))//" "//tmpdir
1693 call system("/bin/cp "//tmpfile(:ilen(tmpfile))//" "//tmpdir)
1697 c------------------------------------------------------------------------------
1698 subroutine move_from_tmp(source)
1699 include "DIMENSIONS"
1700 include "COMMON.IOUNITS"
1701 character*(*) source
1704 write (*,*) "Moving ",source(:ilen(source)),
1705 & " from temporary directory to working directory"
1706 write (*,*) "/bin/mv "//source(:ilen(source))//" "//curdir
1707 call system("/bin/mv "//source(:ilen(source))//" "//curdir)
1710 c------------------------------------------------------------------------------
1711 subroutine random_init(seed)
1713 C Initialize random number generator
1715 implicit real*8 (a-h,o-z)
1716 include 'DIMENSIONS'
1722 logical OKRandom, prng_restart
1724 integer iseed_array(4)
1726 include 'COMMON.IOUNITS'
1727 include 'COMMON.TIME1'
1728 c include 'COMMON.THREAD'
1729 include 'COMMON.SBRIDGE'
1730 include 'COMMON.CONTROL'
1731 include 'COMMON.MCM'
1732 c include 'COMMON.MAP'
1733 include 'COMMON.HEADER'
1734 c include 'COMMON.CSA'
1735 include 'COMMON.CHAIN'
1736 c include 'COMMON.MUCA'
1737 c include 'COMMON.MD'
1738 include 'COMMON.FFIELD'
1739 include 'COMMON.SETUP'
1740 iseed=-dint(dabs(seed))
1741 if (iseed.eq.0) then
1742 write (iout,'(/80(1h*)/20x,a/80(1h*))')
1743 & 'Random seed undefined. The program will stop.'
1744 write (*,'(/80(1h*)/20x,a/80(1h*))')
1745 & 'Random seed undefined. The program will stop.'
1747 call mpi_finalize(mpi_comm_world,ierr)
1749 stop 'Bad random seed.'
1752 if (fg_rank.eq.0) then
1756 if(me.eq.king .or. .not. out1file)
1757 & write (iout,*) 'MPI: node= ', me, ' iseed= ',iseedi8
1758 write (*,*) 'MPI: node= ', me, ' iseed= ',iseedi8
1759 OKRandom = prng_restart(me,iseedi8)
1762 tmp=65536.0d0**(4-i)
1763 iseed_array(i) = dint(seed/tmp)
1764 seed=seed-iseed_array(i)*tmp
1766 if(me.eq.king .or. .not. out1file)
1767 & write (iout,*) 'MPI: node= ', me, ' iseed(4)= ',
1768 & (iseed_array(i),i=1,4)
1769 write (*,*) 'MPI: node= ',me, ' iseed(4)= ',
1770 & (iseed_array(i),i=1,4)
1771 OKRandom = prng_restart(me,iseed_array)
1774 c r1=ran_number(0.0D0,1.0D0)
1775 if(me.eq.king .or. .not. out1file)
1776 & write (iout,*) 'ran_num',r1
1777 if (r1.lt.0.0d0) OKRandom=.false.
1779 if (.not.OKRandom) then
1780 write (iout,*) 'PRNG IS NOT WORKING!!!'
1781 print *,'PRNG IS NOT WORKING!!!'
1784 call mpi_abort(mpi_comm_world,error_msg,ierr)
1787 write (iout,*) 'too many processors for parallel prng'
1788 write (*,*) 'too many processors for parallel prng'
1796 c write (iout,*) 'ran_num',ran_number(0.0d0,1.0d0)