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),Fdimless_(maxconf)
35 double precision energia(0:max_ene)
36 double precision totfree_(maxconf),entfac_(maxconf)
41 c write (iout,*) i,list_conf(i)
44 c write(iout,*) "entrop before", entfac(i),i
48 write (iout,*) me," indstart",indstart(me)," indend",indend(me)
49 call daread_ccoords(indstart(me),indend(me))
52 c write(iout,*) "entrop after", entfac(i),i
55 c write (iout,*) "ncon",ncon
57 temper=1.0d0/(beta_h(ib)*1.987D-3)
58 c write (iout,*) "ib",ib," beta_h",beta_h(ib)," temper",temper
59 c quot=1.0d0/(T0*beta_h(ib)*1.987D-3)
66 c fT(l)=kfacl/(kfacl-1.0d0+quotl)
68 if (rescale_mode.eq.1) then
69 quot=1.0d0/(T0*beta_h(ib)*1.987D-3)
76 fT(l)=kfacl/(kfacl-1.0d0+quotl)
78 else if (rescale_mode.eq.2) then
79 quot=1.0d0/(T0*beta_h(ib)*1.987D-3)
83 fT(l)=1.12692801104297249644d0/
84 & dlog(dexp(quotl)+dexp(-quotl))
86 c write (iout,*) 1.0d0/(beta_h(ib)*1.987D-3),ft
101 c write (iout,*) "i",i," ii",ii
106 c(k,j)=allcart(k,j,i)
107 c(k,j+nres)=allcart(k,j+nres,i)
112 c(k,nres+nres)=c(k,nres)
116 ihpb(j)=ihpb_all(j,i)
117 jhpb(j)=jhpb_all(j,i)
119 call int_from_cart1(.false.)
120 call etotal(energia(0),fT)
121 totfree(i)=energia(0)
123 write (iout,*) "Conformation",i
124 call enerprint(energia(0),ft)
125 write (iout,'(a,3(3x,a5),5x,3(3x,a5))')
126 & "Residue","X(CA)","Y(CA)","Z(CA)","X(SC)","Y(SC)","Z(SC)"
128 write (iout,'(a3,1x,i3,3f8.3,5x,3f8.3)')
129 & restyp(itype(ires)),ires,(c(j,ires),j=1,3),
130 & (c(j,ires+nres),j=1,3)
137 enetb(k,i)=energia(k)
143 evdw2=enetb(2,i)+evdw2_14
158 cc if (wcorr6.eq.0) ecorr6=0.0d0
160 eello_turn3=enetb(8,i)
161 eello_turn4=enetb(9,i)
170 edihcnstr=enetb(20,i)
171 ehomology_constr=enetb(21,i)
177 etot=wsc*evdw+wscp*evdw2+ft(1)*welec*ees+wvdwpp*evdw1
178 & +wang*ebe+ft(1)*wtor*etors+wscloc*escloc
179 & +wstrain*ehpb+ft(3)*wcorr*ecorr+ft(4)*wcorr5*ecorr5
180 & +ft(5)*wcorr6*ecorr6+ft(3)*wturn4*eello_turn4
181 & +ft(2)*wturn3*eello_turn3
182 & +ft(5)*wturn6*eturn6+ft(2)*wel_loc*eel_loc
183 & +edihcnstr+ft(2)*wtor_d*etors_d+ft(1)*wsccor*esccor
184 & +wbond*estr+ehomology_constr+wdfa_dist*edfadis
185 & +wdfa_tor*edfator+wdfa_nei*edfanei+wdfa_beta*edfabet
187 etot=wsc*evdw+wscp*evdw2+ft(1)*welec*(ees+evdw1)
188 & +wang*ebe+ft(1)*wtor*etors+wscloc*escloc
189 & +wstrain*ehpb+ft(3)*wcorr*ecorr+ft(4)*wcorr5*ecorr5
190 & +ft(5)*wcorr6*ecorr6+ft(3)*wturn4*eello_turn4
191 & +ft(2)*wturn3*eello_turn3
192 & +ft(5)*wturn6*eturn6+ft(2)*wel_loc*eel_loc+edihcnstr
193 & +ft(2)*wtor_d*etors_d+ft(1)*wsccor*esccor+wdfa_dist*edfadis
194 & +wdfa_tor*edfator+wdfa_nei*edfanei+wdfa_beta*edfabet
195 & +wbond*estr+ehomology_constr
198 Fdimless_(i)=beta_h(ib)*etot+entfac(ii)
201 write (iout,*) "etrop", i,ii,ib,
202 & 1.0d0/(1.987d-3*beta_h(ib)),totfree(i),
203 & entfac(ii),Fdimless_(i)
206 Fdimless(i)=beta_h(ib)*etot+entfac(ii)
209 write (iout,*) "etrop", i,ii,ib,
210 & 1.0d0/(1.987d-3*beta_h(ib)),totfree(i),
211 & entfac(ii),Fdimless(i)
216 call MPI_Gatherv(Fdimless_(1),scount(me),
217 & MPI_REAL,Fdimless(1),
218 & scount(0),idispl(0),MPI_REAL,Master,
219 & MPI_COMM_WORLD, IERROR)
220 call MPI_Gatherv(totfree_(1),scount(me),
221 & MPI_DOUBLE_PRECISION,totfree(1),
222 & scount(0),idispl(0),MPI_DOUBLE_PRECISION,Master,
223 & MPI_COMM_WORLD, IERROR)
224 call MPI_Gatherv(entfac(indstart(me)+1),scount(me),
225 & MPI_DOUBLE_PRECISION,entfac_(1),
226 & scount(0),idispl(0),MPI_DOUBLE_PRECISION,Master,
227 & MPI_COMM_WORLD, IERROR)
228 if (me.eq.Master) then
235 write (iout,*) "The FDIMLESS array before sorting"
237 write (iout,*) i,fdimless(i)
240 call mysort1(ncon,Fdimless,list_conf)
242 write (iout,*) "The FDIMLESS array after sorting"
244 write (iout,*) i,list_conf(i),fdimless(i)
248 totfree(i)=fdimless(i)
252 qfree=qfree+dexp(dble(-fdimless(i)+fdimless(1)))
254 c write (iout,*) "qfree",qfree
257 do i=1,min0(ncon,maxstr_proc)-1
258 sumprob=sumprob+dexp(dble(-fdimless(i)+fdimless(1)))/qfree
260 write (iout,*) 'i=',i,ib,beta_h(ib),
261 & 1.0d0/(1.987d-3*beta_h(ib)),list_conf(i),
262 & totfree(list_conf(i)),
263 & -entfac(list_conf(i)),fdimless(i),sumprob
265 if (sumprob.gt.prob_limit) goto 122
266 c if (sumprob.gt.1.00d0) goto 122
272 call MPI_Bcast(nlist, 1, MPI_INTEGER, Master, MPI_COMM_WORLD,
274 call MPI_Bcast(list_conf,nlist,MPI_INTEGER,Master,MPI_COMM_WORLD,
277 c write (iout,*) "iproc",iproc," indstart",indstart(iproc),
278 c & " indend",indend(iproc)
280 write (iout,*) "nlist",nlist
284 !--------------------------------------------------
285 subroutine mysort1(n, x, ipermut)
287 integer i,j,imax,ipm,n
295 if (x(j).lt.xtemp) then
303 ipermut(imax)=ipermut(i)