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
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 if (modecalc.eq.-2) then
74 else if (modecalc.eq.-1) then
75 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 else if (modecalc.eq.1) then
89 else if (modecalc.eq.2) then
91 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 else if (ModeCalc.eq.7) then
99 else if (ModeCalc.eq.8) then
101 else if (modecalc.eq.11) then
103 else if (modecalc.eq.12) then
105 else if (modecalc.eq.14) then
109 write (iout,*) "Need a parallel version to run MREMD."
113 write (iout,'(a)') 'This calculation type is not supported',
119 if (fg_rank.eq.0) call finish_task
120 c call memmon_print_usage()
122 call print_detailed_timing
124 call MPI_Finalize(ierr)
127 call dajczas(tcpu(),hrtime,mintime,sectime)
128 stop '********** Program terminated normally.'
131 c--------------------------------------------------------------------------
137 include 'COMMON.SETUP'
138 include 'COMMON.CONTROL'
139 include 'COMMON.IOUNITS'
140 if (me.eq.king .or. .not. out1file)
141 & write (iout,*) "Calling chainbuild"
146 c---------------------------------------------------------------------------
148 subroutine exec_MREMD
153 include 'COMMON.SETUP'
154 include 'COMMON.CONTROL'
155 include 'COMMON.IOUNITS'
156 include 'COMMON.REMD'
157 if (me.eq.king .or. .not. out1file)
158 & write (iout,*) "Calling chainbuild"
160 if (me.eq.king .or. .not. out1file)
161 & write (iout,*) "Calling REMD"
173 c---------------------------------------------------------------------------
174 subroutine exec_eeval_or_minim
175 implicit real*8 (a-h,o-z)
180 include 'COMMON.SETUP'
181 include 'COMMON.TIME1'
182 include 'COMMON.INTERACT'
183 include 'COMMON.NAMES'
185 include 'COMMON.HEADER'
186 include 'COMMON.CONTROL'
187 include 'COMMON.CONTACTS'
188 include 'COMMON.CHAIN'
190 include 'COMMON.IOUNITS'
191 include 'COMMON.FFIELD'
192 include 'COMMON.REMD'
194 include 'COMMON.SBRIDGE'
196 double precision energy(0:n_ene)
197 double precision energy_long(0:n_ene),energy_short(0:n_ene)
198 double precision varia(maxvar)
199 if (indpdb.eq.0) call chainbuild
207 print *,"Processor",myrank," after chainbuild"
209 call etotal_long(energy_long(0))
210 write (iout,*) "Printing long range energy"
211 call enerprint(energy_long(0))
212 call etotal_short(energy_short(0))
213 write (iout,*) "Printing short range energy"
214 call enerprint(energy_short(0))
216 energy(i)=energy_long(i)+energy_short(i)
217 write (iout,*) i,energy_long(i),energy_short(i),energy(i)
219 write (iout,*) "Printing long+short range energy"
220 call enerprint(energy(0))
222 call etotal(energy(0))
224 time_ene=MPI_Wtime()-time00
226 time_ene=tcpu()-time00
228 write (iout,*) "Time for energy evaluation",time_ene
229 print *,"after etotal"
232 call enerprint(energy(0))
233 call hairpin(.true.,nharp,iharp)
234 call secondary2(.true.)
238 print *, 'Calling OVERLAP_SC'
239 call overlap_sc(fail)
243 call sc_move(2,nres-1,10,1d10,nft_sc,etot)
244 print *,'SC_move',nft_sc,etot
245 write(iout,*) 'SC_move',nft_sc,etot
249 print *, 'Calling MINIM_DC'
255 call minim_dc(etot,iretcode,nfun)
257 if (indpdb.ne.0) then
261 call geom_to_var(nvar,varia)
262 print *,'Calling MINIMIZE.'
268 call minimize(etot,varia,iretcode,nfun)
270 print *,'SUMSL return code is',iretcode,' eval ',nfun
272 evals=nfun/(MPI_WTIME()-time1)
274 evals=nfun/(tcpu()-time1)
276 print *,'# eval/s',evals
277 print *,'refstr=',refstr
278 call hairpin(.true.,nharp,iharp)
279 call secondary2(.true.)
280 call etotal(energy(0))
282 call enerprint(energy(0))
285 call briefout(0,etot)
286 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
287 write (iout,'(a,i3)') 'SUMSL return code:',iretcode
288 write (iout,'(a,i20)') '# of energy evaluations:',nfun+1
289 write (iout,'(a,f16.3)')'# of energy evaluations/sec:',evals
291 print *,'refstr=',refstr
292 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
293 call briefout(0,etot)
295 if (outpdb) call pdbout(etot,titel(:32),ipdb)
296 if (outmol2) call mol2out(etot,titel(:32))
299 c---------------------------------------------------------------------------
300 subroutine exec_regularize
301 implicit real*8 (a-h,o-z)
306 include 'COMMON.SETUP'
307 include 'COMMON.TIME1'
308 include 'COMMON.INTERACT'
309 include 'COMMON.NAMES'
311 include 'COMMON.HEADER'
312 include 'COMMON.CONTROL'
313 include 'COMMON.CONTACTS'
314 include 'COMMON.CHAIN'
316 include 'COMMON.IOUNITS'
317 include 'COMMON.FFIELD'
318 include 'COMMON.REMD'
320 include 'COMMON.SBRIDGE'
321 double precision energy(0:n_ene)
326 call regularize(nct-nnt+1,etot,rms,cref(1,nnt,1),iretcode)
327 call etotal(energy(0))
328 energy(0)=energy(0)-energy(14)
330 call enerprint(energy(0))
332 call briefout(0,etot)
333 if (outpdb) call pdbout(etot,titel(:32),ipdb)
334 if (outmol2) call mol2out(etot,titel(:32))
335 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
336 write (iout,'(a,i3)') 'SUMSL return code:',iretcode
339 c---------------------------------------------------------------------------
340 subroutine exec_thread
345 include "COMMON.SETUP"
349 c---------------------------------------------------------------------------
351 implicit real*8 (a-h,o-z)
353 character*10 nodeinfo
354 double precision varia(maxvar)
358 include "COMMON.SETUP"
359 include 'COMMON.CONTROL'
363 if (modecalc.eq.3) then
369 if (modecalc.eq.3) then
380 c---------------------------------------------------------------------------
381 subroutine exec_mult_eeval_or_minim
382 implicit real*8 (a-h,o-z)
386 dimension muster(mpi_status_size)
388 include 'COMMON.SETUP'
389 include 'COMMON.TIME1'
390 include 'COMMON.INTERACT'
391 include 'COMMON.NAMES'
393 include 'COMMON.HEADER'
394 include 'COMMON.CONTROL'
395 include 'COMMON.CONTACTS'
396 include 'COMMON.CHAIN'
398 include 'COMMON.IOUNITS'
399 include 'COMMON.FFIELD'
400 include 'COMMON.REMD'
402 include 'COMMON.SBRIDGE'
403 double precision varia(maxvar)
405 double precision energy(0:max_ene)
415 open(intin,file=intinname,status='old')
416 write (istat,'(a5,20a12)')"# ",
417 & (wname(print_order(i)),i=1,nprint_ene)
419 write (istat,'(a5,20a12)')"# ",
420 & (ename(print_order(i)),i=1,nprint_ene),
421 & "ETOT total","RMSD","nat.contact","nnt.contact"
423 write (istat,'(a5,20a12)')"# ",
424 & (ename(print_order(i)),i=1,nprint_ene),"ETOT total"
430 read (intin,'(e15.10,e15.5)',end=1100,err=1100) time,ene
431 call read_x(intin,*11)
433 c Broadcast the order to compute internal coordinates to the slaves.
435 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
437 call int_from_cart1(.false.)
439 read (intin,'(i5)',end=1100,err=1100) iconf
440 call read_angles(intin,*11)
441 call geom_to_var(nvar,varia)
444 write (iout,'(a,i7)') 'Conformation #',iconf
445 call etotal(energy(0))
446 call briefout(iconf,energy(0))
447 call enerprint(energy(0))
450 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
451 write (istat,'(i5,20(f12.3))') iconf,
452 & (energy(print_order(i)),i=1,nprint_ene),etot,
453 & rms,frac,frac_nn,co
456 write (istat,'(i5,16(f12.3))') iconf,
457 & (energy(print_order(i)),i=1,nprint_ene),etot
473 if (mm.lt.nodes) then
475 read (intin,'(e15.10,e15.5)',end=11,err=11) time,ene
476 call read_x(intin,*11)
478 c Broadcast the order to compute internal coordinates to the slaves.
480 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
482 call int_from_cart1(.false.)
484 read (intin,'(i5)',end=11,err=11) iconf
485 call read_angles(intin,*11)
486 call geom_to_var(nvar,varia)
489 write (iout,'(a,i7)') 'Conformation #',iconf
499 call mpi_send(ind,6,mpi_integer,mm,idint,CG_COMM,
501 call mpi_send(varia,nvar,mpi_double_precision,mm,
502 * idreal,CG_COMM,ierr)
503 call mpi_send(ene0,1,mpi_double_precision,mm,
504 * idreal,CG_COMM,ierr)
505 c print *,'task ',n,' sent to worker ',mm,nvar
507 call mpi_recv(ind,6,mpi_integer,mpi_any_source,idint,
508 * CG_COMM,muster,ierr)
509 man=muster(mpi_source)
510 c print *,'receiving result from worker ',man,' (',iii1,iii,')'
511 call mpi_recv(varia,nvar,mpi_double_precision,
512 * man,idreal,CG_COMM,muster,ierr)
514 * mpi_double_precision,man,idreal,
515 * CG_COMM,muster,ierr)
516 call mpi_recv(ene0,1,
517 * mpi_double_precision,man,idreal,
518 * CG_COMM,muster,ierr)
519 c print *,'result received from worker ',man,' sending now'
521 call var_to_geom(nvar,varia)
523 call etotal(energy(0))
527 write (iout,'(a,2i7)') 'Conformation #',iconf,ind(5)
530 call enerprint(energy(0))
531 call briefout(it,etot)
532 c if (minim) call briefout(it,etot)
534 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
535 write (istat,'(i5,19(f12.3))') iconf,
536 & (energy(print_order(i)),i=1,nprint_ene),etot,
537 & rms,frac,frac_nn,co
539 write (istat,'(i5,15(f12.3))') iconf,
540 & (energy(print_order(i)),i=1,nprint_ene),etot
545 read (intin,'(e15.10,e15.5)',end=1101,err=1101) time,ene
546 call read_x(intin,*11)
548 c Broadcast the order to compute internal coordinates to the slaves.
550 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
552 call int_from_cart1(.false.)
554 read (intin,'(i5)',end=1101,err=1101) iconf
555 call read_angles(intin,*11)
556 call geom_to_var(nvar,varia)
567 call mpi_send(ind,6,mpi_integer,man,idint,CG_COMM,
569 call mpi_send(varia,nvar,mpi_double_precision,man,
570 * idreal,CG_COMM,ierr)
571 call mpi_send(ene0,1,mpi_double_precision,man,
572 * idreal,CG_COMM,ierr)
573 nf_mcmf=nf_mcmf+ind(4)
579 call mpi_recv(ind,6,mpi_integer,mpi_any_source,idint,
580 * CG_COMM,muster,ierr)
581 man=muster(mpi_source)
582 call mpi_recv(varia,nvar,mpi_double_precision,
583 * man,idreal,CG_COMM,muster,ierr)
585 * mpi_double_precision,man,idreal,
586 * CG_COMM,muster,ierr)
587 call mpi_recv(ene0,1,
588 * mpi_double_precision,man,idreal,
589 * CG_COMM,muster,ierr)
591 call var_to_geom(nvar,varia)
593 call etotal(energy(0))
597 write (iout,'(a,2i7)') 'Conformation #',iconf,ind(5)
600 call enerprint(energy(0))
601 call briefout(it,etot)
603 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
604 write (istat,'(i5,19(f12.3))') iconf,
605 & (energy(print_order(i)),i=1,nprint_ene),etot,
606 & rms,frac,frac_nn,co
608 write (istat,'(i5,15(f12.3))') iconf,
609 & (energy(print_order(i)),i=1,nprint_ene),etot
621 call mpi_send(ind,6,mpi_integer,i,idint,CG_COMM,
626 open(intin,file=intinname,status='old')
627 write (istat,'(a5,20a12)')"# ",
628 & (wname(print_order(i)),i=1,nprint_ene)
629 write (istat,'("# ",20(1pe12.4))')
630 & (weights(print_order(i)),i=1,nprint_ene)
632 write (istat,'(a5,20a12)')"# ",
633 & (ename(print_order(i)),i=1,nprint_ene),
634 & "ETOT total","RMSD","nat.contact","nnt.contact"
636 write (istat,'(a5,14a12)')"# ",
637 & (ename(print_order(i)),i=1,nprint_ene),"ETOT total"
641 read (intin,'(e15.10,e15.5)',end=11,err=11) time,ene
642 call read_x(intin,*11)
644 c Broadcast the order to compute internal coordinates to the slaves.
646 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
648 call int_from_cart1(.false.)
650 read (intin,'(i5)',end=11,err=11) iconf
651 call read_angles(intin,*11)
652 call geom_to_var(nvar,varia)
655 write (iout,'(a,i7)') 'Conformation #',iconf
656 if (minim) call minimize(etot,varia,iretcode,nfun)
657 call etotal(energy(0))
660 call enerprint(energy(0))
661 if (minim) call briefout(it,etot)
663 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
664 write (istat,'(i5,18(f12.3))') iconf,
665 & (energy(print_order(i)),i=1,nprint_ene),
666 & etot,rms,frac,frac_nn,co
669 write (istat,'(i5,14(f12.3))') iconf,
670 & (energy(print_order(i)),i=1,nprint_ene),etot
677 c---------------------------------------------------------------------------
678 subroutine exec_checkgrad
679 implicit real*8 (a-h,o-z)
684 include 'COMMON.SETUP'
685 include 'COMMON.TIME1'
686 include 'COMMON.INTERACT'
687 include 'COMMON.NAMES'
689 include 'COMMON.HEADER'
690 include 'COMMON.CONTROL'
691 include 'COMMON.CONTACTS'
692 include 'COMMON.CHAIN'
694 include 'COMMON.IOUNITS'
695 include 'COMMON.FFIELD'
696 include 'COMMON.REMD'
698 include 'COMMON.SBRIDGE'
700 double precision energy(0:max_ene)
702 c vbld(i)=vbld(i)+ran_number(-0.1d0,0.1d0)
703 c if (itype(i).ne.10)
704 c & vbld(i+nres)=vbld(i+nres)+ran_number(-0.001d0,0.001d0)
706 if (indpdb.eq.0) call chainbuild
709 c dc(j,i)=dc(j,i)+ran_number(-0.2d0,0.2d0)
713 c if (itype(i).ne.10) then
715 c dc(j,i+nres)=dc(j,i+nres)+ran_number(-0.2d0,0.2d0)
720 c dc(j,0)=ran_number(-0.2d0,0.2d0)
730 call etotal(energy(0))
732 call enerprint(energy(0))
733 write (iout,*) "Uconst",Uconst," Uconst_back",uconst_back
734 print *,'icheckgrad=',icheckgrad
735 goto (10,20,30) icheckgrad
736 10 call check_ecartint
737 write(iout,*) "kupadupa"
740 20 call check_cartgrad
745 c---------------------------------------------------------------------------
752 c---------------------------------------------------------------------------
758 include 'COMMON.IOUNITS'
759 C Conformational Space Annealling programmed by Jooyoung Lee.
760 C This method works only with parallel machines!
764 write (iout,*) "CSA works on parallel machines only"
768 c---------------------------------------------------------------------------
769 subroutine exec_softreg
771 include 'COMMON.IOUNITS'
772 include 'COMMON.CONTROL'
773 double precision energy(0:max_ene)
775 call etotal(energy(0))
776 call enerprint(energy(0))
777 if (.not.lsecondary) then
778 write(iout,*) 'Calling secondary structure recognition'
779 call secondary2(debug)
781 write(iout,*) 'Using secondary structure supplied in pdb'
786 call etotal(energy(0))
788 call enerprint(energy(0))
790 call briefout(0,etot)
791 call secondary2(.true.)
792 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)