1 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
5 C Program to carry out conformational search of proteins in an united-residue C
8 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
9 implicit real*8 (a-h,o-z)
15 include 'COMMON.SETUP'
17 include 'COMMON.TIME1'
18 include 'COMMON.INTERACT'
19 include 'COMMON.NAMES'
21 include 'COMMON.HEADER'
22 include 'COMMON.CONTROL'
23 include 'COMMON.CONTACTS'
24 include 'COMMON.CHAIN'
26 include 'COMMON.IOUNITS'
27 include 'COMMON.FFIELD'
28 c include 'COMMON.REMD'
30 include 'COMMON.SBRIDGE'
31 double precision hrtime,mintime,sectime
32 character*64 text_mode_calc(-2:14) /'test',
33 & 'SC rotamer distribution',
34 & 'Energy evaluation or minimization',
35 & 'Regularization of PDB structure',
36 & 'Threading of a sequence on PDB structures',
37 & 'Monte Carlo (with minimization) ',
38 & 'Energy minimization of multiple conformations',
39 & 'Checking energy gradient',
40 & 'Entropic sampling Monte Carlo (with minimization)',
45 & 'Soft regularization of PDB structure',
46 & 'Mesoscopic molecular dynamics (MD) ',
48 & 'Replica exchange molecular dynamics (REMD)'/
51 c call memmon_print_usage()
55 & write(iout,*)'### LAST MODIFIED 11/03/09 1:19PM by czarek'
56 if (me.eq.king) call cinfo
57 C Read force field parameters and job setup data
61 if (me.eq.king .or. .not. out1file) then
63 & text_mode_calc(modecalc)(:ilen(text_mode_calc(modecalc))),
65 if (minim) write (iout,'(a)')
66 & 'Conformations will be energy-minimized.'
67 write (iout,'(80(1h*)/)')
71 c if (modecalc.eq.-2) then
74 c else if (modecalc.eq.-1) then
75 c write(iout,*) "call check_sc_map next"
80 if (fg_rank.gt.0) then
81 C Fine-grain slaves just do energy and gradient components.
82 call ergastulum ! slave workhouse in Latin
85 if (modecalc.eq.0) then
86 call exec_eeval_or_minim
87 c else if (modecalc.eq.1) then
88 c call exec_regularize
89 c else if (modecalc.eq.2) then
91 c else if (modecalc.eq.3 .or. modecalc .eq.6) then
93 else if (modecalc.eq.4) then
94 call exec_mult_eeval_or_minim
95 else if (modecalc.eq.5) then
97 c else if (ModeCalc.eq.7) then
99 else if (ModeCalc.eq.8) then
101 c else if (modecalc.eq.11) then
103 c else if (modecalc.eq.12) then
105 c else if (modecalc.eq.14) then
108 write (iout,'(a)') 'This calculation type is not supported',
114 if (fg_rank.eq.0) call finish_task
115 c call memmon_print_usage()
117 call print_detailed_timing
119 call MPI_Finalize(ierr)
122 call dajczas(tcpu(),hrtime,mintime,sectime)
123 stop '********** Program terminated normally.'
126 c---------------------------------------------------------------------------
127 subroutine exec_eeval_or_minim
128 implicit real*8 (a-h,o-z)
133 include 'COMMON.SETUP'
134 include 'COMMON.TIME1'
135 include 'COMMON.INTERACT'
136 include 'COMMON.NAMES'
138 include 'COMMON.HEADER'
139 include 'COMMON.CONTROL'
140 include 'COMMON.CONTACTS'
141 include 'COMMON.CHAIN'
143 include 'COMMON.IOUNITS'
144 include 'COMMON.FFIELD'
145 c include 'COMMON.REMD'
146 c include 'COMMON.MD'
147 include 'COMMON.SBRIDGE'
149 double precision energy(0:n_ene)
150 double precision energy_long(0:n_ene),energy_short(0:n_ene)
151 double precision varia(maxvar)
152 if (indpdb.eq.0) call chainbuild
155 c if (split_ene) then
156 c print *,"Processor",myrank," after chainbuild"
158 c call etotal_long(energy_long(0))
159 c write (iout,*) "Printing long range energy"
160 c call enerprint(energy_long(0))
161 c call etotal_short(energy_short(0))
162 c write (iout,*) "Printing short range energy"
163 c call enerprint(energy_short(0))
165 c energy(i)=energy_long(i)+energy_short(i)
166 c write (iout,*) i,energy_long(i),energy_short(i),energy(i)
168 c write (iout,*) "Printing long+short range energy"
169 c call enerprint(energy(0))
171 call etotal(energy(0))
172 c time_ene=MPI_Wtime()-time00
173 write (iout,*) "Time for energy evaluation",time_ene
174 print *,"after etotal"
177 call enerprint(energy(0))
178 c call hairpin(.true.,nharp,iharp)
179 c call secondary2(.true.)
183 print *, 'Calling MINIM_DC'
185 call minim_dc(etot,iretcode,nfun)
187 if (indpdb.ne.0) then
191 call geom_to_var(nvar,varia)
192 print *,'Calling MINIMIZE.'
194 call minimize(etot,varia,iretcode,nfun)
196 print *,'SUMSL return code is',iretcode,' eval ',nfun
197 c evals=nfun/(MPI_WTIME()-time1)
198 print *,'# eval/s',evals
199 print *,'refstr=',refstr
200 c call hairpin(.true.,nharp,iharp)
201 c call secondary2(.true.)
202 call etotal(energy(0))
204 call enerprint(energy(0))
207 call briefout(0,etot)
208 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
209 write (iout,'(a,i3)') 'SUMSL return code:',iretcode
210 write (iout,'(a,i20)') '# of energy evaluations:',nfun+1
211 write (iout,'(a,f16.3)')'# of energy evaluations/sec:',evals
213 print *,'refstr=',refstr
214 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
215 call briefout(0,etot)
217 if (outpdb) call pdbout(etot,titel(:32),ipdb)
218 if (outmol2) call mol2out(etot,titel(:32))
222 subroutine exec_checkgrad
223 implicit real*8 (a-h,o-z)
228 include 'COMMON.SETUP'
229 include 'COMMON.TIME1'
230 include 'COMMON.INTERACT'
231 include 'COMMON.NAMES'
233 include 'COMMON.HEADER'
234 include 'COMMON.CONTROL'
235 include 'COMMON.CONTACTS'
236 include 'COMMON.CHAIN'
238 include 'COMMON.IOUNITS'
239 include 'COMMON.FFIELD'
240 c include 'COMMON.REMD'
242 include 'COMMON.SBRIDGE'
244 double precision energy(0:max_ene)
246 c vbld(i)=vbld(i)+ran_number(-0.1d0,0.1d0)
247 c if (itype(i).ne.10)
248 c & vbld(i+nres)=vbld(i+nres)+ran_number(-0.001d0,0.001d0)
250 if (indpdb.eq.0) call chainbuild
253 c dc(j,i)=dc(j,i)+ran_number(-0.2d0,0.2d0)
257 c if (itype(i).ne.10) then
259 c dc(j,i+nres)=dc(j,i+nres)+ran_number(-0.2d0,0.2d0)
264 c dc(j,0)=ran_number(-0.2d0,0.2d0)
269 c call read_fragments
271 c call rescale_weights(t_bath)
276 call etotal(energy(0))
278 call enerprint(energy(0))
279 write (iout,*) "Uconst",Uconst," Uconst_back",uconst_back
280 print *,'icheckgrad=',icheckgrad
281 goto (10,20,30) icheckgrad
282 10 call check_ecartint
284 20 call check_cartgrad
289 c---------------------------------------------------------------------------
295 include 'COMMON.IOUNITS'
296 C Conformational Space Annealling programmed by Jooyoung Lee.
297 C This method works only with parallel machines!
301 write (iout,*) "CSA works on parallel machines only"
305 c---------------------------------------------------------------------------
307 subroutine exec_mult_eeval_or_minim
308 implicit real*8 (a-h,o-z)
311 integer muster(mpi_status_size)
312 include 'COMMON.SETUP'
313 include 'COMMON.TIME1'
314 include 'COMMON.INTERACT'
315 include 'COMMON.NAMES'
317 include 'COMMON.HEADER'
318 include 'COMMON.CONTROL'
319 include 'COMMON.CONTACTS'
320 include 'COMMON.CHAIN'
322 include 'COMMON.IOUNITS'
323 include 'COMMON.FFIELD'
324 include 'COMMON.SBRIDGE'
325 double precision varia(maxvar)
327 double precision energy(0:n_ene)
337 open(intin,file=intinname,status='old')
338 write (istat,'(a5,100a12)')"# ",
339 & (wname(print_order(i)),i=1,nprint_ene)
341 write (istat,'(a5,100a12)')"# ",
342 & (ename(print_order(i)),i=1,nprint_ene),
343 & "ETOT total","RMSD","nat.contact","nnt.contact",
344 & "cont.order","TMscore"
346 write (istat,'(a5,100a12)')"# ",
347 & (ename(print_order(i)),i=1,nprint_ene),"ETOT total"
353 read (intin,'(e15.10,e15.5)',end=1100,err=1100) time,ene
354 call read_x(intin,*11)
355 c Broadcast the order to compute internal coordinates to the slaves.
357 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
358 call int_from_cart1(.false.)
360 read (intin,'(i5)',end=1100,err=1100) iconf
361 call read_angles(intin,*11)
362 call geom_to_var(nvar,varia)
365 write (iout,'(a,i7)') 'Conformation #',iconf
366 call etotal(energy(0))
367 call briefout(iconf,energy(0))
368 call enerprint(energy(0))
371 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
372 call calc_tmscore(tm,.true.)
373 write (istat,'(i5,100(f12.3))') iconf,
374 & (energy(print_order(i)),i=1,nprint_ene),etot,
375 & rms,frac,frac_nn,co,tm
377 write (istat,'(i5,100(f12.3))') iconf,
378 & (energy(print_order(i)),i=1,nprint_ene),etot
393 if (mm.lt.nodes) then
395 read (intin,'(e15.10,e15.5)',end=11,err=11) time,ene
396 call read_x(intin,*11)
397 c Broadcast the order to compute internal coordinates to the slaves.
399 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
400 call int_from_cart1(.false.)
402 read (intin,'(i5)',end=11,err=11) iconf
403 call read_angles(intin,*11)
404 call geom_to_var(nvar,varia)
409 write (iout,*) 'Conformation #',iconf,' read'
418 call mpi_send(ind,6,mpi_integer,mm,idint,CG_COMM,
420 call mpi_send(varia,nvar,mpi_double_precision,mm,
421 * idreal,CG_COMM,ierr)
422 call mpi_send(ene0,1,mpi_double_precision,mm,
423 * idreal,CG_COMM,ierr)
424 c print *,'task ',n,' sent to worker ',mm,nvar
426 call mpi_recv(ind,6,mpi_integer,mpi_any_source,idint,
427 * CG_COMM,muster,ierr)
428 man=muster(mpi_source)
429 c print *,'receiving result from worker ',man,' (',iii1,iii,')'
430 call mpi_recv(varia,nvar,mpi_double_precision,
431 * man,idreal,CG_COMM,muster,ierr)
433 * mpi_double_precision,man,idreal,
434 * CG_COMM,muster,ierr)
435 call mpi_recv(ene0,1,
436 * mpi_double_precision,man,idreal,
437 * CG_COMM,muster,ierr)
438 c print *,'result received from worker ',man,' sending now'
440 call var_to_geom(nvar,varia)
442 call etotal(energy(0))
446 write (iout,*) 'Conformation #',iconf," sumsl return code ",
450 call enerprint(energy(0))
451 call briefout(iconf,etot)
453 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
454 call calc_tmscore(tm,.true.)
455 write (istat,'(i5,100(f12.3))') iconf,
456 & (energy(print_order(i)),i=1,nprint_ene),etot,
457 & rms,frac,frac_nn,co,tm
459 write (istat,'(i5,100(f12.3))') iconf,
460 & (energy(print_order(i)),i=1,nprint_ene),etot
465 read (intin,'(e15.10,e15.5)',end=11,err=11) time,ene
466 call read_x(intin,*11)
467 c Broadcast the order to compute internal coordinates to the slaves.
469 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
470 call int_from_cart1(.false.)
472 read (intin,'(i5)',end=11,err=11) iconf
473 call read_angles(intin,*11)
474 call geom_to_var(nvar,varia)
478 write (iout,*) 'Conformation #',iconf,' read'
486 call mpi_send(ind,6,mpi_integer,man,idint,CG_COMM,
488 call mpi_send(varia,nvar,mpi_double_precision,man,
489 * idreal,CG_COMM,ierr)
490 call mpi_send(ene0,1,mpi_double_precision,man,
491 * idreal,CG_COMM,ierr)
492 nf_mcmf=nf_mcmf+ind(4)
498 call mpi_recv(ind,6,mpi_integer,mpi_any_source,idint,
499 * CG_COMM,muster,ierr)
500 man=muster(mpi_source)
501 call mpi_recv(varia,nvar,mpi_double_precision,
502 * man,idreal,CG_COMM,muster,ierr)
504 * mpi_double_precision,man,idreal,
505 * CG_COMM,muster,ierr)
506 call mpi_recv(ene0,1,
507 * mpi_double_precision,man,idreal,
508 * CG_COMM,muster,ierr)
510 call var_to_geom(nvar,varia)
512 call etotal(energy(0))
516 write (iout,*) 'Conformation #',iconf," sumsl return code ",
520 call enerprint(energy(0))
521 call briefout(iconf,etot)
523 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
524 call calc_tmscore(tm,.true.)
525 write (istat,'(i5,100(f12.3))') iconf,
526 & (energy(print_order(i)),i=1,nprint_ene),etot,
527 & rms,frac,frac_nn,co,tm
529 write (istat,'(i5,100(f12.3))') iconf,
530 & (energy(print_order(i)),i=1,nprint_ene),etot
542 call mpi_send(ind,6,mpi_integer,i,idint,CG_COMM,
548 subroutine exec_mult_eeval_or_minim
550 include 'COMMON.IOUNITS'
551 write (iout,*) "Unsupported option in serial version"
555 c---------------------------------------------------------------------------