2 implicit real*8 (a-h,o-z)
8 include 'COMMON.CONTROL'
9 include 'COMMON.SBRIDGE'
10 include 'COMMON.IOUNITS'
11 include 'COMMON.SPLITELE'
13 C Read force-field parameters except weights
15 C Read job setup parameters
17 C Read control parameters for energy minimzation if required
18 if (minim) call read_minim
19 C Read MCM control parameters if required
20 if (modecalc.eq.3 .or. modecalc.eq.6) call mcmread
21 C Read MD control parameters if reqjuired
22 if (modecalc.eq.12) call read_MDpar
23 C Read MREMD control parameters if required
24 if (modecalc.eq.14) then
28 C Read MUCA control parameters if required
29 if (lmuca) call read_muca
30 C Read CSA control parameters if required (from fort.40 if exists
31 C otherwise from general input file)
32 if (modecalc.eq.8) then
33 inquire (file="fort.40",exist=file_exist)
34 if (.not.file_exist) call csaread
36 cfmc if (modecalc.eq.10) call mcmfread
37 C Read molecule information, molecule geometry, energy-term weights, and
38 C restraints if requested
40 C Print restraint information
42 if (.not. out1file .or. me.eq.king) then
45 &write (iout,'(a,i5,a)') "The following",nhpb-nss,
46 & " distance constraints have been imposed"
48 write (iout,'(3i6,f10.5)') i-nss,ihpb(i),jhpb(i),forcon(i)
53 c print *,"Processor",myrank," leaves READRTNS"
56 C-------------------------------------------------------------------------------
57 subroutine read_control
61 implicit real*8 (a-h,o-z)
65 logical OKRandom, prng_restart
68 include 'COMMON.IOUNITS'
69 include 'COMMON.TIME1'
70 include 'COMMON.THREAD'
71 include 'COMMON.SBRIDGE'
72 include 'COMMON.CONTROL'
75 include 'COMMON.HEADER'
77 include 'COMMON.CHAIN'
80 include 'COMMON.FFIELD'
81 include 'COMMON.INTERACT'
82 include 'COMMON.SETUP'
83 include 'COMMON.SPLITELE'
84 include 'COMMON.SHIELD'
85 COMMON /MACHSW/ KDIAG,ICORFL,IXDR
86 character*8 diagmeth(0:3) /'Library','EVVRSP','Givens','Jacobi'/
88 character*320 controlcard
93 read (INP,'(a)') titel
94 call card_concat(controlcard)
95 c out1file=index(controlcard,'OUT1FILE').gt.0 .or. fg_rank.gt.0
96 c print *,"Processor",me," fg_rank",fg_rank," out1file",out1file
97 call reada(controlcard,'SEED',seed,0.0D0)
98 call random_init(seed)
99 C Set up the time limit (caution! The time must be input in minutes!)
100 read_cart=index(controlcard,'READ_CART').gt.0
101 call readi(controlcard,'CONSTR_DIST',constr_dist,0)
102 C this variable with_theta_constr is the variable which allow to read and execute the
103 C constrains on theta angles WITH_THETA_CONSTR is the keyword
104 with_theta_constr = index(controlcard,"WITH_THETA_CONSTR").gt.0
105 write (iout,*) "with_theta_constr ",with_theta_constr
106 call readi(controlcard,'SYM',symetr,1)
107 call reada(controlcard,'TIMLIM',timlim,960.0D0) ! default 16 hours
108 unres_pdb = index(controlcard,'UNRES_PDB') .gt. 0
109 call reada(controlcard,'SAFETY',safety,30.0D0) ! default 30 minutes
110 call reada(controlcard,'RMSDBC',rmsdbc,3.0D0)
111 call reada(controlcard,'RMSDBC1',rmsdbc1,0.5D0)
112 call reada(controlcard,'RMSDBC1MAX',rmsdbc1max,1.5D0)
113 call reada(controlcard,'RMSDBCM',rmsdbcm,3.0D0)
114 call reada(controlcard,'DRMS',drms,0.1D0)
115 if(me.eq.king .or. .not. out1file .and. fg_rank.eq.0) then
116 write (iout,'(a,f10.1)')'RMSDBC = ',rmsdbc
117 write (iout,'(a,f10.1)')'RMSDBC1 = ',rmsdbc1
118 write (iout,'(a,f10.1)')'RMSDBC1MAX = ',rmsdbc1max
119 write (iout,'(a,f10.1)')'DRMS = ',drms
120 write (iout,'(a,f10.1)')'RMSDBCM = ',rmsdbcm
121 write (iout,'(a,f10.1)') 'Time limit (min):',timlim
123 call readi(controlcard,'NZ_START',nz_start,0)
124 call readi(controlcard,'NZ_END',nz_end,0)
125 call readi(controlcard,'IZ_SC',iz_sc,0)
127 safety = 60.0d0*safety
130 call reada(controlcard,"T_BATH",t_bath,300.0d0)
131 minim=(index(controlcard,'MINIMIZE').gt.0)
132 dccart=(index(controlcard,'CART').gt.0)
133 overlapsc=(index(controlcard,'OVERLAP').gt.0)
134 overlapsc=.not.overlapsc
135 searchsc=(index(controlcard,'NOSEARCHSC').gt.0)
136 searchsc=.not.searchsc
137 sideadd=(index(controlcard,'SIDEADD').gt.0)
138 energy_dec=(index(controlcard,'ENERGY_DEC').gt.0)
139 outpdb=(index(controlcard,'PDBOUT').gt.0)
140 outmol2=(index(controlcard,'MOL2OUT').gt.0)
141 pdbref=(index(controlcard,'PDBREF').gt.0)
142 refstr=pdbref .or. (index(controlcard,'REFSTR').gt.0)
143 indpdb=index(controlcard,'PDBSTART')
144 extconf=(index(controlcard,'EXTCONF').gt.0)
145 AFMlog=(index(controlcard,'AFM'))
146 selfguide=(index(controlcard,'SELFGUIDE'))
147 print *,'AFMlog',AFMlog,selfguide,"KUPA"
148 call readi(controlcard,'IPRINT',iprint,0)
149 C SHIELD keyword sets if the shielding effect of side-chains is used
150 C 0 denots no shielding is used all peptide are equally despite the
151 C solvent accesible area
152 C 1 the newly introduced function
153 C 2 reseved for further possible developement
154 call readi(controlcard,'SHIELD',shield_mode,0)
155 C if(me.eq.king .or. .not. out1file .and. fg_rank.eq.0) then
156 write(iout,*) "shield_mode",shield_mode
158 call readi(controlcard,'MAXGEN',maxgen,10000)
159 call readi(controlcard,'MAXOVERLAP',maxoverlap,1000)
160 call readi(controlcard,"KDIAG",kdiag,0)
161 call readi(controlcard,"RESCALE_MODE",rescale_mode,2)
162 if(me.eq.king .or. .not. out1file .and. fg_rank.eq.0)
163 & write (iout,*) "RESCALE_MODE",rescale_mode
164 split_ene=index(controlcard,'SPLIT_ENE').gt.0
165 if (index(controlcard,'REGULAR').gt.0.0D0) then
166 call reada(controlcard,'WEIDIS',weidis,0.1D0)
170 if (index(controlcard,'CHECKGRAD').gt.0) then
172 if (index(controlcard,'CART').gt.0) then
174 elseif (index(controlcard,'CARINT').gt.0) then
179 elseif (index(controlcard,'THREAD').gt.0) then
181 call readi(controlcard,'THREAD',nthread,0)
182 if (nthread.gt.0) then
183 call reada(controlcard,'WEIDIS',weidis,0.1D0)
186 & write (iout,'(a)')'A number has to follow the THREAD keyword.'
187 stop 'Error termination in Read_Control.'
189 else if (index(controlcard,'MCMA').gt.0) then
191 else if (index(controlcard,'MCEE').gt.0) then
193 else if (index(controlcard,'MULTCONF').gt.0) then
195 else if (index(controlcard,'MAP').gt.0) then
197 call readi(controlcard,'MAP',nmap,0)
198 else if (index(controlcard,'CSA').gt.0) then
200 crc else if (index(controlcard,'ZSCORE').gt.0) then
202 crc ZSCORE is rm from UNRES, modecalc=9 is available
205 cfcm else if (index(controlcard,'MCMF').gt.0) then
207 else if (index(controlcard,'SOFTREG').gt.0) then
209 else if (index(controlcard,'CHECK_BOND').gt.0) then
211 else if (index(controlcard,'TEST').gt.0) then
213 else if (index(controlcard,'MD').gt.0) then
215 else if (index(controlcard,'RE ').gt.0) then
219 lmuca=index(controlcard,'MUCA').gt.0
220 call readi(controlcard,'MUCADYN',mucadyn,0)
221 call readi(controlcard,'MUCASMOOTH',muca_smooth,0)
222 if (lmuca .and. (me.eq.king .or. .not.out1file ))
224 write (iout,*) 'MUCADYN=',mucadyn
225 write (iout,*) 'MUCASMOOTH=',muca_smooth
228 iscode=index(controlcard,'ONE_LETTER')
229 indphi=index(controlcard,'PHI')
230 indback=index(controlcard,'BACK')
231 iranconf=index(controlcard,'RAND_CONF')
232 i2ndstr=index(controlcard,'USE_SEC_PRED')
233 gradout=index(controlcard,'GRADOUT').gt.0
234 gnorm_check=index(controlcard,'GNORM_CHECK').gt.0
235 C DISTCHAINMAX become obsolete for periodic boundry condition
236 call reada(controlcard,'DISTCHAINMAX',distchainmax,5.0d0)
237 C Reading the dimensions of box in x,y,z coordinates
238 call reada(controlcard,'BOXX',boxxsize,100.0d0)
239 call reada(controlcard,'BOXY',boxysize,100.0d0)
240 call reada(controlcard,'BOXZ',boxzsize,100.0d0)
241 c Cutoff range for interactions
242 call reada(controlcard,"R_CUT",r_cut,15.0d0)
243 call reada(controlcard,"LAMBDA",rlamb,0.3d0)
244 call reada(controlcard,"LIPTHICK",lipthick,0.0d0)
245 call reada(controlcard,"LIPAQBUF",lipbufthick,0.0d0)
246 if (lipthick.gt.0.0d0) then
247 bordliptop=(boxzsize+lipthick)/2.0
248 bordlipbot=bordliptop-lipthick
250 if ((bordliptop.gt.boxzsize).or.(borlipbot.lt.0.0))
251 & write(iout,*) "WARNING WRONG SIZE OF LIPIDIC PHASE"
252 buflipbot=bordlipbot+lipbufthick
253 bufliptop=bordliptop-lipbufthick
254 if ((lipbufthick*2.0d0).gt.lipthick)
255 &write(iout,*) "WARNING WRONG SIZE OF LIP AQ BUF"
257 write(iout,*) "bordliptop=",bordliptop
258 write(iout,*) "bordlipbot=",bordlipbot
259 write(iout,*) "bufliptop=",bufliptop
260 write(iout,*) "buflipbot=",buflipbot
261 write (iout,*) "SHIELD MODE",shield_mode
262 if (shield_mode.gt.0) then
264 C VSolvSphere the volume of solving sphere
266 C rpp(1,1) is the energy r0 for peptide group contact and will be used for it
267 C there will be no distinction between proline peptide group and normal peptide
268 C group in case of shielding parameters
269 VSolvSphere=4.0/3.0*pi*rpp(1,1)**3
270 VSolvSphere_div=VSolvSphere-4.0/3.0*pi*(rpp(1,1)/2.0)**3
271 write (iout,*) VSolvSphere,VSolvSphere_div
272 C long axis of side chain
274 long_r_sidechain(i)=vbldsc0(1,i)
275 short_r_sidechain(i)=sigma0(i)
278 if (me.eq.king .or. .not.out1file )
279 & write (iout,*) "DISTCHAINMAX",distchainmax
281 if(me.eq.king.or..not.out1file)
282 & write (iout,'(2a)') diagmeth(kdiag),
283 & ' routine used to diagonalize matrices.'
286 c--------------------------------------------------------------------------
287 subroutine read_REMDpar
291 implicit real*8 (a-h,o-z)
293 include 'COMMON.IOUNITS'
294 include 'COMMON.TIME1'
297 include 'COMMON.LANGEVIN'
299 include 'COMMON.LANGEVIN.lang0'
301 include 'COMMON.INTERACT'
302 include 'COMMON.NAMES'
304 include 'COMMON.REMD'
305 include 'COMMON.CONTROL'
306 include 'COMMON.SETUP'
308 character*320 controlcard
309 character*3200 controlcard1
310 integer iremd_m_total
312 if(me.eq.king.or..not.out1file)
313 & write (iout,*) "REMD setup"
315 call card_concat(controlcard)
316 call readi(controlcard,"NREP",nrep,3)
317 call readi(controlcard,"NSTEX",nstex,1000)
318 call reada(controlcard,"RETMIN",retmin,10.0d0)
319 call reada(controlcard,"RETMAX",retmax,1000.0d0)
320 mremdsync=(index(controlcard,'SYNC').gt.0)
321 call readi(controlcard,"NSYN",i_sync_step,100)
322 restart1file=(index(controlcard,'REST1FILE').gt.0)
323 traj1file=(index(controlcard,'TRAJ1FILE').gt.0)
324 call readi(controlcard,"TRAJCACHE",max_cache_traj_use,1)
325 if(max_cache_traj_use.gt.max_cache_traj)
326 & max_cache_traj_use=max_cache_traj
327 if(me.eq.king.or..not.out1file) then
328 cd if (traj1file) then
329 crc caching is in testing - NTWX is not ignored
330 cd write (iout,*) "NTWX value is ignored"
331 cd write (iout,*) " trajectory is stored to one file by master"
332 cd write (iout,*) " before exchange at NSTEX intervals"
334 write (iout,*) "NREP= ",nrep
335 write (iout,*) "NSTEX= ",nstex
336 write (iout,*) "SYNC= ",mremdsync
337 write (iout,*) "NSYN= ",i_sync_step
338 write (iout,*) "TRAJCACHE= ",max_cache_traj_use
341 if (index(controlcard,'TLIST').gt.0) then
343 call card_concat(controlcard1)
344 read(controlcard1,*) (remd_t(i),i=1,nrep)
345 if(me.eq.king.or..not.out1file)
346 & write (iout,*)'tlist',(remd_t(i),i=1,nrep)
349 if (index(controlcard,'MLIST').gt.0) then
351 call card_concat(controlcard1)
352 read(controlcard1,*) (remd_m(i),i=1,nrep)
353 if(me.eq.king.or..not.out1file) then
354 write (iout,*)'mlist',(remd_m(i),i=1,nrep)
357 iremd_m_total=iremd_m_total+remd_m(i)
359 write (iout,*) 'Total number of replicas ',iremd_m_total
362 if(me.eq.king.or..not.out1file)
363 & write (iout,'(/30(1h=),a,29(1h=)/)') " End of REMD run setup "
366 c--------------------------------------------------------------------------
367 subroutine read_MDpar
371 implicit real*8 (a-h,o-z)
373 include 'COMMON.IOUNITS'
374 include 'COMMON.TIME1'
377 include 'COMMON.LANGEVIN'
379 include 'COMMON.LANGEVIN.lang0'
381 include 'COMMON.INTERACT'
382 include 'COMMON.NAMES'
384 include 'COMMON.SETUP'
385 include 'COMMON.CONTROL'
386 include 'COMMON.SPLITELE'
388 character*320 controlcard
390 call card_concat(controlcard)
391 call readi(controlcard,"NSTEP",n_timestep,1000000)
392 call readi(controlcard,"NTWE",ntwe,100)
393 call readi(controlcard,"NTWX",ntwx,1000)
394 call reada(controlcard,"DT",d_time,1.0d-1)
395 call reada(controlcard,"DVMAX",dvmax,2.0d1)
396 call reada(controlcard,"DAMAX",damax,1.0d1)
397 call reada(controlcard,"EDRIFTMAX",edriftmax,1.0d+1)
398 call readi(controlcard,"LANG",lang,0)
399 RESPA = index(controlcard,"RESPA") .gt. 0
400 call readi(controlcard,"NTIME_SPLIT",ntime_split,1)
401 ntime_split0=ntime_split
402 call readi(controlcard,"MAXTIME_SPLIT",maxtime_split,64)
403 ntime_split0=ntime_split
404 c call reada(controlcard,"R_CUT",r_cut,2.0d0)
405 c call reada(controlcard,"LAMBDA",rlamb,0.3d0)
406 rest = index(controlcard,"REST").gt.0
407 tbf = index(controlcard,"TBF").gt.0
408 usampl = index(controlcard,"USAMPL").gt.0
410 mdpdb = index(controlcard,"MDPDB").gt.0
411 call reada(controlcard,"T_BATH",t_bath,300.0d0)
412 call reada(controlcard,"TAU_BATH",tau_bath,1.0d-1)
413 call reada(controlcard,"EQ_TIME",eq_time,1.0d+4)
414 call readi(controlcard,"RESET_MOMENT",count_reset_moment,1000)
415 if (count_reset_moment.eq.0) count_reset_moment=1000000000
416 call readi(controlcard,"RESET_VEL",count_reset_vel,1000)
417 reset_moment=lang.eq.0 .and. tbf .and. count_reset_moment.gt.0
418 reset_vel=lang.eq.0 .and. tbf .and. count_reset_vel.gt.0
419 if (count_reset_vel.eq.0) count_reset_vel=1000000000
420 large = index(controlcard,"LARGE").gt.0
421 print_compon = index(controlcard,"PRINT_COMPON").gt.0
422 rattle = index(controlcard,"RATTLE").gt.0
423 c if performing umbrella sampling, fragments constrained are read from the fragment file
429 if(me.eq.king.or..not.out1file) then
431 write (iout,'(27(1h=),a26,27(1h=))') " Parameters of the MD run "
433 write (iout,'(a)') "The units are:"
434 write (iout,'(a)') "positions: angstrom, time: 48.9 fs"
435 write (iout,'(2a)') "velocity: angstrom/(48.9 fs),",
436 & " acceleration: angstrom/(48.9 fs)**2"
437 write (iout,'(a)') "energy: kcal/mol, temperature: K"
439 write (iout,'(a60,i10)') "Number of time steps:",n_timestep
440 write (iout,'(a60,f10.5,a)')
441 & "Initial time step of numerical integration:",d_time,
443 write (iout,'(60x,f10.5,a)') d_time*48.9," fs"
445 write (iout,'(2a,i4,a)')
446 & "A-MTS algorithm used; initial time step for fast-varying",
447 & " short-range forces split into",ntime_split," steps."
448 write (iout,'(a,f5.2,a,f5.2)') "Short-range force cutoff",
449 & r_cut," lambda",rlamb
451 write (iout,'(2a,f10.5)')
452 & "Maximum acceleration threshold to reduce the time step",
453 & "/increase split number:",damax
454 write (iout,'(2a,f10.5)')
455 & "Maximum predicted energy drift to reduce the timestep",
456 & "/increase split number:",edriftmax
457 write (iout,'(a60,f10.5)')
458 & "Maximum velocity threshold to reduce velocities:",dvmax
459 write (iout,'(a60,i10)') "Frequency of property output:",ntwe
460 write (iout,'(a60,i10)') "Frequency of coordinate output:",ntwx
461 if (rattle) write (iout,'(a60)')
462 & "Rattle algorithm used to constrain the virtual bonds"
466 call reada(controlcard,"ETAWAT",etawat,0.8904d0)
467 call reada(controlcard,"RWAT",rwat,1.4d0)
468 call reada(controlcard,"SCAL_FRIC",scal_fric,2.0d-2)
469 surfarea=index(controlcard,"SURFAREA").gt.0
470 call readi(controlcard,"RESET_FRICMAT",reset_fricmat,1000)
471 if(me.eq.king.or..not.out1file)then
472 write (iout,'(/a,$)') "Langevin dynamics calculation"
475 & " with direct integration of Langevin equations"
476 else if (lang.eq.2) then
477 write (iout,'(a/)') " with TINKER stochasic MD integrator"
478 else if (lang.eq.3) then
479 write (iout,'(a/)') " with Ciccotti's stochasic MD integrator"
480 else if (lang.eq.4) then
481 write (iout,'(a/)') " in overdamped mode"
483 write (iout,'(//a,i5)')
484 & "=========== ERROR: Unknown Langevin dynamics mode:",lang
487 write (iout,'(a60,f10.5)') "Temperature:",t_bath
488 write (iout,'(a60,f10.5)') "Viscosity of the solvent:",etawat
489 write (iout,'(a60,f10.5)') "Radius of solvent molecule:",rwat
490 write (iout,'(a60,f10.5)')
491 & "Scaling factor of the friction forces:",scal_fric
492 if (surfarea) write (iout,'(2a,i10,a)')
493 & "Friction coefficients will be scaled by solvent-accessible",
494 & " surface area every",reset_fricmat," steps."
496 c Calculate friction coefficients and bounds of stochastic forces
497 eta=6*pi*cPoise*etawat
498 if(me.eq.king.or..not.out1file)
499 & write(iout,'(a60,f10.5)')"Eta of the solvent in natural units:"
501 gamp=scal_fric*(pstok+rwat)*eta
502 stdfp=dsqrt(2*Rb*t_bath/d_time)
504 gamsc(i)=scal_fric*(restok(i)+rwat)*eta
505 stdfsc(i)=dsqrt(2*Rb*t_bath/d_time)
507 if(me.eq.king.or..not.out1file)then
508 write (iout,'(/2a/)')
509 & "Radii of site types and friction coefficients and std's of",
510 & " stochastic forces of fully exposed sites"
511 write (iout,'(a5,f5.2,2f10.5)')'p',pstok,gamp,stdfp*dsqrt(gamp)
513 write (iout,'(a5,f5.2,2f10.5)') restyp(i),restok(i),
514 & gamsc(i),stdfsc(i)*dsqrt(gamsc(i))
518 if(me.eq.king.or..not.out1file)then
519 write (iout,'(a)') "Berendsen bath calculation"
520 write (iout,'(a60,f10.5)') "Temperature:",t_bath
521 write (iout,'(a60,f10.5)') "Coupling constant (tau):",tau_bath
523 & write (iout,'(a,i10,a)') "Momenta will be reset at zero every",
524 & count_reset_moment," steps"
526 & write (iout,'(a,i10,a)')
527 & "Velocities will be reset at random every",count_reset_vel,
531 if(me.eq.king.or..not.out1file)
532 & write (iout,'(a31)') "Microcanonical mode calculation"
534 if(me.eq.king.or..not.out1file)then
535 if (rest) write (iout,'(/a/)') "===== Calculation restarted ===="
537 write(iout,*) "MD running with constraints."
538 write(iout,*) "Equilibration time ", eq_time, " mtus."
539 write(iout,*) "Constraining ", nfrag," fragments."
540 write(iout,*) "Length of each fragment, weight and q0:"
542 write (iout,*) "Set of restraints #",iset
544 write(iout,'(2i5,f8.1,f7.4)') ifrag(1,i,iset),
545 & ifrag(2,i,iset),wfrag(i,iset),qinfrag(i,iset)
547 write(iout,*) "constraints between ", npair, "fragments."
548 write(iout,*) "constraint pairs, weights and q0:"
550 write(iout,'(2i5,f8.1,f7.4)') ipair(1,i,iset),
551 & ipair(2,i,iset),wpair(i,iset),qinpair(i,iset)
553 write(iout,*) "angle constraints within ", nfrag_back,
554 & "backbone fragments."
555 write(iout,*) "fragment, weights:"
557 write(iout,'(2i5,3f8.1)') ifrag_back(1,i,iset),
558 & ifrag_back(2,i,iset),wfrag_back(1,i,iset),
559 & wfrag_back(2,i,iset),wfrag_back(3,i,iset)
562 iset=mod(kolor,nset)+1
565 if(me.eq.king.or..not.out1file)
566 & write (iout,'(/30(1h=),a,29(1h=)/)') " End of MD run setup "
569 c------------------------------------------------------------------------------
572 C Read molecular data.
574 implicit real*8 (a-h,o-z)
580 include 'COMMON.IOUNITS'
583 include 'COMMON.INTERACT'
584 include 'COMMON.LOCAL'
585 include 'COMMON.NAMES'
586 include 'COMMON.CHAIN'
587 include 'COMMON.FFIELD'
588 include 'COMMON.SBRIDGE'
589 include 'COMMON.HEADER'
590 include 'COMMON.CONTROL'
591 include 'COMMON.DBASE'
592 include 'COMMON.THREAD'
593 include 'COMMON.CONTACTS'
594 include 'COMMON.TORCNSTR'
595 include 'COMMON.TIME1'
596 include 'COMMON.BOUNDS'
598 include 'COMMON.SETUP'
599 character*4 sequence(maxres)
601 double precision x(maxvar)
602 character*256 pdbfile
603 character*400 weightcard
604 character*80 weightcard_t,ucase
605 dimension itype_pdb(maxres)
606 common /pizda/ itype_pdb
607 logical seq_comp,fail
608 double precision energia(0:n_ene)
614 C Read weights of the subsequent energy terms.
615 call card_concat(weightcard)
616 call reada(weightcard,'WLONG',wlong,1.0D0)
617 call reada(weightcard,'WSC',wsc,wlong)
618 call reada(weightcard,'WSCP',wscp,wlong)
619 call reada(weightcard,'WELEC',welec,1.0D0)
620 call reada(weightcard,'WVDWPP',wvdwpp,welec)
621 call reada(weightcard,'WEL_LOC',wel_loc,1.0D0)
622 call reada(weightcard,'WCORR4',wcorr4,0.0D0)
623 call reada(weightcard,'WCORR5',wcorr5,0.0D0)
624 call reada(weightcard,'WCORR6',wcorr6,0.0D0)
625 call reada(weightcard,'WTURN3',wturn3,1.0D0)
626 call reada(weightcard,'WTURN4',wturn4,1.0D0)
627 call reada(weightcard,'WTURN6',wturn6,1.0D0)
628 call reada(weightcard,'WSCCOR',wsccor,1.0D0)
629 call reada(weightcard,'WSTRAIN',wstrain,1.0D0)
630 call reada(weightcard,'WBOND',wbond,1.0D0)
631 call reada(weightcard,'WTOR',wtor,1.0D0)
632 call reada(weightcard,'WTORD',wtor_d,1.0D0)
633 call reada(weightcard,'WANG',wang,1.0D0)
634 call reada(weightcard,'WSCLOC',wscloc,1.0D0)
635 call reada(weightcard,'SCAL14',scal14,0.4D0)
636 call reada(weightcard,'SCALSCP',scalscp,1.0d0)
637 call reada(weightcard,'CUTOFF',cutoff_corr,7.0d0)
638 call reada(weightcard,'DELT_CORR',delt_corr,0.5d0)
639 call reada(weightcard,'TEMP0',temp0,300.0d0)
640 call reada(weightcard,'WLT',wliptran,0.0D0)
641 if (index(weightcard,'SOFT').gt.0) ipot=6
642 C 12/1/95 Added weight for the multi-body term WCORR
643 call reada(weightcard,'WCORRH',wcorr,1.0D0)
644 if (wcorr4.gt.0.0d0) wcorr=wcorr4
664 if(me.eq.king.or..not.out1file)
665 & write (iout,10) wsc,wscp,welec,wvdwpp,wbond,wang,wscloc,wtor,
666 & wtor_d,wstrain,wel_loc,wcorr,wcorr5,wcorr6,wsccor,wturn3,
668 10 format (/'Energy-term weights (unscaled):'//
669 & 'WSCC= ',f10.6,' (SC-SC)'/
670 & 'WSCP= ',f10.6,' (SC-p)'/
671 & 'WELEC= ',f10.6,' (p-p electr)'/
672 & 'WVDWPP= ',f10.6,' (p-p VDW)'/
673 & 'WBOND= ',f10.6,' (stretching)'/
674 & 'WANG= ',f10.6,' (bending)'/
675 & 'WSCLOC= ',f10.6,' (SC local)'/
676 & 'WTOR= ',f10.6,' (torsional)'/
677 & 'WTORD= ',f10.6,' (double torsional)'/
678 & 'WSTRAIN=',f10.6,' (SS bridges & dist. cnstr.)'/
679 & 'WEL_LOC=',f10.6,' (multi-body 3-rd order)'/
680 & 'WCORR4= ',f10.6,' (multi-body 4th order)'/
681 & 'WCORR5= ',f10.6,' (multi-body 5th order)'/
682 & 'WCORR6= ',f10.6,' (multi-body 6th order)'/
683 & 'WSCCOR= ',f10.6,' (back-scloc correlation)'/
684 & 'WTURN3= ',f10.6,' (turns, 3rd order)'/
685 & 'WTURN4= ',f10.6,' (turns, 4th order)'/
686 & 'WTURN6= ',f10.6,' (turns, 6th order)')
687 if(me.eq.king.or..not.out1file)then
688 if (wcorr4.gt.0.0d0) then
689 write (iout,'(/2a/)') 'Local-electrostatic type correlation ',
690 & 'between contact pairs of peptide groups'
691 write (iout,'(2(a,f5.3/))')
692 & 'Cutoff on 4-6th order correlation terms: ',cutoff_corr,
693 & 'Range of quenching the correlation terms:',2*delt_corr
694 else if (wcorr.gt.0.0d0) then
695 write (iout,'(/2a/)') 'Hydrogen-bonding correlation ',
696 & 'between contact pairs of peptide groups'
698 write (iout,'(a,f8.3)')
699 & 'Scaling factor of 1,4 SC-p interactions:',scal14
700 write (iout,'(a,f8.3)')
701 & 'General scaling factor of SC-p interactions:',scalscp
703 r0_corr=cutoff_corr-delt_corr
705 aad(i,1)=scalscp*aad(i,1)
706 aad(i,2)=scalscp*aad(i,2)
707 bad(i,1)=scalscp*bad(i,1)
708 bad(i,2)=scalscp*bad(i,2)
710 call rescale_weights(t_bath)
711 if(me.eq.king.or..not.out1file)
712 & write (iout,22) wsc,wscp,welec,wvdwpp,wbond,wang,wscloc,wtor,
713 & wtor_d,wstrain,wel_loc,wcorr,wcorr5,wcorr6,wsccor,wturn3,
715 22 format (/'Energy-term weights (scaled):'//
716 & 'WSCC= ',f10.6,' (SC-SC)'/
717 & 'WSCP= ',f10.6,' (SC-p)'/
718 & 'WELEC= ',f10.6,' (p-p electr)'/
719 & 'WVDWPP= ',f10.6,' (p-p VDW)'/
720 & 'WBOND= ',f10.6,' (stretching)'/
721 & 'WANG= ',f10.6,' (bending)'/
722 & 'WSCLOC= ',f10.6,' (SC local)'/
723 & 'WTOR= ',f10.6,' (torsional)'/
724 & 'WTORD= ',f10.6,' (double torsional)'/
725 & 'WSTRAIN=',f10.6,' (SS bridges & dist. cnstr.)'/
726 & 'WEL_LOC=',f10.6,' (multi-body 3-rd order)'/
727 & 'WCORR4= ',f10.6,' (multi-body 4th order)'/
728 & 'WCORR5= ',f10.6,' (multi-body 5th order)'/
729 & 'WCORR6= ',f10.6,' (multi-body 6th order)'/
730 & 'WSCCOR= ',f10.6,' (back-scloc correlatkion)'/
731 & 'WTURN3= ',f10.6,' (turns, 3rd order)'/
732 & 'WTURN4= ',f10.6,' (turns, 4th order)'/
733 & 'WTURN6= ',f10.6,' (turns, 6th order)')
734 if(me.eq.king.or..not.out1file)
735 & write (iout,*) "Reference temperature for weights calculation:",
737 call reada(weightcard,"D0CM",d0cm,3.78d0)
738 call reada(weightcard,"AKCM",akcm,15.1d0)
739 call reada(weightcard,"AKTH",akth,11.0d0)
740 call reada(weightcard,"AKCT",akct,12.0d0)
741 call reada(weightcard,"V1SS",v1ss,-1.08d0)
742 call reada(weightcard,"V2SS",v2ss,7.61d0)
743 call reada(weightcard,"V3SS",v3ss,13.7d0)
744 call reada(weightcard,"EBR",ebr,-5.50D0)
745 call reada(weightcard,"ATRISS",atriss,0.301D0)
746 call reada(weightcard,"BTRISS",btriss,0.021D0)
747 call reada(weightcard,"CTRISS",ctriss,1.001D0)
748 call reada(weightcard,"DTRISS",dtriss,1.001D0)
749 write (iout,*) "ATRISS=", atriss
750 write (iout,*) "BTRISS=", btriss
751 write (iout,*) "CTRISS=", ctriss
752 write (iout,*) "DTRISS=", dtriss
753 dyn_ss=(index(weightcard,'DYN_SS').gt.0)
755 dyn_ss_mask(i)=.false.
759 dyn_ssbond_ij(i,j)=1.0d300
762 call reada(weightcard,"HT",Ht,0.0D0)
764 ss_depth=ebr/wsc-0.25*eps(1,1)
765 Ht=Ht/wsc-0.25*eps(1,1)
766 akcm=akcm*wstrain/wsc
767 akth=akth*wstrain/wsc
768 akct=akct*wstrain/wsc
769 v1ss=v1ss*wstrain/wsc
770 v2ss=v2ss*wstrain/wsc
771 v3ss=v3ss*wstrain/wsc
773 if (wstrain.ne.0.0) then
774 ss_depth=ebr/wstrain-0.25*eps(1,1)*wsc/wstrain
780 if(me.eq.king.or..not.out1file) then
781 write (iout,*) "Parameters of the SS-bond potential:"
782 write (iout,*) "D0CM",d0cm," AKCM",akcm," AKTH",akth,
784 write (iout,*) "V1SS",v1ss," V2SS",v2ss," V3SS",v3ss
785 write (iout,*) "EBR",ebr," SS_DEPTH",ss_depth
786 write (iout,*)" HT",Ht
787 print *,'indpdb=',indpdb,' pdbref=',pdbref
789 if (indpdb.gt.0 .or. pdbref) then
790 read(inp,'(a)') pdbfile
791 if(me.eq.king.or..not.out1file)
792 & write (iout,'(2a)') 'PDB data will be read from file ',
793 & pdbfile(:ilen(pdbfile))
794 open(ipdbin,file=pdbfile,status='old',err=33)
796 33 write (iout,'(a)') 'Error opening PDB file.'
799 c write (iout,*) 'Begin reading pdb data'
802 c write (iout,*) 'Finished reading pdb data'
804 if(me.eq.king.or..not.out1file)
805 & write (iout,'(a,i3,a,i3)')'nsup=',nsup,
806 & ' nstart_sup=',nstart_sup
808 itype_pdb(i)=itype(i)
812 nct=nstart_sup+nsup-1
813 call contact(.false.,ncont_ref,icont_ref,co)
816 if(me.eq.king.or..not.out1file)
817 & write(iout,*)'Adding sidechains'
821 if (iti.ne.10 .and. itype(i).ne.ntyp1) then
824 do while (fail.and.nsi.le.maxsi)
825 call gen_side(iti,theta(i+1),alph(i),omeg(i),fail)
828 if(fail) write(iout,*)'Adding sidechain failed for res ',
829 & i,' after ',nsi,' trials'
834 if (indpdb.eq.0) then
835 C Read sequence if not taken from the pdb file.
837 c print *,'nres=',nres
838 if (iscode.gt.0) then
839 read (inp,'(80a1)') (sequence(i)(1:1),i=1,nres)
841 read (inp,'(20(1x,a3))') (sequence(i),i=1,nres)
843 C Convert sequence to numeric code
845 itype(i)=rescode(i,sequence(i),iscode)
847 C Assign initial virtual bond lengths
853 vbld(i+nres)=dsc(iabs(itype(i)))
854 vbld_inv(i+nres)=dsc_inv(iabs(itype(i)))
855 c write (iout,*) "i",i," itype",itype(i),
856 c & " dsc",dsc(itype(i))," vbld",vbld(i),vbld(i+nres)
860 c print '(20i4)',(itype(i),i=1,nres)
863 if (itype(i).eq.ntyp1 .or. itype(i+1).eq.ntyp1) then
865 if (itype(i).eq.ntyp1) then
869 else if (iabs(itype(i+1)).ne.20) then
871 else if (iabs(itype(i)).ne.20) then
878 if(me.eq.king.or..not.out1file)then
879 write (iout,*) "ITEL"
881 write (iout,*) i,itype(i),itel(i)
883 print *,'Call Read_Bridge.'
886 C 8/13/98 Set limits to generating the dihedral angles
891 read (inp,*) ndih_constr
892 if (ndih_constr.gt.0) then
894 read (inp,*) (idih_constr(i),phi0(i),drange(i),ftors(i),
896 if(me.eq.king.or..not.out1file)then
898 & 'There are',ndih_constr,' constraints on phi angles.'
900 write (iout,'(i5,3f8.3)') idih_constr(i),phi0(i),drange(i),
905 phi0(i)=deg2rad*phi0(i)
906 drange(i)=deg2rad*drange(i)
908 C if(me.eq.king.or..not.out1file)
909 C & write (iout,*) 'FTORS',ftors
912 phibound(1,ii) = phi0(i)-drange(i)
913 phibound(2,ii) = phi0(i)+drange(i)
916 C first setting the theta boundaries to 0 to pi
917 C this mean that there is no energy penalty for any angle occuring this can be applied
918 C for generate random conformation but is not implemented in this way
923 C begin reading theta constrains this is quartic constrains allowing to
924 C have smooth second derivative
925 if (with_theta_constr) then
926 C with_theta_constr is keyword allowing for occurance of theta constrains
927 read (inp,*) ntheta_constr
928 C ntheta_constr is the number of theta constrains
929 if (ntheta_constr.gt.0) then
931 read (inp,*) (itheta_constr(i),theta_constr0(i),
932 & theta_drange(i),for_thet_constr(i),
934 C the above code reads from 1 to ntheta_constr
935 C itheta_constr(i) residue i for which is theta_constr
936 C theta_constr0 the global minimum value
937 C theta_drange is range for which there is no energy penalty
938 C for_thet_constr is the force constant for quartic energy penalty
940 if(me.eq.king.or..not.out1file)then
942 & 'There are',ntheta_constr,' constraints on phi angles.'
944 write (iout,'(i5,3f8.3)') itheta_constr(i),theta_constr0(i),
950 theta_constr0(i)=deg2rad*theta_constr0(i)
951 theta_drange(i)=deg2rad*theta_drange(i)
953 C if(me.eq.king.or..not.out1file)
954 C & write (iout,*) 'FTORS',ftors
955 C do i=1,ntheta_constr
956 C ii = itheta_constr(i)
957 C thetabound(1,ii) = phi0(i)-drange(i)
958 C thetabound(2,ii) = phi0(i)+drange(i)
960 endif ! ntheta_constr.gt.0
961 endif! with_theta_constr
963 C with_dihed_constr = index(controlcard,"WITH_DIHED_CONSTR").gt.0
964 C write (iout,*) "with_dihed_constr ",with_dihed_constr
969 write (iout,'(a)') 'Boundaries in phi angle sampling:'
971 write (iout,'(a3,i5,2f10.1)')
972 & restyp(itype(i)),i,phibound(1,i)*rad2deg,phibound(2,i)*rad2deg
978 cd print *,'NNT=',NNT,' NCT=',NCT
979 if (itype(1).eq.ntyp1) nnt=2
980 if (itype(nres).eq.ntyp1) nct=nct-1
982 if(me.eq.king.or..not.out1file)
983 & write (iout,'(a,i3)') 'nsup=',nsup
985 if (nsup.le.(nct-nnt+1)) then
986 do i=0,nct-nnt+1-nsup
987 if (seq_comp(itype(nnt+i),itype_pdb(nstart_sup),nsup)) then
993 & 'Error - sequences to be superposed do not match.'
996 do i=0,nsup-(nct-nnt+1)
997 if (seq_comp(itype(nnt),itype_pdb(nstart_sup+i),nct-nnt+1))
999 nstart_sup=nstart_sup+i
1005 & 'Error - sequences to be superposed do not match.'
1008 if (nsup.eq.0) nsup=nct-nnt
1009 if (nstart_sup.eq.0) nstart_sup=nnt
1010 if (nstart_seq.eq.0) nstart_seq=nnt
1011 if(me.eq.king.or..not.out1file)
1012 & write (iout,*) 'nsup=',nsup,' nstart_sup=',nstart_sup,
1013 & ' nstart_seq=',nstart_seq
1015 c--- Zscore rms -------
1016 if (nz_start.eq.0) nz_start=nnt
1017 if (nz_end.eq.0 .and. nsup.gt.0) then
1019 else if (nz_end.eq.0) then
1022 if(me.eq.king.or..not.out1file)then
1023 write (iout,*) 'NZ_START=',nz_start,' NZ_END=',nz_end
1024 write (iout,*) 'IZ_SC=',iz_sc
1026 c----------------------
1029 if (.not.pdbref) then
1030 call read_angles(inp,*38)
1032 38 write (iout,'(a)') 'Error reading reference structure.'
1034 call MPI_Finalize(MPI_COMM_WORLD,IERROR)
1035 stop 'Error reading reference structure'
1039 czscore call geom_to_var(nvar,coord_exp_zs(1,1))
1046 cref(j,i,kkk)=c(j,i)
1049 call contact(.true.,ncont_ref,icont_ref,co)
1053 write (iout,*) "constr_dist",constr_dist,nstart_sup,nsup
1055 if (constr_dist.gt.0) call read_dist_constr
1056 write (iout,*) "After read_dist_constr nhpb",nhpb
1057 if ((AFMlog.gt.0).or.(selfguide.gt.0)) call read_afminp
1059 if(me.eq.king.or..not.out1file)
1060 & write (iout,*) 'Contact order:',co
1062 if(me.eq.king.or..not.out1file)
1063 & write (2,*) 'Shifting contacts:',nstart_seq,nstart_sup
1066 icont_ref(j,i)=icont_ref(j,i)+nstart_seq-nstart_sup
1068 if(me.eq.king.or..not.out1file)
1069 & write (2,*) i,' ',restyp(itype(icont_ref(1,i))),' ',
1070 & icont_ref(1,i),' ',
1071 & restyp(itype(icont_ref(2,i))),' ',icont_ref(2,i)
1075 if (indpdb.eq.0 .and. modecalc.ne.2 .and. modecalc.ne.4
1076 & .and. modecalc.ne.8 .and. modecalc.ne.9 .and.
1077 & modecalc.ne.10) then
1078 C If input structure hasn't been supplied from the PDB file read or generate
1080 if (iranconf.eq.0 .and. .not. extconf) then
1081 if(me.eq.king.or..not.out1file .and.fg_rank.eq.0)
1082 & write (iout,'(a)') 'Initial geometry will be read in.'
1084 read(inp,'(8f10.5)',end=36,err=36)
1085 & ((c(l,k),l=1,3),k=1,nres),
1086 & ((c(l,k+nres),l=1,3),k=nnt,nct)
1087 write (iout,*) "Exit READ_CART"
1088 write (iout,'(8f10.5)')
1089 & ((c(l,k),l=1,3),k=1,nres),
1090 & ((c(l,k+nres),l=1,3),k=nnt,nct)
1091 call int_from_cart1(.true.)
1092 write (iout,*) "Finish INT_TO_CART"
1095 dc(j,i)=c(j,i+1)-c(j,i)
1096 dc_norm(j,i)=dc_norm(j,i)*vbld_inv(i+1)
1100 if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then
1102 dc(j,i+nres)=c(j,i+nres)-c(j,i)
1103 dc_norm(j,i+nres)=dc_norm(j,i+nres)*vbld_inv(i+nres)
1109 call read_angles(inp,*36)
1112 36 write (iout,'(a)') 'Error reading angle file.'
1114 call mpi_finalize( MPI_COMM_WORLD,IERR )
1116 stop 'Error reading angle file.'
1118 else if (extconf) then
1119 if(me.eq.king.or..not.out1file .and. fg_rank.eq.0)
1120 & write (iout,'(a)') 'Extended chain initial geometry.'
1122 theta(i)=90d0*deg2rad
1125 phi(i)=180d0*deg2rad
1128 alph(i)=110d0*deg2rad
1131 omeg(i)=-120d0*deg2rad
1132 if (itype(i).le.0) omeg(i)=-omeg(i)
1135 if(me.eq.king.or..not.out1file)
1136 & write (iout,'(a)') 'Random-generated initial geometry.'
1140 if (me.eq.king .or. fg_rank.eq.0 .and. (
1141 & modecalc.eq.12 .or. modecalc.eq.14) ) then
1145 call gen_rand_conf(itmp,*30)
1147 30 write (iout,*) 'Failed to generate random conformation',
1148 & ', itrial=',itrial
1149 write (*,*) 'Processor:',me,
1150 & ' Failed to generate random conformation',
1160 write (iout,'(a,i3,a)') 'Processor:',me,
1161 & ' error in generating random conformation.'
1162 write (*,'(a,i3,a)') 'Processor:',me,
1163 & ' error in generating random conformation.'
1166 call MPI_Abort(mpi_comm_world,error_msg,ierrcode)
1171 & ' error in generating random conformation.'
1176 elseif (modecalc.eq.4) then
1177 read (inp,'(a)') intinname
1178 open (intin,file=intinname,status='old',err=333)
1179 if (me.eq.king .or. .not.out1file.and.fg_rank.eq.0)
1180 & write (iout,'(a)') 'intinname',intinname
1181 write (*,'(a)') 'Processor',myrank,' intinname',intinname
1183 333 write (iout,'(2a)') 'Error opening angle file ',intinname
1185 call MPI_Finalize(MPI_COMM_WORLD,IERR)
1187 stop 'Error opening angle file.'
1191 C Generate distance constraints, if the PDB structure is to be regularized.
1192 if (nthread.gt.0) then
1193 call read_threadbase
1196 if (me.eq.king .or. .not. out1file)
1198 if (ns.gt.0 .and. (me.eq.king .or. .not.out1file) ) then
1199 write (iout,'(/a,i3,a)')
1200 & 'The chain contains',ns,' disulfide-bridging cysteines.'
1201 write (iout,'(20i4)') (iss(i),i=1,ns)
1203 write(iout,*)"Running with dynamic disulfide-bond formation"
1205 write (iout,'(/a/)') 'Pre-formed links are:'
1211 write (iout,'(2a,i3,3a,i3,a,3f10.3)')
1212 & restyp(it1),'(',i1,') -- ',restyp(it2),'(',i2,')',dhpb(i),
1218 if (ns.gt.0.and.dyn_ss) then
1222 forcon(i-nss)=forcon(i)
1229 dyn_ss_mask(iss(i))=.true.
1232 if (i2ndstr.gt.0) call secstrp2dihc
1233 c call geom_to_var(nvar,x)
1234 c call etotal(energia(0))
1235 c call enerprint(energia(0))
1236 c call briefout(0,etot)
1238 cd write (iout,'(2(a,i3))') 'NNT',NNT,' NCT',NCT
1239 cd write (iout,'(a)') 'Variable list:'
1240 cd write (iout,'(i4,f10.5)') (i,rad2deg*x(i),i=1,nvar)
1242 if (me.eq.king .or. (fg_rank.eq.0 .and. .not.out1file))
1243 & write (iout,'(//80(1h*)/20x,a,i4,a/80(1h*)//)')
1244 & 'Processor',myrank,': end reading molecular data.'
1249 c--------------------------------------------------------------------------
1250 logical function seq_comp(itypea,itypeb,length)
1252 integer length,itypea(length),itypeb(length)
1255 if (itypea(i).ne.itypeb(i)) then
1263 c-----------------------------------------------------------------------------
1264 subroutine read_bridge
1265 C Read information about disulfide bridges.
1266 implicit real*8 (a-h,o-z)
1267 include 'DIMENSIONS'
1271 include 'COMMON.IOUNITS'
1272 include 'COMMON.GEO'
1273 include 'COMMON.VAR'
1274 include 'COMMON.INTERACT'
1275 include 'COMMON.LOCAL'
1276 include 'COMMON.NAMES'
1277 include 'COMMON.CHAIN'
1278 include 'COMMON.FFIELD'
1279 include 'COMMON.SBRIDGE'
1280 include 'COMMON.HEADER'
1281 include 'COMMON.CONTROL'
1282 include 'COMMON.DBASE'
1283 include 'COMMON.THREAD'
1284 include 'COMMON.TIME1'
1285 include 'COMMON.SETUP'
1286 C Read bridging residues.
1287 read (inp,*) ns,(iss(i),i=1,ns)
1289 if(me.eq.king.or..not.out1file)
1290 & write (iout,*) 'ns=',ns,' iss:',(iss(i),i=1,ns)
1291 C Check whether the specified bridging residues are cystines.
1293 if (itype(iss(i)).ne.1) then
1294 if (me.eq.king.or..not.out1file) write (iout,'(2a,i3,a)')
1295 & 'Do you REALLY think that the residue ',
1296 & restyp(itype(iss(i))),i,
1297 & ' can form a disulfide bridge?!!!'
1298 write (*,'(2a,i3,a)')
1299 & 'Do you REALLY think that the residue ',
1300 & restyp(itype(iss(i))),i,
1301 & ' can form a disulfide bridge?!!!'
1303 call MPI_Finalize(MPI_COMM_WORLD,ierror)
1308 C Read preformed bridges.
1310 read (inp,*) nss,(ihpb(i),jhpb(i),i=1,nss)
1312 & write(iout,*)'nss=',nss,' ihpb,jhpb: ',(ihpb(i),jhpb(i),i=1,nss)
1315 C Check if the residues involved in bridges are in the specified list of
1316 C bridging residues.
1319 if (ihpb(i).eq.ihpb(j).or.ihpb(i).eq.jhpb(j)
1320 & .or.jhpb(i).eq.ihpb(j).or.jhpb(i).eq.jhpb(j)) then
1321 write (iout,'(a,i3,a)') 'Disulfide pair',i,
1322 & ' contains residues present in other pairs.'
1323 write (*,'(a,i3,a)') 'Disulfide pair',i,
1324 & ' contains residues present in other pairs.'
1326 call MPI_Finalize(MPI_COMM_WORLD,ierror)
1332 if (ihpb(i).eq.iss(j)) goto 10
1334 write (iout,'(a,i3,a)') 'Pair',i,' contains unknown cystine.'
1337 if (jhpb(i).eq.iss(j)) goto 20
1339 write (iout,'(a,i3,a)') 'Pair',i,' contains unknown cystine.'
1345 ihpb(i)=ihpb(i)+nres
1346 jhpb(i)=jhpb(i)+nres
1352 c----------------------------------------------------------------------------
1353 subroutine read_x(kanal,*)
1354 implicit real*8 (a-h,o-z)
1355 include 'DIMENSIONS'
1356 include 'COMMON.GEO'
1357 include 'COMMON.VAR'
1358 include 'COMMON.CHAIN'
1359 include 'COMMON.IOUNITS'
1360 include 'COMMON.CONTROL'
1361 include 'COMMON.LOCAL'
1362 include 'COMMON.INTERACT'
1363 c Read coordinates from input
1365 read(kanal,'(8f10.5)',end=10,err=10)
1366 & ((c(l,k),l=1,3),k=1,nres),
1367 & ((c(l,k+nres),l=1,3),k=nnt,nct)
1370 c(j,2*nres)=c(j,nres)
1372 call int_from_cart1(.false.)
1375 dc(j,i)=c(j,i+1)-c(j,i)
1376 dc_norm(j,i)=dc(j,i)*vbld_inv(i+1)
1380 if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then
1382 dc(j,i+nres)=c(j,i+nres)-c(j,i)
1383 dc_norm(j,i+nres)=dc(j,i+nres)*vbld_inv(i+nres)
1391 c----------------------------------------------------------------------------
1392 subroutine read_threadbase
1393 implicit real*8 (a-h,o-z)
1394 include 'DIMENSIONS'
1395 include 'COMMON.IOUNITS'
1396 include 'COMMON.GEO'
1397 include 'COMMON.VAR'
1398 include 'COMMON.INTERACT'
1399 include 'COMMON.LOCAL'
1400 include 'COMMON.NAMES'
1401 include 'COMMON.CHAIN'
1402 include 'COMMON.FFIELD'
1403 include 'COMMON.SBRIDGE'
1404 include 'COMMON.HEADER'
1405 include 'COMMON.CONTROL'
1406 include 'COMMON.DBASE'
1407 include 'COMMON.THREAD'
1408 include 'COMMON.TIME1'
1409 C Read pattern database for threading.
1410 read (icbase,*) nseq
1412 read (icbase,'(i5,2x,a8,2i4)') nres_base(1,i),str_nam(i),
1413 & nres_base(2,i),nres_base(3,i)
1414 read (icbase,'(9f8.3)') ((cart_base(k,j,i),k=1,3),j=1,
1416 c write (iout,'(i5,2x,a8,2i4)') nres_base(1,i),str_nam(i),
1417 c & nres_base(2,i),nres_base(3,i)
1418 c write (iout,'(9f8.3)') ((cart_base(k,j,i),k=1,3),j=1,
1422 if (weidis.eq.0.0D0) weidis=0.1D0
1431 read (inp,*) nexcl,(iexam(1,i),iexam(2,i),i=1,nexcl)
1432 write (iout,'(a,i5)') 'nexcl: ',nexcl
1433 write (iout,'(2i5)') (iexam(1,i),iexam(2,i),i=1,nexcl)
1436 c------------------------------------------------------------------------------
1437 subroutine setup_var
1438 implicit real*8 (a-h,o-z)
1439 include 'DIMENSIONS'
1440 include 'COMMON.IOUNITS'
1441 include 'COMMON.GEO'
1442 include 'COMMON.VAR'
1443 include 'COMMON.INTERACT'
1444 include 'COMMON.LOCAL'
1445 include 'COMMON.NAMES'
1446 include 'COMMON.CHAIN'
1447 include 'COMMON.FFIELD'
1448 include 'COMMON.SBRIDGE'
1449 include 'COMMON.HEADER'
1450 include 'COMMON.CONTROL'
1451 include 'COMMON.DBASE'
1452 include 'COMMON.THREAD'
1453 include 'COMMON.TIME1'
1454 C Set up variable list.
1460 if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then
1462 ialph(i,1)=nvar+nside
1466 if (indphi.gt.0) then
1468 else if (indback.gt.0) then
1473 cd write (iout,'(3i4)') (i,ialph(i,1),ialph(i,2),i=2,nres-1)
1476 c----------------------------------------------------------------------------
1477 subroutine gen_dist_constr
1478 C Generate CA distance constraints.
1479 implicit real*8 (a-h,o-z)
1480 include 'DIMENSIONS'
1481 include 'COMMON.IOUNITS'
1482 include 'COMMON.GEO'
1483 include 'COMMON.VAR'
1484 include 'COMMON.INTERACT'
1485 include 'COMMON.LOCAL'
1486 include 'COMMON.NAMES'
1487 include 'COMMON.CHAIN'
1488 include 'COMMON.FFIELD'
1489 include 'COMMON.SBRIDGE'
1490 include 'COMMON.HEADER'
1491 include 'COMMON.CONTROL'
1492 include 'COMMON.DBASE'
1493 include 'COMMON.THREAD'
1494 include 'COMMON.TIME1'
1495 dimension itype_pdb(maxres)
1496 common /pizda/ itype_pdb
1498 cd print *,'gen_dist_constr: nnt=',nnt,' nct=',nct
1499 cd write (2,*) 'gen_dist_constr: nnt=',nnt,' nct=',nct,
1500 cd & ' nstart_sup',nstart_sup,' nstart_seq',nstart_seq,
1502 do i=nstart_sup,nstart_sup+nsup-1
1503 cd write (2,*) 'i',i,' seq ',restyp(itype(i+nstart_seq-nstart_sup)),
1504 cd & ' seq_pdb', restyp(itype_pdb(i))
1505 do j=i+2,nstart_sup+nsup-1
1507 ihpb(nhpb)=i+nstart_seq-nstart_sup
1508 jhpb(nhpb)=j+nstart_seq-nstart_sup
1510 dhpb(nhpb)=dist(i,j)
1513 cd write (iout,'(a)') 'Distance constraints:'
1518 cd if (ii.gt.nres) then
1523 cd write (iout,'(a,1x,a,i4,3x,a,1x,a,i4,2f10.3)')
1524 cd & restyp(itype(ii)),iden,ii,restyp(itype(jj)),iden,jj,
1525 cd & dhpb(i),forcon(i)
1529 c----------------------------------------------------------------------------
1531 implicit real*8 (a-h,o-z)
1532 include 'DIMENSIONS'
1533 include 'COMMON.MAP'
1534 include 'COMMON.IOUNITS'
1535 character*3 angid(4) /'THE','PHI','ALP','OME'/
1536 character*80 mapcard,ucase
1538 read (inp,'(a)') mapcard
1539 mapcard=ucase(mapcard)
1540 if (index(mapcard,'PHI').gt.0) then
1542 else if (index(mapcard,'THE').gt.0) then
1544 else if (index(mapcard,'ALP').gt.0) then
1546 else if (index(mapcard,'OME').gt.0) then
1549 write(iout,'(a)')'Error - illegal variable spec in MAP card.'
1550 stop 'Error - illegal variable spec in MAP card.'
1552 call readi (mapcard,'RES1',res1(imap),0)
1553 call readi (mapcard,'RES2',res2(imap),0)
1554 if (res1(imap).eq.0) then
1555 res1(imap)=res2(imap)
1556 else if (res2(imap).eq.0) then
1557 res2(imap)=res1(imap)
1559 if(res1(imap)*res2(imap).eq.0 .or. res1(imap).gt.res2(imap))then
1561 & 'Error - illegal definition of variable group in MAP.'
1562 stop 'Error - illegal definition of variable group in MAP.'
1564 call reada(mapcard,'FROM',ang_from(imap),0.0D0)
1565 call reada(mapcard,'TO',ang_to(imap),0.0D0)
1566 call readi(mapcard,'NSTEP',nstep(imap),0)
1567 if (ang_from(imap).eq.ang_to(imap) .or. nstep(imap).eq.0) then
1569 & 'Illegal boundary and/or step size specification in MAP.'
1570 stop 'Illegal boundary and/or step size specification in MAP.'
1575 c----------------------------------------------------------------------------
1577 implicit real*8 (a-h,o-z)
1578 include 'DIMENSIONS'
1579 include 'COMMON.IOUNITS'
1580 include 'COMMON.GEO'
1581 include 'COMMON.CSA'
1582 include 'COMMON.BANK'
1583 include 'COMMON.CONTROL'
1585 character*620 mcmcard
1586 call card_concat(mcmcard)
1588 call readi(mcmcard,'NCONF',nconf,50)
1589 call readi(mcmcard,'NADD',nadd,0)
1590 call readi(mcmcard,'JSTART',jstart,1)
1591 call readi(mcmcard,'JEND',jend,1)
1592 call readi(mcmcard,'NSTMAX',nstmax,500000)
1593 call readi(mcmcard,'N0',n0,1)
1594 call readi(mcmcard,'N1',n1,6)
1595 call readi(mcmcard,'N2',n2,4)
1596 call readi(mcmcard,'N3',n3,0)
1597 call readi(mcmcard,'N4',n4,0)
1598 call readi(mcmcard,'N5',n5,0)
1599 call readi(mcmcard,'N6',n6,10)
1600 call readi(mcmcard,'N7',n7,0)
1601 call readi(mcmcard,'N8',n8,0)
1602 call readi(mcmcard,'N9',n9,0)
1603 call readi(mcmcard,'N14',n14,0)
1604 call readi(mcmcard,'N15',n15,0)
1605 call readi(mcmcard,'N16',n16,0)
1606 call readi(mcmcard,'N17',n17,0)
1607 call readi(mcmcard,'N18',n18,0)
1609 vdisulf=(index(mcmcard,'DYNSS').gt.0)
1611 call readi(mcmcard,'NDIFF',ndiff,2)
1612 call reada(mcmcard,'DIFFCUT',diffcut,0.0d0)
1613 call readi(mcmcard,'IS1',is1,1)
1614 call readi(mcmcard,'IS2',is2,8)
1615 call readi(mcmcard,'NRAN0',nran0,4)
1616 call readi(mcmcard,'NRAN1',nran1,2)
1617 call readi(mcmcard,'IRR',irr,1)
1618 call readi(mcmcard,'NSEED',nseed,20)
1619 call readi(mcmcard,'NTOTAL',ntotal,10000)
1620 call reada(mcmcard,'CUT1',cut1,2.0d0)
1621 call reada(mcmcard,'CUT2',cut2,5.0d0)
1622 call reada(mcmcard,'ESTOP',estop,-3000.0d0)
1623 call readi(mcmcard,'ICMAX',icmax,3)
1624 call readi(mcmcard,'IRESTART',irestart,0)
1625 c!bankt call readi(mcmcard,'NBANKTM',ntbankm,0)
1628 call reada(mcmcard,'DELE',dele,20.0d0)
1629 call reada(mcmcard,'DIFCUT',difcut,720.0d0)
1630 call readi(mcmcard,'IREF',iref,0)
1631 call reada(mcmcard,'RMSCUT',rmscut,4.0d0)
1632 call reada(mcmcard,'PNCCUT',pnccut,0.5d0)
1633 call readi(mcmcard,'NCONF_IN',nconf_in,0)
1634 call reada(mcmcard,'RDIH_BIAS',rdih_bias,0.5d0)
1635 write (iout,*) "NCONF_IN",nconf_in
1638 c----------------------------------------------------------------------------
1639 cfmc subroutine mcmfread
1640 cfmc implicit real*8 (a-h,o-z)
1641 cfmc include 'DIMENSIONS'
1642 cfmc include 'COMMON.MCMF'
1643 cfmc include 'COMMON.IOUNITS'
1644 cfmc include 'COMMON.GEO'
1645 cfmc character*80 ucase
1646 cfmc character*620 mcmcard
1647 cfmc call card_concat(mcmcard)
1649 cfmc call readi(mcmcard,'MAXRANT',maxrant,1000)
1650 cfmc write(iout,*)'MAXRANT=',maxrant
1651 cfmc call readi(mcmcard,'MAXFAM',maxfam,maxfam_p)
1652 cfmc write(iout,*)'MAXFAM=',maxfam
1653 cfmc call readi(mcmcard,'NNET1',nnet1,5)
1654 cfmc write(iout,*)'NNET1=',nnet1
1655 cfmc call readi(mcmcard,'NNET2',nnet2,4)
1656 cfmc write(iout,*)'NNET2=',nnet2
1657 cfmc call readi(mcmcard,'NNET3',nnet3,4)
1658 cfmc write(iout,*)'NNET3=',nnet3
1659 cfmc call readi(mcmcard,'ILASTT',ilastt,0)
1660 cfmc write(iout,*)'ILASTT=',ilastt
1661 cfmc call readi(mcmcard,'MAXSTR',maxstr,maxstr_mcmf)
1662 cfmc write(iout,*)'MAXSTR=',maxstr
1663 cfmc maxstr_f=maxstr/maxfam
1664 cfmc write(iout,*)'MAXSTR_F=',maxstr_f
1665 cfmc call readi(mcmcard,'NMCMF',nmcmf,10)
1666 cfmc write(iout,*)'NMCMF=',nmcmf
1667 cfmc call readi(mcmcard,'IFOCUS',ifocus,nmcmf)
1668 cfmc write(iout,*)'IFOCUS=',ifocus
1669 cfmc call readi(mcmcard,'NLOCMCMF',nlocmcmf,1000)
1670 cfmc write(iout,*)'NLOCMCMF=',nlocmcmf
1671 cfmc call readi(mcmcard,'INTPRT',intprt,1000)
1672 cfmc write(iout,*)'INTPRT=',intprt
1673 cfmc call readi(mcmcard,'IPRT',iprt,100)
1674 cfmc write(iout,*)'IPRT=',iprt
1675 cfmc call readi(mcmcard,'IMAXTR',imaxtr,100)
1676 cfmc write(iout,*)'IMAXTR=',imaxtr
1677 cfmc call readi(mcmcard,'MAXEVEN',maxeven,1000)
1678 cfmc write(iout,*)'MAXEVEN=',maxeven
1679 cfmc call readi(mcmcard,'MAXEVEN1',maxeven1,3)
1680 cfmc write(iout,*)'MAXEVEN1=',maxeven1
1681 cfmc call readi(mcmcard,'INIMIN',inimin,200)
1682 cfmc write(iout,*)'INIMIN=',inimin
1683 cfmc call readi(mcmcard,'NSTEPMCMF',nstepmcmf,10)
1684 cfmc write(iout,*)'NSTEPMCMF=',nstepmcmf
1685 cfmc call readi(mcmcard,'NTHREAD',nthread,5)
1686 cfmc write(iout,*)'NTHREAD=',nthread
1687 cfmc call readi(mcmcard,'MAXSTEPMCMF',maxstepmcmf,2500)
1688 cfmc write(iout,*)'MAXSTEPMCMF=',maxstepmcmf
1689 cfmc call readi(mcmcard,'MAXPERT',maxpert,9)
1690 cfmc write(iout,*)'MAXPERT=',maxpert
1691 cfmc call readi(mcmcard,'IRMSD',irmsd,1)
1692 cfmc write(iout,*)'IRMSD=',irmsd
1693 cfmc call reada(mcmcard,'DENEMIN',denemin,0.01D0)
1694 cfmc write(iout,*)'DENEMIN=',denemin
1695 cfmc call reada(mcmcard,'RCUT1S',rcut1s,3.5D0)
1696 cfmc write(iout,*)'RCUT1S=',rcut1s
1697 cfmc call reada(mcmcard,'RCUT1E',rcut1e,2.0D0)
1698 cfmc write(iout,*)'RCUT1E=',rcut1e
1699 cfmc call reada(mcmcard,'RCUT2S',rcut2s,0.5D0)
1700 cfmc write(iout,*)'RCUT2S=',rcut2s
1701 cfmc call reada(mcmcard,'RCUT2E',rcut2e,0.1D0)
1702 cfmc write(iout,*)'RCUT2E=',rcut2e
1703 cfmc call reada(mcmcard,'DPERT1',d_pert1,180.0D0)
1704 cfmc write(iout,*)'DPERT1=',d_pert1
1705 cfmc call reada(mcmcard,'DPERT1A',d_pert1a,180.0D0)
1706 cfmc write(iout,*)'DPERT1A=',d_pert1a
1707 cfmc call reada(mcmcard,'DPERT2',d_pert2,90.0D0)
1708 cfmc write(iout,*)'DPERT2=',d_pert2
1709 cfmc call reada(mcmcard,'DPERT2A',d_pert2a,45.0D0)
1710 cfmc write(iout,*)'DPERT2A=',d_pert2a
1711 cfmc call reada(mcmcard,'DPERT2B',d_pert2b,90.0D0)
1712 cfmc write(iout,*)'DPERT2B=',d_pert2b
1713 cfmc call reada(mcmcard,'DPERT2C',d_pert2c,60.0D0)
1714 cfmc write(iout,*)'DPERT2C=',d_pert2c
1715 cfmc d_pert1=deg2rad*d_pert1
1716 cfmc d_pert1a=deg2rad*d_pert1a
1717 cfmc d_pert2=deg2rad*d_pert2
1718 cfmc d_pert2a=deg2rad*d_pert2a
1719 cfmc d_pert2b=deg2rad*d_pert2b
1720 cfmc d_pert2c=deg2rad*d_pert2c
1721 cfmc call reada(mcmcard,'KT_MCMF1',kt_mcmf1,1.0D0)
1722 cfmc write(iout,*)'KT_MCMF1=',kt_mcmf1
1723 cfmc call reada(mcmcard,'KT_MCMF2',kt_mcmf2,1.0D0)
1724 cfmc write(iout,*)'KT_MCMF2=',kt_mcmf2
1725 cfmc call reada(mcmcard,'DKT_MCMF1',dkt_mcmf1,10.0D0)
1726 cfmc write(iout,*)'DKT_MCMF1=',dkt_mcmf1
1727 cfmc call reada(mcmcard,'DKT_MCMF2',dkt_mcmf2,1.0D0)
1728 cfmc write(iout,*)'DKT_MCMF2=',dkt_mcmf2
1729 cfmc call reada(mcmcard,'RCUTINI',rcutini,3.5D0)
1730 cfmc write(iout,*)'RCUTINI=',rcutini
1731 cfmc call reada(mcmcard,'GRAT',grat,0.5D0)
1732 cfmc write(iout,*)'GRAT=',grat
1733 cfmc call reada(mcmcard,'BIAS_MCMF',bias_mcmf,0.0D0)
1734 cfmc write(iout,*)'BIAS_MCMF=',bias_mcmf
1738 c----------------------------------------------------------------------------
1740 implicit real*8 (a-h,o-z)
1741 include 'DIMENSIONS'
1742 include 'COMMON.MCM'
1743 include 'COMMON.MCE'
1744 include 'COMMON.IOUNITS'
1746 character*320 mcmcard
1747 call card_concat(mcmcard)
1748 call readi(mcmcard,'MAXACC',maxacc,100)
1749 call readi(mcmcard,'MAX_MCM_IT',max_mcm_it,10000)
1750 call readi(mcmcard,'MAXTRIAL',maxtrial,100)
1751 call readi(mcmcard,'MAXTRIAL_ITER',maxtrial_iter,1000)
1752 call readi(mcmcard,'MAXREPM',maxrepm,200)
1753 call reada(mcmcard,'RANFRACT',RanFract,0.5D0)
1754 call reada(mcmcard,'POOL_FRACT',pool_fraction,0.01D0)
1755 call reada(mcmcard,'OVERLAP',overlap_cut,1.0D3)
1756 call reada(mcmcard,'E_UP',e_up,5.0D0)
1757 call reada(mcmcard,'DELTE',delte,0.1D0)
1758 call readi(mcmcard,'NSWEEP',nsweep,5)
1759 call readi(mcmcard,'NSTEPH',nsteph,0)
1760 call readi(mcmcard,'NSTEPC',nstepc,0)
1761 call reada(mcmcard,'TMIN',tmin,298.0D0)
1762 call reada(mcmcard,'TMAX',tmax,298.0D0)
1763 call readi(mcmcard,'NWINDOW',nwindow,0)
1764 call readi(mcmcard,'PRINT_MC',print_mc,0)
1765 print_stat=(index(mcmcard,'NO_PRINT_STAT').le.0)
1766 print_int=(index(mcmcard,'NO_PRINT_INT').le.0)
1767 ent_read=(index(mcmcard,'ENT_READ').gt.0)
1768 call readi(mcmcard,'SAVE_FREQ',save_frequency,1000)
1769 call readi(mcmcard,'MESSAGE_FREQ',message_frequency,1000)
1770 call readi(mcmcard,'POOL_READ_FREQ',pool_read_freq,5000)
1771 call readi(mcmcard,'POOL_SAVE_FREQ',pool_save_freq,1000)
1772 call readi(mcmcard,'PRINT_FREQ',print_freq,1000)
1773 if (nwindow.gt.0) then
1774 read (inp,*) (winstart(i),winend(i),i=1,nwindow)
1776 winlen(i)=winend(i)-winstart(i)+1
1779 if (tmax.lt.tmin) tmax=tmin
1780 if (tmax.eq.tmin) then
1784 if (nstepc.gt.0 .and. nsteph.gt.0) then
1785 tsteph=(tmax/tmin)**(1.0D0/(nsteph+0.0D0))
1786 tstepc=(tmax/tmin)**(1.0D0/(nstepc+0.0D0))
1788 C Probabilities of different move types
1789 sumpro_type(0)=0.0D0
1790 call reada(mcmcard,'MULTI_BOND',sumpro_type(1),1.0d0)
1791 call reada(mcmcard,'ONE_ANGLE' ,sumpro_type(2),2.0d0)
1792 sumpro_type(2)=sumpro_type(1)+sumpro_type(2)
1793 call reada(mcmcard,'THETA' ,sumpro_type(3),0.0d0)
1794 sumpro_type(3)=sumpro_type(2)+sumpro_type(3)
1795 call reada(mcmcard,'SIDE_CHAIN',sumpro_type(4),0.5d0)
1796 sumpro_type(4)=sumpro_type(3)+sumpro_type(4)
1798 print *,'i',i,' sumprotype',sumpro_type(i)
1799 sumpro_type(i)=sumpro_type(i)/sumpro_type(MaxMoveType)
1800 print *,'i',i,' sumprotype',sumpro_type(i)
1804 c----------------------------------------------------------------------------
1805 subroutine read_minim
1806 implicit real*8 (a-h,o-z)
1807 include 'DIMENSIONS'
1808 include 'COMMON.MINIM'
1809 include 'COMMON.IOUNITS'
1811 character*320 minimcard
1812 call card_concat(minimcard)
1813 call readi(minimcard,'MAXMIN',maxmin,2000)
1814 call readi(minimcard,'MAXFUN',maxfun,5000)
1815 call readi(minimcard,'MINMIN',minmin,maxmin)
1816 call readi(minimcard,'MINFUN',minfun,maxmin)
1817 call reada(minimcard,'TOLF',tolf,1.0D-2)
1818 call reada(minimcard,'RTOLF',rtolf,1.0D-4)
1819 print_min_stat=min0(index(minimcard,'PRINT_MIN_STAT'),1)
1820 print_min_res=min0(index(minimcard,'PRINT_MIN_RES'),1)
1821 print_min_ini=min0(index(minimcard,'PRINT_MIN_INI'),1)
1822 write (iout,'(/80(1h*)/20x,a/80(1h*))')
1823 & 'Options in energy minimization:'
1824 write (iout,'(4(a,i5),a,1pe14.5,a,1pe14.5)')
1825 & 'MaxMin:',MaxMin,' MaxFun:',MaxFun,
1826 & 'MinMin:',MinMin,' MinFun:',MinFun,
1827 & ' TolF:',TolF,' RTolF:',RTolF
1830 c----------------------------------------------------------------------------
1831 subroutine read_angles(kanal,*)
1832 implicit real*8 (a-h,o-z)
1833 include 'DIMENSIONS'
1834 include 'COMMON.GEO'
1835 include 'COMMON.VAR'
1836 include 'COMMON.CHAIN'
1837 include 'COMMON.IOUNITS'
1838 include 'COMMON.CONTROL'
1839 c Read angles from input
1841 read (kanal,*,err=10,end=10) (theta(i),i=3,nres)
1842 read (kanal,*,err=10,end=10) (phi(i),i=4,nres)
1843 read (kanal,*,err=10,end=10) (alph(i),i=2,nres-1)
1844 read (kanal,*,err=10,end=10) (omeg(i),i=2,nres-1)
1847 c 9/7/01 avoid 180 deg valence angle
1848 if (theta(i).gt.179.99d0) theta(i)=179.99d0
1850 theta(i)=deg2rad*theta(i)
1851 phi(i)=deg2rad*phi(i)
1852 alph(i)=deg2rad*alph(i)
1853 omeg(i)=deg2rad*omeg(i)
1858 c----------------------------------------------------------------------------
1859 subroutine reada(rekord,lancuch,wartosc,default)
1861 character*(*) rekord,lancuch
1862 double precision wartosc,default
1865 iread=index(rekord,lancuch)
1866 if (iread.eq.0) then
1870 iread=iread+ilen(lancuch)+1
1871 read (rekord(iread:),*,err=10,end=10) wartosc
1876 c----------------------------------------------------------------------------
1877 subroutine readi(rekord,lancuch,wartosc,default)
1879 character*(*) rekord,lancuch
1880 integer wartosc,default
1883 iread=index(rekord,lancuch)
1884 if (iread.eq.0) then
1888 iread=iread+ilen(lancuch)+1
1889 read (rekord(iread:),*,err=10,end=10) wartosc
1894 c----------------------------------------------------------------------------
1895 subroutine multreadi(rekord,lancuch,tablica,dim,default)
1898 integer tablica(dim),default
1899 character*(*) rekord,lancuch
1906 iread=index(rekord,lancuch(:ilen(lancuch))//"=")
1907 if (iread.eq.0) return
1908 iread=iread+ilen(lancuch)+1
1909 read (rekord(iread:),*,end=10,err=10) (tablica(i),i=1,dim)
1912 c----------------------------------------------------------------------------
1913 subroutine multreada(rekord,lancuch,tablica,dim,default)
1916 double precision tablica(dim),default
1917 character*(*) rekord,lancuch
1924 iread=index(rekord,lancuch(:ilen(lancuch))//"=")
1925 if (iread.eq.0) return
1926 iread=iread+ilen(lancuch)+1
1927 read (rekord(iread:),*,end=10,err=10) (tablica(i),i=1,dim)
1930 c----------------------------------------------------------------------------
1931 subroutine openunits
1932 implicit real*8 (a-h,o-z)
1933 include 'DIMENSIONS'
1936 character*16 form,nodename
1939 include 'COMMON.SETUP'
1940 include 'COMMON.IOUNITS'
1942 include 'COMMON.CONTROL'
1943 integer lenpre,lenpot,ilen,lentmp
1945 character*3 out1file_text,ucase
1948 c print *,"Processor",myrank,"fg_rank",fg_rank," entered openunits"
1949 call getenv_loc("PREFIX",prefix)
1951 call getenv_loc("POT",pot)
1952 call getenv_loc("DIRTMP",tmpdir)
1953 call getenv_loc("CURDIR",curdir)
1954 call getenv_loc("OUT1FILE",out1file_text)
1955 c print *,"Processor",myrank,"fg_rank",fg_rank," did GETENV"
1956 out1file_text=ucase(out1file_text)
1957 if (out1file_text(1:1).eq."Y") then
1960 out1file=fg_rank.gt.0
1965 if (lentmp.gt.0) then
1966 write (*,'(80(1h!))')
1967 write (*,'(a,19x,a,19x,a)') "!"," A T T E N T I O N ","!"
1968 write (*,'(80(1h!))')
1969 write (*,*)"All output files will be on node /tmp directory."
1971 call MPI_GET_PROCESSOR_NAME( nodename, nodelen, IERROR )
1972 if (me.eq.king) then
1973 write (*,*) "The master node is ",nodename
1974 else if (fg_rank.eq.0) then
1975 write (*,*) "I am the CG slave node ",nodename
1977 write (*,*) "I am the FG slave node ",nodename
1980 PREFIX = tmpdir(:lentmp)//'/'//prefix(:lenpre)
1981 lenpre = lentmp+lenpre+1
1983 entname=prefix(:lenpre)//'_'//pot(:lenpot)//'.entr'
1984 C Get the names and open the input files
1985 #if defined(WINIFL) || defined(WINPGI)
1986 open(1,file=pref_orig(:ilen(pref_orig))//
1987 & '.inp',status='old',readonly,shared)
1988 open (9,file=prefix(:ilen(prefix))//'.intin',status='unknown')
1989 C open (18,file=prefix(:ilen(prefix))//'.entin',status='unknown')
1990 C Get parameter filenames and open the parameter files.
1991 call getenv_loc('BONDPAR',bondname)
1992 open (ibond,file=bondname,status='old',readonly,shared)
1993 call getenv_loc('THETPAR',thetname)
1994 open (ithep,file=thetname,status='old',readonly,shared)
1995 call getenv_loc('ROTPAR',rotname)
1996 open (irotam,file=rotname,status='old',readonly,shared)
1997 call getenv_loc('TORPAR',torname)
1998 open (itorp,file=torname,status='old',readonly,shared)
1999 call getenv_loc('TORDPAR',tordname)
2000 open (itordp,file=tordname,status='old',readonly,shared)
2001 call getenv_loc('FOURIER',fouriername)
2002 open (ifourier,file=fouriername,status='old',readonly,shared)
2003 call getenv_loc('ELEPAR',elename)
2004 open (ielep,file=elename,status='old',readonly,shared)
2005 call getenv_loc('SIDEPAR',sidename)
2006 open (isidep,file=sidename,status='old',readonly,shared)
2007 #elif (defined CRAY) || (defined AIX)
2008 open(1,file=pref_orig(:ilen(pref_orig))//'.inp',status='old',
2010 c print *,"Processor",myrank," opened file 1"
2011 open (9,file=prefix(:ilen(prefix))//'.intin',status='unknown')
2012 c print *,"Processor",myrank," opened file 9"
2013 C open (18,file=prefix(:ilen(prefix))//'.entin',status='unknown')
2014 C Get parameter filenames and open the parameter files.
2015 call getenv_loc('BONDPAR',bondname)
2016 open (ibond,file=bondname,status='old',action='read')
2017 c print *,"Processor",myrank," opened file IBOND"
2018 call getenv_loc('THETPAR',thetname)
2019 open (ithep,file=thetname,status='old',action='read')
2020 c print *,"Processor",myrank," opened file ITHEP"
2021 call getenv_loc('ROTPAR',rotname)
2022 open (irotam,file=rotname,status='old',action='read')
2023 c print *,"Processor",myrank," opened file IROTAM"
2024 call getenv_loc('TORPAR',torname)
2025 open (itorp,file=torname,status='old',action='read')
2026 c print *,"Processor",myrank," opened file ITORP"
2027 call getenv_loc('TORDPAR',tordname)
2028 open (itordp,file=tordname,status='old',action='read')
2029 c print *,"Processor",myrank," opened file ITORDP"
2030 call getenv_loc('SCCORPAR',sccorname)
2031 open (isccor,file=sccorname,status='old',action='read')
2032 c print *,"Processor",myrank," opened file ISCCOR"
2033 call getenv_loc('FOURIER',fouriername)
2034 open (ifourier,file=fouriername,status='old',action='read')
2035 c print *,"Processor",myrank," opened file IFOURIER"
2036 call getenv_loc('ELEPAR',elename)
2037 open (ielep,file=elename,status='old',action='read')
2038 c print *,"Processor",myrank," opened file IELEP"
2039 call getenv_loc('SIDEPAR',sidename)
2040 open (isidep,file=sidename,status='old',action='read')
2041 c print *,"Processor",myrank," opened file ISIDEP"
2042 c print *,"Processor",myrank," opened parameter files"
2044 open(1,file=pref_orig(:ilen(pref_orig))//'.inp',status='old')
2045 open (9,file=prefix(:ilen(prefix))//'.intin',status='unknown')
2046 C open (18,file=prefix(:ilen(prefix))//'.entin',status='unknown')
2047 C Get parameter filenames and open the parameter files.
2048 call getenv_loc('BONDPAR',bondname)
2049 open (ibond,file=bondname,status='old')
2050 call getenv_loc('THETPAR',thetname)
2051 open (ithep,file=thetname,status='old')
2052 call getenv_loc('ROTPAR',rotname)
2053 open (irotam,file=rotname,status='old')
2054 call getenv_loc('TORPAR',torname)
2055 open (itorp,file=torname,status='old')
2056 call getenv_loc('TORDPAR',tordname)
2057 open (itordp,file=tordname,status='old')
2058 call getenv_loc('SCCORPAR',sccorname)
2059 open (isccor,file=sccorname,status='old')
2060 call getenv_loc('FOURIER',fouriername)
2061 open (ifourier,file=fouriername,status='old')
2062 call getenv_loc('ELEPAR',elename)
2063 open (ielep,file=elename,status='old')
2064 call getenv_loc('SIDEPAR',sidename)
2065 open (isidep,file=sidename,status='old')
2067 open(1,file=pref_orig(:ilen(pref_orig))//'.inp',status='old',
2069 open (9,file=prefix(:ilen(prefix))//'.intin',status='unknown')
2070 C open (18,file=prefix(:ilen(prefix))//'.entin',status='unknown')
2071 C Get parameter filenames and open the parameter files.
2072 call getenv_loc('BONDPAR',bondname)
2073 open (ibond,file=bondname,status='old',readonly)
2074 call getenv_loc('THETPAR',thetname)
2075 open (ithep,file=thetname,status='old',readonly)
2076 call getenv_loc('ROTPAR',rotname)
2077 open (irotam,file=rotname,status='old',readonly)
2078 call getenv_loc('TORPAR',torname)
2079 open (itorp,file=torname,status='old',readonly)
2080 call getenv_loc('TORDPAR',tordname)
2081 open (itordp,file=tordname,status='old',readonly)
2082 call getenv_loc('SCCORPAR',sccorname)
2083 open (isccor,file=sccorname,status='old',readonly)
2085 call getenv_loc('THETPARPDB',thetname_pdb)
2086 print *,"thetname_pdb ",thetname_pdb
2087 open (ithep_pdb,file=thetname_pdb,status='old',action='read')
2088 print *,ithep_pdb," opened"
2090 call getenv_loc('FOURIER',fouriername)
2091 open (ifourier,file=fouriername,status='old',readonly)
2092 call getenv_loc('ELEPAR',elename)
2093 open (ielep,file=elename,status='old',readonly)
2094 call getenv_loc('SIDEPAR',sidename)
2095 open (isidep,file=sidename,status='old',readonly)
2096 call getenv_loc('LIPTRANPAR',liptranname)
2097 open (iliptranpar,file=liptranname,status='old',action='read')
2099 call getenv_loc('ROTPARPDB',rotname_pdb)
2100 open (irotam_pdb,file=rotname_pdb,status='old',action='read')
2105 C 8/9/01 In the newest version SCp interaction constants are read from a file
2106 C Use -DOLDSCP to use hard-coded constants instead.
2108 call getenv_loc('SCPPAR',scpname)
2109 #if defined(WINIFL) || defined(WINPGI)
2110 open (iscpp,file=scpname,status='old',readonly,shared)
2111 #elif (defined CRAY) || (defined AIX)
2112 open (iscpp,file=scpname,status='old',action='read')
2114 open (iscpp,file=scpname,status='old')
2116 open (iscpp,file=scpname,status='old',readonly)
2119 call getenv_loc('PATTERN',patname)
2120 #if defined(WINIFL) || defined(WINPGI)
2121 open (icbase,file=patname,status='old',readonly,shared)
2122 #elif (defined CRAY) || (defined AIX)
2123 open (icbase,file=patname,status='old',action='read')
2125 open (icbase,file=patname,status='old')
2127 open (icbase,file=patname,status='old',readonly)
2130 C Open output file only for CG processes
2131 c print *,"Processor",myrank," fg_rank",fg_rank
2132 if (fg_rank.eq.0) then
2134 if (nodes.eq.1) then
2137 npos = dlog10(dfloat(nodes-1))+1
2139 if (npos.lt.3) npos=3
2140 write (liczba,'(i1)') npos
2141 form = '(bz,i'//liczba(:ilen(liczba))//'.'//liczba(:ilen(liczba))
2143 write (liczba,form) me
2144 outname=prefix(:lenpre)//'.out_'//pot(:lenpot)//
2145 & liczba(:ilen(liczba))
2146 intname=prefix(:lenpre)//'_'//pot(:lenpot)//liczba(:ilen(liczba))
2148 pdbname=prefix(:lenpre)//'_'//pot(:lenpot)//liczba(:ilen(liczba))
2150 mol2name=prefix(:lenpre)//'_'//pot(:lenpot)//
2151 & liczba(:ilen(liczba))//'.mol2'
2152 statname=prefix(:lenpre)//'_'//pot(:lenpot)//
2153 & liczba(:ilen(liczba))//'.stat'
2155 & call copy_to_tmp(pref_orig(:ilen(pref_orig))//'_'//pot(:lenpot)
2156 & //liczba(:ilen(liczba))//'.stat')
2157 rest2name=prefix(:ilen(prefix))//"_"//liczba(:ilen(liczba))
2160 qname=prefix(:lenpre)//'_'//pot(:lenpot)//
2161 & liczba(:ilen(liczba))//'.const'
2166 outname=prefix(:lenpre)//'.out_'//pot(:lenpot)
2167 intname=prefix(:lenpre)//'_'//pot(:lenpot)//'.int'
2168 pdbname=prefix(:lenpre)//'_'//pot(:lenpot)//'.pdb'
2169 mol2name=prefix(:lenpre)//'_'//pot(:lenpot)//'.mol2'
2170 statname=prefix(:lenpre)//'_'//pot(:lenpot)//'.stat'
2172 & call copy_to_tmp(pref_orig(:ilen(pref_orig))//'_'//pot(:lenpot)
2174 rest2name=prefix(:ilen(prefix))//'.rst'
2176 qname=prefix(:lenpre)//'_'//pot(:lenpot)//'.const'
2179 #if defined(AIX) || defined(PGI)
2180 if (me.eq.king .or. .not. out1file)
2181 & open(iout,file=outname,status='unknown')
2183 if (fg_rank.gt.0) then
2184 write (liczba,'(i3.3)') myrank/nfgtasks
2185 write (ll,'(bz,i3.3)') fg_rank
2186 open(iout,file="debug"//liczba(:ilen(liczba))//"."//ll,
2191 open(igeom,file=intname,status='unknown',position='append')
2192 open(ipdb,file=pdbname,status='unknown')
2193 open(imol2,file=mol2name,status='unknown')
2194 open(istat,file=statname,status='unknown',position='append')
2196 c1out open(iout,file=outname,status='unknown')
2199 if (me.eq.king .or. .not.out1file)
2200 & open(iout,file=outname,status='unknown')
2202 if (fg_rank.gt.0) then
2203 write (liczba,'(i3.3)') myrank/nfgtasks
2204 write (ll,'(bz,i3.3)') fg_rank
2205 open(iout,file="debug"//liczba(:ilen(liczba))//"."//ll,
2210 open(igeom,file=intname,status='unknown',access='append')
2211 open(ipdb,file=pdbname,status='unknown')
2212 open(imol2,file=mol2name,status='unknown')
2213 open(istat,file=statname,status='unknown',access='append')
2215 c1out open(iout,file=outname,status='unknown')
2218 csa_rbank=prefix(:lenpre)//'.CSA.rbank'
2219 csa_seed=prefix(:lenpre)//'.CSA.seed'
2220 csa_history=prefix(:lenpre)//'.CSA.history'
2221 csa_bank=prefix(:lenpre)//'.CSA.bank'
2222 csa_bank1=prefix(:lenpre)//'.CSA.bank1'
2223 csa_alpha=prefix(:lenpre)//'.CSA.alpha'
2224 csa_alpha1=prefix(:lenpre)//'.CSA.alpha1'
2225 c!bankt csa_bankt=prefix(:lenpre)//'.CSA.bankt'
2226 csa_int=prefix(:lenpre)//'.int'
2227 csa_bank_reminimized=prefix(:lenpre)//'.CSA.bank_reminimized'
2228 csa_native_int=prefix(:lenpre)//'.CSA.native.int'
2229 csa_in=prefix(:lenpre)//'.CSA.in'
2230 c print *,"Processor",myrank,"fg_rank",fg_rank," opened files"
2233 write (iout,'(80(1h-))')
2234 write (iout,'(30x,a)') "FILE ASSIGNMENT"
2235 write (iout,'(80(1h-))')
2236 write (iout,*) "Input file : ",
2237 & pref_orig(:ilen(pref_orig))//'.inp'
2238 write (iout,*) "Output file : ",
2239 & outname(:ilen(outname))
2241 write (iout,*) "Sidechain potential file : ",
2242 & sidename(:ilen(sidename))
2244 write (iout,*) "SCp potential file : ",
2245 & scpname(:ilen(scpname))
2247 write (iout,*) "Electrostatic potential file : ",
2248 & elename(:ilen(elename))
2249 write (iout,*) "Cumulant coefficient file : ",
2250 & fouriername(:ilen(fouriername))
2251 write (iout,*) "Torsional parameter file : ",
2252 & torname(:ilen(torname))
2253 write (iout,*) "Double torsional parameter file : ",
2254 & tordname(:ilen(tordname))
2255 write (iout,*) "SCCOR parameter file : ",
2256 & sccorname(:ilen(sccorname))
2257 write (iout,*) "Bond & inertia constant file : ",
2258 & bondname(:ilen(bondname))
2259 write (iout,*) "Bending parameter file : ",
2260 & thetname(:ilen(thetname))
2261 write (iout,*) "Rotamer parameter file : ",
2262 & rotname(:ilen(rotname))
2263 write (iout,*) "Thetpdb parameter file : ",
2264 & thetname_pdb(:ilen(thetname_pdb))
2265 write (iout,*) "Threading database : ",
2266 & patname(:ilen(patname))
2268 &write (iout,*)" DIRTMP : ",
2270 write (iout,'(80(1h-))')
2274 c----------------------------------------------------------------------------
2275 subroutine card_concat(card)
2276 implicit real*8 (a-h,o-z)
2277 include 'DIMENSIONS'
2278 include 'COMMON.IOUNITS'
2280 character*80 karta,ucase
2282 read (inp,'(a)') karta
2285 do while (karta(80:80).eq.'&')
2286 card=card(:ilen(card)+1)//karta(:79)
2287 read (inp,'(a)') karta
2290 card=card(:ilen(card)+1)//karta
2293 c----------------------------------------------------------------------------------
2295 implicit real*8 (a-h,o-z)
2296 include 'DIMENSIONS'
2297 include 'COMMON.CHAIN'
2298 include 'COMMON.IOUNITS'
2300 open(irest2,file=rest2name,status='unknown')
2301 read(irest2,*) totT,EK,potE,totE,t_bath
2304 read(irest2,'(3e15.5)') (d_t(j,i),j=1,3)
2307 read(irest2,'(3e15.5)') (dc(j,i),j=1,3)
2310 read (irest2,*) iset
2315 c---------------------------------------------------------------------------------
2316 subroutine read_fragments
2317 implicit real*8 (a-h,o-z)
2318 include 'DIMENSIONS'
2322 include 'COMMON.SETUP'
2323 include 'COMMON.CHAIN'
2324 include 'COMMON.IOUNITS'
2326 include 'COMMON.CONTROL'
2327 read(inp,*) nset,nfrag,npair,nfrag_back
2328 if(me.eq.king.or..not.out1file)
2329 & write(iout,*) "nset",nset," nfrag",nfrag," npair",npair,
2330 & " nfrag_back",nfrag_back
2332 read(inp,*) mset(iset)
2334 read(inp,*) wfrag(i,iset),ifrag(1,i,iset),ifrag(2,i,iset),
2336 if(me.eq.king.or..not.out1file)
2337 & write(iout,*) "R ",i,wfrag(i,iset),ifrag(1,i,iset),
2338 & ifrag(2,i,iset), qinfrag(i,iset)
2341 read(inp,*) wpair(i,iset),ipair(1,i,iset),ipair(2,i,iset),
2343 if(me.eq.king.or..not.out1file)
2344 & write(iout,*) "R ",i,wpair(i,iset),ipair(1,i,iset),
2345 & ipair(2,i,iset), qinpair(i,iset)
2348 read(inp,*) wfrag_back(1,i,iset),wfrag_back(2,i,iset),
2349 & wfrag_back(3,i,iset),
2350 & ifrag_back(1,i,iset),ifrag_back(2,i,iset)
2351 if(me.eq.king.or..not.out1file)
2352 & write(iout,*) "A",i,wfrag_back(1,i,iset),wfrag_back(2,i,iset),
2353 & wfrag_back(3,i,iset),ifrag_back(1,i,iset),ifrag_back(2,i,iset)
2358 C---------------------------------------------------------------------------
2359 subroutine read_afminp
2360 implicit real*8 (a-h,o-z)
2361 include 'DIMENSIONS'
2365 include 'COMMON.SETUP'
2366 include 'COMMON.CONTROL'
2367 include 'COMMON.CHAIN'
2368 include 'COMMON.IOUNITS'
2369 include 'COMMON.SBRIDGE'
2370 character*320 afmcard
2372 call card_concat(afmcard)
2373 call readi(afmcard,"BEG",afmbeg,0)
2374 call readi(afmcard,"END",afmend,0)
2375 call reada(afmcard,"FORCE",forceAFMconst,0.0d0)
2376 call reada(afmcard,"VEL",velAFMconst,0.0d0)
2377 print *,'FORCE=' ,forceAFMconst
2378 CCCC NOW PROPERTIES FOR AFM
2381 distafminit=(c(i,afmend)-c(i,afmbeg))**2+distafminit
2383 distafminit=dsqrt(distafminit)
2384 print *,'initdist',distafminit
2388 c-------------------------------------------------------------------------------
2389 subroutine read_dist_constr
2390 implicit real*8 (a-h,o-z)
2391 include 'DIMENSIONS'
2395 include 'COMMON.SETUP'
2396 include 'COMMON.CONTROL'
2397 include 'COMMON.CHAIN'
2398 include 'COMMON.IOUNITS'
2399 include 'COMMON.SBRIDGE'
2400 integer ifrag_(2,100),ipair_(2,100)
2401 double precision wfrag_(100),wpair_(100)
2402 character*500 controlcard
2404 write (iout,*) "Calling read_dist_constr"
2405 c write (iout,*) "nres",nres," nstart_sup",nstart_sup," nsup",nsup
2407 call card_concat(controlcard)
2408 call readi(controlcard,"NFRAG",nfrag_,0)
2409 call readi(controlcard,"NPAIR",npair_,0)
2410 call readi(controlcard,"NDIST",ndist_,0)
2411 call reada(controlcard,'DIST_CUT',dist_cut,5.0d0)
2412 call multreadi(controlcard,"IFRAG",ifrag_(1,1),2*nfrag_,0)
2413 call multreadi(controlcard,"IPAIR",ipair_(1,1),2*npair_,0)
2414 call multreada(controlcard,"WFRAG",wfrag_(1),nfrag_,0.0d0)
2415 call multreada(controlcard,"WPAIR",wpair_(1),npair_,0.0d0)
2416 c write (iout,*) "NFRAG",nfrag_," NPAIR",npair_," NDIST",ndist_
2417 c write (iout,*) "IFRAG"
2419 c write (iout,*) i,ifrag_(1,i),ifrag_(2,i),wfrag_(i)
2421 c write (iout,*) "IPAIR"
2423 c write (iout,*) i,ipair_(1,i),ipair_(2,i),wpair_(i)
2427 if (ifrag_(1,i).lt.nstart_sup) ifrag_(1,i)=nstart_sup
2428 if (ifrag_(2,i).gt.nstart_sup+nsup-1)
2429 & ifrag_(2,i)=nstart_sup+nsup-1
2430 c write (iout,*) i,ifrag_(1,i),ifrag_(2,i),wfrag_(i)
2432 if (wfrag_(i).gt.0.0d0) then
2433 do j=ifrag_(1,i),ifrag_(2,i)-1
2434 do k=j+1,ifrag_(2,i)
2435 c write (iout,*) "j",j," k",k
2437 if (constr_dist.eq.1) then
2442 forcon(nhpb)=wfrag_(i)
2443 else if (constr_dist.eq.2) then
2444 if (ddjk.le.dist_cut) then
2449 forcon(nhpb)=wfrag_(i)
2456 forcon(nhpb)=wfrag_(i)*dexp(-0.5d0*(ddjk/dist_cut)**2)
2459 if (.not.out1file .or. me.eq.king)
2460 & write (iout,'(a,3i5,f8.2,1pe12.2)') "+dist.constr ",
2461 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
2463 write (iout,'(a,3i5,f8.2,1pe12.2)') "+dist.constr ",
2464 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
2471 if (wpair_(i).gt.0.0d0) then
2479 do j=ifrag_(1,ii),ifrag_(2,ii)
2480 do k=ifrag_(1,jj),ifrag_(2,jj)
2484 forcon(nhpb)=wpair_(i)
2485 dhpb(nhpb)=dist(j,k)
2487 if (.not.out1file .or. me.eq.king)
2488 & write (iout,'(a,3i5,f8.2,f10.1)') "+dist.constr ",
2489 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
2491 write (iout,'(a,3i5,f8.2,f10.1)') "+dist.constr ",
2492 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
2500 if (constr_dist.eq.11) then
2501 read (inp,*) ihpb(nhpb+1),jhpb(nhpb+1),dhpb(i),dhpb1(i),
2502 & ibecarb(i),forcon(nhpb+1),fordepth(nhpb+1)
2503 fordepth(nhpb+1)=fordepth(nhpb+1)/forcon(nhpb+1)
2506 read (inp,*) ihpb(nhpb+1),jhpb(nhpb+1),dhpb(i),dhpb1(i),
2507 & ibecarb(i),forcon(nhpb+1)
2509 if (forcon(nhpb+1).gt.0.0d0) then
2511 if (ibecarb(i).gt.0) then
2512 ihpb(i)=ihpb(i)+nres
2513 jhpb(i)=jhpb(i)+nres
2515 if (dhpb(nhpb).eq.0.0d0)
2516 & dhpb(nhpb)=dist(ihpb(nhpb),jhpb(nhpb))
2518 C read (inp,*) ihpb(nhpb+1),jhpb(nhpb+1),forcon(nhpb+1)
2519 C if (forcon(nhpb+1).gt.0.0d0) then
2521 C dhpb(nhpb)=dist(ihpb(nhpb),jhpb(nhpb))
2523 if (.not.out1file .or. me.eq.king)
2524 & write (iout,'(a,3i5,f8.2,f10.1)') "+dist.constr ",
2525 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
2527 write (iout,'(a,3i5,f8.2,f10.1)') "+dist.constr ",
2528 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
2535 c-------------------------------------------------------------------------------
2537 subroutine flush(iu)
2542 subroutine flush(iu)
2547 c------------------------------------------------------------------------------
2548 subroutine copy_to_tmp(source)
2549 include "DIMENSIONS"
2550 include "COMMON.IOUNITS"
2551 character*(*) source
2552 character* 256 tmpfile
2556 tmpfile=curdir(:ilen(curdir))//"/"//source(:ilen(source))
2557 inquire(file=tmpfile,exist=ex)
2559 write (*,*) "Copying ",tmpfile(:ilen(tmpfile)),
2560 & " to temporary directory..."
2561 write (*,*) "/bin/cp "//tmpfile(:ilen(tmpfile))//" "//tmpdir
2562 call system("/bin/cp "//tmpfile(:ilen(tmpfile))//" "//tmpdir)
2566 c------------------------------------------------------------------------------
2567 subroutine move_from_tmp(source)
2568 include "DIMENSIONS"
2569 include "COMMON.IOUNITS"
2570 character*(*) source
2573 write (*,*) "Moving ",source(:ilen(source)),
2574 & " from temporary directory to working directory"
2575 write (*,*) "/bin/mv "//source(:ilen(source))//" "//curdir
2576 call system("/bin/mv "//source(:ilen(source))//" "//curdir)
2579 c------------------------------------------------------------------------------
2580 subroutine random_init(seed)
2582 C Initialize random number generator
2584 implicit real*8 (a-h,o-z)
2585 include 'DIMENSIONS'
2588 logical OKRandom, prng_restart
2590 integer iseed_array(4)
2592 include 'COMMON.IOUNITS'
2593 include 'COMMON.TIME1'
2594 include 'COMMON.THREAD'
2595 include 'COMMON.SBRIDGE'
2596 include 'COMMON.CONTROL'
2597 include 'COMMON.MCM'
2598 include 'COMMON.MAP'
2599 include 'COMMON.HEADER'
2600 include 'COMMON.CSA'
2601 include 'COMMON.CHAIN'
2602 include 'COMMON.MUCA'
2604 include 'COMMON.FFIELD'
2605 include 'COMMON.SETUP'
2606 iseed=-dint(dabs(seed))
2607 if (iseed.eq.0) then
2608 write (iout,'(/80(1h*)/20x,a/80(1h*))')
2609 & 'Random seed undefined. The program will stop.'
2610 write (*,'(/80(1h*)/20x,a/80(1h*))')
2611 & 'Random seed undefined. The program will stop.'
2613 call mpi_finalize(mpi_comm_world,ierr)
2615 stop 'Bad random seed.'
2618 if (fg_rank.eq.0) then
2622 & write (iout,*) 'MPI: node= ', me, ' iseed= ',iseed
2623 OKRandom = prng_restart(me,iseed)
2626 tmp=65536.0d0**(4-i)
2627 iseed_array(i) = dint(seed/tmp)
2628 seed=seed-iseed_array(i)*tmp
2631 & write (iout,*) 'MPI: node= ', me, ' iseed(4)= ',
2632 & (iseed_array(i),i=1,4)
2633 write (*,*) 'MPI: node= ',me, ' iseed(4)= ',
2634 & (iseed_array(i),i=1,4)
2635 OKRandom = prng_restart(me,iseed_array)
2638 c r1 = prng_next(me)
2639 r1=ran_number(0.0D0,1.0D0)
2641 & write (iout,*) 'ran_num',r1
2642 if (r1.lt.0.0d0) OKRandom=.false.
2644 if (.not.OKRandom) then
2645 write (iout,*) 'PRNG IS NOT WORKING!!!'
2646 print *,'PRNG IS NOT WORKING!!!'
2649 call mpi_abort(mpi_comm_world,error_msg,ierr)
2652 write (iout,*) 'too many processors for parallel prng'
2653 write (*,*) 'too many processors for parallel prng'
2661 write (iout,*) 'ran_num',ran_number(0.0d0,1.0d0)