MPQC 3.0.0-alpha
Loading...
Searching...
No Matches
macros_gamess.h
1//
2// macros_gamess.h
3//
4// Copyright (C) 2001 Edward Valeev
5//
6// Author: Edward Valeev <evaleev@vt.edu>
7// Maintainer: EV
8//
9// This file is part of the SC Toolkit.
10//
11// The SC Toolkit is free software; you can redistribute it and/or modify
12// it under the terms of the GNU Library General Public License as published by
13// the Free Software Foundation; either version 2, or (at your option)
14// any later version.
15//
16// The SC Toolkit is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU Library General Public License for more details.
20//
21// You should have received a copy of the GNU Library General Public License
22// along with the SC Toolkit; see the file COPYING.LIB. If not, write to
23// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24//
25// The U.S. Government is granted a limited license as per AL 91-7.
26//
27
28#ifndef _chemistry_qc_libint2_macrosgamess_h_
29#define _chemistry_qc_libint2_macrosgamess_h_
30
31/* True if the integral is nonzero. */
32#define INT_NONZERO(x) (((x)< -1.0e-15)||((x)> 1.0e-15))
33
34// for definition of the ordering see CGShellInfo
35namespace libint2 {
36 enum CGShellOrdering {
37 CGShellOrdering_Standard = LIBINT_CGSHELL_ORDERING_STANDARD,
38 CGShellOrdering_IntV3 = LIBINT_CGSHELL_ORDERING_INTV3,
39 CGShellOrdering_GAMESS = LIBINT_CGSHELL_ORDERING_GAMESS,
40 CGShellOrdering_ORCA = LIBINT_CGSHELL_ORDERING_ORCA
41 };
42};
43
44#include <cgshellinfo.h> // provided by libint2
45
46/* Computes an index to a Cartesian function within a shell given
47 * am = total angular momentum
48 * i = the exponent of x (i is used twice in the macro--beware side effects)
49 * j = the exponent of y
50 * for this ordering there is no formula
51 */
52#define INT_CARTINDEX(am,i,j) libint2::CGShellInfo< libint2::CGShellOrderingData<libint2::CGShellOrdering_GAMESS,LIBINT_MAX_AM> >::cartindex(am,i,j)
53
54/* This sets up the above loop over cartesian exponents as follows
55 * FOR_CART(i,j,k,am)
56 * Stuff using i,j,k.
57 * END_FOR_CART
58 */
59#define FOR_CART(i,j,k,am) for(int __xyz=0; __xyz<INT_NCART(am); ++__xyz) { \
60 libint2::CGShellInfo< libint2::CGShellOrderingData<libint2::CGShellOrdering_GAMESS,LIBINT_MAX_AM> >::cartindex_to_ijk(am,__xyz,i,j,k);
61#define END_FOR_CART }
62
63
64/* This sets up a loop over all of the generalized contractions
65 * and all of the cartesian exponents.
66 * gc is the number of the gen con
67 * index is the index within the current gen con.
68 * i,j,k are the angular momentum for x,y,z
69 * sh is the shell pointer
70 */
71#define FOR_GCCART(gc,index,i,j,k,sh)\
72 for ((gc)=0; (gc)<(sh)->ncon; (gc)++) {\
73 (index)=0;\
74 FOR_CART(i,j,k,(sh)->type[gc].am)
75
76#define FOR_GCCART_GS(gc,index,i,j,k,sh)\
77 for ((gc)=0; (gc)<(sh)->ncontraction(); (gc)++) {\
78 (index)=0;\
79 FOR_CART(i,j,k,(sh)->am(gc))
80
81#define END_FOR_GCCART(index)\
82 (index)++;\
83 END_FOR_CART\
84 }
85
86#define END_FOR_GCCART_GS(index)\
87 (index)++;\
88 END_FOR_CART\
89 }
90
91/* These are like the above except no index is kept track of. */
92#define FOR_GCCART2(gc,i,j,k,sh)\
93 for ((gc)=0; (gc)<(sh)->ncon; (gc)++) {\
94 FOR_CART(i,j,k,(sh)->type[gc].am)
95
96#define END_FOR_GCCART2\
97 END_FOR_CART\
98 }
99
100/* These are used to loop over shells, given the centers structure
101 * and the center index, and shell index. */
102#define FOR_SHELLS(c,i,j) for((i)=0;(i)<(c)->n;i++) {\
103 for((j)=0;(j)<(c)->center[(i)].basis.n;j++) {
104#define END_FOR_SHELLS }}
105
106/* Computes the number of Cartesian function in a shell given
107 * am = total angular momentum
108 * formula: (am*(am+1))/2 + am+1;
109 */
110#define INT_NCART(am) ((am>=0)?((((am)+2)*((am)+1))>>1):0)
111
112/* Like INT_NCART, but only for nonnegative arguments. */
113#define INT_NCART_NN(am) ((((am)+2)*((am)+1))>>1)
114
115/* For a given ang. mom., am, with n cartesian functions, compute the
116 * number of cartesian functions for am+1 or am-1
117 */
118#define INT_NCART_DEC(am,n) ((n)-(am)-1)
119#define INT_NCART_INC(am,n) ((n)+(am)+2)
120
121/* Computes the number of pure angular momentum functions in a shell
122 * given am = total angular momentum
123 */
124#define INT_NPURE(am) (2*(am)+1)
125
126/* Computes the number of functions in a shell given
127 * pu = pure angular momentum boolean
128 * am = total angular momentum
129 */
130#define INT_NFUNC(pu,am) ((pu)?INT_NPURE(am):INT_NCART(am))
131
132/* Given a centers pointer and a shell number, this evaluates the
133 * pointer to that shell. */
134#define INT_SH(c,s) ((c)->center[(c)->center_num[s]].basis.shell[(c)->shell_num[s]])
135
136/* Given a centers pointer and a shell number, get the angular momentum
137 * of that shell. */
138#define INT_SH_AM(c,s) ((c)->center[(c)->center_num[s]].basis.shell[(c)->shell_num[s]].type.am)
139
140/* Given a centers pointer and a shell number, get pure angular momentum
141 * boolean for that shell. */
142#define INT_SH_PU(c,s) ((c)->center[(c)->center_num[s]].basis.shell[(c)->shell_num[s]].type.puream)
143
144/* Given a centers pointer, a center number, and a shell number,
145 * get the angular momentum of that shell. */
146#define INT_CE_SH_AM(c,a,s) ((c)->center[(a)].basis.shell[(s)].type.am)
147
148/* Given a centers pointer, a center number, and a shell number,
149 * get pure angular momentum boolean for that shell. */
150#define INT_CE_SH_PU(c,a,s) ((c)->center[(a)].basis.shell[(s)].type.puream)
151
152/* Given a centers pointer and a shell number, compute the number
153 * of functions in that shell. */
154/* #define INT_SH_NFUNC(c,s) INT_NFUNC(INT_SH_PU(c,s),INT_SH_AM(c,s)) */
155#define INT_SH_NFUNC(c,s) ((c)->center[(c)->center_num[s]].basis.shell[(c)->shell_num[s]].nfunc)
156
157/* These macros assist in looping over the unique integrals
158 * in a shell quartet. The exy variables are booleans giving
159 * information about the equivalence between shells x and y. The nx
160 * variables give the number of functions in each shell, x. The
161 * i,j,k are the current values of the looping indices for shells 1, 2, and 3.
162 * The macros return the maximum index to be included in a summation
163 * over indices 1, 2, 3, and 4.
164 * These macros require canonical integrals. This requirement comes
165 * from the need that integrals of the shells (1 2|2 1) are not
166 * used. The integrals (1 2|1 2) must be used with these macros to
167 * get the right nonredundant integrals.
168 */
169#define INT_MAX1(n1) ((n1)-1)
170#define INT_MAX2(e12,i,n2) ((e12)?(i):((n2)-1))
171#define INT_MAX3(e13e24,i,n3) ((e13e24)?(i):((n3)-1))
172#define INT_MAX4(e13e24,e34,i,j,k,n4) \
173 ((e34)?(((e13e24)&&((k)==(i)))?(j):(k)) \
174 :((e13e24)&&((k)==(i)))?(j):(n4)-1)
175/* A note on integral symmetries:
176 * There are 15 ways of having equivalent indices.
177 * There are 8 of these which are important for determining the
178 * nonredundant integrals (that is there are only 8 ways of counting
179 * the number of nonredundant integrals in a shell quartet)
180 * Integral type Integral Counting Type
181 * 1 (1 2|3 4) 1
182 * 2 (1 1|3 4) 2
183 * 3 (1 2|1 4) ->1
184 * 4 (1 2|3 1) ->1
185 * 5 (1 1|1 4) 3
186 * 6 (1 1|3 1) ->2
187 * 7 (1 2|1 1) ->5
188 * 8 (1 1|1 1) 4
189 * 9 (1 2|2 4) ->1
190 * 10 (1 2|3 2) ->1
191 * 11 (1 2|3 3) 5
192 * 12 (1 1|3 3) 6
193 * 13 (1 2|1 2) 7
194 * 14 (1 2|2 1) 8 reduces to 7 thru canonicalization
195 * 15 (1 2|2 2) ->5
196 */
197
198#endif // header guard

Generated at Wed Sep 25 2024 02:45:29 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.12.0.