1 | ! **************************************************************
|
---|
2 | !
|
---|
3 | ! This file contains the subroutines: enyflx
|
---|
4 | !
|
---|
5 | ! Copyright 2003 Frank Eisenmenger, U.H.E. Hansmann,
|
---|
6 | ! Shura Hayryan, Chin-Ku
|
---|
7 | ! Copyright 2007 Frank Eisenmenger, U.H.E. Hansmann,
|
---|
8 | ! Jan H. Meinke, Sandipan Mohanty
|
---|
9 | !
|
---|
10 | ! **************************************************************
|
---|
11 |
|
---|
12 |
|
---|
13 | real*8 function enyflx(nml)
|
---|
14 |
|
---|
15 | ! .......................................................................
|
---|
16 | !
|
---|
17 | ! PURPOSE: Calculate internal energy of molecule 'nml' with FLEX dataset
|
---|
18 | !
|
---|
19 | ! CALLS: none
|
---|
20 | !
|
---|
21 | ! .......................................................................
|
---|
22 |
|
---|
23 | include 'INCL.H'
|
---|
24 |
|
---|
25 | integer nml
|
---|
26 |
|
---|
27 | integer ntlvr, i, i14, i1, i1s, i2, i2s, ia, ic, ijhb, ifivr,
|
---|
28 | & ims, io, iowh, it, jowh, ity, iv, ivw, j, jty
|
---|
29 | double precision cqi, cth, qp, e0, evw, vr, ep, rij, py, px, pz,
|
---|
30 | & rij2, rij6, rij12, sr, xij, xi, yij, xj, yj, yi,
|
---|
31 | & zj, zi, zij
|
---|
32 |
|
---|
33 | ntlvr=nvrml(nml)
|
---|
34 | if (ntlvr.eq.0) then
|
---|
35 | write (logString, '(a,i4)')
|
---|
36 | & ' enyflx> No variables defined in molecule #',nml
|
---|
37 | return
|
---|
38 | endif
|
---|
39 |
|
---|
40 | enyflx=0.0
|
---|
41 | eyel=0.0
|
---|
42 | eyvw=0.0
|
---|
43 | eyhb=0.0
|
---|
44 | eyvr=0.0
|
---|
45 |
|
---|
46 | ifivr=ivrml1(nml)
|
---|
47 | i1s=imsml1(nml)+nmsml(nml)
|
---|
48 |
|
---|
49 | do io=ifivr+ntlvr-1,ifivr,-1 ! ______ over variables in desc. order
|
---|
50 | iv=iorvr(io) ! index of var.
|
---|
51 |
|
---|
52 | ia=iatvr(iv) ! prim.mv.at
|
---|
53 | it=ityvr(iv) ! type
|
---|
54 | ic=iclvr(iv) ! class
|
---|
55 |
|
---|
56 | if (it.eq.3) then ! torsion
|
---|
57 | vr=toat(ia)
|
---|
58 |
|
---|
59 | e0=e0to(ic)
|
---|
60 | if (e0.ne.0.0) eyvr=eyvr+e0*(1.0+sgto(ic)*cos(vr*rnto(ic)))
|
---|
61 |
|
---|
62 | elseif (it.eq.2) then ! b.angle
|
---|
63 | vr=baat(ia)
|
---|
64 | elseif (it.eq.1) then ! b.length
|
---|
65 | vr=blat(ia)
|
---|
66 | endif
|
---|
67 |
|
---|
68 | i2s=i1s-1 ! last m.s per 'iv'
|
---|
69 | i1s=imsvr1(iv) ! 1st m.s
|
---|
70 |
|
---|
71 | do ims=i1s,i2s ! __ loop over m.s
|
---|
72 | i1=latms1(ims)
|
---|
73 | i2=latms2(ims)
|
---|
74 |
|
---|
75 | do i=i1,i2 ! __ loop over atoms i ===================
|
---|
76 |
|
---|
77 | ity=ityat(i)
|
---|
78 | cqi=conv*cgat(i)
|
---|
79 |
|
---|
80 | xi=xat(i)
|
---|
81 | yi=yat(i)
|
---|
82 | zi=zat(i)
|
---|
83 |
|
---|
84 | do ivw=ivwat1(i),ivwat2(i) ! over vdW-domains of 'i'
|
---|
85 | do j=lvwat1(ivw),lvwat2(ivw) ! atoms j
|
---|
86 |
|
---|
87 | jty=ityat(j)
|
---|
88 |
|
---|
89 | xj=xat(j)
|
---|
90 | yj=yat(j)
|
---|
91 | zj=zat(j)
|
---|
92 |
|
---|
93 | xij=xj-xi
|
---|
94 | yij=yj-yi
|
---|
95 | zij=zj-zi
|
---|
96 |
|
---|
97 | rij2=xij*xij+yij*yij+zij*zij
|
---|
98 | rij6=rij2**3
|
---|
99 | rij12=rij6*rij6
|
---|
100 | rij=sqrt(rij2)
|
---|
101 | if(epsd) then
|
---|
102 | ! --------------------------------- distance dependent dielectric constant
|
---|
103 | sr=slp_f*rij
|
---|
104 | ep=plt-(sr*sr+2.0*sr+2.0)*(plt-1.0)*exp(-sr)/2.0
|
---|
105 | else
|
---|
106 | ep=1.0d0
|
---|
107 | end if
|
---|
108 |
|
---|
109 | eyel=eyel+cqi*cgat(j)/(rij*ep)
|
---|
110 |
|
---|
111 | evw=aij(ity,jty)/rij12-cij(ity,jty)/rij6
|
---|
112 |
|
---|
113 | ijhb=ihbty(ity,jty)
|
---|
114 | if (ijhb.ne.0.and.rij.le.cohb) then ! HB Possible
|
---|
115 |
|
---|
116 | if (ijhb.gt.0) then ! i=H,j=acceptor
|
---|
117 | iowh=iowat(i)
|
---|
118 | px=xi-xat(iowh)
|
---|
119 | py=yi-yat(iowh)
|
---|
120 | pz=zi-zat(iowh)
|
---|
121 | else ! i=acceptor,j=H
|
---|
122 | jowh=iowat(j)
|
---|
123 | px=xat(jowh)-xj
|
---|
124 | py=yat(jowh)-yj
|
---|
125 | pz=zat(jowh)-zj
|
---|
126 | endif
|
---|
127 |
|
---|
128 | cth=(xij*px+yij*py+zij*pz)/(rij*
|
---|
129 | & sqrt(px*px+py*py+pz*pz))
|
---|
130 |
|
---|
131 | if (cth.gt.0.0) then
|
---|
132 | eyhb=eyhb+ evw + cth*(
|
---|
133 | & (ahb(ity,jty)-aij(ity,jty))/rij12-
|
---|
134 | & (chb(ity,jty)-cij(ity,jty))/rij6 )
|
---|
135 | else ! No Hydrogen Bond
|
---|
136 | eyvw=eyvw + evw
|
---|
137 | endif
|
---|
138 | else
|
---|
139 | eyvw=eyvw + evw
|
---|
140 | endif
|
---|
141 |
|
---|
142 | enddo ! ... atoms j
|
---|
143 | enddo ! ... vdW-domains of i
|
---|
144 |
|
---|
145 | do i14=i14at1(i),i14at2(i) ! over 1-4 partners of 'i'
|
---|
146 | j=l14at(i14)
|
---|
147 |
|
---|
148 | jty=ityat(j)
|
---|
149 |
|
---|
150 | xj=xat(j)
|
---|
151 | yj=yat(j)
|
---|
152 | zj=zat(j)
|
---|
153 |
|
---|
154 | xij=xj-xi
|
---|
155 | yij=yj-yi
|
---|
156 | zij=zj-zi
|
---|
157 |
|
---|
158 | rij2=xij*xij+yij*yij+zij*zij
|
---|
159 | rij6=rij2**3
|
---|
160 | rij12=rij6*rij6
|
---|
161 | rij=sqrt(rij2)
|
---|
162 | if(epsd) then
|
---|
163 | ! --------------------------------- distance dependent dielectric constant
|
---|
164 | sr=slp_f*rij
|
---|
165 | ep=plt-(sr*sr+2.0*sr+2.0)*(plt-1.)*exp(-sr)/2.0
|
---|
166 | else
|
---|
167 | ep=1.0d0
|
---|
168 | end if
|
---|
169 |
|
---|
170 | eyel=eyel+ cqi*cgat(j)/(rij*ep)
|
---|
171 |
|
---|
172 | evw=a14(ity,jty)/rij12-cij(ity,jty)/rij6
|
---|
173 |
|
---|
174 | ijhb=ihbty(ity,jty)
|
---|
175 | if (ijhb.ne.0.and.rij.le.cohb) then ! HB Possible
|
---|
176 |
|
---|
177 | if (ijhb.gt.0) then ! i=H,j=acceptor
|
---|
178 | iowh=iowat(i)
|
---|
179 | px=xi-xat(iowh)
|
---|
180 | py=yi-yat(iowh)
|
---|
181 | pz=zi-zat(iowh)
|
---|
182 | else ! i=acceptor,j=H
|
---|
183 | jowh=iowat(j)
|
---|
184 | px=xat(jowh)-xj
|
---|
185 | py=yat(jowh)-yj
|
---|
186 | pz=zat(jowh)-zj
|
---|
187 | endif
|
---|
188 |
|
---|
189 | cth=(xij*px+yij*py+zij*pz)/(rij*
|
---|
190 | & sqrt(px*px+py*py+pz*pz))
|
---|
191 |
|
---|
192 | if (cth.gt.0.0) then
|
---|
193 | eyhb=eyhb+ evw + cth*(
|
---|
194 | & (ahb(ity,jty)-a14(ity,jty))/rij12-
|
---|
195 | & (chb(ity,jty)-cij(ity,jty))/rij6 )
|
---|
196 | else ! No Hydrogen Bond
|
---|
197 | eyvw=eyvw + evw
|
---|
198 | endif
|
---|
199 | else
|
---|
200 | eyvw=eyvw + evw
|
---|
201 | endif
|
---|
202 |
|
---|
203 | enddo ! ... 1-4-partners of i
|
---|
204 |
|
---|
205 | enddo ! ... atoms i
|
---|
206 | enddo ! ... m.s.
|
---|
207 |
|
---|
208 | enddo ! ... variables
|
---|
209 |
|
---|
210 | eysm = eyel + eyvw + eyhb + eyvr
|
---|
211 | enyflx=eysm
|
---|
212 | return
|
---|
213 | end
|
---|
214 |
|
---|