1 subroutine probabl(ib,nlist,ncon,*)
2 ! construct the conformational ensembles at REMD temperatures
9 integer ierror,errcode,status(MPI_STATUS_SIZE)
11 include "COMMON.IOUNITS"
13 include "COMMON.FFIELD"
14 include "COMMON.INTERACT"
15 include "COMMON.SBRIDGE"
16 include "COMMON.CHAIN"
17 include "COMMON.CLUSTER"
18 real*4 csingle(3,maxres2)
19 double precision fT(6),fTprim(6),fTbis(6),quot,quotl1,quotl,kfacl,
20 & eprim,ebis,temper,kfac/2.4d0/,T0/300.0d0/
21 double precision etot,evdw,evdw2,ees,evdw1,ebe,etors,escloc,
22 & ehpb,ecorr,ecorr5,ecorr6,eello_turn4,eello_turn3,
23 & eturn6,eel_loc,edihcnstr,etors_d,estr,evdw2_14,esccor,
25 integer i,ii,ik,iproc,iscor,j,k,l,ib,nlist,ncon
26 double precision qfree,sumprob,eini,efree,rmsdev
32 real*4 Fdimless(maxconf), Fdimless_buf(maxconf)
33 double precision energia(0:max_ene), totfree_buf(0:maxconf),
39 c write (iout,*) i,list_conf(i)
42 write (iout,*) me," indstart",indstart(me)," indend",indend(me)
43 call daread_ccoords(indstart(me),indend(me))
45 C write (iout,*) "ncon",ncon
47 temper=1.0d0/(beta_h(ib)*1.987D-3)
48 c write (iout,*) "ib",ib," beta_h",beta_h(ib)," temper",temper
49 c quot=1.0d0/(T0*beta_h(ib)*1.987D-3)
56 c fT(l)=kfacl/(kfacl-1.0d0+quotl)
59 if (rescale_mode.eq.1) then
60 quot=1.0d0/(T0*beta_h(ib)*1.987D-3)
67 fT(l)=kfacl/(kfacl-1.0d0+quotl)
70 ft(6)=(320.0d0+80.0d0*dtanh((betaT-320.0d0)/80.0d0))/
72 ftprim(6)=1.0d0/(320.0d0*dcosh((betaT-320.0d0)/80.0d0)**2)
73 ftbis(6)=-2.0d0*dtanh((betaT-320.0d0)/80.0d0)
74 & /(320.0d0*80.0d0*dcosh((betaT-320.0d0)/80.0d0)**3)
85 else if (rescale_mode.eq.2) then
86 quot=1.0d0/(T0*beta_h(ib)*1.987D-3)
90 fT(l)=1.12692801104297249644d0/
91 & dlog(dexp(quotl)+dexp(-quotl))
93 c write (iout,*) 1.0d0/(beta_h(ib)*1.987D-3),ft
96 ft(6)=(320.0d0+80.0d0*dtanh((betaT-320.0d0)/80.0d0))/
98 ftprim(6)=1.0d0/(320.0d0*dcosh((betaT-320.0d0)/80.0d0)**2)
99 ftbis(6)=-2.0d0*dtanh((betaT-320.0d0)/80.0d0)
100 & /(320.0d0*80.0d0*dcosh((betaT-320.0d0)/80.0d0)**3)
119 C write (iout,*) "i",i," ii",ii,"ib",ib,scount(me)
124 c(k,j)=allcart(k,j,i)
125 c(k,j+nres)=allcart(k,j+nres,i)
126 C write(iout,*) "coord",i,j,k,allcart(k,j,i),c(k,j),
127 C & c(k,j+nres),allcart(k,j+nres,i)
130 C write(iout,*) "out of j loop"
134 c(k,nres+nres)=c(k,nres)
136 C write(iout,*) "after nres+nres",nss_all(i)
140 ihpb(j)=ihpb_all(j,i)
141 jhpb(j)=jhpb_all(j,i)
143 call int_from_cart1(.false.)
144 C write(iout,*) "before etotal"
146 call etotal(energia(0),fT)
147 totfree(i)=energia(0)
148 totfree_buf(i)=totfree(i)
149 c write (iout,'(8f10.5)') ((c(l,k),l=1,3),k=1,nres)
150 c write (iout,'(8f10.5)') ((c(l,k+nres),l=1,3),k=nnt,nct)
151 c call enerprint(energia(0),fT)
152 c call pdbout(totfree(i),16,i)
154 write (iout,*) i," energia",(energia(j),j=0,max_ene)
155 write (iout,*) "etot", etot
156 write (iout,*) "ft(6)", ft(6)
159 enetb(k,i)=energia(k)
163 c write (iout,*) evdw
167 evdw2=enetb(2,i)+evdw2_14
183 eello_turn3=enetb(8,i)
184 eello_turn4=enetb(9,i)
193 edihcnstr=enetb(20,i)
195 c etot=wsc*(evdw+ft(6)*evdw_t)+wscp*evdw2+
196 c &ft(1)*welec*ees+wvdwpp*evdw1
197 c & +wang*ebe+ft(1)*wtor*etors+wscloc*escloc
198 c & +wstrain*ehpb+nss*ebr+ft(3)*wcorr*ecorr+ft(4)*wcorr5*ecorr5
199 c & +ft(5)*wcorr6*ecorr6+ft(3)*wturn4*eello_turn4
200 c & +ft(2)*wturn3*eello_turn3
201 c & +ft(5)*wturn6*eturn6+ft(2)*wel_loc*eel_loc
202 c & +edihcnstr+ft(2)*wtor_d*etors_d+ft(1)*wsccor*esccor
205 c etot=wsc*(evdw+ft(6)*evdw_t)+wscp*evdw2+ft(1)*welec*(ees+evdw1)
206 c & +wang*ebe+ft(1)*wtor*etors+wscloc*escloc
207 c & +wstrain*ehpb+nss*ebr+ft(3)*wcorr*ecorr+ft(4)*wcorr5*ecorr5
208 c & +ft(5)*wcorr6*ecorr6+ft(3)*wturn4*eello_turn4
209 c & +ft(2)*wturn3*eello_turn3
210 c & +ft(5)*wturn6*eturn6+ft(2)*wel_loc*eel_loc+edihcnstr
211 c & +ft(2)*wtor_d*etors_d+ft(1)*wsccor*esccor
215 write (iout,*) "etot2", etot
216 write (iout,*) "evdw", wsc, evdw,evdw_t
217 write (iout,*) "evdw2", wscp, evdw2
218 write (iout,*) "welec", ft(1),welec,ees
219 write (iout,*) "evdw1", wvdwpp,evdw1
220 write (iout,*) "ebe", ebe,wang
222 Fdimless(i)=beta_h(ib)*etot+entfac(ii)
223 Fdimless_buf(i)=Fdimless(i)
225 totfree_buf(i)=totfree(i)
227 write (iout,*) "fdim calc", i,ii,ib,
228 & 1.0d0/(1.987d-3*beta_h(ib)),totfree(i),
229 & entfac(ii),Fdimless(i)
234 entfac_buf(ijk)=entfac(ijk)
235 Fdimless_buf(ijk)=Fdimless(ijk)
238 totfree_buf(ijk)=totfree(ijk)
242 c scount_buf=scount(me)
243 c scount_buf2=scount(0)
245 c entfac_buf(indstart(me)+1)=entfac(indstart(me)+1)
248 c WRITE (iout,*) "Wchodze do call MPI_Gatherv1 (Propabl)"
249 call MPI_Gatherv(Fdimless_buf(1),scount(me),
250 & MPI_REAL,Fdimless(1),
251 & scount(0),idispl(0),MPI_REAL,Master,
252 & MPI_COMM_WORLD, IERROR)
253 c WRITE (iout,*) "Wchodze do call MPI_Gatherv2 (Propabl)"
254 call MPI_Gatherv(totfree_buf(1),scount(me),
255 & MPI_DOUBLE_PRECISION,totfree(1),
256 & scount(0),idispl(0),MPI_DOUBLE_PRECISION,Master,
257 & MPI_COMM_WORLD, IERROR)
258 c WRITE (iout,*) "Wchodze do call MPI_Gatherv3 (Propabl)"
259 call MPI_Gatherv(entfac_buf(indstart(me)+1),scount(me),
260 & MPI_DOUBLE_PRECISION,entfac(1),
261 & scount(0),idispl(0),MPI_DOUBLE_PRECISION,Master,
262 & MPI_COMM_WORLD, IERROR)
263 c WRITE (iout,*) "Wychodze z call MPI_Gatherv (Propabl)"
264 if (me.eq.Master) then
265 c WRITE (iout,*) "me.eq.Master"
268 write (iout,*) "The FDIMLESS array before sorting"
270 c write (iout,*) i,fdimless(i)
273 c WRITE (iout,*) "Wchodze do call mysort1"
274 call mysort1(ncon,Fdimless,list_conf)
275 c WRITE (iout,*) "Wychodze z call mysort1"
277 write (iout,*) "The FDIMLESS array after sorting"
279 write (iout,*) i,list_conf(i),fdimless(i)
282 c WRITE (iout,*) "Wchodze do petli i=1,ncon totfree(i)=fdimless(i)"
284 totfree(i)=fdimless(i)
288 qfree=qfree+exp(-fdimless(i)+fdimless(1))
289 c write (iout,*) "fdimless", fdimless(i)
291 c write (iout,*) "qfree",qfree
294 write (iout,*) "ncon", ncon,maxstr_proc
295 do i=1,min0(ncon,maxstr_proc)-1
296 sumprob=sumprob+exp(-fdimless(i)+fdimless(1))/qfree
298 write (iout,*) "tu szukaj ponizej 7"
299 write (iout,*) i,ib,beta_h(ib),
300 & 1.0d0/(1.987d-3*beta_h(ib)),list_conf(i),
301 & totfree(list_conf(i)),
302 & -entfac(list_conf(i)),fdimless(i),sumprob
304 if (sumprob.gt.prob_limit) goto 122
305 c if (sumprob.gt.1.00d0) goto 122
311 call MPI_Bcast(nlist, 1, MPI_INTEGER, Master, MPI_COMM_WORLD,
313 call MPI_Bcast(list_conf,nlist,MPI_INTEGER,Master,MPI_COMM_WORLD,
316 c write (iout,*) "iproc",iproc," indstart",indstart(iproc),
317 c & " indend",indend(iproc)
319 write (iout,*) "nlist",nlist
323 !--------------------------------------------------
324 subroutine mysort1(n, x, ipermut)
326 integer i,j,imax,ipm,n
334 if (x(j).lt.xtemp) then
342 ipermut(imax)=ipermut(i)