-
Notifications
You must be signed in to change notification settings - Fork 0
/
h2h2potpieces.f
328 lines (234 loc) · 8.07 KB
/
h2h2potpieces.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
c ----------------------------------------------------------------------
c This subroutine computes the H2-H2 potential energy surface as
c described in the Journal of Chemical Physics article "A six-
c dimensional H2-H2 potential energy surface for bound state
c spectroscopy" by Robert J. Hinde.
c Please direct comments to [email protected] or [email protected]
c This version of the subroutine is dated 1 June 2010. An earlier
c version of the subroutine (dated 31 October 2007) contained an
c error in the computation of the the potential energy at fixed
c (r, t1, t2, phi) as a power series in (r1, r2). Specifically,
c the term including the coefficient c20 contained a typographical
c error, and was given as c20*(r2-r0)**2. This has been changed
c to the correct expression c20*(r1-r0)**2. Piotr Jankowski first
c notified me of this problem and I appreciate his assistance in
c locating the typographical error.
c Before calling this subroutine, your program must call the vinit
c subroutine that performs some initialization work. The variables
c used in this initialization work are stored in the common block
c /vh2h2c/.
c The subroutine takes six input parameters:
c r = H2-H2 distance in bohr
c r1 = bond length of monomer 1 in bohr
c r2 = bond length of monomer 2 in bohr
c t1 = theta1 in radians
c t2 = theta2 in radians
c phi = phi in radians
c The potential energy is returned to the calling program in the
c variable potl, in units of wavenumbers.
subroutine vh2h2pieces(r, r1, r2, t1, t2, phi, potE,potl)
implicit real*8 (a-h, o-z)
dimension v(4), vv(9), vij(3, 3, 4),potl(8)
common /vh2h2c/ coef(18, 3, 3, 4, 4),
+ arep(3, 3, 4), crep(3, 3, 4),
+ c5(3, 3), c6(3, 3, 4), c8(3, 3, 4), cten(3, 3)
parameter (r0=1.4d0)
parameter (dr=0.3d0)
c --- test for R outside spline endpoints.
if (r.le.4.210625d0) then
write (6, 6009)
6009 format ('warning 6009 in VH2H2: R smaller than recommended')
do i=1, 3
do j=1, 3
do k=1, 4
vij(i, j, k)=arep(i, j, k)*exp(r*crep(i, j, k))
end do
end do
end do
goto 200
else if (r.ge.12.0d0) then
do i=1, 3
do j=1, 3
vij(i, j, 1)=cten(i, j)/r**10
vij(i, j, 4)=c5(i, j)/r**5
do k=2, 3
vij(i, j, k)=0.0d0
end do
end do
end do
do i=1, 3
do j=1, 3
do k=1, 4
vij(i, j, k)=vij(i, j, k)+c6(i, j, k)/r**6+c8(i, j, k)/r**8
end do
end do
end do
goto 200
end if
c --- compute "old R" before shift.
rold=(r+6.5d0*0.0175d0)/1.0175d0
c --- compute index into spline look-up tables.
if (rold.lt.6.5d0) then
c ------ for R < 6.5, it's more convenient to use the old R.
idx=idint((rold-4.25d0)*4.0d0)+1
else if (r.ge.6.5d0.and.r.lt.10.0d0) then
idx=idint((rold-6.5d0)*2.0d0)+10
else if (r.ge.10.0d0.and.r.lt.12.0d0) then
idx=idint(rold-10.0d0)+17
else
write (6, 6001)
6001 format ('error 6001 in VH2H2: spline look-up failed!')
goto 999
end if
c --- evaluate splines for all 9 (r1, r2) pairs.
do i=1, 3
do j=1, 3
do k=1, 4
vij(i, j, k)=0.0d0
end do
end do
end do
do i=1, 3
do j=1, 3
do k=1, 4
do l=1, 4
vij(i, j, k)=r*vij(i, j, k)+coef(idx, i, j, k, l)
end do
end do
end do
end do
c --- use power series in (r1, r2) to compute potential energy.
200 do k=1, 4
do i=1, 3
do j=1, 3
vv(3*(i-1)+j)=vij(i, j, k)
end do
end do
c ------ perform symmetry checks.
if (k.eq.1.or.k.eq.4) then
if (vv(2).ne.vv(4)) then
write (6, 6002) 2, 4, k
goto 999
else if (vv(3).ne.vv(7)) then
write (6, 6002) 3, 7, k
goto 999
else if (vv(6).ne.vv(8)) then
write (6, 6002) 6, 8, k
goto 999
end if
end if
6002 format ('error 6002 in VH2H2: vv(', i1, ') and vv(', i1, ') ',
+ 'do not match for angular term ', i1)
c ------ compute power series coefficients.
c00=vv(5)
c01=0.5d0*(vv(6)-vv(4))/dr
c10=0.5d0*(vv(8)-vv(2))/dr
c02=-vv(5)/(dr**2)+0.5d0*(vv(6)+vv(4))/(dr**2)
c20=-vv(5)/(dr**2)+0.5d0*(vv(8)+vv(2))/(dr**2)
c11=0.25d0*(vv(9)-vv(3)-(vv(7)-vv(1)))/(dr**2)
aa=0.5d0*(vv(3)+vv(1)-2.0d0*vv(2))/(dr**2)
bb=0.5d0*(vv(9)+vv(7)-2.0d0*vv(8))/(dr**2)
c12=0.5d0*(bb-aa)/dr
aa=0.5d0*(vv(7)+vv(1)-2.0d0*vv(4))/(dr**2)
bb=0.5d0*(vv(9)+vv(3)-2.0d0*vv(6))/(dr**2)
c21=0.5d0*(bb-aa)/dr
cc=0.5d0*(vv(8)+vv(2)-2.0d0*vv(5))/(dr**2)
c22=0.5d0*(aa+bb-2.0d0*cc)/(dr**2)
c ------ evaluate power series.
v(k)=c00+
+ c01*(r2-r0)+
+ c10*(r1-r0)+
+ c02*(r2-r0)**2+
+ c20*(r1-r0)**2+
+ c11*(r1-r0)*(r2-r0)+
+ c12*(r1-r0)*(r2-r0)**2+
+ c21*(r1-r0)**2*(r2-r0)+
+ c22*((r1-r0)*(r2-r0))**2
end do
c --- compute the angular functions.
c1=cos(t1)
c2=cos(t2)
s1=sin(t1)
s2=sin(t2)
g000=1.0d0
g202=2.5d0*(3.0d0*c1**2-1.0d0)
g022=2.5d0*(3.0d0*c2**2-1.0d0)
g224=45.0d0/(4.0d0*sqrt(70.0d0))*
* (0.32d0*g022*g202-16.0d0*s1*c1*s2*c2*cos(phi)+
+ (s1*s2)**2*cos(2.0d0*phi))
c --- compute the potential energy from the angular functions and the
c interpolated (r1, r2)-dependent coefficients.
potE=v(1)*g000+v(2)*g202+v(3)*g022+v(4)*g224
potl(1)=v(1)
potl(2)=v(2)
potl(3)=v(3)
potl(4)=v(4)
potl(5)=g000
potl(6)=g202
potl(7)=g022
potl(8)=g224
c print *, potE
c --- this write statement is for debugging purposes.
c write (6, 6123) v(1), g000, v(1)*g000,
c + v(2), g202, v(2)*g202,
c + v(3), g022, v(3)*g022,
c + v(4), g224, v(4)*g224, potl
6123 format ('coefficients and angular functions:'/,
+ 'A000 = ', f12.7, ' g000 = ', f12.7, ' product = ', f12.7/,
+ 'A202 = ', f12.7, ' g202 = ', f12.7, ' product = ', f12.7/,
+ 'A022 = ', f12.7, ' g022 = ', f12.7, ' product = ', f12.7/,
+ 'A224 = ', f12.7, ' g224 = ', f12.7, ' product = ', f12.7/,
+ 50x, '------------'/, 44x, 'sum = ', f12.7/)
return
999 write (6, 6999) r, r1, r2, t1, t2, phi
6999 format ('VH2H2 input parameters:'/,
+ 'R = ', 1pe15.8/,
+ 'r1, r2 = ', 1pe15.8, 1x, 1pe15.8/,
+ 't1, t2 = ', 1pe15.8, 1x, 1pe15.8/,
+ 'phi = ', 1pe15.8)
stop
end
c ----------------------------------------------------------------------
c This is the initialization subroutine that must be called once
c before using the preceding subroutine.
c It reads data from three files:
c all_coefs
c short_range
c long_range
subroutine vinit
implicit real*8 (a-h, o-z)
common /vh2h2c/ coef(18, 3, 3, 4, 4),
+ arep(3, 3, 4), crep(3, 3, 4),
+ c5(3, 3), c6(3, 3, 4), c8(3, 3, 4), cten(3, 3)
open (3, file='all_coefs')
do i=1, 3
do j=1, 3
do k=1, 4
do n=1, 18
read (3, *) (coef(n, i, j, k, l), l=1, 4)
end do
end do
end do
end do
close (3)
open (3, file='short_range')
do i=1, 3
do j=1, 3
do k=1, 4
read (3, *) arep(i, j, k), crep(i, j, k)
end do
end do
end do
close (3)
open (3, file='long_range')
do i=1, 3
do j=1, 3
read (3, *) c5(i, j)
read (3, *) c6(i, j, 1), c8(i, j, 1), cten(i, j)
do k=2, 4
read (3, *) c6(i, j, k), c8(i, j, k)
end do
end do
end do
return
end