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 include "COMMON.NAMES"
19 real*4 csingle(3,maxres2)
20 double precision fT(5),fTprim(5),fTbis(5),quot,quotl1,quotl,kfacl,
21 & eprim,ebis,temper,kfac/2.4d0/,T0/300.0d0/
22 double precision etot,evdw,evdw2,ees,evdw1,ebe,etors,escloc,
23 & ehpb,ecorr,ecorr5,ecorr6,eello_turn4,eello_turn3,
24 & eturn6,eel_loc,edihcnstr,etors_d,estr,evdw2_14,esccor
25 integer i,ii,ik,iproc,iscor,j,k,l,ib,nlist,ncon
27 double precision qfree,sumprob,eini,efree,rmsdev,ehomology_constr,
28 & edfadis,edfator,edfanei,edfabet
34 real*4 Fdimless(maxconf)
35 double precision energia(0:max_ene)
40 c write (iout,*) i,list_conf(i)
43 c write(iout,*) "entrop before", entfac(i),i
47 write (iout,*) me," indstart",indstart(me)," indend",indend(me)
48 call daread_ccoords(indstart(me),indend(me))
51 c write(iout,*) "entrop after", entfac(i),i
54 c write (iout,*) "ncon",ncon
56 temper=1.0d0/(beta_h(ib)*1.987D-3)
57 c write (iout,*) "ib",ib," beta_h",beta_h(ib)," temper",temper
58 c quot=1.0d0/(T0*beta_h(ib)*1.987D-3)
65 c fT(l)=kfacl/(kfacl-1.0d0+quotl)
67 if (rescale_mode.eq.1) then
68 quot=1.0d0/(T0*beta_h(ib)*1.987D-3)
75 fT(l)=kfacl/(kfacl-1.0d0+quotl)
77 else if (rescale_mode.eq.2) then
78 quot=1.0d0/(T0*beta_h(ib)*1.987D-3)
82 fT(l)=1.12692801104297249644d0/
83 & dlog(dexp(quotl)+dexp(-quotl))
85 c write (iout,*) 1.0d0/(beta_h(ib)*1.987D-3),ft
100 c write (iout,*) "i",i," ii",ii
105 c(k,j)=allcart(k,j,i)
106 c(k,j+nres)=allcart(k,j+nres,i)
111 c(k,nres+nres)=c(k,nres)
115 ihpb(j)=ihpb_all(j,i)
116 jhpb(j)=jhpb_all(j,i)
118 call int_from_cart1(.false.)
119 call etotal(energia(0),fT)
120 totfree(i)=energia(0)
122 write (iout,*) "Conformation",i
123 call enerprint(energia(0),ft)
124 write (iout,'(a,3(3x,a5),5x,3(3x,a5))')
125 & "Residue","X(CA)","Y(CA)","Z(CA)","X(SC)","Y(SC)","Z(SC)"
127 write (iout,'(a3,1x,i3,3f8.3,5x,3f8.3)')
128 & restyp(itype(ires)),ires,(c(j,ires),j=1,3),
129 & (c(j,ires+nres),j=1,3)
136 enetb(k,i)=energia(k)
142 evdw2=enetb(2,i)+evdw2_14
157 cc if (wcorr6.eq.0) ecorr6=0.0d0
159 eello_turn3=enetb(8,i)
160 eello_turn4=enetb(9,i)
169 edihcnstr=enetb(20,i)
170 ehomology_constr=enetb(21,i)
176 etot=wsc*evdw+wscp*evdw2+ft(1)*welec*ees+wvdwpp*evdw1
177 & +wang*ebe+ft(1)*wtor*etors+wscloc*escloc
178 & +wstrain*ehpb+ft(3)*wcorr*ecorr+ft(4)*wcorr5*ecorr5
179 & +ft(5)*wcorr6*ecorr6+ft(3)*wturn4*eello_turn4
180 & +ft(2)*wturn3*eello_turn3
181 & +ft(5)*wturn6*eturn6+ft(2)*wel_loc*eel_loc
182 & +edihcnstr+ft(2)*wtor_d*etors_d+ft(1)*wsccor*esccor
183 & +wbond*estr+ehomology_constr+wdfa_dist*edfadis
184 & +wdfa_tor*edfator+wdfa_nei*edfanei+wdfa_beta*edfabet
186 etot=wsc*evdw+wscp*evdw2+ft(1)*welec*(ees+evdw1)
187 & +wang*ebe+ft(1)*wtor*etors+wscloc*escloc
188 & +wstrain*ehpb+ft(3)*wcorr*ecorr+ft(4)*wcorr5*ecorr5
189 & +ft(5)*wcorr6*ecorr6+ft(3)*wturn4*eello_turn4
190 & +ft(2)*wturn3*eello_turn3
191 & +ft(5)*wturn6*eturn6+ft(2)*wel_loc*eel_loc+edihcnstr
192 & +ft(2)*wtor_d*etors_d+ft(1)*wsccor*esccor+wdfa_dist*edfadis
193 & +wdfa_tor*edfator+wdfa_nei*edfanei+wdfa_beta*edfabet
194 & +wbond*estr+ehomology_constr
196 Fdimless(i)=beta_h(ib)*etot+entfac(ii)
200 write (iout,*) "etrop", i,ii,ib,
201 & 1.0d0/(1.987d-3*beta_h(ib)),totfree(i),
202 & entfac(ii),Fdimless(i)
206 call MPI_Gatherv(Fdimless(1),scount(me),
207 & MPI_REAL,Fdimless(1),
208 & scount(0),idispl(0),MPI_REAL,Master,
209 & MPI_COMM_WORLD, IERROR)
210 call MPI_Gatherv(totfree(1),scount(me),
211 & MPI_DOUBLE_PRECISION,totfree(1),
212 & scount(0),idispl(0),MPI_DOUBLE_PRECISION,Master,
213 & MPI_COMM_WORLD, IERROR)
214 call MPI_Gatherv(entfac(indstart(me)+1),scount(me),
215 & MPI_DOUBLE_PRECISION,entfac(1),
216 & scount(0),idispl(0),MPI_DOUBLE_PRECISION,Master,
217 & MPI_COMM_WORLD, IERROR)
218 if (me.eq.Master) then
221 write (iout,*) "The FDIMLESS array before sorting"
223 write (iout,*) i,fdimless(i)
226 call mysort1(ncon,Fdimless,list_conf)
228 write (iout,*) "The FDIMLESS array after sorting"
230 write (iout,*) i,list_conf(i),fdimless(i)
234 totfree(i)=fdimless(i)
238 qfree=qfree+dexp(dble(-fdimless(i)+fdimless(1)))
240 c write (iout,*) "qfree",qfree
243 do i=1,min0(ncon,maxstr_proc)-1
244 sumprob=sumprob+dexp(dble(-fdimless(i)+fdimless(1)))/qfree
247 write (iout,*) 'i=',i,ib,beta_h(ib),
248 & 1.0d0/(1.987d-3*beta_h(ib)),list_conf(i),
249 & totfree(list_conf(i)),
250 & -entfac(list_conf(i)),fdimless(i),sumprob
253 if (sumprob.gt.prob_limit) goto 122
254 c if (sumprob.gt.1.00d0) goto 122
260 call MPI_Bcast(nlist, 1, MPI_INTEGER, Master, MPI_COMM_WORLD,
262 call MPI_Bcast(list_conf,nlist,MPI_INTEGER,Master,MPI_COMM_WORLD,
265 c write (iout,*) "iproc",iproc," indstart",indstart(iproc),
266 c & " indend",indend(iproc)
268 write (iout,*) "nlist",nlist
272 !--------------------------------------------------
273 subroutine mysort1(n, x, ipermut)
275 integer i,j,imax,ipm,n
283 if (x(j).lt.xtemp) then
291 ipermut(imax)=ipermut(i)