forked from JackS9/phatpsy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
genvab.f
244 lines (209 loc) · 7.22 KB
/
genvab.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
SUBROUTINE GENVAB(STVAB,N,L,ETA,RAB,LV,MV,VEXP,OMEGAI,OMEGAJ,A,B,
X SCRPLM,INDEX,ANORM,YLMNRM,D,CGC,QREALY)
IMPLICIT REAL*8(A-H,O,P,R-Z),LOGICAL*1(Q)
C-----------------------------------------------------------------------
C
C GENVAB...
C
C THIS ROUTINE GENERATES ALL THE MATRIX ELEMENTS BETWEEN STO'S
C ON A SINGLE CENTER FOR A POTENTIAL ON ANOTHER CENTER OF THE
C FOLLOWING FORM:
C
C V(R) = SUM(K) C(K)*V(K;R)
C
C LV(K).GE.0
C V(K;R) = R**(LV(K)-1)*EXP(-VEXP(K)*R)
C LV(K).LT.0
C V(K;R) = R**-LV(K)*EXP(-VEXP(K)*R)*Y(-LV(K),MV(K))
C
C WHERE
C
C STVAB(IJ,K) = <I/V(K;R)/J>
C
C IJ = MAX(I,J)*(MAX(I,J)-1)/2+MIN(I,J)
C
C !I> = ANORM(I)*RA**(N(I)-1)*EXP(-ETA(I)*RA)*Y(L(I),M(I))
C
C VARIABLE DEFINITIONS:
C
C RAB............ DISTANCE BETWEEN THE TWO CENTERS.
C NVTERM......... THE NUMBER OF TERMS IN THE POTENTIAL SUM.
C OMEGAI(*,*).... AN ARRAY CONTAINING THE EXPANSION COEFFICIENTS
C OF THE I-TH STO IN ELLIPTICAL COORDINATES.
C OMEGAJ(*,*).... SIMILAR TO OMEGAI(*,*) BUT FOR THE J-TH STO.
C A(*)........... AN ARRAY FOR HOLDING THE A-FUNCTION VALUES
C USED IN THE EXPANSION OF AN STO.
C B(*)........... SIMILAR TO A(*) BUT FOR THE B-FUNCTIONS.
C INDEX(N)....... =N*(N-1)/2, INDEX ARRAY FOR SYMMETRY PACKING.
C SCRPLM(*)...... A SCRATCH ARRAY FOR 'OGEN' USED TO HOLD PLM'S.
C EXPMIN......... MINIMUM EXPONENT ALLOWED (TO AVOID UNDERFLOW).
C NNMXM1......... =2*NMAX-1, WHERE NMAX IS THE MAXIMUM VALUE OF
C N ENCOUNTERED.
C M2STO.......... =MSTO*(MSTO+1)/2, WHERE MSTO IS THE NUMBER
C OF STO'S (INCLUDING ML-VALUES).
C NABDIM......... =4*NMAX-2, DIMESNION OF A(*) AND B(*).
C LMXP1.......... =LMAX+1, WHERE LMAX IS THE MAXIMUM VALUE OF L
C ENCOUNTERED.
C NYLM........... =LLMXP1*(LLXMP1+1)/2, DIMENSION OF YLMNRM(*).
C WHERE LLMXP1=2*LMAX+1.
C NSTO........... NUMBER OF STO'S ON THIS ATOM (NOT INCLUDING
C DIFFERENT ML-VALUES).
C FACT(N)........ =(N-1)-FACTORIAL.
C BINOM(INDEX(N)+M)... =BINOMIAL COEFFICIENT OF X**N*Y**M/X*Y.
C YLMNRM(INDEX(L+1)+/M/+1)... =NORMALIZATION CONSTANT FOR Y(L,M).
C D(L3MX,2)...... D-COEFFICIENTS.
C CGC(NCGC)...... CLEBSCH-GORDON COEFFICIENTS.
C
C ROUTINES CALLED: OGEN, ANMBNM, ABSUM, DCOEF, CGCOEF;
C IABS, DSQRT, DEXP, DABS, MOD, MAX0, MIN0
C
C COMMON USAGE:
C
C /PARMS/ USES - IPARM(19)(=NNMXM1),IPARM(21)(=LMXP1),
C IPARM(27)(=M2STO), IPARM(30)(=NABDIM),
C IPARM(32)(=NSTO), IPARM(34)(=NYLM)
C APARM(1)(=EXPMIN)
C
C
C /BPARMS/ USES - NVTERM
C
C /TABLES/ USES - FACT(*), BINOM(*), ZERO, HALF, ROOTPI,
C HALFPI(2)(=PI)
C
C RESTRICTIONS:
C
C THE FACTORIALS, FACT(*), HAVE TO BE DEFINED UP TO 4*LMAX+1.
C THE DIMENSION HERE IS SUFFICIENT FOR LMAX=5. - FACT(22)
C
C THE BINOMIAL COEFFICIENT ARRAY, BINOM(*), MUST BE DIMENSIONED
C UP TO NNMXM1*(NNMXM1+1)/2. THE DIMENSION HERE IS SUF-
C FICIENT FOR NMAX=7. - BINOM(91)
C
C.......................................................................
C
C LAST REVISION: OCTOBER 12, 1977
C
C WRITTEN BY: JACK A. SMITH
C QUANTUM THEORY PROJECT
C UNIVERSITY OF FLORIDA
C GAINESVILLE, FLORIDA
C
C REFERENCE: COMPUTATION METHODS OF QUANTUM CHEMISTRY. PT I.
C BY FRANK HARRIS (UNIV. OF UTAH).
C
C SUBORDINATE ROUTINES: GENCGC, NDXCGC, CGCOEF,CHKCGC,
C ORDER, GENDC, DCOEF, NDXD,
C OGEN, ANMBNM, ASCALE, BSCALE, ABSUM
C
C-----------------------------------------------------------------------
COMMON /PARMS/ APARM(20),IPARM(50),QPARM(50)
EQUIVALENCE (APARM(1),EXPMIN)
EQUIVALENCE (IPARM(19),NNMXM1), (IPARM(21),LMXP1),
X (IPARM(24),NCGC),
X (IPARM(27),M2STO), (IPARM(28),L3MX),
X (IPARM(30),NABDIM),
X (IPARM(32),NSTO), (IPARM(34),NYLM)
COMMON /BPARMS/ IBPARM(13),N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) GO TO 60
VNORMK=VNORM*DEXP(EXPON)
LB=LV(K)
IF (LB.LT.0) GO TO 35
NB=LB
LB=0
MB=0
GO TO 37
35 LB=-LB
NB=LB+1
MB=MV(K)
37 CONTINUE
C... Up N by 1 and use the Nuclear Attraction form of ABSUM
C (Is the 2*ROOTPI Norm factor valid for NB>0 ??)
NB=NB+1
L2B=INDEX(LB+1)
SUMLA=ZERO
DO 50 ILA=ILAMN,ILAMX,2
IF (ILA.GT.ILAMX) GO TO 50
LA=ILA-1
L2A=INDEX(LA+1)
LMIN=MIN0(LB,LA)
IMLMX=2*LMIN+1
DO 40 IML=1,IMLMX
ML=IML-LMIN-1
IABSML=IABS(ML)
MLP1=IABSML+1
LIMI=NA-IABSML
LIMJ=NB-IABSML
LIMIJ=LIMI+LIMJ
CALL OGEN( NA,LA,ML,RHALF,OMEGAI,NNMXM1,BINOM,FACT,INDEX,SCRPLM)
CALL OGEN(-NB,LB,ML,RHALF,OMEGAJ,NNMXM1,BINOM,FACT,INDEX,SCRPLM)
CALL ANMBNM(A,RETAI,B,RETAJ,LIMIJ,IABSML,NABDIM)
CALL ABSUM(SUM,A,B,OMEGAI,OMEGAJ,LIMI,LIMJ,1)
IF (ML.NE.0) SUM=HALF*SUM
SUM=SUM*DCOEF(D,LB,MB,ML)*YLMNRM(L2A+MLP1)*YLMNRM(L2B+MLP1)
SUMLA=SUMLA+SUM*DCOEF(D,LA,MADIF,ML)
X *CGCOEF(CGC,MADIF,MI,MJ,LA,LI,LJ,QREALY)
IF (MASUM.EQ.MADIF) GO TO 40
SUMLA=SUMLA+SUM*DCOEF(D,LA,MASUM,ML)
X *CGCOEF(CGC,MASUM,MI,MJ,LA,LI,LJ,QREALY)
40 CONTINUE
50 CONTINUE
STVAB(IJ,K)=VNORMK*SUMLA
60 CONTINUE
70 CONTINUE
80 CONTINUE
90 CONTINUE
100 CONTINUE
RETURN
END