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
206 print *,'dc',dc(1,0),dc(2,0),dc(3,0)
208 print *,"Processor",myrank," after chainbuild"
210 call etotal_long(energy_long(0))
211 write (iout,*) "Printing long range energy"
212 call enerprint(energy_long(0))
213 call etotal_short(energy_short(0))
214 write (iout,*) "Printing short range energy"
215 call enerprint(energy_short(0))
217 energy(i)=energy_long(i)+energy_short(i)
218 write (iout,*) i,energy_long(i),energy_short(i),energy(i)
220 write (iout,*) "Printing long+short range energy"
221 call enerprint(energy(0))
223 call etotal(energy(0))
225 time_ene=MPI_Wtime()-time00
227 time_ene=tcpu()-time00
229 write (iout,*) "Time for energy evaluation",time_ene
230 print *,"after etotal"
233 call enerprint(energy(0))
234 call hairpin(.true.,nharp,iharp)
235 print *,'after hairpin'
236 call secondary2(.true.)
237 print *,'after secondary'
241 print *, 'Calling OVERLAP_SC'
242 call overlap_sc(fail)
246 call sc_move(2,nres-1,10,1d10,nft_sc,etot)
247 print *,'SC_move',nft_sc,etot
248 write(iout,*) 'SC_move',nft_sc,etot
252 print *, 'Calling MINIM_DC'
258 call minim_dc(etot,iretcode,nfun)
260 if (indpdb.ne.0) then
264 call geom_to_var(nvar,varia)
265 print *,'Calling MINIMIZE.'
271 call minimize(etot,varia,iretcode,nfun)
273 print *,'SUMSL return code is',iretcode,' eval ',nfun
275 evals=nfun/(MPI_WTIME()-time1)
277 evals=nfun/(tcpu()-time1)
279 print *,'# eval/s',evals
280 print *,'refstr=',refstr
281 call hairpin(.false.,nharp,iharp)
282 print *,'after hairpin'
283 call secondary2(.true.)
284 print *,'after secondary'
285 call etotal(energy(0))
287 call enerprint(energy(0))
290 call briefout(0,etot)
291 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
292 write (iout,'(a,i3)') 'SUMSL return code:',iretcode
293 write (iout,'(a,i20)') '# of energy evaluations:',nfun+1
294 write (iout,'(a,f16.3)')'# of energy evaluations/sec:',evals
296 print *,'refstr=',refstr
297 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
298 call briefout(0,etot)
300 if (outpdb) call pdbout(etot,titel(:32),ipdb)
301 if (outmol2) call mol2out(etot,titel(:32))
304 c---------------------------------------------------------------------------
305 subroutine exec_regularize
306 implicit real*8 (a-h,o-z)
311 include 'COMMON.SETUP'
312 include 'COMMON.TIME1'
313 include 'COMMON.INTERACT'
314 include 'COMMON.NAMES'
316 include 'COMMON.HEADER'
317 include 'COMMON.CONTROL'
318 include 'COMMON.CONTACTS'
319 include 'COMMON.CHAIN'
321 include 'COMMON.IOUNITS'
322 include 'COMMON.FFIELD'
323 include 'COMMON.REMD'
325 include 'COMMON.SBRIDGE'
326 double precision energy(0:n_ene)
331 call regularize(nct-nnt+1,etot,rms,cref(1,nnt,1),iretcode)
332 call etotal(energy(0))
333 energy(0)=energy(0)-energy(14)
335 call enerprint(energy(0))
337 call briefout(0,etot)
338 if (outpdb) call pdbout(etot,titel(:32),ipdb)
339 if (outmol2) call mol2out(etot,titel(:32))
340 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
341 write (iout,'(a,i3)') 'SUMSL return code:',iretcode
344 c---------------------------------------------------------------------------
345 subroutine exec_thread
350 include "COMMON.SETUP"
354 c---------------------------------------------------------------------------
356 implicit real*8 (a-h,o-z)
358 character*10 nodeinfo
359 double precision varia(maxvar)
363 include "COMMON.SETUP"
364 include 'COMMON.CONTROL'
368 if (modecalc.eq.3) then
374 if (modecalc.eq.3) then
385 c---------------------------------------------------------------------------
386 subroutine exec_mult_eeval_or_minim
387 implicit real*8 (a-h,o-z)
391 dimension muster(mpi_status_size)
393 include 'COMMON.SETUP'
394 include 'COMMON.TIME1'
395 include 'COMMON.INTERACT'
396 include 'COMMON.NAMES'
398 include 'COMMON.HEADER'
399 include 'COMMON.CONTROL'
400 include 'COMMON.CONTACTS'
401 include 'COMMON.CHAIN'
403 include 'COMMON.IOUNITS'
404 include 'COMMON.FFIELD'
405 include 'COMMON.REMD'
407 include 'COMMON.SBRIDGE'
408 double precision varia(maxvar)
410 double precision energy(0:max_ene)
420 open(intin,file=intinname,status='old')
421 write (istat,'(a5,20a12)')"# ",
422 & (wname(print_order(i)),i=1,nprint_ene)
424 write (istat,'(a5,20a12)')"# ",
425 & (ename(print_order(i)),i=1,nprint_ene),
426 & "ETOT total","RMSD","nat.contact","nnt.contact"
428 write (istat,'(a5,20a12)')"# ",
429 & (ename(print_order(i)),i=1,nprint_ene),"ETOT total"
435 read (intin,'(e15.10,e15.5)',end=1100,err=1100) time,ene
436 call read_x(intin,*11)
438 c Broadcast the order to compute internal coordinates to the slaves.
440 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
442 call int_from_cart1(.false.)
444 read (intin,'(i5)',end=1100,err=1100) iconf
445 call read_angles(intin,*11)
446 call geom_to_var(nvar,varia)
449 write (iout,'(a,i7)') 'Conformation #',iconf
450 call etotal(energy(0))
451 call briefout(iconf,energy(0))
452 call enerprint(energy(0))
455 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
456 write (istat,'(i5,20(f12.3))') iconf,
457 & (energy(print_order(i)),i=1,nprint_ene),etot,
458 & rms,frac,frac_nn,co
461 write (istat,'(i5,16(f12.3))') iconf,
462 & (energy(print_order(i)),i=1,nprint_ene),etot
478 if (mm.lt.nodes) then
480 read (intin,'(e15.10,e15.5)',end=11,err=11) time,ene
481 call read_x(intin,*11)
483 c Broadcast the order to compute internal coordinates to the slaves.
485 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
487 call int_from_cart1(.false.)
489 read (intin,'(i5)',end=11,err=11) iconf
490 call read_angles(intin,*11)
491 call geom_to_var(nvar,varia)
494 write (iout,'(a,i7)') 'Conformation #',iconf
504 call mpi_send(ind,6,mpi_integer,mm,idint,CG_COMM,
506 call mpi_send(varia,nvar,mpi_double_precision,mm,
507 * idreal,CG_COMM,ierr)
508 call mpi_send(ene0,1,mpi_double_precision,mm,
509 * idreal,CG_COMM,ierr)
510 c print *,'task ',n,' sent to worker ',mm,nvar
512 call mpi_recv(ind,6,mpi_integer,mpi_any_source,idint,
513 * CG_COMM,muster,ierr)
514 man=muster(mpi_source)
515 c print *,'receiving result from worker ',man,' (',iii1,iii,')'
516 call mpi_recv(varia,nvar,mpi_double_precision,
517 * man,idreal,CG_COMM,muster,ierr)
519 * mpi_double_precision,man,idreal,
520 * CG_COMM,muster,ierr)
521 call mpi_recv(ene0,1,
522 * mpi_double_precision,man,idreal,
523 * CG_COMM,muster,ierr)
524 c print *,'result received from worker ',man,' sending now'
526 call var_to_geom(nvar,varia)
528 call etotal(energy(0))
532 write (iout,'(a,2i7)') 'Conformation #',iconf,ind(5)
535 call enerprint(energy(0))
536 call briefout(it,etot)
537 c if (minim) call briefout(it,etot)
539 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
540 write (istat,'(i5,19(f12.3))') iconf,
541 & (energy(print_order(i)),i=1,nprint_ene),etot,
542 & rms,frac,frac_nn,co
544 write (istat,'(i5,15(f12.3))') iconf,
545 & (energy(print_order(i)),i=1,nprint_ene),etot
550 read (intin,'(e15.10,e15.5)',end=1101,err=1101) time,ene
551 call read_x(intin,*11)
553 c Broadcast the order to compute internal coordinates to the slaves.
555 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
557 call int_from_cart1(.false.)
559 read (intin,'(i5)',end=1101,err=1101) iconf
560 call read_angles(intin,*11)
561 call geom_to_var(nvar,varia)
572 call mpi_send(ind,6,mpi_integer,man,idint,CG_COMM,
574 call mpi_send(varia,nvar,mpi_double_precision,man,
575 * idreal,CG_COMM,ierr)
576 call mpi_send(ene0,1,mpi_double_precision,man,
577 * idreal,CG_COMM,ierr)
578 nf_mcmf=nf_mcmf+ind(4)
584 call mpi_recv(ind,6,mpi_integer,mpi_any_source,idint,
585 * CG_COMM,muster,ierr)
586 man=muster(mpi_source)
587 call mpi_recv(varia,nvar,mpi_double_precision,
588 * man,idreal,CG_COMM,muster,ierr)
590 * mpi_double_precision,man,idreal,
591 * CG_COMM,muster,ierr)
592 call mpi_recv(ene0,1,
593 * mpi_double_precision,man,idreal,
594 * CG_COMM,muster,ierr)
596 call var_to_geom(nvar,varia)
598 call etotal(energy(0))
602 write (iout,'(a,2i7)') 'Conformation #',iconf,ind(5)
605 call enerprint(energy(0))
606 call briefout(it,etot)
608 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
609 write (istat,'(i5,19(f12.3))') iconf,
610 & (energy(print_order(i)),i=1,nprint_ene),etot,
611 & rms,frac,frac_nn,co
613 write (istat,'(i5,15(f12.3))') iconf,
614 & (energy(print_order(i)),i=1,nprint_ene),etot
626 call mpi_send(ind,6,mpi_integer,i,idint,CG_COMM,
631 open(intin,file=intinname,status='old')
632 write (istat,'(a5,20a12)')"# ",
633 & (wname(print_order(i)),i=1,nprint_ene)
634 write (istat,'("# ",20(1pe12.4))')
635 & (weights(print_order(i)),i=1,nprint_ene)
637 write (istat,'(a5,20a12)')"# ",
638 & (ename(print_order(i)),i=1,nprint_ene),
639 & "ETOT total","RMSD","nat.contact","nnt.contact"
641 write (istat,'(a5,14a12)')"# ",
642 & (ename(print_order(i)),i=1,nprint_ene),"ETOT total"
646 read (intin,'(e15.10,e15.5)',end=11,err=11) time,ene
647 call read_x(intin,*11)
649 c Broadcast the order to compute internal coordinates to the slaves.
651 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
653 call int_from_cart1(.false.)
655 read (intin,'(i5)',end=11,err=11) iconf
656 call read_angles(intin,*11)
657 call geom_to_var(nvar,varia)
660 write (iout,'(a,i7)') 'Conformation #',iconf
661 if (minim) call minimize(etot,varia,iretcode,nfun)
662 call etotal(energy(0))
665 call enerprint(energy(0))
666 if (minim) call briefout(it,etot)
668 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
669 write (istat,'(i5,18(f12.3))') iconf,
670 & (energy(print_order(i)),i=1,nprint_ene),
671 & etot,rms,frac,frac_nn,co
674 write (istat,'(i5,14(f12.3))') iconf,
675 & (energy(print_order(i)),i=1,nprint_ene),etot
682 c---------------------------------------------------------------------------
683 subroutine exec_checkgrad
684 implicit real*8 (a-h,o-z)
689 include 'COMMON.SETUP'
690 include 'COMMON.TIME1'
691 include 'COMMON.INTERACT'
692 include 'COMMON.NAMES'
694 include 'COMMON.HEADER'
695 include 'COMMON.CONTROL'
696 include 'COMMON.CONTACTS'
697 include 'COMMON.CHAIN'
699 include 'COMMON.IOUNITS'
700 include 'COMMON.FFIELD'
701 include 'COMMON.REMD'
703 include 'COMMON.SBRIDGE'
705 double precision energy(0:max_ene)
707 c vbld(i)=vbld(i)+ran_number(-0.1d0,0.1d0)
708 c if (itype(i).ne.10)
709 c & vbld(i+nres)=vbld(i+nres)+ran_number(-0.001d0,0.001d0)
711 if (indpdb.eq.0) call chainbuild
714 c dc(j,i)=dc(j,i)+ran_number(-0.2d0,0.2d0)
718 c if (itype(i).ne.10) then
720 c dc(j,i+nres)=dc(j,i+nres)+ran_number(-0.2d0,0.2d0)
725 c dc(j,0)=ran_number(-0.2d0,0.2d0)
735 call etotal(energy(0))
737 call enerprint(energy(0))
738 write (iout,*) "Uconst",Uconst," Uconst_back",uconst_back
739 print *,'icheckgrad=',icheckgrad
740 goto (10,20,30) icheckgrad
741 10 call check_ecartint
743 20 call check_cartgrad
748 c---------------------------------------------------------------------------
755 c---------------------------------------------------------------------------
761 include 'COMMON.IOUNITS'
762 C Conformational Space Annealling programmed by Jooyoung Lee.
763 C This method works only with parallel machines!
767 write (iout,*) "CSA works on parallel machines only"
771 c---------------------------------------------------------------------------
772 subroutine exec_softreg
774 include 'COMMON.IOUNITS'
775 include 'COMMON.CONTROL'
776 double precision energy(0:max_ene)
778 call etotal(energy(0))
779 call enerprint(energy(0))
780 if (.not.lsecondary) then
781 write(iout,*) 'Calling secondary structure recognition'
782 call secondary2(debug)
784 write(iout,*) 'Using secondary structure supplied in pdb'
789 call etotal(energy(0))
791 call enerprint(energy(0))
793 call briefout(0,etot)
794 call secondary2(.true.)
795 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)