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 03/28/12 23:29 by czarek'
56 if (me.eq.king) call cinfo
57 C Read force field parameters and job setup data
59 if (me.eq.king .or. .not. out1file) then
61 & text_mode_calc(modecalc)(:ilen(text_mode_calc(modecalc))),
63 if (minim) write (iout,'(a)')
64 & 'Conformations will be energy-minimized.'
65 write (iout,'(80(1h*)/)')
69 if (modecalc.eq.-2) then
72 else if (modecalc.eq.-1) then
73 write(iout,*) "call check_sc_map next"
78 if (fg_rank.gt.0) then
79 C Fine-grain slaves just do energy and gradient components.
80 call ergastulum ! slave workhouse in Latin
83 if (modecalc.eq.0) then
84 call exec_eeval_or_minim
85 else if (modecalc.eq.1) then
87 else if (modecalc.eq.2) then
89 else if (modecalc.eq.3 .or. modecalc .eq.6) then
91 else if (modecalc.eq.4) then
92 call exec_mult_eeval_or_minim
93 else if (modecalc.eq.5) then
95 else if (ModeCalc.eq.7) then
97 else if (ModeCalc.eq.8) then
99 else if (modecalc.eq.11) then
101 else if (modecalc.eq.12) then
103 else if (modecalc.eq.14) then
106 write (iout,'(a)') 'This calculation type is not supported',
112 if (fg_rank.eq.0) call finish_task
113 c call memmon_print_usage()
115 call print_detailed_timing
117 call MPI_Finalize(ierr)
120 call dajczas(tcpu(),hrtime,mintime,sectime)
121 stop '********** Program terminated normally.'
124 c--------------------------------------------------------------------------
130 include 'COMMON.SETUP'
131 include 'COMMON.CONTROL'
132 include 'COMMON.IOUNITS'
133 if (me.eq.king .or. .not. out1file)
134 & write (iout,*) "Calling chainbuild"
139 c---------------------------------------------------------------------------
140 subroutine exec_MREMD
144 include 'COMMON.SETUP'
145 include 'COMMON.CONTROL'
146 include 'COMMON.IOUNITS'
147 include 'COMMON.REMD'
148 if (me.eq.king .or. .not. out1file)
149 & write (iout,*) "Calling chainbuild"
151 if (me.eq.king .or. .not. out1file)
152 & write (iout,*) "Calling REMD"
162 write (iout,*) "MREMD works on parallel machines only"
166 c---------------------------------------------------------------------------
167 subroutine exec_eeval_or_minim
168 implicit real*8 (a-h,o-z)
173 include 'COMMON.SETUP'
174 include 'COMMON.TIME1'
175 include 'COMMON.INTERACT'
176 include 'COMMON.NAMES'
178 include 'COMMON.HEADER'
179 include 'COMMON.CONTROL'
180 include 'COMMON.CONTACTS'
181 include 'COMMON.CHAIN'
183 include 'COMMON.IOUNITS'
184 include 'COMMON.FFIELD'
185 include 'COMMON.REMD'
187 include 'COMMON.SBRIDGE'
189 double precision energy(0:n_ene)
190 double precision energy_long(0:n_ene),energy_short(0:n_ene)
191 double precision varia(maxvar)
192 integer nharp,iharp(4,maxres/3)
193 if (indpdb.eq.0) call chainbuild
201 print *,"Processor",myrank," after chainbuild"
203 call etotal_long(energy_long(0))
204 write (iout,*) "Printing long range energy"
205 call enerprint(energy_long(0))
206 call etotal_short(energy_short(0))
207 write (iout,*) "Printing short range energy"
208 call enerprint(energy_short(0))
210 energy(i)=energy_long(i)+energy_short(i)
211 write (iout,*) i,energy_long(i),energy_short(i),energy(i)
213 write (iout,*) "Printing long+short range energy"
214 call enerprint(energy(0))
216 call etotal(energy(0))
218 time_ene=MPI_Wtime()-time00
220 time_ene=tcpu()-time00
222 write (iout,*) "Time for energy evaluation",time_ene
225 call enerprint(energy(0))
226 call hairpin(.true.,nharp,iharp)
227 call secondary2(.true.)
231 call overlap_sc(fail)
235 call sc_move(2,nres-1,10,1d10,nft_sc,etot)
244 call minim_dc(etot,iretcode,nfun)
246 if (indpdb.ne.0) then
250 call geom_to_var(nvar,varia)
256 call minimize(etot,varia,iretcode,nfun)
258 print *,'SUMSL return code is',iretcode,' eval ',nfun
260 evals=nfun/(MPI_WTIME()-time1)
262 evals=nfun/(tcpu()-time1)
264 print *,'# eval/s',evals
265 print *,'refstr=',refstr
266 call hairpin(.true.,nharp,iharp)
267 call secondary2(.true.)
268 call etotal(energy(0))
270 call enerprint(energy(0))
273 call briefout(0,etot)
274 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
275 write (iout,'(a,i3)') 'SUMSL return code:',iretcode
276 write (iout,'(a,i20)') '# of energy evaluations:',nfun+1
277 write (iout,'(a,f16.3)')'# of energy evaluations/sec:',evals
279 print *,'refstr=',refstr
280 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
281 call briefout(0,etot)
285 if (outx) call cartout(0.0d0)
287 if (outx) call cartoutx(0.0d0)
289 if (outpdb) call pdbout(etot,titel(:32),ipdb)
290 if (outmol2) call mol2out(etot,titel(:32))
291 if (minim .and. iretcode.ne.4) call check_ecartint
294 c---------------------------------------------------------------------------
295 subroutine exec_regularize
296 implicit real*8 (a-h,o-z)
301 include 'COMMON.SETUP'
302 include 'COMMON.TIME1'
303 include 'COMMON.INTERACT'
304 include 'COMMON.NAMES'
306 include 'COMMON.HEADER'
307 include 'COMMON.CONTROL'
308 include 'COMMON.CONTACTS'
309 include 'COMMON.CHAIN'
311 include 'COMMON.IOUNITS'
312 include 'COMMON.FFIELD'
313 include 'COMMON.REMD'
315 include 'COMMON.SBRIDGE'
316 double precision energy(0:n_ene)
321 call regularize(nct-nnt+1,etot,rms,cref(1,nnt),iretcode)
322 call etotal(energy(0))
323 energy(0)=energy(0)-energy(14)
325 call enerprint(energy(0))
327 call briefout(0,etot)
330 if (outx) call cartout(0.0d0)
332 if (outx) call cartoutx(0.0d0)
334 if (outpdb) call pdbout(etot,titel(:32),ipdb)
335 if (outmol2) call mol2out(etot,titel(:32))
336 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
337 write (iout,'(a,i3)') 'SUMSL return code:',iretcode
340 c---------------------------------------------------------------------------
341 subroutine exec_thread
346 include "COMMON.SETUP"
350 c---------------------------------------------------------------------------
352 implicit real*8 (a-h,o-z)
354 character*10 nodeinfo
355 double precision varia(maxvar)
359 include "COMMON.SETUP"
360 include 'COMMON.CONTROL'
364 if (modecalc.eq.3) then
370 if (modecalc.eq.3) then
381 c---------------------------------------------------------------------------
382 subroutine exec_mult_eeval_or_minim
383 implicit real*8 (a-h,o-z)
387 dimension muster(mpi_status_size)
389 include 'COMMON.SETUP'
390 include 'COMMON.TIME1'
391 include 'COMMON.INTERACT'
392 include 'COMMON.NAMES'
394 include 'COMMON.HEADER'
395 include 'COMMON.CONTROL'
396 include 'COMMON.CONTACTS'
397 include 'COMMON.CHAIN'
399 include 'COMMON.IOUNITS'
400 include 'COMMON.FFIELD'
401 include 'COMMON.REMD'
403 include 'COMMON.SBRIDGE'
404 double precision varia(maxvar)
406 double precision energy(0:n_ene)
416 open(intin,file=intinname,status='old')
417 write (istat,'(a5,30a12)')"# ",
418 & (wname(print_order(i)),i=1,nprint_ene)
420 write (istat,'(a5,30a12)')"# ",
421 & (ename(print_order(i)),i=1,nprint_ene),
422 & "ETOT total","RMSD","nat.contact","nnt.contact","cont.order"
424 write (istat,'(a5,30a12)')"# ",
425 & (ename(print_order(i)),i=1,nprint_ene),"ETOT total"
431 read (intin,'(e15.10,e15.5)',end=1100,err=1100) time,ene
432 call read_x(intin,*11)
434 c Broadcast the order to compute internal coordinates to the slaves.
436 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
438 call int_from_cart1(.false.)
440 read (intin,'(i5)',end=1100,err=1100) iconf
441 call read_angles(intin,*11)
442 call geom_to_var(nvar,varia)
445 write (iout,'(a,i7)') 'Conformation #',iconf
446 call etotal(energy(0))
447 call briefout(iconf,energy(0))
448 call enerprint(energy(0))
451 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
452 write (istat,'(i5,30(f12.3))') iconf,
453 & (energy(print_order(i)),i=1,nprint_ene),etot,
454 & rms,frac,frac_nn,co
457 write (istat,'(i5,30(f12.3))') iconf,
458 & (energy(print_order(i)),i=1,nprint_ene),etot
474 if (mm.lt.nodes) then
476 read (intin,'(e15.10,e15.5)',end=11,err=11) time,ene
477 call read_x(intin,*11)
479 c Broadcast the order to compute internal coordinates to the slaves.
481 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
483 call int_from_cart1(.false.)
485 read (intin,'(i5)',end=11,err=11) iconf
486 call read_angles(intin,*11)
487 call geom_to_var(nvar,varia)
492 write (iout,*) 'Conformation #',iconf,' read'
501 call mpi_send(ind,6,mpi_integer,mm,idint,CG_COMM,
503 call mpi_send(varia,nvar,mpi_double_precision,mm,
504 * idreal,CG_COMM,ierr)
505 call mpi_send(ene0,1,mpi_double_precision,mm,
506 * idreal,CG_COMM,ierr)
507 c print *,'task ',n,' sent to worker ',mm,nvar
509 call mpi_recv(ind,6,mpi_integer,mpi_any_source,idint,
510 * CG_COMM,muster,ierr)
511 man=muster(mpi_source)
512 c print *,'receiving result from worker ',man,' (',iii1,iii,')'
513 call mpi_recv(varia,nvar,mpi_double_precision,
514 * man,idreal,CG_COMM,muster,ierr)
516 * mpi_double_precision,man,idreal,
517 * CG_COMM,muster,ierr)
518 call mpi_recv(ene0,1,
519 * mpi_double_precision,man,idreal,
520 * CG_COMM,muster,ierr)
521 c print *,'result received from worker ',man,' sending now'
523 call var_to_geom(nvar,varia)
525 call etotal(energy(0))
529 write (iout,*) 'Conformation #',iconf," sumsl return code ",
533 call enerprint(energy(0))
534 call briefout(it,etot)
535 c if (minim) call briefout(it,etot)
537 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
538 write (istat,'(i5,30(f12.3))') iconf,
539 & (energy(print_order(i)),i=1,nprint_ene),etot,
540 & rms,frac,frac_nn,co
542 write (istat,'(i5,30(f12.3))') iconf,
543 & (energy(print_order(i)),i=1,nprint_ene),etot
548 read (intin,'(e15.10,e15.5)',end=11,err=11) time,ene
549 call read_x(intin,*11)
551 c Broadcast the order to compute internal coordinates to the slaves.
553 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
555 call int_from_cart1(.false.)
557 read (intin,'(i5)',end=11,err=11) iconf
558 call read_angles(intin,*11)
559 call geom_to_var(nvar,varia)
563 write (iout,*) 'Conformation #',iconf,' read'
571 call mpi_send(ind,6,mpi_integer,man,idint,CG_COMM,
573 call mpi_send(varia,nvar,mpi_double_precision,man,
574 * idreal,CG_COMM,ierr)
575 call mpi_send(ene0,1,mpi_double_precision,man,
576 * idreal,CG_COMM,ierr)
577 nf_mcmf=nf_mcmf+ind(4)
583 call mpi_recv(ind,6,mpi_integer,mpi_any_source,idint,
584 * CG_COMM,muster,ierr)
585 man=muster(mpi_source)
586 call mpi_recv(varia,nvar,mpi_double_precision,
587 * man,idreal,CG_COMM,muster,ierr)
589 * mpi_double_precision,man,idreal,
590 * CG_COMM,muster,ierr)
591 call mpi_recv(ene0,1,
592 * mpi_double_precision,man,idreal,
593 * CG_COMM,muster,ierr)
595 call var_to_geom(nvar,varia)
597 call etotal(energy(0))
601 write (iout,*) 'Conformation #',iconf," sumsl return code ",
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,30(f12.3))') iconf,
610 & (energy(print_order(i)),i=1,nprint_ene),etot,
611 & rms,frac,frac_nn,co
613 write (istat,'(i5,30(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=1100,err=1100) 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=1100,err=1100) 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
683 c---------------------------------------------------------------------------
684 subroutine exec_checkgrad
685 implicit real*8 (a-h,o-z)
690 include 'COMMON.SETUP'
691 include 'COMMON.TIME1'
692 include 'COMMON.INTERACT'
693 include 'COMMON.NAMES'
695 include 'COMMON.HEADER'
696 include 'COMMON.CONTROL'
697 include 'COMMON.CONTACTS'
698 include 'COMMON.CHAIN'
700 include 'COMMON.IOUNITS'
701 include 'COMMON.FFIELD'
702 include 'COMMON.REMD'
704 include 'COMMON.SBRIDGE'
706 double precision energy(0:max_ene)
708 c vbld(i)=vbld(i)+ran_number(-0.1d0,0.1d0)
709 c if (itype(i).ne.10)
710 c & vbld(i+nres)=vbld(i+nres)+ran_number(-0.001d0,0.001d0)
712 if (indpdb.eq.0) call chainbuild
715 c dc(j,i)=dc(j,i)+ran_number(-0.2d0,0.2d0)
719 c if (itype(i).ne.10) then
721 c dc(j,i+nres)=dc(j,i+nres)+ran_number(-0.2d0,0.2d0)
726 c dc(j,0)=ran_number(-0.2d0,0.2d0)
733 call rescale_weights(t_bath)
738 call etotal(energy(0))
740 call enerprint(energy(0))
741 write (iout,*) "Uconst",Uconst," Uconst_back",uconst_back
742 print *,'icheckgrad=',icheckgrad
743 goto (10,20,30) icheckgrad
744 10 call check_ecartint
746 20 call check_cartgrad
751 c---------------------------------------------------------------------------
758 c---------------------------------------------------------------------------
764 include 'COMMON.IOUNITS'
765 C Conformational Space Annealling programmed by Jooyoung Lee.
766 C This method works only with parallel machines!
769 write (iout,*) "CSA is not supported in this version"
771 csa write (iout,*) "CSA works on parallel machines only"
772 write (iout,*) "CSA is not supported in this version"
776 c---------------------------------------------------------------------------
777 subroutine exec_softreg
778 implicit real*8 (a-h,o-z)
780 include 'COMMON.IOUNITS'
781 include 'COMMON.CONTROL'
782 double precision energy(0:max_ene)
783 logical debug /.false./
785 call etotal(energy(0))
786 call enerprint(energy(0))
787 if (.not.lsecondary) then
788 write(iout,*) 'Calling secondary structure recognition'
789 call secondary2(debug)
791 write(iout,*) 'Using secondary structure supplied in pdb'
796 call etotal(energy(0))
798 call enerprint(energy(0))
800 call briefout(0,etot)
801 call secondary2(.true.)
802 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)