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 11/22/15 10:36PM 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 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
201 if (indpdb.ne.0) then
212 print *,'dc',dc(1,0),dc(2,0),dc(3,0)
214 print *,"Processor",myrank," after chainbuild"
216 call etotal_long(energy_long(0))
217 write (iout,*) "Printing long range energy"
218 call enerprint(energy_long(0))
219 call etotal_short(energy_short(0))
220 write (iout,*) "Printing short range energy"
221 call enerprint(energy_short(0))
223 energy(i)=energy_long(i)+energy_short(i)
224 write (iout,*) i,energy_long(i),energy_short(i),energy(i)
226 write (iout,*) "Printing long+short range energy"
227 call enerprint(energy(0))
229 call etotal(energy(0))
231 time_ene=MPI_Wtime()-time00
233 time_ene=tcpu()-time00
235 write (iout,*) "Time for energy evaluation",time_ene
236 print *,"after etotal"
239 call enerprint(energy(0))
240 call hairpin(.true.,nharp,iharp)
241 print *,'after hairpin'
242 call secondary2(.true.)
243 print *,'after secondary'
247 print *, 'Calling OVERLAP_SC'
248 call overlap_sc(fail)
252 call sc_move(2,nres-1,10,1d10,nft_sc,etot)
253 print *,'SC_move',nft_sc,etot
254 write(iout,*) 'SC_move',nft_sc,etot
258 print *, 'Calling MINIM_DC'
264 call minim_dc(etot,iretcode,nfun)
266 if (indpdb.ne.0) then
270 call geom_to_var(nvar,varia)
271 print *,'Calling MINIMIZE.'
277 call minimize(etot,varia,iretcode,nfun)
279 print *,'SUMSL return code is',iretcode,' eval ',nfun
281 evals=nfun/(MPI_WTIME()-time1)
283 evals=nfun/(tcpu()-time1)
285 print *,'# eval/s',evals
286 print *,'refstr=',refstr
287 call hairpin(.false.,nharp,iharp)
288 print *,'after hairpin'
289 call secondary2(.true.)
290 print *,'after secondary'
291 call etotal(energy(0))
293 call enerprint(energy(0))
296 call briefout(0,etot)
297 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
298 write (iout,'(a,i3)') 'SUMSL return code:',iretcode
299 write (iout,'(a,i20)') '# of energy evaluations:',nfun+1
300 write (iout,'(a,f16.3)')'# of energy evaluations/sec:',evals
302 print *,'refstr=',refstr
303 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
304 call briefout(0,etot)
306 if (outpdb) call pdbout(etot,titel(:32),ipdb)
307 if (outmol2) call mol2out(etot,titel(:32))
310 c---------------------------------------------------------------------------
311 subroutine exec_regularize
312 implicit real*8 (a-h,o-z)
317 include 'COMMON.SETUP'
318 include 'COMMON.TIME1'
319 include 'COMMON.INTERACT'
320 include 'COMMON.NAMES'
322 include 'COMMON.HEADER'
323 include 'COMMON.CONTROL'
324 include 'COMMON.CONTACTS'
325 include 'COMMON.CHAIN'
327 include 'COMMON.IOUNITS'
328 include 'COMMON.FFIELD'
329 include 'COMMON.REMD'
331 include 'COMMON.SBRIDGE'
332 double precision energy(0:n_ene)
337 call regularize(nct-nnt+1,etot,rms,cref(1,nnt,1),iretcode)
338 call etotal(energy(0))
339 energy(0)=energy(0)-energy(14)
341 call enerprint(energy(0))
343 call briefout(0,etot)
344 if (outpdb) call pdbout(etot,titel(:32),ipdb)
345 if (outmol2) call mol2out(etot,titel(:32))
346 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
347 write (iout,'(a,i3)') 'SUMSL return code:',iretcode
350 c---------------------------------------------------------------------------
351 subroutine exec_thread
356 include "COMMON.SETUP"
360 c---------------------------------------------------------------------------
362 implicit real*8 (a-h,o-z)
364 character*10 nodeinfo
365 double precision varia(maxvar)
369 include "COMMON.SETUP"
370 include 'COMMON.CONTROL'
374 if (modecalc.eq.3) then
380 if (modecalc.eq.3) then
391 c---------------------------------------------------------------------------
392 subroutine exec_mult_eeval_or_minim
393 implicit real*8 (a-h,o-z)
397 dimension muster(mpi_status_size)
399 include 'COMMON.SETUP'
400 include 'COMMON.TIME1'
401 include 'COMMON.INTERACT'
402 include 'COMMON.NAMES'
404 include 'COMMON.HEADER'
405 include 'COMMON.CONTROL'
406 include 'COMMON.CONTACTS'
407 include 'COMMON.CHAIN'
409 include 'COMMON.IOUNITS'
410 include 'COMMON.FFIELD'
411 include 'COMMON.REMD'
413 include 'COMMON.SBRIDGE'
414 double precision varia(maxvar)
416 double precision energy(0:max_ene)
426 open(intin,file=intinname,status='old')
427 write (istat,'(a5,20a12)')"# ",
428 & (wname(print_order(i)),i=1,nprint_ene)
430 write (istat,'(a5,20a12)')"# ",
431 & (ename(print_order(i)),i=1,nprint_ene),
432 & "ETOT total","RMSD","nat.contact","nnt.contact"
434 write (istat,'(a5,20a12)')"# ",
435 & (ename(print_order(i)),i=1,nprint_ene),"ETOT total"
441 read (intin,'(e15.10,e15.5)',end=1100,err=1100) time,ene
442 call read_x(intin,*11)
444 c Broadcast the order to compute internal coordinates to the slaves.
446 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
448 call int_from_cart1(.false.)
450 read (intin,'(i5)',end=1100,err=1100) iconf
451 call read_angles(intin,*11)
452 call geom_to_var(nvar,varia)
455 write (iout,'(a,i7)') 'Conformation #',iconf
456 call etotal(energy(0))
457 call briefout(iconf,energy(0))
458 call enerprint(energy(0))
461 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
462 write (istat,'(i5,20(f12.3))') iconf,
463 & (energy(print_order(i)),i=1,nprint_ene),etot,
464 & rms,frac,frac_nn,co
467 write (istat,'(i5,16(f12.3))') iconf,
468 & (energy(print_order(i)),i=1,nprint_ene),etot
484 if (mm.lt.nodes) then
486 read (intin,'(e15.10,e15.5)',end=11,err=11) time,ene
487 call read_x(intin,*11)
489 c Broadcast the order to compute internal coordinates to the slaves.
491 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
493 call int_from_cart1(.false.)
495 read (intin,'(i5)',end=11,err=11) iconf
496 call read_angles(intin,*11)
497 call geom_to_var(nvar,varia)
500 write (iout,'(a,i7)') 'Conformation #',iconf
510 call mpi_send(ind,6,mpi_integer,mm,idint,CG_COMM,
512 call mpi_send(varia,nvar,mpi_double_precision,mm,
513 * idreal,CG_COMM,ierr)
514 call mpi_send(ene0,1,mpi_double_precision,mm,
515 * idreal,CG_COMM,ierr)
516 c print *,'task ',n,' sent to worker ',mm,nvar
518 call mpi_recv(ind,6,mpi_integer,mpi_any_source,idint,
519 * CG_COMM,muster,ierr)
520 man=muster(mpi_source)
521 c print *,'receiving result from worker ',man,' (',iii1,iii,')'
522 call mpi_recv(varia,nvar,mpi_double_precision,
523 * man,idreal,CG_COMM,muster,ierr)
525 * mpi_double_precision,man,idreal,
526 * CG_COMM,muster,ierr)
527 call mpi_recv(ene0,1,
528 * mpi_double_precision,man,idreal,
529 * CG_COMM,muster,ierr)
530 c print *,'result received from worker ',man,' sending now'
532 call var_to_geom(nvar,varia)
534 call etotal(energy(0))
538 write (iout,'(a,2i7)') 'Conformation #',iconf,ind(5)
541 call enerprint(energy(0))
542 call briefout(it,etot)
543 c if (minim) call briefout(it,etot)
545 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
546 write (istat,'(i5,19(f12.3))') iconf,
547 & (energy(print_order(i)),i=1,nprint_ene),etot,
548 & rms,frac,frac_nn,co
550 write (istat,'(i5,15(f12.3))') iconf,
551 & (energy(print_order(i)),i=1,nprint_ene),etot
556 read (intin,'(e15.10,e15.5)',end=1101,err=1101) time,ene
557 call read_x(intin,*11)
559 c Broadcast the order to compute internal coordinates to the slaves.
561 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
563 call int_from_cart1(.false.)
565 read (intin,'(i5)',end=1101,err=1101) iconf
566 call read_angles(intin,*11)
567 call geom_to_var(nvar,varia)
578 call mpi_send(ind,6,mpi_integer,man,idint,CG_COMM,
580 call mpi_send(varia,nvar,mpi_double_precision,man,
581 * idreal,CG_COMM,ierr)
582 call mpi_send(ene0,1,mpi_double_precision,man,
583 * idreal,CG_COMM,ierr)
584 nf_mcmf=nf_mcmf+ind(4)
590 call mpi_recv(ind,6,mpi_integer,mpi_any_source,idint,
591 * CG_COMM,muster,ierr)
592 man=muster(mpi_source)
593 call mpi_recv(varia,nvar,mpi_double_precision,
594 * man,idreal,CG_COMM,muster,ierr)
596 * mpi_double_precision,man,idreal,
597 * CG_COMM,muster,ierr)
598 call mpi_recv(ene0,1,
599 * mpi_double_precision,man,idreal,
600 * CG_COMM,muster,ierr)
602 call var_to_geom(nvar,varia)
604 call etotal(energy(0))
608 write (iout,'(a,2i7)') 'Conformation #',iconf,ind(5)
611 call enerprint(energy(0))
612 call briefout(it,etot)
614 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
615 write (istat,'(i5,19(f12.3))') iconf,
616 & (energy(print_order(i)),i=1,nprint_ene),etot,
617 & rms,frac,frac_nn,co
619 write (istat,'(i5,15(f12.3))') iconf,
620 & (energy(print_order(i)),i=1,nprint_ene),etot
632 call mpi_send(ind,6,mpi_integer,i,idint,CG_COMM,
637 open(intin,file=intinname,status='old')
638 write (istat,'(a5,20a12)')"# ",
639 & (wname(print_order(i)),i=1,nprint_ene)
640 write (istat,'("# ",20(1pe12.4))')
641 & (weights(print_order(i)),i=1,nprint_ene)
643 write (istat,'(a5,20a12)')"# ",
644 & (ename(print_order(i)),i=1,nprint_ene),
645 & "ETOT total","RMSD","nat.contact","nnt.contact"
647 write (istat,'(a5,14a12)')"# ",
648 & (ename(print_order(i)),i=1,nprint_ene),"ETOT total"
652 read (intin,'(e15.10,e15.5)',end=11,err=11) time,ene
653 call read_x(intin,*11)
655 c Broadcast the order to compute internal coordinates to the slaves.
657 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
659 call int_from_cart1(.false.)
661 read (intin,'(i5)',end=11,err=11) iconf
662 call read_angles(intin,*11)
663 call geom_to_var(nvar,varia)
666 write (iout,'(a,i7)') 'Conformation #',iconf
667 if (minim) call minimize(etot,varia,iretcode,nfun)
668 call etotal(energy(0))
671 call enerprint(energy(0))
672 if (minim) call briefout(it,etot)
674 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
675 write (istat,'(i5,18(f12.3))') iconf,
676 & (energy(print_order(i)),i=1,nprint_ene),
677 & etot,rms,frac,frac_nn,co
680 write (istat,'(i5,14(f12.3))') iconf,
681 & (energy(print_order(i)),i=1,nprint_ene),etot
688 c---------------------------------------------------------------------------
689 subroutine exec_checkgrad
690 implicit real*8 (a-h,o-z)
695 include 'COMMON.SETUP'
696 include 'COMMON.TIME1'
697 include 'COMMON.INTERACT'
698 include 'COMMON.NAMES'
700 include 'COMMON.HEADER'
701 include 'COMMON.CONTROL'
702 include 'COMMON.CONTACTS'
703 include 'COMMON.CHAIN'
705 include 'COMMON.IOUNITS'
706 include 'COMMON.FFIELD'
707 include 'COMMON.REMD'
709 include 'COMMON.SBRIDGE'
711 double precision energy(0:max_ene)
713 c vbld(i)=vbld(i)+ran_number(-0.1d0,0.1d0)
714 c if (itype(i).ne.10)
715 c & vbld(i+nres)=vbld(i+nres)+ran_number(-0.001d0,0.001d0)
717 if (indpdb.eq.0) call chainbuild
720 c dc(j,i)=dc(j,i)+ran_number(-0.2d0,0.2d0)
724 c if (itype(i).ne.10) then
726 c dc(j,i+nres)=dc(j,i+nres)+ran_number(-0.2d0,0.2d0)
731 c dc(j,0)=ran_number(-0.2d0,0.2d0)
741 call etotal(energy(0))
743 call enerprint(energy(0))
744 write (iout,*) "Uconst",Uconst," Uconst_back",uconst_back
745 print *,'icheckgrad=',icheckgrad
746 goto (10,20,30) icheckgrad
747 10 call check_ecartint
749 20 call check_cartgrad
754 c---------------------------------------------------------------------------
761 c---------------------------------------------------------------------------
767 include 'COMMON.IOUNITS'
768 C Conformational Space Annealling programmed by Jooyoung Lee.
769 C This method works only with parallel machines!
773 write (iout,*) "CSA works on parallel machines only"
777 c---------------------------------------------------------------------------
778 subroutine exec_softreg
780 include 'COMMON.IOUNITS'
781 include 'COMMON.CONTROL'
782 double precision energy(0:max_ene)
784 call etotal(energy(0))
785 call enerprint(energy(0))
786 if (.not.lsecondary) then
787 write(iout,*) 'Calling secondary structure recognition'
788 call secondary2(debug)
790 write(iout,*) 'Using secondary structure supplied in pdb'
795 call etotal(energy(0))
797 call enerprint(energy(0))
799 call briefout(0,etot)
800 call secondary2(.true.)
801 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)