2 c Read the PMFs from wham
5 include 'DIMENSIONS.FREE'
6 include 'COMMON.IOUNITS'
9 integer i,iumb,iiset,j,t,nbin,iparm,nRmax
10 double precision beta_h_temp,qtemp,htemp
11 read(inp,*,err=10,end=10) delta_q
12 write(iout,*) "delta_q",delta_q
14 do iparm = 1, nparmset
16 write(iout,*) "PMFread: iparm",iparm," nT",nT_h(iparm),
17 & " nR",nR(:nT_h(iparm),iparm)
18 c print *,(beta_h(i),i=1,nT(iparm))
21 read (inp,*,end=10,err=10) iiset,beta_h_temp,nbin
22 write (iout,*) iiset,beta_h_temp,nbin
23 if (iiset.ne.iumb) then
24 write(iout,*) "Error: inconsistency in US windows",
28 beta_h_temp=1.0d0/(0.001987*beta_h_temp)
29 if (dabs(beta_h_temp-beta_h(j,iparm)).gt.1.0d-6) then
31 & "Error replica temperatures do not match PMF temperatures"
32 write (iout,*) 1.0d0/(0.001987*beta_h_temp),
33 & 1.0d0/(0.001987*beta_h(j,iparm))
37 read (inp,*,end=10,err=10) qtemp,htemp
38 t = int(qtemp/delta_q+1.0d-4)
39 write (iout,*) qtemp,t,htemp
40 if (i.eq.1) tmin(j,iumb,iparm)=t
41 if (i.eq.nbin) tmax(j,iumb,iparm)=t
42 PMFtab(t,j,iumb,iparm)=dlog(htemp)/beta_h_temp
49 if (nR(i,iparm).gt.nRmax) nRmax=nR(i,iparm)
52 write (iout,*)"Input PMFs, restraint",iumb,
53 & " q0",q0(1,iumb,:nT_h(iparm),iparm)
54 write (iout,'(5x,20f10.1)') (1.0d0/(0.001987*beta_h(j,iparm)),
56 do i=0,int(1.0/delta_q)
57 write (iout,'(f5.2,$)') i*delta_q
59 if (i.lt.tmin(j,iumb,iparm).or.i.gt.tmax(j,iumb,iparm)) then
60 write (iout,'(" ------",$)')
62 write (iout,'(f10.3$)') PMFtab(i,j,iumb,iparm)
73 c------------------------------------------------------------------------
74 subroutine PMF_energy(q,irep,iset,iparm,ePMF,ePMF_q)
75 c Calculate the energy and derivative in q due to the biasing PMF
76 c Caution! Only ONE q is handled, no multi-D q-restraints available!
79 include 'DIMENSIONS.FREE'
80 include 'COMMON.IOUNITS'
83 integer i,iqmin,iqmax,irep,iset,iparm
84 double precision q,qmin,qmax,ePMF,ePMF_q
85 c Determine the location of the q
86 iqmin=tmin(irep,iset,iparm)
87 iqmax=tmax(irep,iset,iparm)
91 write (iout,*) "PMF_energy q",q," qmin",qmin," qmax",qmax,
92 & " irep",irep," iset",iset
95 ePMF_q=(PMFtab(iqmin+1,irep,iset,iparm)-
96 & PMFtab(iqmin,irep,iset,iparm))/delta_q
97 ePMF=PMFtab(iqmin,irep,iset,iparm)+ePMF_q*(q-qmin)
99 write (iout,*) "q<=qmin ePMF",ePMF," ePMF_q",ePMF_q
101 else if (q.ge.qmax) then
102 ePMF_q=(PMFtab(iqmax,irep,iset,iparm)-
103 & PMFtab(iqmax-1,irep,iset,iparm))/delta_q
104 ePMF=PMFtab(iqmax,irep,iset,iparm)+ePMF_q*(q-qmax)
106 write (iout,*) "q>=qmax ePMF",ePMF," ePMF_q",ePMF_q
111 if (q.ge.qmin .and. q.le.qmax) then
112 ePMF_q=(PMFtab(i,irep,iset,iparm)-
113 & PMFtab(i-1,irep,iset,iparm))/delta_q
114 ePMF=PMFtab(i-1,irep,iset,iparm)+ePMF_q*(q-qmin)
116 write (iout,*) "qmin<q<qmax bin",i," ePMF",ePMF," ePMF_q",ePMF_q