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 if (modecalc.eq.3 .or. modecalc.eq.6) call mcmread
20 C Read MD control parameters if reqjuired
21 if (modecalc.eq.12) call read_MDpar
22 C Read MREMD control parameters if required
23 if (modecalc.eq.14) then
27 C Read MUCA control parameters if required
28 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 csa if (modecalc.eq.8) then
32 csa inquire (file="fort.40",exist=file_exist)
33 csa 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.THREAD'
70 include 'COMMON.SBRIDGE'
71 include 'COMMON.CONTROL'
74 include 'COMMON.HEADER'
75 csa include 'COMMON.CSA'
76 include 'COMMON.CHAIN'
79 include 'COMMON.FFIELD'
80 include 'COMMON.SETUP'
81 COMMON /MACHSW/ KDIAG,ICORFL,IXDR
82 character*8 diagmeth(0:3) /'Library','EVVRSP','Givens','Jacobi'/
84 character*320 controlcard
89 read (INP,'(a)') titel
90 call card_concat(controlcard)
91 c out1file=index(controlcard,'OUT1FILE').gt.0 .or. fg_rank.gt.0
92 c print *,"Processor",me," fg_rank",fg_rank," out1file",out1file
93 call reada(controlcard,'SEED',seed,0.0D0)
94 call random_init(seed)
95 C Set up the time limit (caution! The time must be input in minutes!)
96 read_cart=index(controlcard,'READ_CART').gt.0
97 call readi(controlcard,'CONSTR_DIST',constr_dist,0)
98 call reada(controlcard,'TIMLIM',timlim,960.0D0) ! default 16 hours
99 unres_pdb = index(controlcard,'UNRES_PDB') .gt. 0
100 call reada(controlcard,'SAFETY',safety,30.0D0) ! default 30 minutes
101 call reada(controlcard,'RMSDBC',rmsdbc,3.0D0)
102 call reada(controlcard,'RMSDBC1',rmsdbc1,0.5D0)
103 call reada(controlcard,'RMSDBC1MAX',rmsdbc1max,1.5D0)
104 call reada(controlcard,'RMSDBCM',rmsdbcm,3.0D0)
105 call reada(controlcard,'DRMS',drms,0.1D0)
106 if(me.eq.king .or. .not. out1file .and. fg_rank.eq.0) then
107 write (iout,'(a,f10.1)')'RMSDBC = ',rmsdbc
108 write (iout,'(a,f10.1)')'RMSDBC1 = ',rmsdbc1
109 write (iout,'(a,f10.1)')'RMSDBC1MAX = ',rmsdbc1max
110 write (iout,'(a,f10.1)')'DRMS = ',drms
111 write (iout,'(a,f10.1)')'RMSDBCM = ',rmsdbcm
112 write (iout,'(a,f10.1)') 'Time limit (min):',timlim
114 call readi(controlcard,'NZ_START',nz_start,0)
115 call readi(controlcard,'NZ_END',nz_end,0)
116 call readi(controlcard,'IZ_SC',iz_sc,0)
118 safety = 60.0d0*safety
121 call reada(controlcard,"T_BATH",t_bath,300.0d0)
122 minim=(index(controlcard,'MINIMIZE').gt.0)
123 dccart=(index(controlcard,'CART').gt.0)
124 overlapsc=(index(controlcard,'OVERLAP').gt.0)
125 overlapsc=.not.overlapsc
126 searchsc=(index(controlcard,'NOSEARCHSC').gt.0)
127 searchsc=.not.searchsc
128 sideadd=(index(controlcard,'SIDEADD').gt.0)
129 energy_dec=(index(controlcard,'ENERGY_DEC').gt.0)
130 outpdb=(index(controlcard,'PDBOUT').gt.0)
131 outmol2=(index(controlcard,'MOL2OUT').gt.0)
132 pdbref=(index(controlcard,'PDBREF').gt.0)
133 refstr=pdbref .or. (index(controlcard,'REFSTR').gt.0)
134 indpdb=index(controlcard,'PDBSTART')
135 extconf=(index(controlcard,'EXTCONF').gt.0)
136 call readi(controlcard,'IPRINT',iprint,0)
137 call readi(controlcard,'MAXGEN',maxgen,10000)
138 call readi(controlcard,'MAXOVERLAP',maxoverlap,1000)
139 call readi(controlcard,"KDIAG",kdiag,0)
140 call readi(controlcard,"RESCALE_MODE",rescale_mode,1)
141 if(me.eq.king .or. .not. out1file .and. fg_rank.eq.0)
142 & write (iout,*) "RESCALE_MODE",rescale_mode
143 split_ene=index(controlcard,'SPLIT_ENE').gt.0
144 if (index(controlcard,'REGULAR').gt.0.0D0) then
145 call reada(controlcard,'WEIDIS',weidis,0.1D0)
149 if (index(controlcard,'CHECKGRAD').gt.0) then
151 if (index(controlcard,'CART').gt.0) then
153 elseif (index(controlcard,'CARINT').gt.0) then
158 elseif (index(controlcard,'THREAD').gt.0) then
160 call readi(controlcard,'THREAD',nthread,0)
161 if (nthread.gt.0) then
162 call reada(controlcard,'WEIDIS',weidis,0.1D0)
165 & write (iout,'(a)')'A number has to follow the THREAD keyword.'
166 stop 'Error termination in Read_Control.'
168 else if (index(controlcard,'MCMA').gt.0) then
170 else if (index(controlcard,'MCEE').gt.0) then
172 else if (index(controlcard,'MULTCONF').gt.0) then
174 else if (index(controlcard,'MAP').gt.0) then
176 call readi(controlcard,'MAP',nmap,0)
177 else if (index(controlcard,'CSA').gt.0) then
178 write(*,*) "CSA not supported in this version"
181 crc else if (index(controlcard,'ZSCORE').gt.0) then
183 crc ZSCORE is rm from UNRES, modecalc=9 is available
186 cfcm else if (index(controlcard,'MCMF').gt.0) then
188 else if (index(controlcard,'SOFTREG').gt.0) then
190 else if (index(controlcard,'CHECK_BOND').gt.0) then
192 else if (index(controlcard,'TEST').gt.0) then
194 else if (index(controlcard,'MD').gt.0) then
196 else if (index(controlcard,'RE ').gt.0) then
200 lmuca=index(controlcard,'MUCA').gt.0
201 call readi(controlcard,'MUCADYN',mucadyn,0)
202 call readi(controlcard,'MUCASMOOTH',muca_smooth,0)
203 if (lmuca .and. (me.eq.king .or. .not.out1file ))
205 write (iout,*) 'MUCADYN=',mucadyn
206 write (iout,*) 'MUCASMOOTH=',muca_smooth
209 iscode=index(controlcard,'ONE_LETTER')
210 indphi=index(controlcard,'PHI')
211 indback=index(controlcard,'BACK')
212 iranconf=index(controlcard,'RAND_CONF')
213 i2ndstr=index(controlcard,'USE_SEC_PRED')
214 gradout=index(controlcard,'GRADOUT').gt.0
215 gnorm_check=index(controlcard,'GNORM_CHECK').gt.0
217 if(me.eq.king.or..not.out1file)
218 & write (iout,'(2a)') diagmeth(kdiag),
219 & ' routine used to diagonalize matrices.'
222 c--------------------------------------------------------------------------
223 subroutine read_REMDpar
227 implicit real*8 (a-h,o-z)
229 include 'COMMON.IOUNITS'
230 include 'COMMON.TIME1'
233 include 'COMMON.LANGEVIN'
235 include 'COMMON.LANGEVIN.lang0'
237 include 'COMMON.INTERACT'
238 include 'COMMON.NAMES'
240 include 'COMMON.REMD'
241 include 'COMMON.CONTROL'
242 include 'COMMON.SETUP'
244 character*320 controlcard
245 character*3200 controlcard1
246 integer iremd_m_total
248 if(me.eq.king.or..not.out1file)
249 & write (iout,*) "REMD setup"
251 call card_concat(controlcard)
252 call readi(controlcard,"NREP",nrep,3)
253 call readi(controlcard,"NSTEX",nstex,1000)
254 call reada(controlcard,"RETMIN",retmin,10.0d0)
255 call reada(controlcard,"RETMAX",retmax,1000.0d0)
256 mremdsync=(index(controlcard,'SYNC').gt.0)
257 call readi(controlcard,"NSYN",i_sync_step,100)
258 restart1file=(index(controlcard,'REST1FILE').gt.0)
259 traj1file=(index(controlcard,'TRAJ1FILE').gt.0)
260 call readi(controlcard,"TRAJCACHE",max_cache_traj_use,1)
261 if(max_cache_traj_use.gt.max_cache_traj)
262 & max_cache_traj_use=max_cache_traj
263 if(me.eq.king.or..not.out1file) then
264 cd if (traj1file) then
265 crc caching is in testing - NTWX is not ignored
266 cd write (iout,*) "NTWX value is ignored"
267 cd write (iout,*) " trajectory is stored to one file by master"
268 cd write (iout,*) " before exchange at NSTEX intervals"
270 write (iout,*) "NREP= ",nrep
271 write (iout,*) "NSTEX= ",nstex
272 write (iout,*) "SYNC= ",mremdsync
273 write (iout,*) "NSYN= ",i_sync_step
274 write (iout,*) "TRAJCACHE= ",max_cache_traj_use
277 t_exchange_only=(index(controlcard,'TONLY').gt.0)
278 call readi(controlcard,"HREMD",hremd,0)
279 if((me.eq.king.or..not.out1file).and.hremd.gt.0) then
280 write (iout,*) "Hamiltonian REMD with ",hremd," sets of weights"
282 if(usampl.and.hremd.gt.0) then
284 & "========== ERROR: USAMPL and HREMD cannot be used together"
286 call MPI_Abort(MPI_COMM_WORLD,IERROR,ERRCODE)
293 if (index(controlcard,'TLIST').gt.0) then
295 call card_concat(controlcard1)
296 read(controlcard1,*) (remd_t(i),i=1,nrep)
297 if(me.eq.king.or..not.out1file)
298 & write (iout,*)'tlist',(remd_t(i),i=1,nrep)
301 if (index(controlcard,'MLIST').gt.0) then
303 call card_concat(controlcard1)
304 read(controlcard1,*) (remd_m(i),i=1,nrep)
305 if(me.eq.king.or..not.out1file) then
306 write (iout,*)'mlist',(remd_m(i),i=1,nrep)
309 iremd_m_total=iremd_m_total+remd_m(i)
312 write (iout,*) 'Total number of replicas ',
313 & iremd_m_total*hremd
315 write (iout,*) 'Total number of replicas ',iremd_m_total
319 if(me.eq.king.or..not.out1file)
320 & write (iout,'(/30(1h=),a,29(1h=)/)') " End of REMD run setup "
323 c--------------------------------------------------------------------------
324 subroutine read_MDpar
328 implicit real*8 (a-h,o-z)
330 include 'COMMON.IOUNITS'
331 include 'COMMON.TIME1'
334 include 'COMMON.LANGEVIN'
336 include 'COMMON.LANGEVIN.lang0'
338 include 'COMMON.INTERACT'
339 include 'COMMON.NAMES'
341 include 'COMMON.SETUP'
342 include 'COMMON.CONTROL'
343 include 'COMMON.SPLITELE'
345 character*320 controlcard
347 call card_concat(controlcard)
348 call readi(controlcard,"NSTEP",n_timestep,1000000)
349 call readi(controlcard,"NTWE",ntwe,100)
350 call readi(controlcard,"NTWX",ntwx,1000)
351 call reada(controlcard,"DT",d_time,1.0d-1)
352 call reada(controlcard,"DVMAX",dvmax,2.0d1)
353 call reada(controlcard,"DAMAX",damax,1.0d1)
354 call reada(controlcard,"EDRIFTMAX",edriftmax,1.0d+1)
355 call readi(controlcard,"LANG",lang,0)
356 RESPA = index(controlcard,"RESPA") .gt. 0
357 call readi(controlcard,"NTIME_SPLIT",ntime_split,1)
358 ntime_split0=ntime_split
359 call readi(controlcard,"MAXTIME_SPLIT",maxtime_split,64)
360 ntime_split0=ntime_split
361 call reada(controlcard,"R_CUT",r_cut,2.0d0)
362 call reada(controlcard,"LAMBDA",rlamb,0.3d0)
363 rest = index(controlcard,"REST").gt.0
364 tbf = index(controlcard,"TBF").gt.0
365 call readi(controlcard,"HMC",hmc,0)
366 tnp = index(controlcard,"NOSEPOINCARE99").gt.0
367 tnp1 = index(controlcard,"NOSEPOINCARE01").gt.0
368 tnh = index(controlcard,"NOSEHOOVER96").gt.0
369 if (RESPA.and.tnh)then
370 xiresp = index(controlcard,"XIRESP").gt.0
372 call reada(controlcard,"Q_NP",Q_np,0.1d0)
373 usampl = index(controlcard,"USAMPL").gt.0
375 mdpdb = index(controlcard,"MDPDB").gt.0
376 call reada(controlcard,"T_BATH",t_bath,300.0d0)
377 call reada(controlcard,"TAU_BATH",tau_bath,1.0d-1)
378 call reada(controlcard,"EQ_TIME",eq_time,1.0d+4)
379 call readi(controlcard,"RESET_MOMENT",count_reset_moment,1000)
380 if (count_reset_moment.eq.0) count_reset_moment=1000000000
381 call readi(controlcard,"RESET_VEL",count_reset_vel,1000)
382 reset_moment=lang.eq.0 .and. tbf .and. count_reset_moment.gt.0
383 reset_vel=lang.eq.0 .and. tbf .and. count_reset_vel.gt.0
384 if (count_reset_vel.eq.0) count_reset_vel=1000000000
385 large = index(controlcard,"LARGE").gt.0
386 print_compon = index(controlcard,"PRINT_COMPON").gt.0
387 rattle = index(controlcard,"RATTLE").gt.0
388 c if performing umbrella sampling, fragments constrained are read from the fragment file
394 if(me.eq.king.or..not.out1file) then
396 write (iout,'(27(1h=),a26,27(1h=))') " Parameters of the MD run "
398 write (iout,'(a)') "The units are:"
399 write (iout,'(a)') "positions: angstrom, time: 48.9 fs"
400 write (iout,'(2a)') "velocity: angstrom/(48.9 fs),",
401 & " acceleration: angstrom/(48.9 fs)**2"
402 write (iout,'(a)') "energy: kcal/mol, temperature: K"
404 write (iout,'(a60,i10)') "Number of time steps:",n_timestep
405 write (iout,'(a60,f10.5,a)')
406 & "Initial time step of numerical integration:",d_time,
408 write (iout,'(60x,f10.5,a)') d_time*48.9," fs"
410 write (iout,'(2a,i4,a)')
411 & "A-MTS algorithm used; initial time step for fast-varying",
412 & " short-range forces split into",ntime_split," steps."
413 write (iout,'(a,f5.2,a,f5.2)') "Short-range force cutoff",
414 & r_cut," lambda",rlamb
416 write (iout,'(2a,f10.5)')
417 & "Maximum acceleration threshold to reduce the time step",
418 & "/increase split number:",damax
419 write (iout,'(2a,f10.5)')
420 & "Maximum predicted energy drift to reduce the timestep",
421 & "/increase split number:",edriftmax
422 write (iout,'(a60,f10.5)')
423 & "Maximum velocity threshold to reduce velocities:",dvmax
424 write (iout,'(a60,i10)') "Frequency of property output:",ntwe
425 write (iout,'(a60,i10)') "Frequency of coordinate output:",ntwx
426 if (rattle) write (iout,'(a60)')
427 & "Rattle algorithm used to constrain the virtual bonds"
431 call reada(controlcard,"ETAWAT",etawat,0.8904d0)
432 call reada(controlcard,"RWAT",rwat,1.4d0)
433 call reada(controlcard,"SCAL_FRIC",scal_fric,2.0d-2)
434 surfarea=index(controlcard,"SURFAREA").gt.0
435 call readi(controlcard,"RESET_FRICMAT",reset_fricmat,1000)
436 if(me.eq.king.or..not.out1file)then
437 write (iout,'(/a,$)') "Langevin dynamics calculation"
440 & " with direct integration of Langevin equations"
441 else if (lang.eq.2) then
442 write (iout,'(a/)') " with TINKER stochasic MD integrator"
443 else if (lang.eq.3) then
444 write (iout,'(a/)') " with Ciccotti's stochasic MD integrator"
445 else if (lang.eq.4) then
446 write (iout,'(a/)') " in overdamped mode"
448 write (iout,'(//a,i5)')
449 & "=========== ERROR: Unknown Langevin dynamics mode:",lang
452 write (iout,'(a60,f10.5)') "Temperature:",t_bath
453 write (iout,'(a60,f10.5)') "Viscosity of the solvent:",etawat
454 write (iout,'(a60,f10.5)') "Radius of solvent molecule:",rwat
455 write (iout,'(a60,f10.5)')
456 & "Scaling factor of the friction forces:",scal_fric
457 if (surfarea) write (iout,'(2a,i10,a)')
458 & "Friction coefficients will be scaled by solvent-accessible",
459 & " surface area every",reset_fricmat," steps."
461 c Calculate friction coefficients and bounds of stochastic forces
462 eta=6*pi*cPoise*etawat
463 if(me.eq.king.or..not.out1file)
464 & write(iout,'(a60,f10.5)')"Eta of the solvent in natural units:"
466 gamp=scal_fric*(pstok+rwat)*eta
467 stdfp=dsqrt(2*Rb*t_bath/d_time)
469 gamsc(i)=scal_fric*(restok(i)+rwat)*eta
470 stdfsc(i)=dsqrt(2*Rb*t_bath/d_time)
472 if(me.eq.king.or..not.out1file)then
473 write (iout,'(/2a/)')
474 & "Radii of site types and friction coefficients and std's of",
475 & " stochastic forces of fully exposed sites"
476 write (iout,'(a5,f5.2,2f10.5)')'p',pstok,gamp,stdfp*dsqrt(gamp)
478 write (iout,'(a5,f5.2,2f10.5)') restyp(i),restok(i),
479 & gamsc(i),stdfsc(i)*dsqrt(gamsc(i))
483 if(me.eq.king.or..not.out1file)then
484 write (iout,'(a)') "Berendsen bath calculation"
485 write (iout,'(a60,f10.5)') "Temperature:",t_bath
486 write (iout,'(a60,f10.5)') "Coupling constant (tau):",tau_bath
488 & write (iout,'(a,i10,a)') "Momenta will be reset at zero every",
489 & count_reset_moment," steps"
491 & write (iout,'(a,i10,a)')
492 & "Velocities will be reset at random every",count_reset_vel,
495 else if (tnp .or. tnp1 .or. tnh) then
496 if (tnp .or. tnp1) then
497 write (iout,'(a)') "Nose-Poincare bath calculation"
498 if (tnp) write (iout,'(a)')
499 & "J.Comput.Phys. 151 114 (1999) S.D.Bond B.J.Leimkuhler B.B.Laird"
500 if (tnp1) write (iout,'(a)') "JPSJ 70 75 (2001) S. Nose"
502 write (iout,'(a)') "Nose-Hoover bath calculation"
503 write (iout,'(a)') "Mol.Phys. 87 1117 (1996) Martyna et al."
513 WDTI(i) = 1.0*d_time/nresn
520 write (iout,'(a)') "NVT-XI-RESPA algorithm"
522 write (iout,'(a)') "NVT-XO-RESPA algorithm"
525 WDTIi(i) = 1.0*d_time/nresn/ntime_split
533 write (iout,'(a60,f10.5)') "Temperature:",t_bath
534 write (iout,'(a60,f10.5)') "Q =",Q_np
536 & write (iout,'(a,i10,a)') "Momenta will be reset at zero every",
537 & count_reset_moment," steps"
539 & write (iout,'(a,i10,a)')
540 & "Velocities will be reset at random every",count_reset_vel,
543 else if (hmc.gt.0) then
544 write (iout,'(a)') "Hybrid Monte Carlo calculation"
545 write (iout,'(a60,f10.5)') "Temperature:",t_bath
546 write (iout,'(a60,i10)')
547 & "Number of MD steps between Metropolis tests:",hmc
550 if(me.eq.king.or..not.out1file)
551 & write (iout,'(a31)') "Microcanonical mode calculation"
553 if(me.eq.king.or..not.out1file)then
554 if (rest) write (iout,'(/a/)') "===== Calculation restarted ===="
556 write(iout,*) "MD running with constraints."
557 write(iout,*) "Equilibration time ", eq_time, " mtus."
558 write(iout,*) "Constraining ", nfrag," fragments."
559 write(iout,*) "Length of each fragment, weight and q0:"
561 write (iout,*) "Set of restraints #",iset
563 write(iout,'(2i5,f8.1,f7.4)') ifrag(1,i,iset),
564 & ifrag(2,i,iset),wfrag(i,iset),qinfrag(i,iset)
566 write(iout,*) "constraints between ", npair, "fragments."
567 write(iout,*) "constraint pairs, weights and q0:"
569 write(iout,'(2i5,f8.1,f7.4)') ipair(1,i,iset),
570 & ipair(2,i,iset),wpair(i,iset),qinpair(i,iset)
572 write(iout,*) "angle constraints within ", nfrag_back,
573 & "backbone fragments."
574 write(iout,*) "fragment, weights:"
576 write(iout,'(2i5,3f8.1)') ifrag_back(1,i,iset),
577 & ifrag_back(2,i,iset),wfrag_back(1,i,iset),
578 & wfrag_back(2,i,iset),wfrag_back(3,i,iset)
581 iset=mod(kolor,nset)+1
584 if(me.eq.king.or..not.out1file)
585 & write (iout,'(/30(1h=),a,29(1h=)/)') " End of MD run setup "
588 c------------------------------------------------------------------------------
591 C Read molecular data.
593 implicit real*8 (a-h,o-z)
599 include 'COMMON.IOUNITS'
602 include 'COMMON.INTERACT'
603 include 'COMMON.LOCAL'
604 include 'COMMON.NAMES'
605 include 'COMMON.CHAIN'
606 include 'COMMON.FFIELD'
607 include 'COMMON.SBRIDGE'
608 include 'COMMON.HEADER'
609 include 'COMMON.CONTROL'
610 include 'COMMON.DBASE'
611 include 'COMMON.THREAD'
612 include 'COMMON.CONTACTS'
613 include 'COMMON.TORCNSTR'
614 include 'COMMON.TIME1'
615 include 'COMMON.BOUNDS'
617 include 'COMMON.REMD'
618 include 'COMMON.SETUP'
619 character*4 sequence(maxres)
621 double precision x(maxvar)
622 character*256 pdbfile
623 character*320 weightcard
624 character*80 weightcard_t,ucase
625 dimension itype_pdb(maxres)
626 common /pizda/ itype_pdb
627 logical seq_comp,fail
628 double precision energia(0:n_ene)
634 C Read weights of the subsequent energy terms.
647 if(me.eq.king.or..not.out1file) then
648 write (iout,*) 'Reading ',hremd,' sets of weights for HREMD'
649 write (iout,*) 'Current weights for processor ',
650 & me,' set ',i2set(me)
654 call card_concat(weightcard)
655 call reada(weightcard,'WLONG',wlong,1.0D0)
656 call reada(weightcard,'WSC',wsc,wlong)
657 call reada(weightcard,'WSCP',wscp,wlong)
658 call reada(weightcard,'WELEC',welec,1.0D0)
659 call reada(weightcard,'WVDWPP',wvdwpp,welec)
660 call reada(weightcard,'WEL_LOC',wel_loc,1.0D0)
661 call reada(weightcard,'WCORR4',wcorr4,0.0D0)
662 call reada(weightcard,'WCORR5',wcorr5,0.0D0)
663 call reada(weightcard,'WCORR6',wcorr6,0.0D0)
664 call reada(weightcard,'WTURN3',wturn3,1.0D0)
665 call reada(weightcard,'WTURN4',wturn4,1.0D0)
666 call reada(weightcard,'WTURN6',wturn6,1.0D0)
667 call reada(weightcard,'WSCCOR',wsccor,1.0D0)
668 call reada(weightcard,'WSTRAIN',wstrain,1.0D0)
669 call reada(weightcard,'WBOND',wbond,1.0D0)
670 call reada(weightcard,'WTOR',wtor,1.0D0)
671 call reada(weightcard,'WTORD',wtor_d,1.0D0)
672 call reada(weightcard,'WANG',wang,1.0D0)
673 call reada(weightcard,'WSCLOC',wscloc,1.0D0)
674 call reada(weightcard,'SCAL14',scal14,0.4D0)
675 call reada(weightcard,'SCALSCP',scalscp,1.0d0)
676 call reada(weightcard,'CUTOFF',cutoff_corr,7.0d0)
677 call reada(weightcard,'DELT_CORR',delt_corr,0.5d0)
678 call reada(weightcard,'TEMP0',temp0,300.0d0)
679 if (index(weightcard,'SOFT').gt.0) ipot=6
680 C 12/1/95 Added weight for the multi-body term WCORR
681 call reada(weightcard,'WCORRH',wcorr,1.0D0)
682 if (wcorr4.gt.0.0d0) wcorr=wcorr4
690 hweights(i,7)=wel_loc
693 hweights(i,10)=wturn6
695 hweights(i,12)=wscloc
697 hweights(i,14)=wtor_d
698 hweights(i,15)=wstrain
699 hweights(i,16)=wvdwpp
701 hweights(i,18)=scal14
702 hweights(i,21)=wsccor
707 weights(i)=hweights(i2set(me),i)
731 call card_concat(weightcard)
732 call reada(weightcard,'WLONG',wlong,1.0D0)
733 call reada(weightcard,'WSC',wsc,wlong)
734 call reada(weightcard,'WSCP',wscp,wlong)
735 call reada(weightcard,'WELEC',welec,1.0D0)
736 call reada(weightcard,'WVDWPP',wvdwpp,welec)
737 call reada(weightcard,'WEL_LOC',wel_loc,1.0D0)
738 call reada(weightcard,'WCORR4',wcorr4,0.0D0)
739 call reada(weightcard,'WCORR5',wcorr5,0.0D0)
740 call reada(weightcard,'WCORR6',wcorr6,0.0D0)
741 call reada(weightcard,'WTURN3',wturn3,1.0D0)
742 call reada(weightcard,'WTURN4',wturn4,1.0D0)
743 call reada(weightcard,'WTURN6',wturn6,1.0D0)
744 call reada(weightcard,'WSCCOR',wsccor,1.0D0)
745 call reada(weightcard,'WSTRAIN',wstrain,1.0D0)
746 call reada(weightcard,'WBOND',wbond,1.0D0)
747 call reada(weightcard,'WTOR',wtor,1.0D0)
748 call reada(weightcard,'WTORD',wtor_d,1.0D0)
749 call reada(weightcard,'WANG',wang,1.0D0)
750 call reada(weightcard,'WSCLOC',wscloc,1.0D0)
751 call reada(weightcard,'SCAL14',scal14,0.4D0)
752 call reada(weightcard,'SCALSCP',scalscp,1.0d0)
753 call reada(weightcard,'CUTOFF',cutoff_corr,7.0d0)
754 call reada(weightcard,'DELT_CORR',delt_corr,0.5d0)
755 call reada(weightcard,'TEMP0',temp0,300.0d0)
756 if (index(weightcard,'SOFT').gt.0) ipot=6
757 C 12/1/95 Added weight for the multi-body term WCORR
758 call reada(weightcard,'WCORRH',wcorr,1.0D0)
759 if (wcorr4.gt.0.0d0) wcorr=wcorr4
781 if(me.eq.king.or..not.out1file)
782 & write (iout,10) wsc,wscp,welec,wvdwpp,wbond,wang,wscloc,wtor,
783 & wtor_d,wstrain,wel_loc,wcorr,wcorr5,wcorr6,wsccor,wturn3,
785 10 format (/'Energy-term weights (unscaled):'//
786 & 'WSCC= ',f10.6,' (SC-SC)'/
787 & 'WSCP= ',f10.6,' (SC-p)'/
788 & 'WELEC= ',f10.6,' (p-p electr)'/
789 & 'WVDWPP= ',f10.6,' (p-p VDW)'/
790 & 'WBOND= ',f10.6,' (stretching)'/
791 & 'WANG= ',f10.6,' (bending)'/
792 & 'WSCLOC= ',f10.6,' (SC local)'/
793 & 'WTOR= ',f10.6,' (torsional)'/
794 & 'WTORD= ',f10.6,' (double torsional)'/
795 & 'WSTRAIN=',f10.6,' (SS bridges & dist. cnstr.)'/
796 & 'WEL_LOC=',f10.6,' (multi-body 3-rd order)'/
797 & 'WCORR4= ',f10.6,' (multi-body 4th order)'/
798 & 'WCORR5= ',f10.6,' (multi-body 5th order)'/
799 & 'WCORR6= ',f10.6,' (multi-body 6th order)'/
800 & 'WSCCOR= ',f10.6,' (back-scloc correlation)'/
801 & 'WTURN3= ',f10.6,' (turns, 3rd order)'/
802 & 'WTURN4= ',f10.6,' (turns, 4th order)'/
803 & 'WTURN6= ',f10.6,' (turns, 6th order)')
804 if(me.eq.king.or..not.out1file)then
805 if (wcorr4.gt.0.0d0) then
806 write (iout,'(/2a/)') 'Local-electrostatic type correlation ',
807 & 'between contact pairs of peptide groups'
808 write (iout,'(2(a,f5.3/))')
809 & 'Cutoff on 4-6th order correlation terms: ',cutoff_corr,
810 & 'Range of quenching the correlation terms:',2*delt_corr
811 else if (wcorr.gt.0.0d0) then
812 write (iout,'(/2a/)') 'Hydrogen-bonding correlation ',
813 & 'between contact pairs of peptide groups'
815 write (iout,'(a,f8.3)')
816 & 'Scaling factor of 1,4 SC-p interactions:',scal14
817 write (iout,'(a,f8.3)')
818 & 'General scaling factor of SC-p interactions:',scalscp
820 r0_corr=cutoff_corr-delt_corr
822 aad(i,1)=scalscp*aad(i,1)
823 aad(i,2)=scalscp*aad(i,2)
824 bad(i,1)=scalscp*bad(i,1)
825 bad(i,2)=scalscp*bad(i,2)
827 call rescale_weights(t_bath)
828 if(me.eq.king.or..not.out1file)
829 & write (iout,22) wsc,wscp,welec,wvdwpp,wbond,wang,wscloc,wtor,
830 & wtor_d,wstrain,wel_loc,wcorr,wcorr5,wcorr6,wsccor,wturn3,
832 22 format (/'Energy-term weights (scaled):'//
833 & 'WSCC= ',f10.6,' (SC-SC)'/
834 & 'WSCP= ',f10.6,' (SC-p)'/
835 & 'WELEC= ',f10.6,' (p-p electr)'/
836 & 'WVDWPP= ',f10.6,' (p-p VDW)'/
837 & 'WBOND= ',f10.6,' (stretching)'/
838 & 'WANG= ',f10.6,' (bending)'/
839 & 'WSCLOC= ',f10.6,' (SC local)'/
840 & 'WTOR= ',f10.6,' (torsional)'/
841 & 'WTORD= ',f10.6,' (double torsional)'/
842 & 'WSTRAIN=',f10.6,' (SS bridges & dist. cnstr.)'/
843 & 'WEL_LOC=',f10.6,' (multi-body 3-rd order)'/
844 & 'WCORR4= ',f10.6,' (multi-body 4th order)'/
845 & 'WCORR5= ',f10.6,' (multi-body 5th order)'/
846 & 'WCORR6= ',f10.6,' (multi-body 6th order)'/
847 & 'WSCCOR= ',f10.6,' (back-scloc correlatkion)'/
848 & 'WTURN3= ',f10.6,' (turns, 3rd order)'/
849 & 'WTURN4= ',f10.6,' (turns, 4th order)'/
850 & 'WTURN6= ',f10.6,' (turns, 6th order)')
851 if(me.eq.king.or..not.out1file)
852 & write (iout,*) "Reference temperature for weights calculation:",
854 call reada(weightcard,"D0CM",d0cm,3.78d0)
855 call reada(weightcard,"AKCM",akcm,15.1d0)
856 call reada(weightcard,"AKTH",akth,11.0d0)
857 call reada(weightcard,"AKCT",akct,12.0d0)
858 call reada(weightcard,"V1SS",v1ss,-1.08d0)
859 call reada(weightcard,"V2SS",v2ss,7.61d0)
860 call reada(weightcard,"V3SS",v3ss,13.7d0)
861 call reada(weightcard,"EBR",ebr,-5.50D0)
862 if(me.eq.king.or..not.out1file) then
863 write (iout,*) "Parameters of the SS-bond potential:"
864 write (iout,*) "D0CM",d0cm," AKCM",akcm," AKTH",akth,
866 write (iout,*) "V1SS",v1ss," V2SS",v2ss," V3SS",v3ss
867 write (iout,*) "EBR",ebr
868 print *,'indpdb=',indpdb,' pdbref=',pdbref
870 if (indpdb.gt.0 .or. pdbref) then
871 read(inp,'(a)') pdbfile
872 if(me.eq.king.or..not.out1file)
873 & write (iout,'(2a)') 'PDB data will be read from file ',
874 & pdbfile(:ilen(pdbfile))
875 open(ipdbin,file=pdbfile,status='old',err=33)
877 33 write (iout,'(a)') 'Error opening PDB file.'
880 c print *,'Begin reading pdb data'
882 c print *,'Finished reading pdb data'
883 if(me.eq.king.or..not.out1file)
884 & write (iout,'(a,i3,a,i3)')'nsup=',nsup,
885 & ' nstart_sup=',nstart_sup
887 itype_pdb(i)=itype(i)
891 nct=nstart_sup+nsup-1
892 call contact(.false.,ncont_ref,icont_ref,co)
895 if(me.eq.king.or..not.out1file)
896 & write(iout,*)'Adding sidechains'
903 do while (fail.and.nsi.le.maxsi)
904 call gen_side(iti,theta(i+1),alph(i),omeg(i),fail)
907 if(fail) write(iout,*)'Adding sidechain failed for res ',
908 & i,' after ',nsi,' trials'
913 if (indpdb.eq.0) then
914 C Read sequence if not taken from the pdb file.
916 c print *,'nres=',nres
917 if (iscode.gt.0) then
918 read (inp,'(80a1)') (sequence(i)(1:1),i=1,nres)
920 read (inp,'(20(1x,a3))') (sequence(i),i=1,nres)
922 C Convert sequence to numeric code
924 itype(i)=rescode(i,sequence(i),iscode)
926 C Assign initial virtual bond lengths
932 vbld(i+nres)=dsc(itype(i))
933 vbld_inv(i+nres)=dsc_inv(itype(i))
934 c write (iout,*) "i",i," itype",itype(i),
935 c & " dsc",dsc(itype(i))," vbld",vbld(i),vbld(i+nres)
939 c print '(20i4)',(itype(i),i=1,nres)
942 if (itype(i).eq.21 .or. itype(i+1).eq.21) then
944 if (itype(i).eq.21) then
948 else if (itype(i+1).ne.20) then
950 else if (itype(i).ne.20) then
957 if(me.eq.king.or..not.out1file)then
958 write (iout,*) "ITEL"
960 write (iout,*) i,itype(i),itel(i)
962 print *,'Call Read_Bridge.'
965 C 8/13/98 Set limits to generating the dihedral angles
970 read (inp,*) ndih_constr
971 if (ndih_constr.gt.0) then
973 read (inp,*) (idih_constr(i),phi0(i),drange(i),i=1,ndih_constr)
974 if(me.eq.king.or..not.out1file)then
976 & 'There are',ndih_constr,' constraints on phi angles.'
978 write (iout,'(i5,2f8.3)') idih_constr(i),phi0(i),drange(i)
982 phi0(i)=deg2rad*phi0(i)
983 drange(i)=deg2rad*drange(i)
985 if(me.eq.king.or..not.out1file)
986 & write (iout,*) 'FTORS',ftors
989 phibound(1,ii) = phi0(i)-drange(i)
990 phibound(2,ii) = phi0(i)+drange(i)
997 write (iout,'(a)') 'Boundaries in phi angle sampling:'
999 write (iout,'(a3,i5,2f10.1)')
1000 & restyp(itype(i)),i,phibound(1,i)*rad2deg,phibound(2,i)*rad2deg
1006 cd print *,'NNT=',NNT,' NCT=',NCT
1007 if (itype(1).eq.21) nnt=2
1008 if (itype(nres).eq.21) nct=nct-1
1010 if(me.eq.king.or..not.out1file)
1011 & write (iout,'(a,i3)') 'nsup=',nsup
1013 if (nsup.le.(nct-nnt+1)) then
1014 do i=0,nct-nnt+1-nsup
1015 if (seq_comp(itype(nnt+i),itype_pdb(nstart_sup),nsup)) then
1021 & 'Error - sequences to be superposed do not match.'
1024 do i=0,nsup-(nct-nnt+1)
1025 if (seq_comp(itype(nnt),itype_pdb(nstart_sup+i),nct-nnt+1))
1027 nstart_sup=nstart_sup+i
1033 & 'Error - sequences to be superposed do not match.'
1036 if (nsup.eq.0) nsup=nct-nnt
1037 if (nstart_sup.eq.0) nstart_sup=nnt
1038 if (nstart_seq.eq.0) nstart_seq=nnt
1039 if(me.eq.king.or..not.out1file)
1040 & write (iout,*) 'nsup=',nsup,' nstart_sup=',nstart_sup,
1041 & ' nstart_seq=',nstart_seq
1043 c--- Zscore rms -------
1044 if (nz_start.eq.0) nz_start=nnt
1045 if (nz_end.eq.0 .and. nsup.gt.0) then
1047 else if (nz_end.eq.0) then
1050 if(me.eq.king.or..not.out1file)then
1051 write (iout,*) 'NZ_START=',nz_start,' NZ_END=',nz_end
1052 write (iout,*) 'IZ_SC=',iz_sc
1054 c----------------------
1057 if (.not.pdbref) then
1058 call read_angles(inp,*38)
1060 38 write (iout,'(a)') 'Error reading reference structure.'
1062 call MPI_Finalize(MPI_COMM_WORLD,IERROR)
1063 stop 'Error reading reference structure'
1067 czscore call geom_to_var(nvar,coord_exp_zs(1,1))
1076 call contact(.true.,ncont_ref,icont_ref,co)
1078 c write (iout,*) "constr_dist",constr_dist,nstart_sup,nsup
1080 if (constr_dist.gt.0) call read_dist_constr
1081 c write (iout,*) "After read_dist_constr nhpb",nhpb
1083 if(me.eq.king.or..not.out1file)
1084 & write (iout,*) 'Contact order:',co
1086 if(me.eq.king.or..not.out1file)
1087 & write (2,*) 'Shifting contacts:',nstart_seq,nstart_sup
1090 icont_ref(j,i)=icont_ref(j,i)+nstart_seq-nstart_sup
1092 if(me.eq.king.or..not.out1file)
1093 & write (2,*) i,' ',restyp(itype(icont_ref(1,i))),' ',
1094 & icont_ref(1,i),' ',
1095 & restyp(itype(icont_ref(2,i))),' ',icont_ref(2,i)
1099 if (indpdb.eq.0 .and. modecalc.ne.2 .and. modecalc.ne.4
1100 & .and. modecalc.ne.8 .and. modecalc.ne.9 .and.
1101 & modecalc.ne.10) then
1102 C If input structure hasn't been supplied from the PDB file read or generate
1104 if (iranconf.eq.0 .and. .not. extconf) then
1105 if(me.eq.king.or..not.out1file .and.fg_rank.eq.0)
1106 & write (iout,'(a)') 'Initial geometry will be read in.'
1108 read(inp,'(8f10.5)',end=36,err=36)
1109 & ((c(l,k),l=1,3),k=1,nres),
1110 & ((c(l,k+nres),l=1,3),k=nnt,nct)
1111 call int_from_cart1(.false.)
1114 dc(j,i)=c(j,i+1)-c(j,i)
1115 dc_norm(j,i)=dc_norm(j,i)*vbld_inv(i+1)
1119 if (itype(i).ne.10) then
1121 dc(j,i+nres)=c(j,i+nres)-c(j,i)
1122 dc_norm(j,i+nres)=dc_norm(j,i+nres)*vbld_inv(i+nres)
1128 call read_angles(inp,*36)
1131 36 write (iout,'(a)') 'Error reading angle file.'
1133 call mpi_finalize( MPI_COMM_WORLD,IERR )
1135 stop 'Error reading angle file.'
1137 else if (extconf) then
1138 if(me.eq.king.or..not.out1file .and. fg_rank.eq.0)
1139 & write (iout,'(a)') 'Extended chain initial geometry.'
1141 theta(i)=90d0*deg2rad
1144 phi(i)=180d0*deg2rad
1147 alph(i)=110d0*deg2rad
1150 omeg(i)=-120d0*deg2rad
1153 if(me.eq.king.or..not.out1file)
1154 & write (iout,'(a)') 'Random-generated initial geometry.'
1158 if (me.eq.king .or. fg_rank.eq.0 .and. (
1159 & modecalc.eq.12 .or. modecalc.eq.14) ) then
1163 call gen_rand_conf(itmp,*30)
1165 30 write (iout,*) 'Failed to generate random conformation',
1166 & ', itrial=',itrial
1167 write (*,*) 'Processor:',me,
1168 & ' Failed to generate random conformation',
1178 write (iout,'(a,i3,a)') 'Processor:',me,
1179 & ' error in generating random conformation.'
1180 write (*,'(a,i3,a)') 'Processor:',me,
1181 & ' error in generating random conformation.'
1184 call MPI_Abort(mpi_comm_world,error_msg,ierrcode)
1191 elseif (modecalc.eq.4) then
1192 read (inp,'(a)') intinname
1193 open (intin,file=intinname,status='old',err=333)
1194 if (me.eq.king .or. .not.out1file.and.fg_rank.eq.0)
1195 & write (iout,'(a)') 'intinname',intinname
1196 write (*,'(a)') 'Processor',myrank,' intinname',intinname
1198 333 write (iout,'(2a)') 'Error opening angle file ',intinname
1200 call MPI_Finalize(MPI_COMM_WORLD,IERR)
1202 stop 'Error opening angle file.'
1206 C Generate distance constraints, if the PDB structure is to be regularized.
1207 if (nthread.gt.0) then
1208 call read_threadbase
1211 if (me.eq.king .or. .not. out1file)
1213 if (ns.gt.0 .and. (me.eq.king .or. .not.out1file) ) then
1214 write (iout,'(/a,i3,a)')
1215 & 'The chain contains',ns,' disulfide-bridging cysteines.'
1216 write (iout,'(20i4)') (iss(i),i=1,ns)
1217 write (iout,'(/a/)') 'Pre-formed links are:'
1223 if (me.eq.king.or..not.out1file)
1224 & write (iout,'(2a,i3,3a,i3,a,3f10.3)')
1225 & restyp(it1),'(',i1,') -- ',restyp(it2),'(',i2,')',dhpb(i),
1230 if (i2ndstr.gt.0) call secstrp2dihc
1231 c call geom_to_var(nvar,x)
1232 c call etotal(energia(0))
1233 c call enerprint(energia(0))
1234 c call briefout(0,etot)
1236 cd write (iout,'(2(a,i3))') 'NNT',NNT,' NCT',NCT
1237 cd write (iout,'(a)') 'Variable list:'
1238 cd write (iout,'(i4,f10.5)') (i,rad2deg*x(i),i=1,nvar)
1240 if (me.eq.king .or. (fg_rank.eq.0 .and. .not.out1file))
1241 & write (iout,'(//80(1h*)/20x,a,i4,a/80(1h*)//)')
1242 & 'Processor',myrank,': end reading molecular data.'
1246 c--------------------------------------------------------------------------
1247 logical function seq_comp(itypea,itypeb,length)
1249 integer length,itypea(length),itypeb(length)
1252 if (itypea(i).ne.itypeb(i)) then
1260 c-----------------------------------------------------------------------------
1261 subroutine read_bridge
1262 C Read information about disulfide bridges.
1263 implicit real*8 (a-h,o-z)
1264 include 'DIMENSIONS'
1268 include 'COMMON.IOUNITS'
1269 include 'COMMON.GEO'
1270 include 'COMMON.VAR'
1271 include 'COMMON.INTERACT'
1272 include 'COMMON.LOCAL'
1273 include 'COMMON.NAMES'
1274 include 'COMMON.CHAIN'
1275 include 'COMMON.FFIELD'
1276 include 'COMMON.SBRIDGE'
1277 include 'COMMON.HEADER'
1278 include 'COMMON.CONTROL'
1279 include 'COMMON.DBASE'
1280 include 'COMMON.THREAD'
1281 include 'COMMON.TIME1'
1282 include 'COMMON.SETUP'
1283 C Read bridging residues.
1284 read (inp,*) ns,(iss(i),i=1,ns)
1286 if(me.eq.king.or..not.out1file)
1287 & write (iout,*) 'ns=',ns,' iss:',(iss(i),i=1,ns)
1288 C Check whether the specified bridging residues are cystines.
1290 if (itype(iss(i)).ne.1) then
1291 if (me.eq.king.or..not.out1file) write (iout,'(2a,i3,a)')
1292 & 'Do you REALLY think that the residue ',restyp(iss(i)),i,
1293 & ' can form a disulfide bridge?!!!'
1294 write (*,'(2a,i3,a)')
1295 & 'Do you REALLY think that the residue ',restyp(iss(i)),i,
1296 & ' can form a disulfide bridge?!!!'
1298 call MPI_Finalize(MPI_COMM_WORLD,ierror)
1303 C Read preformed bridges.
1305 read (inp,*) nss,(ihpb(i),jhpb(i),i=1,nss)
1306 write (iout,*) 'nss=',nss,' ihpb,jhpb: ',(ihpb(i),jhpb(i),i=1,nss)
1309 C Check if the residues involved in bridges are in the specified list of
1310 C bridging residues.
1313 if (ihpb(i).eq.ihpb(j).or.ihpb(i).eq.jhpb(j)
1314 & .or.jhpb(i).eq.ihpb(j).or.jhpb(i).eq.jhpb(j)) then
1315 write (iout,'(a,i3,a)') 'Disulfide pair',i,
1316 & ' contains residues present in other pairs.'
1317 write (*,'(a,i3,a)') 'Disulfide pair',i,
1318 & ' contains residues present in other pairs.'
1320 call MPI_Finalize(MPI_COMM_WORLD,ierror)
1326 if (ihpb(i).eq.iss(j)) goto 10
1328 write (iout,'(a,i3,a)') 'Pair',i,' contains unknown cystine.'
1331 if (jhpb(i).eq.iss(j)) goto 20
1333 write (iout,'(a,i3,a)') 'Pair',i,' contains unknown cystine.'
1339 ihpb(i)=ihpb(i)+nres
1340 jhpb(i)=jhpb(i)+nres
1346 c----------------------------------------------------------------------------
1347 subroutine read_x(kanal,*)
1348 implicit real*8 (a-h,o-z)
1349 include 'DIMENSIONS'
1350 include 'COMMON.GEO'
1351 include 'COMMON.VAR'
1352 include 'COMMON.CHAIN'
1353 include 'COMMON.IOUNITS'
1354 include 'COMMON.CONTROL'
1355 include 'COMMON.LOCAL'
1356 include 'COMMON.INTERACT'
1357 c Read coordinates from input
1359 read(kanal,'(8f10.5)',end=10,err=10)
1360 & ((c(l,k),l=1,3),k=1,nres),
1361 & ((c(l,k+nres),l=1,3),k=nnt,nct)
1364 c(j,2*nres)=c(j,nres)
1366 call int_from_cart1(.false.)
1369 dc(j,i)=c(j,i+1)-c(j,i)
1370 dc_norm(j,i)=dc(j,i)*vbld_inv(i+1)
1374 if (itype(i).ne.10) then
1376 dc(j,i+nres)=c(j,i+nres)-c(j,i)
1377 dc_norm(j,i+nres)=dc(j,i+nres)*vbld_inv(i+nres)
1385 c----------------------------------------------------------------------------
1386 subroutine read_threadbase
1387 implicit real*8 (a-h,o-z)
1388 include 'DIMENSIONS'
1389 include 'COMMON.IOUNITS'
1390 include 'COMMON.GEO'
1391 include 'COMMON.VAR'
1392 include 'COMMON.INTERACT'
1393 include 'COMMON.LOCAL'
1394 include 'COMMON.NAMES'
1395 include 'COMMON.CHAIN'
1396 include 'COMMON.FFIELD'
1397 include 'COMMON.SBRIDGE'
1398 include 'COMMON.HEADER'
1399 include 'COMMON.CONTROL'
1400 include 'COMMON.DBASE'
1401 include 'COMMON.THREAD'
1402 include 'COMMON.TIME1'
1403 C Read pattern database for threading.
1404 read (icbase,*) nseq
1406 read (icbase,'(i5,2x,a8,2i4)') nres_base(1,i),str_nam(i),
1407 & nres_base(2,i),nres_base(3,i)
1408 read (icbase,'(9f8.3)') ((cart_base(k,j,i),k=1,3),j=1,
1410 c write (iout,'(i5,2x,a8,2i4)') nres_base(1,i),str_nam(i),
1411 c & nres_base(2,i),nres_base(3,i)
1412 c write (iout,'(9f8.3)') ((cart_base(k,j,i),k=1,3),j=1,
1416 if (weidis.eq.0.0D0) weidis=0.1D0
1425 read (inp,*) nexcl,(iexam(1,i),iexam(2,i),i=1,nexcl)
1426 write (iout,'(a,i5)') 'nexcl: ',nexcl
1427 write (iout,'(2i5)') (iexam(1,i),iexam(2,i),i=1,nexcl)
1430 c------------------------------------------------------------------------------
1431 subroutine setup_var
1432 implicit real*8 (a-h,o-z)
1433 include 'DIMENSIONS'
1434 include 'COMMON.IOUNITS'
1435 include 'COMMON.GEO'
1436 include 'COMMON.VAR'
1437 include 'COMMON.INTERACT'
1438 include 'COMMON.LOCAL'
1439 include 'COMMON.NAMES'
1440 include 'COMMON.CHAIN'
1441 include 'COMMON.FFIELD'
1442 include 'COMMON.SBRIDGE'
1443 include 'COMMON.HEADER'
1444 include 'COMMON.CONTROL'
1445 include 'COMMON.DBASE'
1446 include 'COMMON.THREAD'
1447 include 'COMMON.TIME1'
1448 C Set up variable list.
1454 if (itype(i).ne.10) then
1456 ialph(i,1)=nvar+nside
1460 if (indphi.gt.0) then
1462 else if (indback.gt.0) then
1467 cd write (iout,'(3i4)') (i,ialph(i,1),ialph(i,2),i=2,nres-1)
1470 c----------------------------------------------------------------------------
1471 subroutine gen_dist_constr
1472 C Generate CA distance constraints.
1473 implicit real*8 (a-h,o-z)
1474 include 'DIMENSIONS'
1475 include 'COMMON.IOUNITS'
1476 include 'COMMON.GEO'
1477 include 'COMMON.VAR'
1478 include 'COMMON.INTERACT'
1479 include 'COMMON.LOCAL'
1480 include 'COMMON.NAMES'
1481 include 'COMMON.CHAIN'
1482 include 'COMMON.FFIELD'
1483 include 'COMMON.SBRIDGE'
1484 include 'COMMON.HEADER'
1485 include 'COMMON.CONTROL'
1486 include 'COMMON.DBASE'
1487 include 'COMMON.THREAD'
1488 include 'COMMON.TIME1'
1489 dimension itype_pdb(maxres)
1490 common /pizda/ itype_pdb
1492 cd print *,'gen_dist_constr: nnt=',nnt,' nct=',nct
1493 cd write (2,*) 'gen_dist_constr: nnt=',nnt,' nct=',nct,
1494 cd & ' nstart_sup',nstart_sup,' nstart_seq',nstart_seq,
1496 do i=nstart_sup,nstart_sup+nsup-1
1497 cd write (2,*) 'i',i,' seq ',restyp(itype(i+nstart_seq-nstart_sup)),
1498 cd & ' seq_pdb', restyp(itype_pdb(i))
1499 do j=i+2,nstart_sup+nsup-1
1501 ihpb(nhpb)=i+nstart_seq-nstart_sup
1502 jhpb(nhpb)=j+nstart_seq-nstart_sup
1504 dhpb(nhpb)=dist(i,j)
1507 cd write (iout,'(a)') 'Distance constraints:'
1512 cd if (ii.gt.nres) then
1517 cd write (iout,'(a,1x,a,i4,3x,a,1x,a,i4,2f10.3)')
1518 cd & restyp(itype(ii)),iden,ii,restyp(itype(jj)),iden,jj,
1519 cd & dhpb(i),forcon(i)
1523 c----------------------------------------------------------------------------
1525 implicit real*8 (a-h,o-z)
1526 include 'DIMENSIONS'
1527 include 'COMMON.MAP'
1528 include 'COMMON.IOUNITS'
1529 character*3 angid(4) /'THE','PHI','ALP','OME'/
1530 character*80 mapcard,ucase
1532 read (inp,'(a)') mapcard
1533 mapcard=ucase(mapcard)
1534 if (index(mapcard,'PHI').gt.0) then
1536 else if (index(mapcard,'THE').gt.0) then
1538 else if (index(mapcard,'ALP').gt.0) then
1540 else if (index(mapcard,'OME').gt.0) then
1543 write(iout,'(a)')'Error - illegal variable spec in MAP card.'
1544 stop 'Error - illegal variable spec in MAP card.'
1546 call readi (mapcard,'RES1',res1(imap),0)
1547 call readi (mapcard,'RES2',res2(imap),0)
1548 if (res1(imap).eq.0) then
1549 res1(imap)=res2(imap)
1550 else if (res2(imap).eq.0) then
1551 res2(imap)=res1(imap)
1553 if(res1(imap)*res2(imap).eq.0 .or. res1(imap).gt.res2(imap))then
1555 & 'Error - illegal definition of variable group in MAP.'
1556 stop 'Error - illegal definition of variable group in MAP.'
1558 call reada(mapcard,'FROM',ang_from(imap),0.0D0)
1559 call reada(mapcard,'TO',ang_to(imap),0.0D0)
1560 call readi(mapcard,'NSTEP',nstep(imap),0)
1561 if (ang_from(imap).eq.ang_to(imap) .or. nstep(imap).eq.0) then
1563 & 'Illegal boundary and/or step size specification in MAP.'
1564 stop 'Illegal boundary and/or step size specification in MAP.'
1569 c----------------------------------------------------------------------------
1570 csa subroutine csaread
1571 csa implicit real*8 (a-h,o-z)
1572 csa include 'DIMENSIONS'
1573 csa include 'COMMON.IOUNITS'
1574 csa include 'COMMON.GEO'
1575 csa include 'COMMON.CSA'
1576 csa include 'COMMON.BANK'
1577 csa include 'COMMON.CONTROL'
1578 csa character*80 ucase
1579 csa character*620 mcmcard
1580 csa call card_concat(mcmcard)
1582 csa call readi(mcmcard,'NCONF',nconf,50)
1583 csa call readi(mcmcard,'NADD',nadd,0)
1584 csa call readi(mcmcard,'JSTART',jstart,1)
1585 csa call readi(mcmcard,'JEND',jend,1)
1586 csa call readi(mcmcard,'NSTMAX',nstmax,500000)
1587 csa call readi(mcmcard,'N0',n0,1)
1588 csa call readi(mcmcard,'N1',n1,6)
1589 csa call readi(mcmcard,'N2',n2,4)
1590 csa call readi(mcmcard,'N3',n3,0)
1591 csa call readi(mcmcard,'N4',n4,0)
1592 csa call readi(mcmcard,'N5',n5,0)
1593 csa call readi(mcmcard,'N6',n6,10)
1594 csa call readi(mcmcard,'N7',n7,0)
1595 csa call readi(mcmcard,'N8',n8,0)
1596 csa call readi(mcmcard,'N9',n9,0)
1597 csa call readi(mcmcard,'N14',n14,0)
1598 csa call readi(mcmcard,'N15',n15,0)
1599 csa call readi(mcmcard,'N16',n16,0)
1600 csa call readi(mcmcard,'N17',n17,0)
1601 csa call readi(mcmcard,'N18',n18,0)
1603 csa vdisulf=(index(mcmcard,'DYNSS').gt.0)
1605 csa call readi(mcmcard,'NDIFF',ndiff,2)
1606 csa call reada(mcmcard,'DIFFCUT',diffcut,0.0d0)
1607 csa call readi(mcmcard,'IS1',is1,1)
1608 csa call readi(mcmcard,'IS2',is2,8)
1609 csa call readi(mcmcard,'NRAN0',nran0,4)
1610 csa call readi(mcmcard,'NRAN1',nran1,2)
1611 csa call readi(mcmcard,'IRR',irr,1)
1612 csa call readi(mcmcard,'NSEED',nseed,20)
1613 csa call readi(mcmcard,'NTOTAL',ntotal,10000)
1614 csa call reada(mcmcard,'CUT1',cut1,2.0d0)
1615 csa call reada(mcmcard,'CUT2',cut2,5.0d0)
1616 csa call reada(mcmcard,'ESTOP',estop,-3000.0d0)
1617 csa call readi(mcmcard,'ICMAX',icmax,3)
1618 csa call readi(mcmcard,'IRESTART',irestart,0)
1619 csac!bankt call readi(mcmcard,'NBANKTM',ntbankm,0)
1622 csa call reada(mcmcard,'DELE',dele,20.0d0)
1623 csa call reada(mcmcard,'DIFCUT',difcut,720.0d0)
1624 csa call readi(mcmcard,'IREF',iref,0)
1625 csa call reada(mcmcard,'RMSCUT',rmscut,4.0d0)
1626 csa call reada(mcmcard,'PNCCUT',pnccut,0.5d0)
1627 csa call readi(mcmcard,'NCONF_IN',nconf_in,0)
1628 csa call reada(mcmcard,'RDIH_BIAS',rdih_bias,0.5d0)
1629 csa write (iout,*) "NCONF_IN",nconf_in
1632 c----------------------------------------------------------------------------
1633 cfmc subroutine mcmfread
1634 cfmc implicit real*8 (a-h,o-z)
1635 cfmc include 'DIMENSIONS'
1636 cfmc include 'COMMON.MCMF'
1637 cfmc include 'COMMON.IOUNITS'
1638 cfmc include 'COMMON.GEO'
1639 cfmc character*80 ucase
1640 cfmc character*620 mcmcard
1641 cfmc call card_concat(mcmcard)
1643 cfmc call readi(mcmcard,'MAXRANT',maxrant,1000)
1644 cfmc write(iout,*)'MAXRANT=',maxrant
1645 cfmc call readi(mcmcard,'MAXFAM',maxfam,maxfam_p)
1646 cfmc write(iout,*)'MAXFAM=',maxfam
1647 cfmc call readi(mcmcard,'NNET1',nnet1,5)
1648 cfmc write(iout,*)'NNET1=',nnet1
1649 cfmc call readi(mcmcard,'NNET2',nnet2,4)
1650 cfmc write(iout,*)'NNET2=',nnet2
1651 cfmc call readi(mcmcard,'NNET3',nnet3,4)
1652 cfmc write(iout,*)'NNET3=',nnet3
1653 cfmc call readi(mcmcard,'ILASTT',ilastt,0)
1654 cfmc write(iout,*)'ILASTT=',ilastt
1655 cfmc call readi(mcmcard,'MAXSTR',maxstr,maxstr_mcmf)
1656 cfmc write(iout,*)'MAXSTR=',maxstr
1657 cfmc maxstr_f=maxstr/maxfam
1658 cfmc write(iout,*)'MAXSTR_F=',maxstr_f
1659 cfmc call readi(mcmcard,'NMCMF',nmcmf,10)
1660 cfmc write(iout,*)'NMCMF=',nmcmf
1661 cfmc call readi(mcmcard,'IFOCUS',ifocus,nmcmf)
1662 cfmc write(iout,*)'IFOCUS=',ifocus
1663 cfmc call readi(mcmcard,'NLOCMCMF',nlocmcmf,1000)
1664 cfmc write(iout,*)'NLOCMCMF=',nlocmcmf
1665 cfmc call readi(mcmcard,'INTPRT',intprt,1000)
1666 cfmc write(iout,*)'INTPRT=',intprt
1667 cfmc call readi(mcmcard,'IPRT',iprt,100)
1668 cfmc write(iout,*)'IPRT=',iprt
1669 cfmc call readi(mcmcard,'IMAXTR',imaxtr,100)
1670 cfmc write(iout,*)'IMAXTR=',imaxtr
1671 cfmc call readi(mcmcard,'MAXEVEN',maxeven,1000)
1672 cfmc write(iout,*)'MAXEVEN=',maxeven
1673 cfmc call readi(mcmcard,'MAXEVEN1',maxeven1,3)
1674 cfmc write(iout,*)'MAXEVEN1=',maxeven1
1675 cfmc call readi(mcmcard,'INIMIN',inimin,200)
1676 cfmc write(iout,*)'INIMIN=',inimin
1677 cfmc call readi(mcmcard,'NSTEPMCMF',nstepmcmf,10)
1678 cfmc write(iout,*)'NSTEPMCMF=',nstepmcmf
1679 cfmc call readi(mcmcard,'NTHREAD',nthread,5)
1680 cfmc write(iout,*)'NTHREAD=',nthread
1681 cfmc call readi(mcmcard,'MAXSTEPMCMF',maxstepmcmf,2500)
1682 cfmc write(iout,*)'MAXSTEPMCMF=',maxstepmcmf
1683 cfmc call readi(mcmcard,'MAXPERT',maxpert,9)
1684 cfmc write(iout,*)'MAXPERT=',maxpert
1685 cfmc call readi(mcmcard,'IRMSD',irmsd,1)
1686 cfmc write(iout,*)'IRMSD=',irmsd
1687 cfmc call reada(mcmcard,'DENEMIN',denemin,0.01D0)
1688 cfmc write(iout,*)'DENEMIN=',denemin
1689 cfmc call reada(mcmcard,'RCUT1S',rcut1s,3.5D0)
1690 cfmc write(iout,*)'RCUT1S=',rcut1s
1691 cfmc call reada(mcmcard,'RCUT1E',rcut1e,2.0D0)
1692 cfmc write(iout,*)'RCUT1E=',rcut1e
1693 cfmc call reada(mcmcard,'RCUT2S',rcut2s,0.5D0)
1694 cfmc write(iout,*)'RCUT2S=',rcut2s
1695 cfmc call reada(mcmcard,'RCUT2E',rcut2e,0.1D0)
1696 cfmc write(iout,*)'RCUT2E=',rcut2e
1697 cfmc call reada(mcmcard,'DPERT1',d_pert1,180.0D0)
1698 cfmc write(iout,*)'DPERT1=',d_pert1
1699 cfmc call reada(mcmcard,'DPERT1A',d_pert1a,180.0D0)
1700 cfmc write(iout,*)'DPERT1A=',d_pert1a
1701 cfmc call reada(mcmcard,'DPERT2',d_pert2,90.0D0)
1702 cfmc write(iout,*)'DPERT2=',d_pert2
1703 cfmc call reada(mcmcard,'DPERT2A',d_pert2a,45.0D0)
1704 cfmc write(iout,*)'DPERT2A=',d_pert2a
1705 cfmc call reada(mcmcard,'DPERT2B',d_pert2b,90.0D0)
1706 cfmc write(iout,*)'DPERT2B=',d_pert2b
1707 cfmc call reada(mcmcard,'DPERT2C',d_pert2c,60.0D0)
1708 cfmc write(iout,*)'DPERT2C=',d_pert2c
1709 cfmc d_pert1=deg2rad*d_pert1
1710 cfmc d_pert1a=deg2rad*d_pert1a
1711 cfmc d_pert2=deg2rad*d_pert2
1712 cfmc d_pert2a=deg2rad*d_pert2a
1713 cfmc d_pert2b=deg2rad*d_pert2b
1714 cfmc d_pert2c=deg2rad*d_pert2c
1715 cfmc call reada(mcmcard,'KT_MCMF1',kt_mcmf1,1.0D0)
1716 cfmc write(iout,*)'KT_MCMF1=',kt_mcmf1
1717 cfmc call reada(mcmcard,'KT_MCMF2',kt_mcmf2,1.0D0)
1718 cfmc write(iout,*)'KT_MCMF2=',kt_mcmf2
1719 cfmc call reada(mcmcard,'DKT_MCMF1',dkt_mcmf1,10.0D0)
1720 cfmc write(iout,*)'DKT_MCMF1=',dkt_mcmf1
1721 cfmc call reada(mcmcard,'DKT_MCMF2',dkt_mcmf2,1.0D0)
1722 cfmc write(iout,*)'DKT_MCMF2=',dkt_mcmf2
1723 cfmc call reada(mcmcard,'RCUTINI',rcutini,3.5D0)
1724 cfmc write(iout,*)'RCUTINI=',rcutini
1725 cfmc call reada(mcmcard,'GRAT',grat,0.5D0)
1726 cfmc write(iout,*)'GRAT=',grat
1727 cfmc call reada(mcmcard,'BIAS_MCMF',bias_mcmf,0.0D0)
1728 cfmc write(iout,*)'BIAS_MCMF=',bias_mcmf
1732 c----------------------------------------------------------------------------
1734 implicit real*8 (a-h,o-z)
1735 include 'DIMENSIONS'
1736 include 'COMMON.MCM'
1737 include 'COMMON.MCE'
1738 include 'COMMON.IOUNITS'
1740 character*320 mcmcard
1741 call card_concat(mcmcard)
1742 call readi(mcmcard,'MAXACC',maxacc,100)
1743 call readi(mcmcard,'MAX_MCM_IT',max_mcm_it,10000)
1744 call readi(mcmcard,'MAXTRIAL',maxtrial,100)
1745 call readi(mcmcard,'MAXTRIAL_ITER',maxtrial_iter,1000)
1746 call readi(mcmcard,'MAXREPM',maxrepm,200)
1747 call reada(mcmcard,'RANFRACT',RanFract,0.5D0)
1748 call reada(mcmcard,'POOL_FRACT',pool_fraction,0.01D0)
1749 call reada(mcmcard,'OVERLAP',overlap_cut,1.0D3)
1750 call reada(mcmcard,'E_UP',e_up,5.0D0)
1751 call reada(mcmcard,'DELTE',delte,0.1D0)
1752 call readi(mcmcard,'NSWEEP',nsweep,5)
1753 call readi(mcmcard,'NSTEPH',nsteph,0)
1754 call readi(mcmcard,'NSTEPC',nstepc,0)
1755 call reada(mcmcard,'TMIN',tmin,298.0D0)
1756 call reada(mcmcard,'TMAX',tmax,298.0D0)
1757 call readi(mcmcard,'NWINDOW',nwindow,0)
1758 call readi(mcmcard,'PRINT_MC',print_mc,0)
1759 print_stat=(index(mcmcard,'NO_PRINT_STAT').le.0)
1760 print_int=(index(mcmcard,'NO_PRINT_INT').le.0)
1761 ent_read=(index(mcmcard,'ENT_READ').gt.0)
1762 call readi(mcmcard,'SAVE_FREQ',save_frequency,1000)
1763 call readi(mcmcard,'MESSAGE_FREQ',message_frequency,1000)
1764 call readi(mcmcard,'POOL_READ_FREQ',pool_read_freq,5000)
1765 call readi(mcmcard,'POOL_SAVE_FREQ',pool_save_freq,1000)
1766 call readi(mcmcard,'PRINT_FREQ',print_freq,1000)
1767 if (nwindow.gt.0) then
1768 read (inp,*) (winstart(i),winend(i),i=1,nwindow)
1770 winlen(i)=winend(i)-winstart(i)+1
1773 if (tmax.lt.tmin) tmax=tmin
1774 if (tmax.eq.tmin) then
1778 if (nstepc.gt.0 .and. nsteph.gt.0) then
1779 tsteph=(tmax/tmin)**(1.0D0/(nsteph+0.0D0))
1780 tstepc=(tmax/tmin)**(1.0D0/(nstepc+0.0D0))
1782 C Probabilities of different move types
1783 sumpro_type(0)=0.0D0
1784 call reada(mcmcard,'MULTI_BOND',sumpro_type(1),1.0d0)
1785 call reada(mcmcard,'ONE_ANGLE' ,sumpro_type(2),2.0d0)
1786 sumpro_type(2)=sumpro_type(1)+sumpro_type(2)
1787 call reada(mcmcard,'THETA' ,sumpro_type(3),0.0d0)
1788 sumpro_type(3)=sumpro_type(2)+sumpro_type(3)
1789 call reada(mcmcard,'SIDE_CHAIN',sumpro_type(4),0.5d0)
1790 sumpro_type(4)=sumpro_type(3)+sumpro_type(4)
1792 print *,'i',i,' sumprotype',sumpro_type(i)
1793 sumpro_type(i)=sumpro_type(i)/sumpro_type(MaxMoveType)
1794 print *,'i',i,' sumprotype',sumpro_type(i)
1798 c----------------------------------------------------------------------------
1799 subroutine read_minim
1800 implicit real*8 (a-h,o-z)
1801 include 'DIMENSIONS'
1802 include 'COMMON.MINIM'
1803 include 'COMMON.IOUNITS'
1805 character*320 minimcard
1806 call card_concat(minimcard)
1807 call readi(minimcard,'MAXMIN',maxmin,2000)
1808 call readi(minimcard,'MAXFUN',maxfun,5000)
1809 call readi(minimcard,'MINMIN',minmin,maxmin)
1810 call readi(minimcard,'MINFUN',minfun,maxmin)
1811 call reada(minimcard,'TOLF',tolf,1.0D-2)
1812 call reada(minimcard,'RTOLF',rtolf,1.0D-4)
1813 write (iout,'(/80(1h*)/20x,a/80(1h*))')
1814 & 'Options in energy minimization:'
1815 write (iout,'(4(a,i5),a,1pe14.5,a,1pe14.5)')
1816 & 'MaxMin:',MaxMin,' MaxFun:',MaxFun,
1817 & 'MinMin:',MinMin,' MinFun:',MinFun,
1818 & ' TolF:',TolF,' RTolF:',RTolF
1821 c----------------------------------------------------------------------------
1822 subroutine read_angles(kanal,*)
1823 implicit real*8 (a-h,o-z)
1824 include 'DIMENSIONS'
1825 include 'COMMON.GEO'
1826 include 'COMMON.VAR'
1827 include 'COMMON.CHAIN'
1828 include 'COMMON.IOUNITS'
1829 include 'COMMON.CONTROL'
1830 c Read angles from input
1832 read (kanal,*,err=10,end=10) (theta(i),i=3,nres)
1833 read (kanal,*,err=10,end=10) (phi(i),i=4,nres)
1834 read (kanal,*,err=10,end=10) (alph(i),i=2,nres-1)
1835 read (kanal,*,err=10,end=10) (omeg(i),i=2,nres-1)
1838 c 9/7/01 avoid 180 deg valence angle
1839 if (theta(i).gt.179.99d0) theta(i)=179.99d0
1841 theta(i)=deg2rad*theta(i)
1842 phi(i)=deg2rad*phi(i)
1843 alph(i)=deg2rad*alph(i)
1844 omeg(i)=deg2rad*omeg(i)
1849 c----------------------------------------------------------------------------
1850 subroutine reada(rekord,lancuch,wartosc,default)
1852 character*(*) rekord,lancuch
1853 double precision wartosc,default
1856 iread=index(rekord,lancuch)
1857 if (iread.eq.0) then
1861 iread=iread+ilen(lancuch)+1
1862 read (rekord(iread:),*,err=10,end=10) wartosc
1867 c----------------------------------------------------------------------------
1868 subroutine readi(rekord,lancuch,wartosc,default)
1870 character*(*) rekord,lancuch
1871 integer wartosc,default
1874 iread=index(rekord,lancuch)
1875 if (iread.eq.0) then
1879 iread=iread+ilen(lancuch)+1
1880 read (rekord(iread:),*,err=10,end=10) wartosc
1885 c----------------------------------------------------------------------------
1886 subroutine multreadi(rekord,lancuch,tablica,dim,default)
1889 integer tablica(dim),default
1890 character*(*) rekord,lancuch
1897 iread=index(rekord,lancuch(:ilen(lancuch))//"=")
1898 if (iread.eq.0) return
1899 iread=iread+ilen(lancuch)+1
1900 read (rekord(iread:),*,end=10,err=10) (tablica(i),i=1,dim)
1903 c----------------------------------------------------------------------------
1904 subroutine multreada(rekord,lancuch,tablica,dim,default)
1907 double precision tablica(dim),default
1908 character*(*) rekord,lancuch
1915 iread=index(rekord,lancuch(:ilen(lancuch))//"=")
1916 if (iread.eq.0) return
1917 iread=iread+ilen(lancuch)+1
1918 read (rekord(iread:),*,end=10,err=10) (tablica(i),i=1,dim)
1921 c----------------------------------------------------------------------------
1922 subroutine openunits
1923 implicit real*8 (a-h,o-z)
1924 include 'DIMENSIONS'
1927 character*16 form,nodename
1930 include 'COMMON.SETUP'
1931 include 'COMMON.IOUNITS'
1933 include 'COMMON.CONTROL'
1934 integer lenpre,lenpot,ilen,lentmp
1936 character*3 out1file_text,ucase
1939 c print *,"Processor",myrank,"fg_rank",fg_rank," entered openunits"
1940 call getenv_loc("PREFIX",prefix)
1942 call getenv_loc("POT",pot)
1943 call getenv_loc("DIRTMP",tmpdir)
1944 call getenv_loc("CURDIR",curdir)
1945 call getenv_loc("OUT1FILE",out1file_text)
1946 c print *,"Processor",myrank,"fg_rank",fg_rank," did GETENV"
1947 out1file_text=ucase(out1file_text)
1948 if (out1file_text(1:1).eq."Y") then
1951 out1file=fg_rank.gt.0
1956 if (lentmp.gt.0) then
1957 write (*,'(80(1h!))')
1958 write (*,'(a,19x,a,19x,a)') "!"," A T T E N T I O N ","!"
1959 write (*,'(80(1h!))')
1960 write (*,*)"All output files will be on node /tmp directory."
1962 call MPI_GET_PROCESSOR_NAME( nodename, nodelen, IERROR )
1963 if (me.eq.king) then
1964 write (*,*) "The master node is ",nodename
1965 else if (fg_rank.eq.0) then
1966 write (*,*) "I am the CG slave node ",nodename
1968 write (*,*) "I am the FG slave node ",nodename
1971 PREFIX = tmpdir(:lentmp)//'/'//prefix(:lenpre)
1972 lenpre = lentmp+lenpre+1
1974 entname=prefix(:lenpre)//'_'//pot(:lenpot)//'.entr'
1975 C Get the names and open the input files
1976 #if defined(WINIFL) || defined(WINPGI)
1977 open(1,file=pref_orig(:ilen(pref_orig))//
1978 & '.inp',status='old',readonly,shared)
1979 open (9,file=prefix(:ilen(prefix))//'.intin',status='unknown')
1980 C open (18,file=prefix(:ilen(prefix))//'.entin',status='unknown')
1981 C Get parameter filenames and open the parameter files.
1982 call getenv_loc('BONDPAR',bondname)
1983 open (ibond,file=bondname,status='old',readonly,shared)
1984 call getenv_loc('THETPAR',thetname)
1985 open (ithep,file=thetname,status='old',readonly,shared)
1987 call getenv_loc('THETPARPDB',thetname_pdb)
1988 open (ithep_pdb,file=thetname_pdb,status='old',readonly,shared)
1990 call getenv_loc('ROTPAR',rotname)
1991 open (irotam,file=rotname,status='old',readonly,shared)
1993 call getenv_loc('ROTPARPDB',rotname_pdb)
1994 open (irotam_pdb,file=rotname_pdb,status='old',readonly,shared)
1996 call getenv_loc('TORPAR',torname)
1997 open (itorp,file=torname,status='old',readonly,shared)
1998 call getenv_loc('TORDPAR',tordname)
1999 open (itordp,file=tordname,status='old',readonly,shared)
2000 call getenv_loc('FOURIER',fouriername)
2001 open (ifourier,file=fouriername,status='old',readonly,shared)
2002 call getenv_loc('ELEPAR',elename)
2003 open (ielep,file=elename,status='old',readonly,shared)
2004 call getenv_loc('SIDEPAR',sidename)
2005 open (isidep,file=sidename,status='old',readonly,shared)
2006 #elif (defined CRAY) || (defined AIX)
2007 open(1,file=pref_orig(:ilen(pref_orig))//'.inp',status='old',
2009 c print *,"Processor",myrank," opened file 1"
2010 open (9,file=prefix(:ilen(prefix))//'.intin',status='unknown')
2011 c print *,"Processor",myrank," opened file 9"
2012 C open (18,file=prefix(:ilen(prefix))//'.entin',status='unknown')
2013 C Get parameter filenames and open the parameter files.
2014 call getenv_loc('BONDPAR',bondname)
2015 open (ibond,file=bondname,status='old',action='read')
2016 c print *,"Processor",myrank," opened file IBOND"
2017 call getenv_loc('THETPAR',thetname)
2018 open (ithep,file=thetname,status='old',action='read')
2019 c print *,"Processor",myrank," opened file ITHEP"
2021 call getenv_loc('THETPARPDB',thetname_pdb)
2022 open (ithep_pdb,file=thetname_pdb,status='old',action='read')
2024 call getenv_loc('ROTPAR',rotname)
2025 open (irotam,file=rotname,status='old',action='read')
2026 c print *,"Processor",myrank," opened file IROTAM"
2028 call getenv_loc('ROTPARPDB',rotname_pdb)
2029 open (irotam_pdb,file=rotname_pdb,status='old',action='read')
2031 call getenv_loc('TORPAR',torname)
2032 open (itorp,file=torname,status='old',action='read')
2033 c print *,"Processor",myrank," opened file ITORP"
2034 call getenv_loc('TORDPAR',tordname)
2035 open (itordp,file=tordname,status='old',action='read')
2036 c print *,"Processor",myrank," opened file ITORDP"
2037 call getenv_loc('SCCORPAR',sccorname)
2038 open (isccor,file=sccorname,status='old',action='read')
2039 c print *,"Processor",myrank," opened file ISCCOR"
2040 call getenv_loc('FOURIER',fouriername)
2041 open (ifourier,file=fouriername,status='old',action='read')
2042 c print *,"Processor",myrank," opened file IFOURIER"
2043 call getenv_loc('ELEPAR',elename)
2044 open (ielep,file=elename,status='old',action='read')
2045 c print *,"Processor",myrank," opened file IELEP"
2046 call getenv_loc('SIDEPAR',sidename)
2047 open (isidep,file=sidename,status='old',action='read')
2048 c print *,"Processor",myrank," opened file ISIDEP"
2049 c print *,"Processor",myrank," opened parameter files"
2051 open(1,file=pref_orig(:ilen(pref_orig))//'.inp',status='old')
2052 open (9,file=prefix(:ilen(prefix))//'.intin',status='unknown')
2053 C open (18,file=prefix(:ilen(prefix))//'.entin',status='unknown')
2054 C Get parameter filenames and open the parameter files.
2055 call getenv_loc('BONDPAR',bondname)
2056 open (ibond,file=bondname,status='old')
2057 call getenv_loc('THETPAR',thetname)
2058 open (ithep,file=thetname,status='old')
2060 call getenv_loc('THETPARPDB',thetname_pdb)
2061 open (ithep_pdb,file=thetname_pdb,status='old')
2063 call getenv_loc('ROTPAR',rotname)
2064 open (irotam,file=rotname,status='old')
2066 call getenv_loc('ROTPARPDB',rotname_pdb)
2067 open (irotam_pdb,file=rotname_pdb,status='old')
2069 call getenv_loc('TORPAR',torname)
2070 open (itorp,file=torname,status='old')
2071 call getenv_loc('TORDPAR',tordname)
2072 open (itordp,file=tordname,status='old')
2073 call getenv_loc('SCCORPAR',sccorname)
2074 open (isccor,file=sccorname,status='old')
2075 call getenv_loc('FOURIER',fouriername)
2076 open (ifourier,file=fouriername,status='old')
2077 call getenv_loc('ELEPAR',elename)
2078 open (ielep,file=elename,status='old')
2079 call getenv_loc('SIDEPAR',sidename)
2080 open (isidep,file=sidename,status='old')
2082 open(1,file=pref_orig(:ilen(pref_orig))//'.inp',status='old',
2084 open (9,file=prefix(:ilen(prefix))//'.intin',status='unknown')
2085 C open (18,file=prefix(:ilen(prefix))//'.entin',status='unknown')
2086 C Get parameter filenames and open the parameter files.
2087 call getenv_loc('BONDPAR',bondname)
2088 open (ibond,file=bondname,status='old',action='read')
2089 call getenv_loc('THETPAR',thetname)
2090 open (ithep,file=thetname,status='old',action='read')
2092 call getenv_loc('THETPARPDB',thetname_pdb)
2093 print *,"thetname_pdb ",thetname_pdb
2094 open (ithep_pdb,file=thetname_pdb,status='old',action='read')
2095 print *,ithep_pdb," opened"
2097 call getenv_loc('ROTPAR',rotname)
2098 open (irotam,file=rotname,status='old',action='read')
2100 call getenv_loc('ROTPARPDB',rotname_pdb)
2101 open (irotam_pdb,file=rotname_pdb,status='old',action='read')
2103 call getenv_loc('TORPAR',torname)
2104 open (itorp,file=torname,status='old',action='read')
2105 call getenv_loc('TORDPAR',tordname)
2106 open (itordp,file=tordname,status='old',action='read')
2107 call getenv_loc('SCCORPAR',sccorname)
2108 open (isccor,file=sccorname,status='old',action='read')
2109 call getenv_loc('FOURIER',fouriername)
2110 open (ifourier,file=fouriername,status='old',action='read')
2111 call getenv_loc('ELEPAR',elename)
2112 open (ielep,file=elename,status='old',action='read')
2113 call getenv_loc('SIDEPAR',sidename)
2114 open (isidep,file=sidename,status='old',action='read')
2118 C 8/9/01 In the newest version SCp interaction constants are read from a file
2119 C Use -DOLDSCP to use hard-coded constants instead.
2121 call getenv_loc('SCPPAR',scpname)
2122 #if defined(WINIFL) || defined(WINPGI)
2123 open (iscpp,file=scpname,status='old',readonly,shared)
2124 #elif (defined CRAY) || (defined AIX)
2125 open (iscpp,file=scpname,status='old',action='read')
2127 open (iscpp,file=scpname,status='old')
2129 open (iscpp,file=scpname,status='old',action='read')
2132 call getenv_loc('PATTERN',patname)
2133 #if defined(WINIFL) || defined(WINPGI)
2134 open (icbase,file=patname,status='old',readonly,shared)
2135 #elif (defined CRAY) || (defined AIX)
2136 open (icbase,file=patname,status='old',action='read')
2138 open (icbase,file=patname,status='old')
2140 open (icbase,file=patname,status='old',action='read')
2143 C Open output file only for CG processes
2144 c print *,"Processor",myrank," fg_rank",fg_rank
2145 if (fg_rank.eq.0) then
2147 if (nodes.eq.1) then
2150 npos = dlog10(dfloat(nodes-1))+1
2152 if (npos.lt.3) npos=3
2153 write (liczba,'(i1)') npos
2154 form = '(bz,i'//liczba(:ilen(liczba))//'.'//liczba(:ilen(liczba))
2156 write (liczba,form) me
2157 outname=prefix(:lenpre)//'.out_'//pot(:lenpot)//
2158 & liczba(:ilen(liczba))
2159 intname=prefix(:lenpre)//'_'//pot(:lenpot)//liczba(:ilen(liczba))
2161 pdbname=prefix(:lenpre)//'_'//pot(:lenpot)//liczba(:ilen(liczba))
2163 mol2name=prefix(:lenpre)//'_'//pot(:lenpot)//
2164 & liczba(:ilen(liczba))//'.mol2'
2165 statname=prefix(:lenpre)//'_'//pot(:lenpot)//
2166 & liczba(:ilen(liczba))//'.stat'
2168 & call copy_to_tmp(pref_orig(:ilen(pref_orig))//'_'//pot(:lenpot)
2169 & //liczba(:ilen(liczba))//'.stat')
2170 rest2name=prefix(:ilen(prefix))//"_"//liczba(:ilen(liczba))
2173 qname=prefix(:lenpre)//'_'//pot(:lenpot)//
2174 & liczba(:ilen(liczba))//'.const'
2179 outname=prefix(:lenpre)//'.out_'//pot(:lenpot)
2180 intname=prefix(:lenpre)//'_'//pot(:lenpot)//'.int'
2181 pdbname=prefix(:lenpre)//'_'//pot(:lenpot)//'.pdb'
2182 mol2name=prefix(:lenpre)//'_'//pot(:lenpot)//'.mol2'
2183 statname=prefix(:lenpre)//'_'//pot(:lenpot)//'.stat'
2185 & call copy_to_tmp(pref_orig(:ilen(pref_orig))//'_'//pot(:lenpot)
2187 rest2name=prefix(:ilen(prefix))//'.rst'
2189 qname=prefix(:lenpre)//'_'//pot(:lenpot)//'.const'
2192 #if defined(AIX) || defined(PGI)
2193 if (me.eq.king .or. .not. out1file)
2194 & open(iout,file=outname,status='unknown')
2196 if (fg_rank.gt.0) then
2197 write (liczba,'(i3.3)') myrank/nfgtasks
2198 write (ll,'(bz,i3.3)') fg_rank
2199 open(iout,file="debug"//liczba(:ilen(liczba))//"."//ll,
2204 open(igeom,file=intname,status='unknown',position='append')
2205 open(ipdb,file=pdbname,status='unknown')
2206 open(imol2,file=mol2name,status='unknown')
2207 open(istat,file=statname,status='unknown',position='append')
2209 c1out open(iout,file=outname,status='unknown')
2212 if (me.eq.king .or. .not.out1file)
2213 & open(iout,file=outname,status='unknown')
2215 if (fg_rank.gt.0) then
2216 write (liczba,'(i3.3)') myrank/nfgtasks
2217 write (ll,'(bz,i3.3)') fg_rank
2218 open(iout,file="debug"//liczba(:ilen(liczba))//"."//ll,
2223 open(igeom,file=intname,status='unknown',access='append')
2224 open(ipdb,file=pdbname,status='unknown')
2225 open(imol2,file=mol2name,status='unknown')
2226 open(istat,file=statname,status='unknown',access='append')
2228 c1out open(iout,file=outname,status='unknown')
2231 csa csa_rbank=prefix(:lenpre)//'.CSA.rbank'
2232 csa csa_seed=prefix(:lenpre)//'.CSA.seed'
2233 csa csa_history=prefix(:lenpre)//'.CSA.history'
2234 csa csa_bank=prefix(:lenpre)//'.CSA.bank'
2235 csa csa_bank1=prefix(:lenpre)//'.CSA.bank1'
2236 csa csa_alpha=prefix(:lenpre)//'.CSA.alpha'
2237 csa csa_alpha1=prefix(:lenpre)//'.CSA.alpha1'
2238 csac!bankt csa_bankt=prefix(:lenpre)//'.CSA.bankt'
2239 csa csa_int=prefix(:lenpre)//'.int'
2240 csa csa_bank_reminimized=prefix(:lenpre)//'.CSA.bank_reminimized'
2241 csa csa_native_int=prefix(:lenpre)//'.CSA.native.int'
2242 csa csa_in=prefix(:lenpre)//'.CSA.in'
2243 c print *,"Processor",myrank,"fg_rank",fg_rank," opened files"
2246 write (iout,'(80(1h-))')
2247 write (iout,'(30x,a)') "FILE ASSIGNMENT"
2248 write (iout,'(80(1h-))')
2249 write (iout,*) "Input file : ",
2250 & pref_orig(:ilen(pref_orig))//'.inp'
2251 write (iout,*) "Output file : ",
2252 & outname(:ilen(outname))
2254 write (iout,*) "Sidechain potential file : ",
2255 & sidename(:ilen(sidename))
2257 write (iout,*) "SCp potential file : ",
2258 & scpname(:ilen(scpname))
2260 write (iout,*) "Electrostatic potential file : ",
2261 & elename(:ilen(elename))
2262 write (iout,*) "Cumulant coefficient file : ",
2263 & fouriername(:ilen(fouriername))
2264 write (iout,*) "Torsional parameter file : ",
2265 & torname(:ilen(torname))
2266 write (iout,*) "Double torsional parameter file : ",
2267 & tordname(:ilen(tordname))
2268 write (iout,*) "SCCOR parameter file : ",
2269 & sccorname(:ilen(sccorname))
2270 write (iout,*) "Bond & inertia constant file : ",
2271 & bondname(:ilen(bondname))
2272 write (iout,*) "Bending parameter file : ",
2273 & thetname(:ilen(thetname))
2274 write (iout,*) "Rotamer parameter file : ",
2275 & rotname(:ilen(rotname))
2276 write (iout,*) "Threading database : ",
2277 & patname(:ilen(patname))
2279 &write (iout,*)" DIRTMP : ",
2281 write (iout,'(80(1h-))')
2285 c----------------------------------------------------------------------------
2286 subroutine card_concat(card)
2287 implicit real*8 (a-h,o-z)
2288 include 'DIMENSIONS'
2289 include 'COMMON.IOUNITS'
2291 character*80 karta,ucase
2293 read (inp,'(a)') karta
2296 do while (karta(80:80).eq.'&')
2297 card=card(:ilen(card)+1)//karta(:79)
2298 read (inp,'(a)') karta
2301 card=card(:ilen(card)+1)//karta
2304 c----------------------------------------------------------------------------------
2306 implicit real*8 (a-h,o-z)
2307 include 'DIMENSIONS'
2308 include 'COMMON.CHAIN'
2309 include 'COMMON.IOUNITS'
2311 open(irest2,file=rest2name,status='unknown')
2312 read(irest2,*) totT,EK,potE,totE,t_bath
2314 read(irest2,'(3e15.5)') (d_t(j,i),j=1,3)
2317 read(irest2,'(3e15.5)') (dc(j,i),j=1,3)
2320 read (irest2,*) iset
2325 c---------------------------------------------------------------------------------
2326 subroutine read_fragments
2327 implicit real*8 (a-h,o-z)
2328 include 'DIMENSIONS'
2332 include 'COMMON.SETUP'
2333 include 'COMMON.CHAIN'
2334 include 'COMMON.IOUNITS'
2336 include 'COMMON.CONTROL'
2337 read(inp,*) nset,nfrag,npair,nfrag_back
2338 if(me.eq.king.or..not.out1file)
2339 & write(iout,*) "nset",nset," nfrag",nfrag," npair",npair,
2340 & " nfrag_back",nfrag_back
2342 read(inp,*) mset(iset)
2344 read(inp,*) wfrag(i,iset),ifrag(1,i,iset),ifrag(2,i,iset),
2346 if(me.eq.king.or..not.out1file)
2347 & write(iout,*) "R ",i,wfrag(i,iset),ifrag(1,i,iset),
2348 & ifrag(2,i,iset), qinfrag(i,iset)
2351 read(inp,*) wpair(i,iset),ipair(1,i,iset),ipair(2,i,iset),
2353 if(me.eq.king.or..not.out1file)
2354 & write(iout,*) "R ",i,wpair(i,iset),ipair(1,i,iset),
2355 & ipair(2,i,iset), qinpair(i,iset)
2358 read(inp,*) wfrag_back(1,i,iset),wfrag_back(2,i,iset),
2359 & wfrag_back(3,i,iset),
2360 & ifrag_back(1,i,iset),ifrag_back(2,i,iset)
2361 if(me.eq.king.or..not.out1file)
2362 & write(iout,*) "A",i,wfrag_back(1,i,iset),wfrag_back(2,i,iset),
2363 & wfrag_back(3,i,iset),ifrag_back(1,i,iset),ifrag_back(2,i,iset)
2368 c-------------------------------------------------------------------------------
2369 subroutine read_dist_constr
2370 implicit real*8 (a-h,o-z)
2371 include 'DIMENSIONS'
2375 include 'COMMON.SETUP'
2376 include 'COMMON.CONTROL'
2377 include 'COMMON.CHAIN'
2378 include 'COMMON.IOUNITS'
2379 include 'COMMON.SBRIDGE'
2380 integer ifrag_(2,100),ipair_(2,100)
2381 double precision wfrag_(100),wpair_(100)
2382 character*500 controlcard
2383 c write (iout,*) "Calling read_dist_constr"
2384 c write (iout,*) "nres",nres," nstart_sup",nstart_sup," nsup",nsup
2386 call card_concat(controlcard)
2387 call readi(controlcard,"NFRAG",nfrag_,0)
2388 call readi(controlcard,"NPAIR",npair_,0)
2389 call readi(controlcard,"NDIST",ndist_,0)
2390 call reada(controlcard,'DIST_CUT',dist_cut,5.0d0)
2391 call multreadi(controlcard,"IFRAG",ifrag_(1,1),2*nfrag_,0)
2392 call multreadi(controlcard,"IPAIR",ipair_(1,1),2*npair_,0)
2393 call multreada(controlcard,"WFRAG",wfrag_(1),nfrag_,0.0d0)
2394 call multreada(controlcard,"WPAIR",wpair_(1),npair_,0.0d0)
2395 c write (iout,*) "NFRAG",nfrag_," NPAIR",npair_," NDIST",ndist_
2396 c write (iout,*) "IFRAG"
2398 c write (iout,*) i,ifrag_(1,i),ifrag_(2,i),wfrag_(i)
2400 c write (iout,*) "IPAIR"
2402 c write (iout,*) i,ipair_(1,i),ipair_(2,i),wpair_(i)
2406 if (ifrag_(1,i).lt.nstart_sup) ifrag_(1,i)=nstart_sup
2407 if (ifrag_(2,i).gt.nstart_sup+nsup-1)
2408 & ifrag_(2,i)=nstart_sup+nsup-1
2409 c write (iout,*) i,ifrag_(1,i),ifrag_(2,i),wfrag_(i)
2411 if (wfrag_(i).gt.0.0d0) then
2412 do j=ifrag_(1,i),ifrag_(2,i)-1
2413 do k=j+1,ifrag_(2,i)
2414 write (iout,*) "j",j," k",k
2416 if (constr_dist.eq.1) then
2421 forcon(nhpb)=wfrag_(i)
2422 else if (constr_dist.eq.2) then
2423 if (ddjk.le.dist_cut) then
2428 forcon(nhpb)=wfrag_(i)
2435 forcon(nhpb)=wfrag_(i)*dexp(-0.5d0*(ddjk/dist_cut)**2)
2438 if (.not.out1file .or. me.eq.king)
2439 & write (iout,'(a,3i5,f8.2,1pe12.2)') "+dist.constr ",
2440 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
2442 write (iout,'(a,3i5,f8.2,1pe12.2)') "+dist.constr ",
2443 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
2450 if (wpair_(i).gt.0.0d0) then
2458 do j=ifrag_(1,ii),ifrag_(2,ii)
2459 do k=ifrag_(1,jj),ifrag_(2,jj)
2463 forcon(nhpb)=wpair_(i)
2464 dhpb(nhpb)=dist(j,k)
2466 if (.not.out1file .or. me.eq.king)
2467 & write (iout,'(a,3i5,f8.2,f10.1)') "+dist.constr ",
2468 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
2470 write (iout,'(a,3i5,f8.2,f10.1)') "+dist.constr ",
2471 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
2478 read (inp,*) ihpb(nhpb+1),jhpb(nhpb+1),forcon(nhpb+1)
2479 if (forcon(nhpb+1).gt.0.0d0) then
2481 dhpb(nhpb)=dist(ihpb(nhpb),jhpb(nhpb))
2483 if (.not.out1file .or. me.eq.king)
2484 & write (iout,'(a,3i5,f8.2,f10.1)') "+dist.constr ",
2485 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
2487 write (iout,'(a,3i5,f8.2,f10.1)') "+dist.constr ",
2488 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
2495 c-------------------------------------------------------------------------------
2497 subroutine flush(iu)
2502 subroutine flush(iu)
2507 c------------------------------------------------------------------------------
2508 subroutine copy_to_tmp(source)
2509 include "DIMENSIONS"
2510 include "COMMON.IOUNITS"
2511 character*(*) source
2512 character* 256 tmpfile
2516 tmpfile=curdir(:ilen(curdir))//"/"//source(:ilen(source))
2517 inquire(file=tmpfile,exist=ex)
2519 write (*,*) "Copying ",tmpfile(:ilen(tmpfile)),
2520 & " to temporary directory..."
2521 write (*,*) "/bin/cp "//tmpfile(:ilen(tmpfile))//" "//tmpdir
2522 call system("/bin/cp "//tmpfile(:ilen(tmpfile))//" "//tmpdir)
2526 c------------------------------------------------------------------------------
2527 subroutine move_from_tmp(source)
2528 include "DIMENSIONS"
2529 include "COMMON.IOUNITS"
2530 character*(*) source
2533 write (*,*) "Moving ",source(:ilen(source)),
2534 & " from temporary directory to working directory"
2535 write (*,*) "/bin/mv "//source(:ilen(source))//" "//curdir
2536 call system("/bin/mv "//source(:ilen(source))//" "//curdir)
2539 c------------------------------------------------------------------------------
2540 subroutine random_init(seed)
2542 C Initialize random number generator
2544 implicit real*8 (a-h,o-z)
2545 include 'DIMENSIONS'
2551 logical OKRandom, prng_restart
2553 integer iseed_array(4)
2555 include 'COMMON.IOUNITS'
2556 include 'COMMON.TIME1'
2557 include 'COMMON.THREAD'
2558 include 'COMMON.SBRIDGE'
2559 include 'COMMON.CONTROL'
2560 include 'COMMON.MCM'
2561 include 'COMMON.MAP'
2562 include 'COMMON.HEADER'
2563 csa include 'COMMON.CSA'
2564 include 'COMMON.CHAIN'
2565 include 'COMMON.MUCA'
2567 include 'COMMON.FFIELD'
2568 include 'COMMON.SETUP'
2569 iseed=-dint(dabs(seed))
2570 if (iseed.eq.0) then
2571 write (iout,'(/80(1h*)/20x,a/80(1h*))')
2572 & 'Random seed undefined. The program will stop.'
2573 write (*,'(/80(1h*)/20x,a/80(1h*))')
2574 & 'Random seed undefined. The program will stop.'
2576 call mpi_finalize(mpi_comm_world,ierr)
2578 stop 'Bad random seed.'
2581 if (fg_rank.eq.0) then
2585 if(me.eq.king .or. .not. out1file)
2586 & write (iout,*) 'MPI: node= ', me, ' iseed= ',iseedi8
2587 write (*,*) 'MPI: node= ', me, ' iseed= ',iseedi8
2588 OKRandom = prng_restart(me,iseedi8)
2591 tmp=65536.0d0**(4-i)
2592 iseed_array(i) = dint(seed/tmp)
2593 seed=seed-iseed_array(i)*tmp
2595 if(me.eq.king .or. .not. out1file)
2596 & write (iout,*) 'MPI: node= ', me, ' iseed(4)= ',
2597 & (iseed_array(i),i=1,4)
2598 write (*,*) 'MPI: node= ',me, ' iseed(4)= ',
2599 & (iseed_array(i),i=1,4)
2600 OKRandom = prng_restart(me,iseed_array)
2603 r1=ran_number(0.0D0,1.0D0)
2604 if(me.eq.king .or. .not. out1file)
2605 & write (iout,*) 'ran_num',r1
2606 if (r1.lt.0.0d0) OKRandom=.false.
2608 if (.not.OKRandom) then
2609 write (iout,*) 'PRNG IS NOT WORKING!!!'
2610 print *,'PRNG IS NOT WORKING!!!'
2613 call mpi_abort(mpi_comm_world,error_msg,ierr)
2616 write (iout,*) 'too many processors for parallel prng'
2617 write (*,*) 'too many processors for parallel prng'
2625 write (iout,*) 'ran_num',ran_number(0.0d0,1.0d0)