[0b990d] | 1 | //
|
---|
| 2 | // sobasis.h --- definition of the Integral class
|
---|
| 3 | //
|
---|
| 4 | // Copyright (C) 1998 Limit Point Systems, Inc.
|
---|
| 5 | //
|
---|
| 6 | // Author: Curtis Janssen <cljanss@limitpt.com>
|
---|
| 7 | // Maintainer: LPS
|
---|
| 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_basis_sobasis_h
|
---|
| 29 | #define _chemistry_qc_basis_sobasis_h
|
---|
| 30 |
|
---|
| 31 | #ifdef __GNUC__
|
---|
| 32 | #pragma interface
|
---|
| 33 | #endif
|
---|
| 34 |
|
---|
| 35 | #include <chemistry/qc/basis/basis.h>
|
---|
| 36 |
|
---|
| 37 | namespace sc {
|
---|
| 38 |
|
---|
| 39 | /** SOTransformShell describes how an AO function contributes to an SO
|
---|
| 40 | function in a particular SO shell. */
|
---|
| 41 | class SOTransformFunction {
|
---|
| 42 | public:
|
---|
| 43 | /// The coefficient of the AO.
|
---|
| 44 | double coef;
|
---|
| 45 | /// The AO function number.
|
---|
| 46 | int aofunc;
|
---|
| 47 | /// The SO function number.
|
---|
| 48 | int sofunc;
|
---|
| 49 | /// The SO function's irrep.
|
---|
| 50 | int irrep;
|
---|
| 51 | };
|
---|
| 52 |
|
---|
| 53 | /** SOTransformShell maintains a list of AO functions contribute to an SO
|
---|
| 54 | function in a particular SO shell. The information is stored in
|
---|
| 55 | objects of type SOTransformFunction. */
|
---|
| 56 | class SOTransformShell {
|
---|
| 57 | public:
|
---|
| 58 | /// The number of the AO shell from which these functions come.
|
---|
| 59 | int aoshell;
|
---|
| 60 | /// The number of AO/SO function pairs contributing.
|
---|
| 61 | int nfunc;
|
---|
| 62 | /// The array of SOTransformFunction objects describing the transform.
|
---|
| 63 | SOTransformFunction *func;
|
---|
| 64 | SOTransformShell();
|
---|
| 65 | ~SOTransformShell();
|
---|
| 66 | /// Add another function to the transform.
|
---|
| 67 | void add_func(int irrep, double coef, int aofunc, int sofunc);
|
---|
| 68 | };
|
---|
| 69 |
|
---|
| 70 | /** SOTransform maintains a list of AO shells that are be used
|
---|
| 71 | to compute the SO. The information is stored in objects of
|
---|
| 72 | type SOTransformShell. */
|
---|
| 73 | class SOTransform {
|
---|
| 74 | public:
|
---|
| 75 | int naoshell_allocated;
|
---|
| 76 | /// The number of AO shells that make up this SO shell.
|
---|
| 77 | int naoshell;
|
---|
| 78 | /// The SOTransformShell object for each AO.
|
---|
| 79 | SOTransformShell *aoshell;
|
---|
| 80 | SOTransform();
|
---|
| 81 | ~SOTransform();
|
---|
| 82 | void set_naoshell(int n);
|
---|
| 83 | /// Adds another term to the transform.
|
---|
| 84 | void add_transform(int aoshell, int irrep,
|
---|
| 85 | double coef, int aofunc, int sofunc);
|
---|
| 86 | };
|
---|
| 87 |
|
---|
| 88 | /** A SOBasis object describes the transformation from an atomic orbital
|
---|
| 89 | basis to a symmetry orbital basis. */
|
---|
| 90 | class SOBasis : public RefCount {
|
---|
| 91 | protected:
|
---|
| 92 | Ref<GaussianBasisSet> basis_;
|
---|
| 93 | int nshell_;
|
---|
| 94 | int nirrep_;
|
---|
| 95 | int *ncomp_;
|
---|
| 96 | int **nfunc_;
|
---|
| 97 | int *naofunc_;
|
---|
| 98 | int **funcoff_;
|
---|
| 99 |
|
---|
| 100 | int *nfunc_in_irrep_;
|
---|
| 101 | int *func_;
|
---|
| 102 | int *irrep_;
|
---|
| 103 | int *func_within_irrep_;
|
---|
| 104 |
|
---|
| 105 | SOTransform *trans_;
|
---|
| 106 |
|
---|
| 107 | public:
|
---|
| 108 | /// Create an SOBasis object given a GaussianBasisSet and Integral objects.
|
---|
| 109 | SOBasis(const Ref<GaussianBasisSet> &, const Ref<Integral>&);
|
---|
| 110 | ~SOBasis();
|
---|
| 111 |
|
---|
| 112 | /// Return the number of shells.
|
---|
| 113 | int nshell() const { return nshell_; }
|
---|
| 114 | /// Return the number of irreps.
|
---|
| 115 | int nirrep() const { return nirrep_; }
|
---|
| 116 | int ncomponent(int iirrep) const { return ncomp_[iirrep]; }
|
---|
| 117 | /// Return the number of functions in the given irrep.
|
---|
| 118 | int nfunction_in_irrep(int irrep) const { return nfunc_in_irrep_[irrep]; }
|
---|
| 119 | /// Return the offset for the first function of the given irrep.
|
---|
| 120 | int function_offset_for_irrep(int irrep) const;
|
---|
| 121 | /// Return the number of functions in the given shell.
|
---|
| 122 | int nfunction(int ishell) const;
|
---|
| 123 | /** Return the number of functions in the AO shell that make up
|
---|
| 124 | the given SO shell. */
|
---|
| 125 | int naofunction(int ishell) const { return naofunc_[ishell]; }
|
---|
| 126 | /// Returns the number of functions in the shell in a given irrep.
|
---|
| 127 | int nfunction(int ishell, int iirrep) const;
|
---|
| 128 | /** Returns the maximum number of functions in a shell (summed over all
|
---|
| 129 | irreps) */
|
---|
| 130 | int max_nfunction_in_shell() const;
|
---|
| 131 | /** Normally, SO shell numbering starts at zero within each irrep.
|
---|
| 132 | This returns an offset to make SO shell numbers unique within the
|
---|
| 133 | shell. */
|
---|
| 134 | int function_offset_within_shell(int ishell, int iirrep) const;
|
---|
| 135 |
|
---|
| 136 | /** Convert the SO shell number to the overall number of the first
|
---|
| 137 | function within that shell. */
|
---|
| 138 | int function(int ishell);
|
---|
| 139 |
|
---|
| 140 | /// Convert SO shell and function number within shell to irrep.
|
---|
| 141 | int irrep(int ishell, int ifunc) const;
|
---|
| 142 | /// Convert SO shell and function number to number within irrep.
|
---|
| 143 | int function_within_irrep(int ishell, int ifunc) const;
|
---|
| 144 |
|
---|
| 145 | /// Return the SOTransform object for the given shell.
|
---|
| 146 | const SOTransform &trans(int i) const { return trans_[i]; }
|
---|
| 147 |
|
---|
| 148 | void print(std::ostream &o=ExEnv::out0()) const;
|
---|
| 149 | };
|
---|
| 150 |
|
---|
| 151 |
|
---|
| 152 | inline int
|
---|
| 153 | SOBasis::function(int ishell)
|
---|
| 154 | {
|
---|
| 155 | return func_[ishell];
|
---|
| 156 | }
|
---|
| 157 |
|
---|
| 158 | inline int
|
---|
| 159 | SOBasis::irrep(int ishell, int ifunc) const
|
---|
| 160 | {
|
---|
| 161 | return irrep_[func_[ishell]+ifunc];
|
---|
| 162 | }
|
---|
| 163 |
|
---|
| 164 | inline int
|
---|
| 165 | SOBasis::function_offset_for_irrep(int irrep) const
|
---|
| 166 | {
|
---|
| 167 | int r = 0;
|
---|
| 168 | for (int i=0; i<irrep; i++) {
|
---|
| 169 | r += nfunc_in_irrep_[i];
|
---|
| 170 | }
|
---|
| 171 | return r;
|
---|
| 172 | }
|
---|
| 173 |
|
---|
| 174 | inline int
|
---|
| 175 | SOBasis::function_within_irrep(int ishell, int ifunc) const
|
---|
| 176 | {
|
---|
| 177 | return func_within_irrep_[func_[ishell]+ifunc];
|
---|
| 178 | }
|
---|
| 179 |
|
---|
| 180 | inline int
|
---|
| 181 | SOBasis::nfunction(int ishell, int iirrep) const
|
---|
| 182 | {
|
---|
| 183 | return nfunc_[ishell][iirrep];
|
---|
| 184 | }
|
---|
| 185 |
|
---|
| 186 | inline int
|
---|
| 187 | SOBasis::function_offset_within_shell(int ishell, int iirrep) const
|
---|
| 188 | {
|
---|
| 189 | return funcoff_[ishell][iirrep];
|
---|
| 190 | }
|
---|
| 191 |
|
---|
| 192 | }
|
---|
| 193 |
|
---|
| 194 | #endif
|
---|
| 195 |
|
---|
| 196 | // Local Variables:
|
---|
| 197 | // mode: c++
|
---|
| 198 | // c-file-style: "CLJ"
|
---|
| 199 | // End:
|
---|