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'
28 c include 'COMMON.REMD'
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/03/09 1:19PM 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 c if (modecalc.eq.-2) then
74 c else if (modecalc.eq.-1) then
75 c 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 c else if (modecalc.eq.1) then
88 c call exec_regularize
89 c else if (modecalc.eq.2) then
91 c 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 c else if (ModeCalc.eq.7) then
99 else if (ModeCalc.eq.8) then
101 c else if (modecalc.eq.11) then
103 c else if (modecalc.eq.12) then
105 c else if (modecalc.eq.14) then
108 write (iout,'(a)') 'This calculation type is not supported',
114 if (fg_rank.eq.0) call finish_task
115 c call memmon_print_usage()
117 call print_detailed_timing
119 call MPI_Finalize(ierr)
122 call dajczas(tcpu(),hrtime,mintime,sectime)
123 stop '********** Program terminated normally.'
126 c---------------------------------------------------------------------------
127 subroutine exec_eeval_or_minim
128 implicit real*8 (a-h,o-z)
133 include 'COMMON.SETUP'
134 include 'COMMON.TIME1'
135 include 'COMMON.INTERACT'
136 include 'COMMON.NAMES'
138 include 'COMMON.HEADER'
139 include 'COMMON.CONTROL'
140 include 'COMMON.CONTACTS'
141 include 'COMMON.CHAIN'
143 include 'COMMON.IOUNITS'
144 include 'COMMON.FFIELD'
145 c include 'COMMON.REMD'
146 c include 'COMMON.MD'
147 include 'COMMON.SBRIDGE'
149 double precision energy(0:n_ene)
150 double precision energy_long(0:n_ene),energy_short(0:n_ene)
151 if (indpdb.eq.0) call chainbuild
154 c if (split_ene) then
155 c print *,"Processor",myrank," after chainbuild"
157 c call etotal_long(energy_long(0))
158 c write (iout,*) "Printing long range energy"
159 c call enerprint(energy_long(0))
160 c call etotal_short(energy_short(0))
161 c write (iout,*) "Printing short range energy"
162 c call enerprint(energy_short(0))
164 c energy(i)=energy_long(i)+energy_short(i)
165 c write (iout,*) i,energy_long(i),energy_short(i),energy(i)
167 c write (iout,*) "Printing long+short range energy"
168 c call enerprint(energy(0))
170 call etotal(energy(0))
171 c time_ene=MPI_Wtime()-time00
172 write (iout,*) "Time for energy evaluation",time_ene
173 print *,"after etotal"
176 call enerprint(energy(0))
177 c call hairpin(.true.,nharp,iharp)
178 c call secondary2(.true.)
182 print *, 'Calling MINIM_DC'
184 call minim_dc(etot,iretcode,nfun)
186 if (indpdb.ne.0) then
190 call geom_to_var(nvar,varia)
191 print *,'Calling MINIMIZE.'
193 call minimize(etot,varia,iretcode,nfun)
195 print *,'SUMSL return code is',iretcode,' eval ',nfun
196 c evals=nfun/(MPI_WTIME()-time1)
197 print *,'# eval/s',evals
198 print *,'refstr=',refstr
199 c call hairpin(.true.,nharp,iharp)
200 c call secondary2(.true.)
201 call etotal(energy(0))
203 call enerprint(energy(0))
206 call briefout(0,etot)
207 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
208 write (iout,'(a,i3)') 'SUMSL return code:',iretcode
209 write (iout,'(a,i20)') '# of energy evaluations:',nfun+1
210 write (iout,'(a,f16.3)')'# of energy evaluations/sec:',evals
212 print *,'refstr=',refstr
213 if (refstr) call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
214 call briefout(0,etot)
216 if (outpdb) call pdbout(etot,titel(:32),ipdb)
217 if (outmol2) call mol2out(etot,titel(:32))
221 subroutine exec_checkgrad
222 implicit real*8 (a-h,o-z)
227 include 'COMMON.SETUP'
228 include 'COMMON.TIME1'
229 include 'COMMON.INTERACT'
230 include 'COMMON.NAMES'
232 include 'COMMON.HEADER'
233 include 'COMMON.CONTROL'
234 include 'COMMON.CONTACTS'
235 include 'COMMON.CHAIN'
237 include 'COMMON.IOUNITS'
238 include 'COMMON.FFIELD'
239 c include 'COMMON.REMD'
241 include 'COMMON.SBRIDGE'
243 double precision energy(0:max_ene)
245 c vbld(i)=vbld(i)+ran_number(-0.1d0,0.1d0)
246 c if (itype(i).ne.10)
247 c & vbld(i+nres)=vbld(i+nres)+ran_number(-0.001d0,0.001d0)
249 if (indpdb.eq.0) call chainbuild
252 c dc(j,i)=dc(j,i)+ran_number(-0.2d0,0.2d0)
256 c if (itype(i).ne.10) then
258 c dc(j,i+nres)=dc(j,i+nres)+ran_number(-0.2d0,0.2d0)
263 c dc(j,0)=ran_number(-0.2d0,0.2d0)
268 c call read_fragments
270 call rescale_weights(t_bath)
275 call etotal(energy(0))
277 call enerprint(energy(0))
278 write (iout,*) "Uconst",Uconst," Uconst_back",uconst_back
279 print *,'icheckgrad=',icheckgrad
280 goto (10,20,30) icheckgrad
281 10 call check_ecartint
283 20 call check_cartgrad
288 c---------------------------------------------------------------------------
294 include 'COMMON.IOUNITS'
295 C Conformational Space Annealling programmed by Jooyoung Lee.
296 C This method works only with parallel machines!
300 write (iout,*) "CSA works on parallel machines only"
304 c---------------------------------------------------------------------------
305 subroutine exec_mult_eeval_or_minim
306 implicit real*8 (a-h,o-z)
309 integer muster(mpi_status_size)
310 include 'COMMON.SETUP'
311 include 'COMMON.TIME1'
312 include 'COMMON.INTERACT'
313 include 'COMMON.NAMES'
315 include 'COMMON.HEADER'
316 include 'COMMON.CONTROL'
317 include 'COMMON.CONTACTS'
318 include 'COMMON.CHAIN'
320 include 'COMMON.IOUNITS'
321 include 'COMMON.FFIELD'
322 include 'COMMON.SBRIDGE'
323 double precision varia(maxvar)
325 double precision energy(0:n_ene)
335 open(intin,file=intinname,status='old')
336 write (istat,'(a5,100a12)')"# ",
337 & (wname(print_order(i)),i=1,nprint_ene)
339 write (istat,'(a5,100a12)')"# ",
340 & (ename(print_order(i)),i=1,nprint_ene),
341 & "ETOT total","RMSD","nat.contact","nnt.contact",
342 & "cont.order","TMscore"
344 write (istat,'(a5,100a12)')"# ",
345 & (ename(print_order(i)),i=1,nprint_ene),"ETOT total"
351 read (intin,'(e15.10,e15.5)',end=1100,err=1100) time,ene
352 call read_x(intin,*11)
353 c Broadcast the order to compute internal coordinates to the slaves.
355 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
356 call int_from_cart1(.false.)
358 read (intin,'(i5)',end=1100,err=1100) iconf
359 call read_angles(intin,*11)
360 call geom_to_var(nvar,varia)
363 write (iout,'(a,i7)') 'Conformation #',iconf
364 call etotal(energy(0))
365 call briefout(iconf,energy(0))
366 call enerprint(energy(0))
369 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
370 call calc_tmscore(tm,.true.)
371 write (istat,'(i5,100(f12.3))') iconf,
372 & (energy(print_order(i)),i=1,nprint_ene),etot,
373 & rms,frac,frac_nn,co,tm
375 write (istat,'(i5,100(f12.3))') iconf,
376 & (energy(print_order(i)),i=1,nprint_ene),etot
391 if (mm.lt.nodes) then
393 read (intin,'(e15.10,e15.5)',end=11,err=11) time,ene
394 call read_x(intin,*11)
395 c Broadcast the order to compute internal coordinates to the slaves.
397 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
398 call int_from_cart1(.false.)
400 read (intin,'(i5)',end=11,err=11) iconf
401 call read_angles(intin,*11)
402 call geom_to_var(nvar,varia)
407 write (iout,*) 'Conformation #',iconf,' read'
416 call mpi_send(ind,6,mpi_integer,mm,idint,CG_COMM,
418 call mpi_send(varia,nvar,mpi_double_precision,mm,
419 * idreal,CG_COMM,ierr)
420 call mpi_send(ene0,1,mpi_double_precision,mm,
421 * idreal,CG_COMM,ierr)
422 c print *,'task ',n,' sent to worker ',mm,nvar
424 call mpi_recv(ind,6,mpi_integer,mpi_any_source,idint,
425 * CG_COMM,muster,ierr)
426 man=muster(mpi_source)
427 c print *,'receiving result from worker ',man,' (',iii1,iii,')'
428 call mpi_recv(varia,nvar,mpi_double_precision,
429 * man,idreal,CG_COMM,muster,ierr)
431 * mpi_double_precision,man,idreal,
432 * CG_COMM,muster,ierr)
433 call mpi_recv(ene0,1,
434 * mpi_double_precision,man,idreal,
435 * CG_COMM,muster,ierr)
436 c print *,'result received from worker ',man,' sending now'
438 call var_to_geom(nvar,varia)
440 call etotal(energy(0))
444 write (iout,*) 'Conformation #',iconf," sumsl return code ",
448 call enerprint(energy(0))
449 call briefout(iconf,etot)
451 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
452 call calc_tmscore(tm,.true.)
453 write (istat,'(i5,100(f12.3))') iconf,
454 & (energy(print_order(i)),i=1,nprint_ene),etot,
455 & rms,frac,frac_nn,co,tm
457 write (istat,'(i5,100(f12.3))') iconf,
458 & (energy(print_order(i)),i=1,nprint_ene),etot
463 read (intin,'(e15.10,e15.5)',end=11,err=11) time,ene
464 call read_x(intin,*11)
465 c Broadcast the order to compute internal coordinates to the slaves.
467 & call MPI_Bcast(6,1,MPI_INTEGER,king,FG_COMM,IERROR)
468 call int_from_cart1(.false.)
470 read (intin,'(i5)',end=11,err=11) iconf
471 call read_angles(intin,*11)
472 call geom_to_var(nvar,varia)
476 write (iout,*) 'Conformation #',iconf,' read'
484 call mpi_send(ind,6,mpi_integer,man,idint,CG_COMM,
486 call mpi_send(varia,nvar,mpi_double_precision,man,
487 * idreal,CG_COMM,ierr)
488 call mpi_send(ene0,1,mpi_double_precision,man,
489 * idreal,CG_COMM,ierr)
490 nf_mcmf=nf_mcmf+ind(4)
496 call mpi_recv(ind,6,mpi_integer,mpi_any_source,idint,
497 * CG_COMM,muster,ierr)
498 man=muster(mpi_source)
499 call mpi_recv(varia,nvar,mpi_double_precision,
500 * man,idreal,CG_COMM,muster,ierr)
502 * mpi_double_precision,man,idreal,
503 * CG_COMM,muster,ierr)
504 call mpi_recv(ene0,1,
505 * mpi_double_precision,man,idreal,
506 * CG_COMM,muster,ierr)
508 call var_to_geom(nvar,varia)
510 call etotal(energy(0))
514 write (iout,*) 'Conformation #',iconf," sumsl return code ",
518 call enerprint(energy(0))
519 call briefout(iconf,etot)
521 call rms_nac_nnc(rms,frac,frac_nn,co,.true.)
522 call calc_tmscore(tm,.true.)
523 write (istat,'(i5,100(f12.3))') iconf,
524 & (energy(print_order(i)),i=1,nprint_ene),etot,
525 & rms,frac,frac_nn,co,tm
527 write (istat,'(i5,100(f12.3))') iconf,
528 & (energy(print_order(i)),i=1,nprint_ene),etot
540 call mpi_send(ind,6,mpi_integer,i,idint,CG_COMM,
545 c---------------------------------------------------------------------------