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'
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 4/25/08 7:29PM by adam'
56 if (me.eq.king) call cinfo
57 C Read force field parameters and job setup data
60 if (me.eq.king .or. .not. out1file) then
62 & text_mode_calc(modecalc)(:ilen(text_mode_calc(modecalc))),
64 if (minim) write (iout,'(a)')
65 & 'Conformations will be energy-minimized.'
66 write (iout,'(80(1h*)/)')
70 if (modecalc.eq.-2) then
73 else if (modecalc.eq.-1) then
74 write(iout,*) "call check_sc_map next"
79 if (fg_rank.gt.0) then
80 C Fine-grain slaves just do energy and gradient components.
81 call ergastulum ! slave workhouse in Latin
84 if (modecalc.eq.0) then
85 call exec_eeval_or_minim
86 else if (modecalc.eq.1) then
88 else if (modecalc.eq.2) then
90 else if (modecalc.eq.3 .or. modecalc .eq.6) then
92 else if (modecalc.eq.4) then
93 call exec_mult_eeval_or_minim
94 else if (modecalc.eq.5) then
96 else if (ModeCalc.eq.7) then
98 else if (ModeCalc.eq.8) then
100 else if (modecalc.eq.11) then
102 else if (modecalc.eq.12) then
104 else if (modecalc.eq.14) then
108 write (iout,*) "Need a parallel version to run MREMD."
112 write (iout,'(a)') 'This calculation type is not supported',
118 if (fg_rank.eq.0) call finish_task
119 c call memmon_print_usage()
121 call print_detailed_timing
123 call MPI_Finalize(ierr)
126 call dajczas(tcpu(),hrtime,mintime,sectime)
127 stop '********** Program terminated normally.'
130 c--------------------------------------------------------------------------
136 include 'COMMON.SETUP'
137 include 'COMMON.CONTROL'
138 include 'COMMON.IOUNITS'
139 c if (me.eq.king .or. .not. out1file) then
140 c write (iout,*) "Calling chainbuild"
144 if (me.eq.king .or. .not. out1file) then
145 write (iout,*) "Calling MD"
151 c---------------------------------------------------------------------------
153 subroutine exec_MREMD
158 include 'COMMON.SETUP'
159 include 'COMMON.CONTROL'
160 include 'COMMON.IOUNITS'
161 include 'COMMON.REMD'
162 ! if (me.eq.king .or. .not. out1file)
163 ! & write (iout,*) "Calling chainbuild"
165 if (me.eq.king .or. .not. out1file)
166 & write (iout,*) "Calling REMD"
178 c---------------------------------------------------------------------------
179 subroutine exec_eeval_or_minim
180 implicit real*8 (a-h,o-z)
185 include 'COMMON.SETUP'
186 include 'COMMON.TIME1'
187 include 'COMMON.INTERACT'
188 include 'COMMON.NAMES'
190 include 'COMMON.HEADER'
191 include 'COMMON.CONTROL'
192 include 'COMMON.CONTACTS'
193 include 'COMMON.CHAIN'
195 include 'COMMON.IOUNITS'
196 include 'COMMON.FFIELD'
197 include 'COMMON.REMD'
199 include 'COMMON.SBRIDGE'
201 double precision energy(0:n_ene)
202 double precision energy_long(0:n_ene),energy_short(0:n_ene)
203 double precision varia(maxvar)
204 if (indpdb.eq.0) call chainbuild
206 if (indpdb.ne.0) then
217 print *,'dc',dc(1,0),dc(2,0),dc(3,0)
219 print *,"Processor",myrank," after chainbuild"
221 call etotal_long(energy_long(0))
222 write (iout,*) "Printing long range energy"
223 call enerprint(energy_long(0))
224 call etotal_short(energy_short(0))
225 write (iout,*) "Printing short range energy"
226 call enerprint(energy_short(0))
228 energy(i)=energy_long(i)+energy_short(i)
229 write (iout,*) i,energy_long(i),energy_short(i),energy(i)
231 write (iout,*) "Printing long+short range energy"
232 call enerprint(energy(0))
234 call etotal(energy(0))
236 time_ene=MPI_Wtime()-time00
238 time_ene=tcpu()-time00
240 write (iout,*) "Time for energy evaluation",time_ene
241 print *,"after etotal"
244 call enerprint(energy(0))
245 call hairpin(.true.,nharp,iharp)
246 print *,'after hairpin'
247 call secondary2(.true.)
248 print *,'after secondary'
252 print *, 'Calling OVERLAP_SC'
253 call overlap_sc(fail)
257 call sc_move(2,nres-1,10,1d10,nft_sc,etot)
258 print *,'SC_move',nft_sc,etot
259 write(iout,*) 'SC_move',nft_sc,etot
263 print *, 'Calling MINIM_DC'
269 call minim_dc(etot,iretcode,nfun)
271 if (indpdb.ne.0) then
275 call geom_to_var(nvar,varia)
276 print *,'Calling MINIMIZE.'
282 call minimize(etot,varia,iretcode,nfun)
284 print *,'SUMSL return code is',iretcode,' eval ',nfun
286 evals=nfun/(MPI_WTIME()-time1)
288 evals=nfun/(tcpu()-time1)
290 print *,'# eval/s',evals
291 print *,'refstr=',refstr
292 call hairpin(.false.,nharp,iharp)
293 print *,'after hairpin'
294 call secondary2(.true.)
295 print *,'after secondary'
296 call etotal(energy(0))
298 call enerprint(energy(0))
301 call briefout(0,etot)
302 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
303 write (iout,'(a,i3)') 'SUMSL return code:',iretcode
304 write (iout,'(a,i20)') '# of energy evaluations:',nfun+1
305 write (iout,'(a,f16.3)')'# of energy evaluations/sec:',evals
307 print *,'refstr=',refstr
308 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
309 call briefout(0,etot)
311 if (outpdb) call pdbout(etot,titel(:32),ipdb)
312 if (outmol2) call mol2out(etot,titel(:32))
315 c---------------------------------------------------------------------------
316 subroutine exec_regularize
317 implicit real*8 (a-h,o-z)
322 include 'COMMON.SETUP'
323 include 'COMMON.TIME1'
324 include 'COMMON.INTERACT'
325 include 'COMMON.NAMES'
327 include 'COMMON.HEADER'
328 include 'COMMON.CONTROL'
329 include 'COMMON.CONTACTS'
330 include 'COMMON.CHAIN'
332 include 'COMMON.IOUNITS'
333 include 'COMMON.FFIELD'
334 include 'COMMON.REMD'
336 include 'COMMON.SBRIDGE'
337 double precision energy(0:n_ene)
342 call regularize(nct-nnt+1,etot,rms,cref(1,nnt,1),iretcode)
343 call etotal(energy(0))
344 energy(0)=energy(0)-energy(14)
346 call enerprint(energy(0))
348 call briefout(0,etot)
349 if (outpdb) call pdbout(etot,titel(:32),ipdb)
350 if (outmol2) call mol2out(etot,titel(:32))
351 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
352 write (iout,'(a,i3)') 'SUMSL return code:',iretcode
355 c---------------------------------------------------------------------------
356 subroutine exec_thread
361 include "COMMON.SETUP"
365 c---------------------------------------------------------------------------
367 implicit real*8 (a-h,o-z)
369 character*10 nodeinfo
370 double precision varia(maxvar)
374 include "COMMON.SETUP"
375 include 'COMMON.CONTROL'
379 if (modecalc.eq.3) then
385 if (modecalc.eq.3) then
396 c---------------------------------------------------------------------------
397 subroutine exec_mult_eeval_or_minim
398 implicit real*8 (a-h,o-z)
402 dimension muster(mpi_status_size)
404 include 'COMMON.SETUP'
405 include 'COMMON.TIME1'
406 include 'COMMON.INTERACT'
407 include 'COMMON.NAMES'
409 include 'COMMON.HEADER'
410 include 'COMMON.CONTROL'
411 include 'COMMON.CONTACTS'
412 include 'COMMON.CHAIN'
414 include 'COMMON.IOUNITS'
415 include 'COMMON.FFIELD'
416 include 'COMMON.REMD'
418 include 'COMMON.SBRIDGE'
419 double precision varia(maxvar)
421 double precision energy(0:max_ene)
431 open(intin,file=intinname,status='old')
432 write (istat,'(a5,20a12)')"# ",
433 & (wname(print_order(i)),i=1,nprint_ene)
435 write (istat,'(a5,20a12)')"# ",
436 & (ename(print_order(i)),i=1,nprint_ene),
437 & "ETOT total","RMSD","nat.contact","nnt.contact"
439 write (istat,'(a5,20a12)')"# ",
440 & (ename(print_order(i)),i=1,nprint_ene),"ETOT total"
446 read (intin,'(e15.10,e15.5)',end=1100,err=1100) time,ene
447 call read_x(intin,*11)
449 c Broadcast the order to compute internal coordinates to the slaves.
451 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
453 call int_from_cart1(.false.)
455 read (intin,'(i5)',end=1100,err=1100) iconf
456 call read_angles(intin,*11)
457 call geom_to_var(nvar,varia)
460 write (iout,'(a,i7)') 'Conformation #',iconf
461 call etotal(energy(0))
462 call briefout(iconf,energy(0))
463 call enerprint(energy(0))
466 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
467 write (istat,'(i5,20(f12.3))') iconf,
468 & (energy(print_order(i)),i=1,nprint_ene),etot,
469 & rms,frac,frac_nn,co
472 write (istat,'(i5,16(f12.3))') iconf,
473 & (energy(print_order(i)),i=1,nprint_ene),etot
489 if (mm.lt.nodes) then
491 read (intin,'(e15.10,e15.5)',end=11,err=11) time,ene
492 call read_x(intin,*11)
494 c Broadcast the order to compute internal coordinates to the slaves.
496 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
498 call int_from_cart1(.false.)
500 read (intin,'(i5)',end=11,err=11) iconf
501 call read_angles(intin,*11)
502 call geom_to_var(nvar,varia)
505 write (iout,'(a,i7)') 'Conformation #',iconf
515 call mpi_send(ind,6,mpi_integer,mm,idint,CG_COMM,
517 call mpi_send(varia,nvar,mpi_double_precision,mm,
518 * idreal,CG_COMM,ierr)
519 call mpi_send(ene0,1,mpi_double_precision,mm,
520 * idreal,CG_COMM,ierr)
521 c print *,'task ',n,' sent to worker ',mm,nvar
523 call mpi_recv(ind,6,mpi_integer,mpi_any_source,idint,
524 * CG_COMM,muster,ierr)
525 man=muster(mpi_source)
526 c print *,'receiving result from worker ',man,' (',iii1,iii,')'
527 call mpi_recv(varia,nvar,mpi_double_precision,
528 * man,idreal,CG_COMM,muster,ierr)
530 * mpi_double_precision,man,idreal,
531 * CG_COMM,muster,ierr)
532 call mpi_recv(ene0,1,
533 * mpi_double_precision,man,idreal,
534 * CG_COMM,muster,ierr)
535 c print *,'result received from worker ',man,' sending now'
537 call var_to_geom(nvar,varia)
539 call etotal(energy(0))
543 write (iout,'(a,2i7)') 'Conformation #',iconf,ind(5)
546 call enerprint(energy(0))
547 call briefout(it,etot)
548 c if (minim) call briefout(it,etot)
550 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
551 write (istat,'(i5,19(f12.3))') iconf,
552 & (energy(print_order(i)),i=1,nprint_ene),etot,
553 & rms,frac,frac_nn,co
555 write (istat,'(i5,15(f12.3))') iconf,
556 & (energy(print_order(i)),i=1,nprint_ene),etot
561 read (intin,'(e15.10,e15.5)',end=1101,err=1101) time,ene
562 call read_x(intin,*11)
564 c Broadcast the order to compute internal coordinates to the slaves.
566 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
568 call int_from_cart1(.false.)
570 read (intin,'(i5)',end=1101,err=1101) iconf
571 call read_angles(intin,*11)
572 call geom_to_var(nvar,varia)
583 call mpi_send(ind,6,mpi_integer,man,idint,CG_COMM,
585 call mpi_send(varia,nvar,mpi_double_precision,man,
586 * idreal,CG_COMM,ierr)
587 call mpi_send(ene0,1,mpi_double_precision,man,
588 * idreal,CG_COMM,ierr)
589 nf_mcmf=nf_mcmf+ind(4)
595 call mpi_recv(ind,6,mpi_integer,mpi_any_source,idint,
596 * CG_COMM,muster,ierr)
597 man=muster(mpi_source)
598 call mpi_recv(varia,nvar,mpi_double_precision,
599 * man,idreal,CG_COMM,muster,ierr)
601 * mpi_double_precision,man,idreal,
602 * CG_COMM,muster,ierr)
603 call mpi_recv(ene0,1,
604 * mpi_double_precision,man,idreal,
605 * CG_COMM,muster,ierr)
607 call var_to_geom(nvar,varia)
609 call etotal(energy(0))
613 write (iout,'(a,2i7)') 'Conformation #',iconf,ind(5)
616 call enerprint(energy(0))
617 call briefout(it,etot)
619 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
620 write (istat,'(i5,19(f12.3))') iconf,
621 & (energy(print_order(i)),i=1,nprint_ene),etot,
622 & rms,frac,frac_nn,co
624 write (istat,'(i5,15(f12.3))') iconf,
625 & (energy(print_order(i)),i=1,nprint_ene),etot
637 call mpi_send(ind,6,mpi_integer,i,idint,CG_COMM,
642 open(intin,file=intinname,status='old')
643 write (istat,'(a5,20a12)')"# ",
644 & (wname(print_order(i)),i=1,nprint_ene)
645 write (istat,'("# ",20(1pe12.4))')
646 & (weights(print_order(i)),i=1,nprint_ene)
648 write (istat,'(a5,20a12)')"# ",
649 & (ename(print_order(i)),i=1,nprint_ene),
650 & "ETOT total","RMSD","nat.contact","nnt.contact"
652 write (istat,'(a5,14a12)')"# ",
653 & (ename(print_order(i)),i=1,nprint_ene),"ETOT total"
657 read (intin,'(e15.10,e15.5)',end=11,err=11) time,ene
658 call read_x(intin,*11)
660 c Broadcast the order to compute internal coordinates to the slaves.
662 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
664 call int_from_cart1(.false.)
666 read (intin,'(i5)',end=11,err=11) iconf
667 call read_angles(intin,*11)
668 call geom_to_var(nvar,varia)
671 write (iout,'(a,i7)') 'Conformation #',iconf
672 if (minim) call minimize(etot,varia,iretcode,nfun)
673 call etotal(energy(0))
676 call enerprint(energy(0))
677 if (minim) call briefout(it,etot)
679 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
680 write (istat,'(i5,18(f12.3))') iconf,
681 & (energy(print_order(i)),i=1,nprint_ene),
682 & etot,rms,frac,frac_nn,co
685 write (istat,'(i5,14(f12.3))') iconf,
686 & (energy(print_order(i)),i=1,nprint_ene),etot
693 c---------------------------------------------------------------------------
694 subroutine exec_checkgrad
695 implicit real*8 (a-h,o-z)
700 include 'COMMON.SETUP'
701 include 'COMMON.TIME1'
702 include 'COMMON.INTERACT'
703 include 'COMMON.NAMES'
705 include 'COMMON.HEADER'
706 include 'COMMON.CONTROL'
707 include 'COMMON.CONTACTS'
708 include 'COMMON.CHAIN'
710 include 'COMMON.IOUNITS'
711 include 'COMMON.FFIELD'
712 include 'COMMON.REMD'
714 include 'COMMON.SBRIDGE'
716 double precision energy(0:max_ene)
719 c vbld(i)=vbld(i)+ran_number(-0.1d0,0.1d0)
720 c if (itype(i).ne.10)
721 c & vbld(i+nres)=vbld(i+nres)+ran_number(-0.001d0,0.001d0)
723 if (indpdb.eq.0) call chainbuild
726 c dc(j,i)=dc(j,i)+ran_number(-0.2d0,0.2d0)
730 c if (itype(i).ne.10) then
732 c dc(j,i+nres)=dc(j,i+nres)+ran_number(-0.2d0,0.2d0)
737 c dc(j,0)=ran_number(-0.2d0,0.2d0)
743 print *, "AFTER read fragments"
745 print *,"chainbuild_cart"
747 print *,"After cartprint"
750 print *,"before ETOT"
751 call etotal(energy(0))
753 call enerprint(energy(0))
754 write (iout,*) "Uconst",Uconst," Uconst_back",uconst_back
755 print *,'icheckgrad=',icheckgrad
756 goto (10,20,30) icheckgrad
757 10 call check_ecartint
760 20 call check_cartgrad
765 c---------------------------------------------------------------------------
772 c---------------------------------------------------------------------------
778 include 'COMMON.IOUNITS'
779 C Conformational Space Annealling programmed by Jooyoung Lee.
780 C This method works only with parallel machines!
784 write (iout,*) "CSA works on parallel machines only"
788 c---------------------------------------------------------------------------
789 subroutine exec_softreg
791 include 'COMMON.IOUNITS'
792 include 'COMMON.CONTROL'
793 double precision energy(0:max_ene)
795 call etotal(energy(0))
796 call enerprint(energy(0))
797 if (.not.lsecondary) then
798 write(iout,*) 'Calling secondary structure recognition'
799 call secondary2(debug)
801 write(iout,*) 'Using secondary structure supplied in pdb'
806 call etotal(energy(0))
808 call enerprint(energy(0))
810 call briefout(0,etot)
811 call secondary2(.true.)
812 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)