Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > contrib > by-pkgid > 263386785cefb9ae5d63b926d214d809 > files > 1255

mpqc-2.1.2-4mdk.ppc.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta name="robots" content="noindex">
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>macros.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body bgcolor="#ffffff">
<!-- Generated by Doxygen 1.2.5 on Mon Oct 14 14:16:37 2002 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; </center>
<hr><h1>macros.h</h1><div class="fragment"><pre>00001 <font class="comment">/*</font>
00002 <font class="comment"> * macros.h</font>
00003 <font class="comment"> *</font>
00004 <font class="comment"> * Copyright (C) 1996 Limit Point Systems, Inc.</font>
00005 <font class="comment"> *</font>
00006 <font class="comment"> * Author: Curtis Janssen &lt;cljanss@ca.sandia.gov&gt;</font>
00007 <font class="comment"> * Maintainer: LPS</font>
00008 <font class="comment"> *</font>
00009 <font class="comment"> * This file is part of the SC Toolkit.</font>
00010 <font class="comment"> *</font>
00011 <font class="comment"> * The SC Toolkit is free software; you can redistribute it and/or modify</font>
00012 <font class="comment"> * it under the terms of the GNU Library General Public License as published by</font>
00013 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
00014 <font class="comment"> * any later version.</font>
00015 <font class="comment"> *</font>
00016 <font class="comment"> * The SC Toolkit is distributed in the hope that it will be useful,</font>
00017 <font class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00018 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</font>
00019 <font class="comment"> * GNU Library General Public License for more details.</font>
00020 <font class="comment"> *</font>
00021 <font class="comment"> * You should have received a copy of the GNU Library General Public License</font>
00022 <font class="comment"> * along with the SC Toolkit; see the file COPYING.LIB.  If not, write to</font>
00023 <font class="comment"> * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.</font>
00024 <font class="comment"> *</font>
00025 <font class="comment"> * The U.S. Government is granted a limited license as per AL 91-7.</font>
00026 <font class="comment"> */</font>
00027 
00028 <font class="comment">/* True if the integral is nonzero. */</font>
00029 <font class="preprocessor">#define INT_NONZERO(x) (((x)&lt; -1.0e-10)||((x)&gt; 1.0e-10))</font>
00030 <font class="preprocessor"></font>
00031 <font class="comment">/* Computes an index to a Cartesian function within a shell given</font>
00032 <font class="comment"> * am = total angular momentum</font>
00033 <font class="comment"> * i = the exponent of x (i is used twice in the macro--beware side effects)</font>
00034 <font class="comment"> * j = the exponent of y</font>
00035 <font class="comment"> * formula: am*(i+1) - (i*(i+1))/2 + i+1 - j - 1</font>
00036 <font class="comment"> * The following loop will generate indices in the proper order:</font>
00037 <font class="comment"> *  cartindex = 0;</font>
00038 <font class="comment"> *  for (i=0; i&lt;=am; i++) {</font>
00039 <font class="comment"> *    for (k=0; k&lt;=am-i; k++) {</font>
00040 <font class="comment"> *      j = am - i - k;</font>
00041 <font class="comment"> *      do_it_with(cartindex); // cartindex == INT_CARTINDEX(am,i,j)</font>
00042 <font class="comment"> *      cartindex++;</font>
00043 <font class="comment"> *      }</font>
00044 <font class="comment"> *    }</font>
00045 <font class="comment"> */</font>
00046 <font class="preprocessor">#define INT_CARTINDEX(am,i,j) (((((((am)+1)&lt;&lt;1)-(i))*((i)+1))&gt;&gt;1)-(j)-1)</font>
00047 <font class="preprocessor"></font>
00048 <font class="comment">/* This sets up the above loop over cartesian exponents as follows</font>
00049 <font class="comment"> * FOR_CART(i,j,k,am)</font>
00050 <font class="comment"> *   Stuff using i,j,k.</font>
00051 <font class="comment"> *   END_FOR_CART</font>
00052 <font class="comment"> */</font>
00053 <font class="preprocessor">#define FOR_CART(i,j,k,am) for((i)=0;(i)&lt;=(am);(i)++) {\</font>
00054 <font class="preprocessor">                           for((k)=0;(k)&lt;=(am)-(i);(k)++) \</font>
00055 <font class="preprocessor">                           { (j) = (am) - (i) - (k);</font>
00056 <font class="preprocessor"></font><font class="preprocessor">#define END_FOR_CART }}</font>
00057 <font class="preprocessor"></font>
00058 <font class="comment">/* This sets up a loop over all of the generalized contractions</font>
00059 <font class="comment"> * and all of the cartesian exponents.</font>
00060 <font class="comment"> * gc is the number of the gen con</font>
00061 <font class="comment"> * index is the index within the current gen con.</font>
00062 <font class="comment"> * i,j,k are the angular momentum for x,y,z</font>
00063 <font class="comment"> * sh is the shell pointer</font>
00064 <font class="comment"> */</font>
00065 <font class="preprocessor">#define FOR_GCCART(gc,index,i,j,k,sh)\</font>
00066 <font class="preprocessor">    for ((gc)=0; (gc)&lt;(sh)-&gt;ncon; (gc)++) {\</font>
00067 <font class="preprocessor">    (index)=0;\</font>
00068 <font class="preprocessor">    FOR_CART(i,j,k,(sh)-&gt;type[gc].am)</font>
00069 <font class="preprocessor"></font>
00070 <font class="preprocessor">#define FOR_GCCART_GS(gc,index,i,j,k,sh)\</font>
00071 <font class="preprocessor">    for ((gc)=0; (gc)&lt;(sh)-&gt;ncontraction(); (gc)++) {\</font>
00072 <font class="preprocessor">    (index)=0;\</font>
00073 <font class="preprocessor">    FOR_CART(i,j,k,(sh)-&gt;am(gc))</font>
00074 <font class="preprocessor"></font>
00075 <font class="preprocessor">#define END_FOR_GCCART(index)\</font>
00076 <font class="preprocessor">    (index)++;\</font>
00077 <font class="preprocessor">    END_FOR_CART\</font>
00078 <font class="preprocessor">    }</font>
00079 <font class="preprocessor"></font>
00080 <font class="preprocessor">#define END_FOR_GCCART_GS(index)\</font>
00081 <font class="preprocessor">    (index)++;\</font>
00082 <font class="preprocessor">    END_FOR_CART\</font>
00083 <font class="preprocessor">    }</font>
00084 <font class="preprocessor"></font>
00085 <font class="comment">/* These are like the above except no index is kept track of. */</font>
00086 <font class="preprocessor">#define FOR_GCCART2(gc,i,j,k,sh)\</font>
00087 <font class="preprocessor">    for ((gc)=0; (gc)&lt;(sh)-&gt;ncon; (gc)++) {\</font>
00088 <font class="preprocessor">    FOR_CART(i,j,k,(sh)-&gt;type[gc].am)</font>
00089 <font class="preprocessor"></font>
00090 <font class="preprocessor">#define END_FOR_GCCART2\</font>
00091 <font class="preprocessor">    END_FOR_CART\</font>
00092 <font class="preprocessor">    }</font>
00093 <font class="preprocessor"></font>
00094 <font class="comment">/* These are used to loop over shells, given the centers structure</font>
00095 <font class="comment"> * and the center index, and shell index. */</font>
00096 <font class="preprocessor">#define FOR_SHELLS(c,i,j) for((i)=0;(i)&lt;(c)-&gt;n;i++) {\</font>
00097 <font class="preprocessor">                          for((j)=0;(j)&lt;(c)-&gt;center[(i)].basis.n;j++) {</font>
00098 <font class="preprocessor"></font><font class="preprocessor">#define END_FOR_SHELLS }}</font>
00099 <font class="preprocessor"></font>
00100 <font class="comment">/* Computes the number of Cartesian function in a shell given</font>
00101 <font class="comment"> * am = total angular momentum</font>
00102 <font class="comment"> * formula: (am*(am+1))/2 + am+1;</font>
00103 <font class="comment"> */</font>
00104 <font class="preprocessor">#define INT_NCART(am) ((am&gt;=0)?((((am)+2)*((am)+1))&gt;&gt;1):0)</font>
00105 <font class="preprocessor"></font>
00106 <font class="comment">/* Like INT_NCART, but only for nonnegative arguments. */</font>
00107 <font class="preprocessor">#define INT_NCART_NN(am) ((((am)+2)*((am)+1))&gt;&gt;1)</font>
00108 <font class="preprocessor"></font>
00109 <font class="comment">/* For a given ang. mom., am, with n cartesian functions, compute the</font>
00110 <font class="comment"> * number of cartesian functions for am+1 or am-1</font>
00111 <font class="comment"> */</font>
00112 <font class="preprocessor">#define INT_NCART_DEC(am,n) ((n)-(am)-1)</font>
00113 <font class="preprocessor"></font><font class="preprocessor">#define INT_NCART_INC(am,n) ((n)+(am)+2)</font>
00114 <font class="preprocessor"></font>
00115 <font class="comment">/* Computes the number of pure angular momentum functions in a shell</font>
00116 <font class="comment"> * given am = total angular momentum</font>
00117 <font class="comment"> */</font>
00118 <font class="preprocessor">#define INT_NPURE(am) (2*(am)+1)</font>
00119 <font class="preprocessor"></font>
00120 <font class="comment">/* Computes the number of functions in a shell given</font>
00121 <font class="comment"> * pu = pure angular momentum boolean</font>
00122 <font class="comment"> * am = total angular momentum</font>
00123 <font class="comment"> */</font>
00124 <font class="preprocessor">#define INT_NFUNC(pu,am) ((pu)?INT_NPURE(am):INT_NCART(am))</font>
00125 <font class="preprocessor"></font>
00126 <font class="comment">/* Given a centers pointer and a shell number, this evaluates the</font>
00127 <font class="comment"> * pointer to that shell. */</font>
00128 <font class="preprocessor">#define INT_SH(c,s) ((c)-&gt;center[(c)-&gt;center_num[s]].basis.shell[(c)-&gt;shell_num[s]])</font>
00129 <font class="preprocessor"></font>
00130 <font class="comment">/* Given a centers pointer and a shell number, get the angular momentum</font>
00131 <font class="comment"> * of that shell. */</font>
00132 <font class="preprocessor">#define INT_SH_AM(c,s) ((c)-&gt;center[(c)-&gt;center_num[s]].basis.shell[(c)-&gt;shell_num[s]].type.am)</font>
00133 <font class="preprocessor"></font>
00134 <font class="comment">/* Given a centers pointer and a shell number, get pure angular momentum</font>
00135 <font class="comment"> * boolean for that shell. */</font>
00136 <font class="preprocessor">#define INT_SH_PU(c,s) ((c)-&gt;center[(c)-&gt;center_num[s]].basis.shell[(c)-&gt;shell_num[s]].type.puream)</font>
00137 <font class="preprocessor"></font>
00138 <font class="comment">/* Given a centers pointer, a center number, and a shell number,</font>
00139 <font class="comment"> * get the angular momentum of that shell. */</font>
00140 <font class="preprocessor">#define INT_CE_SH_AM(c,a,s) ((c)-&gt;center[(a)].basis.shell[(s)].type.am)</font>
00141 <font class="preprocessor"></font>
00142 <font class="comment">/* Given a centers pointer, a center number, and a shell number,</font>
00143 <font class="comment"> * get pure angular momentum boolean for that shell. */</font>
00144 <font class="preprocessor">#define INT_CE_SH_PU(c,a,s) ((c)-&gt;center[(a)].basis.shell[(s)].type.puream)</font>
00145 <font class="preprocessor"></font>
00146 <font class="comment">/* Given a centers pointer and a shell number, compute the number</font>
00147 <font class="comment"> * of functions in that shell. */</font>
00148 <font class="comment">/* #define INT_SH_NFUNC(c,s) INT_NFUNC(INT_SH_PU(c,s),INT_SH_AM(c,s)) */</font>
00149 <font class="preprocessor">#define INT_SH_NFUNC(c,s) ((c)-&gt;center[(c)-&gt;center_num[s]].basis.shell[(c)-&gt;shell_num[s]].nfunc)</font>
00150 <font class="preprocessor"></font>
00151 <font class="comment">/* These macros assist in looping over the unique integrals</font>
00152 <font class="comment"> * in a shell quartet.  The exy variables are booleans giving</font>
00153 <font class="comment"> * information about the equivalence between shells x and y.  The nx</font>
00154 <font class="comment"> * variables give the number of functions in each shell, x. The</font>
00155 <font class="comment"> * i,j,k are the current values of the looping indices for shells 1, 2, and 3.</font>
00156 <font class="comment"> * The macros return the maximum index to be included in a summation</font>
00157 <font class="comment"> * over indices 1, 2, 3, and 4.</font>
00158 <font class="comment"> * These macros require canonical integrals.  This requirement comes</font>
00159 <font class="comment"> * from the need that integrals of the shells (1 2|2 1) are not</font>
00160 <font class="comment"> * used.  The integrals (1 2|1 2) must be used with these macros to</font>
00161 <font class="comment"> * get the right nonredundant integrals.</font>
00162 <font class="comment"> */</font>
00163 <font class="preprocessor">#define INT_MAX1(n1) ((n1)-1)</font>
00164 <font class="preprocessor"></font><font class="preprocessor">#define INT_MAX2(e12,i,n2) ((e12)?(i):((n2)-1))</font>
00165 <font class="preprocessor"></font><font class="preprocessor">#define INT_MAX3(e13e24,i,n3) ((e13e24)?(i):((n3)-1))</font>
00166 <font class="preprocessor"></font><font class="preprocessor">#define INT_MAX4(e13e24,e34,i,j,k,n4) \</font>
00167 <font class="preprocessor">  ((e34)?(((e13e24)&amp;&amp;((k)==(i)))?(j):(k)) \</font>
00168 <font class="preprocessor">        :((e13e24)&amp;&amp;((k)==(i)))?(j):(n4)-1)</font>
00169 <font class="preprocessor"></font><font class="comment">/* A note on integral symmetries:</font>
00170 <font class="comment"> *  There are 15 ways of having equivalent indices.</font>
00171 <font class="comment"> *  There are 8 of these which are important for determining the</font>
00172 <font class="comment"> *  nonredundant integrals (that is there are only 8 ways of counting</font>
00173 <font class="comment"> *  the number of nonredundant integrals in a shell quartet)</font>
00174 <font class="comment"> * Integral type   Integral    Counting Type</font>
00175 <font class="comment"> *     1           (1 2|3 4)      1</font>
00176 <font class="comment"> *     2           (1 1|3 4)      2</font>
00177 <font class="comment"> *     3           (1 2|1 4)       -&gt;1</font>
00178 <font class="comment"> *     4           (1 2|3 1)       -&gt;1</font>
00179 <font class="comment"> *     5           (1 1|1 4)      3</font>
00180 <font class="comment"> *     6           (1 1|3 1)       -&gt;2</font>
00181 <font class="comment"> *     7           (1 2|1 1)       -&gt;5</font>
00182 <font class="comment"> *     8           (1 1|1 1)      4</font>
00183 <font class="comment"> *     9           (1 2|2 4)       -&gt;1</font>
00184 <font class="comment"> *    10           (1 2|3 2)       -&gt;1</font>
00185 <font class="comment"> *    11           (1 2|3 3)      5</font>
00186 <font class="comment"> *    12           (1 1|3 3)      6</font>
00187 <font class="comment"> *    13           (1 2|1 2)      7</font>
00188 <font class="comment"> *    14           (1 2|2 1)      8    reduces to 7 thru canonicalization</font>
00189 <font class="comment"> *    15           (1 2|2 2)       -&gt;5</font>
00190 <font class="comment"> */</font>
</div></pre><hr>
<address>
<small>

Generated at Mon Oct 14 14:16:37 2002 for <a
href="http://aros.ca.sandia.gov/~cljanss/mpqc">MPQC</a>
2.1.2 using the documentation package <a
href="http://www.stack.nl/~dimitri/doxygen/index.html">Doxygen</a>
1.2.5.

</small>
</address>
</body>
</html>