[0b990d] | 1 | //
|
---|
| 2 | // gaussshell.h
|
---|
| 3 | //
|
---|
| 4 | // Copyright (C) 1996 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_gaussshell_h
|
---|
| 29 | #define _chemistry_qc_basis_gaussshell_h
|
---|
| 30 |
|
---|
| 31 | #ifdef __GNUC__
|
---|
| 32 | #pragma interface
|
---|
| 33 | #endif
|
---|
| 34 |
|
---|
| 35 | #include <iostream>
|
---|
| 36 | #include <util/state/state.h>
|
---|
| 37 | #include <math/scmat/vector3.h>
|
---|
| 38 | #include <util/keyval/keyval.h>
|
---|
| 39 |
|
---|
| 40 | namespace sc {
|
---|
| 41 |
|
---|
| 42 | class CartesianIter;
|
---|
| 43 | class SphericalTransformIter;
|
---|
| 44 | class Integral;
|
---|
| 45 |
|
---|
| 46 | /// A Gaussian orbital shell.
|
---|
| 47 | class GaussianShell: public SavableState
|
---|
| 48 | {
|
---|
| 49 | public:
|
---|
| 50 | enum PrimitiveType { Normalized, Unnormalized };
|
---|
| 51 | enum GaussianType { Cartesian, Pure };
|
---|
| 52 | private:
|
---|
| 53 | int nprim;
|
---|
| 54 | int ncon;
|
---|
| 55 | int* l;
|
---|
| 56 | int* puream;
|
---|
| 57 | double* exp;
|
---|
| 58 | double** coef; // contraction coefficients for unnormalized primitives
|
---|
| 59 |
|
---|
| 60 | // computed data:
|
---|
| 61 | int nfunc;
|
---|
| 62 | int min_am_;
|
---|
| 63 | int max_am_;
|
---|
| 64 | int ncart_;
|
---|
| 65 | int has_pure_;
|
---|
| 66 | void init_computed_data();
|
---|
| 67 |
|
---|
| 68 | double shell_normalization(int);
|
---|
| 69 | void convert_coef();
|
---|
| 70 | void normalize_shell();
|
---|
| 71 | PrimitiveType keyval_init(const Ref<KeyVal>&,int,int);
|
---|
| 72 | static const char* amtypes;
|
---|
| 73 | static const char* AMTYPES;
|
---|
| 74 |
|
---|
| 75 | int test_monobound(double &r, double &bound) const;
|
---|
| 76 | public:
|
---|
| 77 | /** A GaussianShell constructor.
|
---|
| 78 | Users of GaussianShell must pass pointers to newed memory that is kept
|
---|
| 79 | by GaussianShell and deleted by the destructor.
|
---|
| 80 | The arguments for the following ctor are:
|
---|
| 81 | <ul>
|
---|
| 82 | <li> ncn is the number of contracted functions
|
---|
| 83 | (1 except for SP and gen. con.)
|
---|
| 84 | <li> nprm is the number of primitives
|
---|
| 85 | <li> e gives the exponents (length nprm)
|
---|
| 86 | <li> am gives the angular momentum (length ncn)
|
---|
| 87 | <li> pure is 1 for pure am and 0 for cartesian (length ncn)
|
---|
| 88 | <li> c are the contraction coefficients (length ncn by nprm)
|
---|
| 89 | <li> pt describes whether the primitive functions are to be
|
---|
| 90 | considered normalized or unnormalized. This effects whether
|
---|
| 91 | or not c is manipulated to give the correct normalization.
|
---|
| 92 | <li> If do_normalize_shell is true (the default), then the
|
---|
| 93 | shell normalization constants will be folded into the
|
---|
| 94 | coefficients.
|
---|
| 95 | </ul>
|
---|
| 96 | */
|
---|
| 97 | GaussianShell(
|
---|
| 98 | int ncn,
|
---|
| 99 | int nprm,
|
---|
| 100 | double* e,
|
---|
| 101 | int* am,
|
---|
| 102 | int* pure,
|
---|
| 103 | double** c,
|
---|
| 104 | PrimitiveType pt = GaussianShell::Normalized,
|
---|
| 105 | bool do_normalize_shell = true);
|
---|
| 106 | /** A GaussianShell constructor. In this ctor pure is either
|
---|
| 107 | GaussianShell::Cartesian or Gaussian::Pure and all of the contracted
|
---|
| 108 | functions are treated in that way. (The user doesn\'t need to compute
|
---|
| 109 | generate a int*pure vector in this case.) */
|
---|
| 110 | GaussianShell(
|
---|
| 111 | int ncn,
|
---|
| 112 | int nprm,
|
---|
| 113 | double* e,
|
---|
| 114 | int* am,
|
---|
| 115 | GaussianType pure,
|
---|
| 116 | double** c,
|
---|
| 117 | PrimitiveType pt = GaussianShell::Normalized);
|
---|
| 118 | /// Construct a GaussianShell from KeyVal input.
|
---|
| 119 | GaussianShell(const Ref<KeyVal>&);
|
---|
| 120 | /// Restore a GaussianShell from a StateIn object.
|
---|
| 121 | GaussianShell(StateIn&);
|
---|
| 122 | /** Construct a GaussianShell from KeyVal input. If pure
|
---|
| 123 | is nonzero Cartesian functions will be used, otherwise,
|
---|
| 124 | solid harmonics will be used. */
|
---|
| 125 | GaussianShell(const Ref<KeyVal>&,int pure);
|
---|
| 126 | ~GaussianShell();
|
---|
| 127 | void save_data_state(StateOut&);
|
---|
| 128 | /// The number of primitive Gaussian shells.
|
---|
| 129 | int nprimitive() const { return nprim; }
|
---|
| 130 | /// The number of contractions formed from the primitives.
|
---|
| 131 | int ncontraction() const { return ncon; }
|
---|
| 132 | /// The number of basis functions.
|
---|
| 133 | int nfunction() const { return nfunc; }
|
---|
| 134 | /// The maximum angular momentum in the shell.
|
---|
| 135 | int max_angular_momentum() const { return max_am_; }
|
---|
| 136 | /// The minimum angular momentum in the shell.
|
---|
| 137 | int min_angular_momentum() const { return min_am_; }
|
---|
| 138 | /// The maximum number of Cartesian functions in any contraction.
|
---|
| 139 | int max_cartesian() const;
|
---|
| 140 | /// The angular momentum of the given contraction.
|
---|
| 141 | int am(int con) const { return l[con]; }
|
---|
| 142 | /// The maximum angular momentum of any contraction.
|
---|
| 143 | int max_am() const { return max_am_; }
|
---|
| 144 | /// The minimum angular momentum of any contraction.
|
---|
| 145 | int min_am() const { return min_am_; }
|
---|
| 146 | /// The character symbol for the angular momentum of the given contraction.
|
---|
| 147 | char amchar(int con) const { return amtypes[l[con]]; }
|
---|
| 148 | /// The number of basis functions coming from the given contraction.
|
---|
| 149 | int nfunction(int con) const;
|
---|
| 150 | /// The total number of functions if this shell was Cartesian.
|
---|
| 151 | int ncartesian() const { return ncart_; }
|
---|
| 152 | /** The total number of Cartesian functions if this shift is applied to
|
---|
| 153 | all of the angular momentums. */
|
---|
| 154 | int ncartesian_with_aminc(int aminc) const;
|
---|
| 155 | /// The number of Cartesian functions for the given contraction.
|
---|
| 156 | int ncartesian(int con) const { return ((l[con]+2)*(l[con]+1))>>1; }
|
---|
| 157 | /// Returns nonzero if contraction con is Cartesian.
|
---|
| 158 | int is_cartesian(int con) const { return !puream[con]; }
|
---|
| 159 | /// Returns nonzero if contraction con is solid harmonics.
|
---|
| 160 | int is_pure(int con) const { return puream[con]; }
|
---|
| 161 | /// Returns nonzero if any contraction is solid harmonics.
|
---|
| 162 | int has_pure() const { return has_pure_; }
|
---|
| 163 | /// Returns the contraction coef for unnormalized primitives.
|
---|
| 164 | double coefficient_unnorm(int con,int prim) const {return coef[con][prim];}
|
---|
| 165 | /// Returns the contraction coef for normalized primitives.
|
---|
| 166 | double coefficient_norm(int con,int prim) const;
|
---|
| 167 | /// Returns the exponent of the given primitive.
|
---|
| 168 | double exponent(int iprim) const { return exp[iprim]; }
|
---|
| 169 |
|
---|
| 170 | /** Compute the values for this shell at position r. The
|
---|
| 171 | basis_values argument must be vector of length nfunction(). */
|
---|
| 172 | int values(CartesianIter **, SphericalTransformIter **,
|
---|
| 173 | const SCVector3& r, double* basis_values);
|
---|
| 174 | /** Like values(...), but computes gradients of the basis function
|
---|
| 175 | values, too. */
|
---|
| 176 | int grad_values(CartesianIter **, SphericalTransformIter **,
|
---|
| 177 | const SCVector3& R,
|
---|
| 178 | double* g_values,
|
---|
| 179 | double* basis_values=0) const;
|
---|
| 180 | /** Like values(...), but computes first and second derivatives of the
|
---|
| 181 | basis function values, too. */
|
---|
| 182 | int hessian_values(CartesianIter **, SphericalTransformIter **,
|
---|
| 183 | const SCVector3& R,
|
---|
| 184 | double* h_values, double* g_values=0,
|
---|
| 185 | double* basis_values=0) const;
|
---|
| 186 |
|
---|
| 187 | /** Returns the intra-generalized-contraction overlap
|
---|
| 188 | matrix element <con func1|con func2> within an arbitrary
|
---|
| 189 | constant for the shell. */
|
---|
| 190 | double relative_overlap(const Ref<Integral>&,
|
---|
| 191 | int con, int func1, int func2) const;
|
---|
| 192 | /** Returns the intra-generalized-contraction overlap matrix element
|
---|
| 193 | <con func1|con func2> within an arbitrary constant for the shell.
|
---|
| 194 | func1 and func2 are determined according to the axis exponents, a1,
|
---|
| 195 | b1, c1, a2, b2, and c2. */
|
---|
| 196 | double relative_overlap(int con,
|
---|
| 197 | int a1, int b1, int c1,
|
---|
| 198 | int a2, int b2, int c2) const;
|
---|
| 199 |
|
---|
| 200 | /// Returns true if this and the argument are equivalent.
|
---|
| 201 | int equiv(const GaussianShell *s);
|
---|
| 202 |
|
---|
| 203 | /** Returns a radius. All functions in the shell are below
|
---|
| 204 | threshold outside this radius. */
|
---|
| 205 | double extent(double threshold) const;
|
---|
| 206 |
|
---|
| 207 | /** Returns a bound for the basis function. This bound
|
---|
| 208 | is defined so that it is positive and monotonically
|
---|
| 209 | decreasing as a function of r. */
|
---|
| 210 | double monobound(double r) const;
|
---|
| 211 |
|
---|
| 212 | void print(std::ostream& =ExEnv::out0()) const;
|
---|
| 213 | };
|
---|
| 214 |
|
---|
| 215 | }
|
---|
| 216 |
|
---|
| 217 | #endif
|
---|
| 218 |
|
---|
| 219 | // Local Variables:
|
---|
| 220 | // mode: c++
|
---|
| 221 | // c-file-style: "CLJ"
|
---|
| 222 | // End:
|
---|