2 c Read the PMFs from wham
5 include 'DIMENSIONS.PMF'
6 include 'COMMON.IOUNITS'
10 integer i,iumb,iiset,j,t,nbin
11 double precision beta_h,qtemp,htemp
13 write (iout,*)"PMFread: nT",nrep," delta_q",delta_q," nW",nset
14 print *,(remd_t(i),i=1,nrep)
17 read (inp,*) iiset,beta_h,nbin
18 write (iout,*) iiset,beta_h,nbin
19 if (iiset.ne.iumb) then
20 write(iout,*) "Error: inconsistency in US windows",
24 if (beta_h.ne.remd_t(j)) then
26 & "Error replica temperatures do not match PMF temperatures"
27 write (iout,*) beta_h,remd_T(j)
31 read (inp,*) qtemp,htemp
32 t = int(qtemp/delta_q+1.0d-4)
33 write (iout,*) qtemp,t,htemp
34 if (i.eq.1) tmin(j,iumb)=t
35 if (i.eq.nbin) tmax(j,iumb)=t
36 PMFtab(t,j,iumb)=dlog(htemp)*Rb*remd_t(j)
41 write (iout,*)"Input PMFs, restraint",iumb," q0",qinfrag(1,iumb)
42 write (iout,'(5x,20f10.1)') (remd_T(j),j=1,nrep)
43 do i=0,int(1.0/delta_q)
44 write (iout,'(f5.2,$)') i*delta_q
46 if (i.lt.tmin(j,iumb).or.i.gt.tmax(j,iumb)) then
47 write (iout,'(" ------",$)')
49 write (iout,'(f10.3$)') PMFtab(i,j,iumb)
57 c------------------------------------------------------------------------
58 subroutine PMF_energy(q,ePMF,ePMF_q)
59 c Calculate the energy and derivative in q due to the biasing PMF
60 c Caution! Only ONE q is handled, no multi-D q-restraints available!
63 include 'DIMENSIONS.PMF'
66 include 'COMMON.SETUP'
67 integer IERROR,ERRCODE
69 include 'COMMON.IOUNITS'
73 integer i,iqmin,iqmax,irep
74 double precision q,qmin,qmax,ePMF,ePMF_q
75 c Determine the location of the q
77 do while (dabs(t_bath-remd_t(irep)).gt.1.0d-4)
80 if (irep.gt.nrep) then
81 write (iout,*) "CHUJ NASTAPIL in PMF_energy!!!"
83 & "Bath temperature does not match that of any replica"
84 write (iout,*) "t_bath",t_bath
85 write (iout,*) "remd_T",(remd_T(:nrep))
86 write (iout,*) "Terminating..."
89 call MPI_Abort(MPI_COMM_WORLD,IERROR,ERRCODE)
98 write (iout,*) "PMF_energy q",q," qmin",qmin," qmax",qmax,
99 & " irep",irep," iset",iset," iqmin",iqmin," iqmax",iqmax
102 ePMF_q=(PMFtab(iqmin+1,irep,iset)-PMFtab(iqmin,irep,iset))
104 ePMF=PMFtab(iqmin,irep,iset)+ePMF_q*(q-qmin)
106 write (iout,*) "q<=qmin ePMF",ePMF," ePMF_q",ePMF_q
108 else if (q.ge.qmax) then
109 ePMF_q=(PMFtab(iqmax,irep,iset)-PMFtab(iqmax-1,irep,iset))/
111 ePMF=PMFtab(iqmax,irep,iset)+ePMF_q*(q-qmax)
113 write (iout,*) "q>=qmax ePMF",ePMF," ePMF_q",ePMF_q
118 if (q.ge.qmin .and. q.le.qmax) then
119 ePMF_q=(PMFtab(i,irep,iset)-PMFtab(i-1,irep,iset))/delta_q
120 ePMF=PMFtab(i-1,irep,iset)+ePMF_q*(q-qmin)
122 write (iout,*) "qmin<q<qmax bin",i," ePMF",ePMF," ePMF_q",ePMF_q