Psi4
gshell.h
Go to the documentation of this file.
1 /*
2  * @BEGIN LICENSE
3  *
4  * Psi4: an open-source quantum chemistry software package
5  *
6  * Copyright (c) 2007-2017 The Psi4 Developers.
7  *
8  * The copyrights for code used from other parties are included in
9  * the corresponding files.
10  *
11  * This file is part of Psi4.
12  *
13  * Psi4 is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU Lesser General Public License as published by
15  * the Free Software Foundation, version 3.
16  *
17  * Psi4 is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public License along
23  * with Psi4; if not, write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25  *
26  * @END LICENSE
27  */
28 
29 #ifndef _psi_src_lib_libmints_gshell_h_
30 #define _psi_src_lib_libmints_gshell_h_
31 
32 #include <cstdio>
33 #include <vector>
34 #include "psi4/libmints/vector3.h"
35 
36 namespace psi {
37 
38 class Vector3;
39 
43 };
44 
46  Cartesian = 0,
47  Pure = 1
48 };
49 
50 enum ShellType {
51  Gaussian = 0,
52  ECPType1 = 1,
54 };
55 
62 class ShellInfo
63 {
64 protected:
66  int l_;
68  int puream_;
70  std::vector<double> exp_;
72  std::vector<double> coef_;
74  std::vector<int> n_;
76  std::vector<double> erd_coef_;
79  std::vector<double> original_coef_;
83  int nc_;
86  int start_;
87 
94 
99  double primitive_normalization(int p);
103 
105  static const char *amtypes;
107  static const char *AMTYPES;
108 
109 public:
119  ShellInfo(int am,
120  const std::vector<double>& c,
121  const std::vector<double>& e,
122  const std::vector<int>& n,
123  int nc,
124  const Vector3& center,
125  int start);
126 
137  ShellInfo(int am,
138  const std::vector<double>& c,
139  const std::vector<double>& e,
140  GaussianType pure,
141  int nc,
142  const Vector3& center,
143  int start,
145 
147  void normalize_shell();
148  void erd_normalize_shell();
149 
151  ShellInfo copy();
152 
154  ShellInfo copy(int nc, const Vector3& c);
155 
157  ShellType shell_type() const { return shelltype_; }
159  int nprimitive() const;
161  int nfunction() const;
163  int ncartesian() const { return ncartesian_; }
165  int am() const { return l_; }
167  char amchar() const { return amtypes[l_]; }
169  char AMCHAR() const { return AMTYPES[l_]; }
171  bool is_cartesian() const { return !puream_; }
173  bool is_pure() const { return puream_; }
174 
176  const Vector3& center() const;
178  int ncenter() const { return nc_; }
179 
181  double exp(int prim) const { return exp_[prim]; }
183  double coef(int pi) const { return coef_[pi]; }
185  int nval(int pi) const { return n_[pi]; }
187  double erd_coef(int pi) const { return erd_coef_[pi]; }
189  double original_coef(int pi) const { return original_coef_[pi]; }
191  const std::vector<double>& exps() const { return exp_; }
193  const std::vector<double>& coefs() const { return coef_; }
195  const std::vector<double>& original_coefs() const { return original_coef_; }
196 
198  void print(std::string out) const;
199 
201  static double normalize(int l, int m, int n);
202 
204  int function_index() const { return start_; }
205  void set_function_index(int i) { start_ = i; }
206 
208  bool operator==(const ShellInfo& RHS)const;
209 
211  bool operator!=(const ShellInfo& RHS)const
212  {
213  return !(*this==RHS);
214  }
215 };
216 
217 
223 {
224 protected:
226  int l_;
228  int puream_;
230  const double* exp_;
232  const double* original_coef_;
234  const double* coef_;
236  const double* erd_coef_;
238  const int* n_;
239 
243  int nc_;
245  const double *center_;
247  int start_;
248 
257 
262  double primitive_normalization(int p);
266 
268  static const char *amtypes;
270  static const char *AMTYPES;
271 
272 public:
285  GaussianShell(ShellType shelltype,
286  int am,
287  int nprimitive,
288  const double *oc,
289  const double *c, const double *ec,
290  const double *e,
291  GaussianType pure,
292  int nc,
293  const double* center,
294  int start);
295 
307  GaussianShell(ShellType shelltype,
308  int am,
309  int nprimitive,
310  const double *oc,
311  const double *e,
312  const int *n,
313  GaussianType pure,
314  int nc,
315  const double* center,
316  int start);
319 
321  ShellType shell_type() const { return shelltype_; }
323  int nprimitive() const;
325  int nfunction() const;
327  int ncartesian() const { return ncartesian_; }
329  int am() const { return l_; }
331  char amchar() const { return amtypes[l_]; }
333  char AMCHAR() const { return AMTYPES[l_]; }
335  bool is_cartesian() const { return !puream_; }
337  bool is_pure() const { return puream_; }
338 
340  const double* center() const;
342  int ncenter() const { return nc_; }
344  int start() const { return start_; }
345 
347  double exp(int prim) const { return exp_[prim]; }
349  double coef(int pi) const { return coef_[pi]; }
351  double original_coef(int pi) const { return original_coef_[pi]; }
353  int nval(int pi) const { return n_[pi]; }
355  double erd_coef(int pi) const { return erd_coef_[pi]; }
357  const double* exps() const { return exp_; }
359  const double* coefs() const { return coef_; }
361  const double* original_coefs() const { return original_coef_; }
363  const double* erd_coefs() const { return erd_coef_; }
364 
366  void print(std::string out) const;
367 
369  int function_index() const { return start_; }
370  void set_function_index(int i) { start_ = i; }
371  double evaluate(double r, int l) const;
372 };
373 
374 }
375 
376 #endif
This class has the same behavior as GaussianShell, but implements everything using slower data struct...
Definition: gshell.h:62
int puream_
Flag for pure angular momentum.
Definition: gshell.h:228
int ncartesian_
How many cartesian functions? (1=s, 3=p, 6=d, ...)
Definition: gshell.h:250
double coef(int pi) const
Return coefficient of pi&#39;th primitive.
Definition: gshell.h:183
ShellType
Definition: gshell.h:50
const Vector3 & center() const
Returns the center of the Molecule this shell is on.
Definition: gshell.cc:200
static double normalize(int l, int m, int n)
Normalize the angular momentum component.
Definition: gshell.cc:195
std::vector< int > n_
R exponents, for ECP basis sets (of length nprimitives_)
Definition: gshell.h:74
std::vector< double > coef_
Contraction coefficients (of length nprimitives_)
Definition: gshell.h:72
double original_coef(int pi) const
Return unnormalized coefficient of pi&#39;th primitive.
Definition: gshell.h:351
void print(std::string out) const
Print out the shell.
Definition: gshell.cc:181
Vector3 center_
Atomic center number in the Molecule.
Definition: gshell.h:85
void contraction_normalization()
const double * coefs() const
Return coefficients.
Definition: gshell.h:359
const double * center() const
Returns the center of the Molecule this shell is on.
Definition: gshell.cc:289
const double * coef_
Contraction coefficients (of length nprimitives_)
Definition: gshell.h:234
int nfunction() const
Total number of basis functions.
Definition: gshell.cc:247
ShellInfo(int am, const std::vector< double > &c, const std::vector< double > &e, const std::vector< int > &n, int nc, const Vector3 &center, int start)
Definition: gshell.cc:40
bool operator!=(const ShellInfo &RHS) const
True if any part of the two ShellInfo instances is unequal.
Definition: gshell.h:211
void erd_normalize_shell()
Definition: gshell.cc:108
ShellType shelltype_
The type of shell this object encodes.
Definition: gshell.h:81
Definition: gshell.h:53
double exp(int prim) const
Returns the exponent of the given primitive.
Definition: gshell.h:181
int function_index() const
Basis function index where this shell starts.
Definition: gshell.h:369
Definition: vector3.h:37
Definition: pointgrp.h:106
bool operator==(const ShellInfo &RHS) const
True if two ShellInfo instances are exactly equal.
Definition: gshell.cc:209
int am() const
The angular momentum of the given contraction.
Definition: gshell.h:329
void contraction_normalization()
Definition: gshell.cc:135
int nfunction_
Definition: gshell.h:93
void normalize_shell()
Definition: gshell.cc:160
bool is_pure() const
Returns true if contraction is pure.
Definition: gshell.h:337
int puream_
Flag for pure angular momentum.
Definition: gshell.h:68
static const char * amtypes
Definition: gshell.h:268
bool is_cartesian() const
Returns true if contraction is Cartesian.
Definition: gshell.h:335
ShellInfo copy()
Make a copy of the ShellInfo.
Definition: gshell.cc:85
void set_function_index(int i)
Definition: gshell.h:205
bool is_pure() const
Returns true if contraction is pure.
Definition: gshell.h:173
int ncenter() const
Returns the atom number this shell is on. Used by integral derivatives for indexing.
Definition: gshell.h:178
int start_
First basis function in this shell.
Definition: gshell.h:247
char AMCHAR() const
The character symbol for the angular momentum of the given contraction (upper case) ...
Definition: gshell.h:169
int am() const
The angular momentum of the given contraction.
Definition: gshell.h:165
const double * erd_coefs() const
Return ERD normalized coefficients.
Definition: gshell.h:363
double primitive_normalization(int p)
Definition: gshell.h:46
double erd_coef(int pi) const
Return unnormalized coefficient of pi&#39;th primitive.
Definition: gshell.h:355
ShellType shell_type() const
The type of shell this object encodes information for.
Definition: gshell.h:321
static const char * AMTYPES
Definition: gshell.h:107
const std::vector< double > & exps() const
Returns the exponent of the given primitive.
Definition: gshell.h:191
Definition: gshell.h:52
int ncenter() const
Returns the atom number this shell is on. Used by integral derivatives for indexing.
Definition: gshell.h:342
Definition: gshell.h:41
const std::vector< double > & original_coefs() const
Return unnormalized coefficient of pi&#39;th primitive and ci&#39;th contraction.
Definition: gshell.h:195
Definition: gshell.h:47
std::vector< double > original_coef_
Definition: gshell.h:79
char amchar() const
The character symbol for the angular momentum of the given contraction.
Definition: gshell.h:331
void print(std::string out) const
Print out the shell.
Definition: gshell.cc:257
int l_
Angular momentum.
Definition: gshell.h:226
static const char * AMTYPES
Definition: gshell.h:270
double erd_coef(int pi) const
Return ERD normalized coefficient of pi&#39;th primitive.
Definition: gshell.h:187
ShellType shelltype_
The type of shell this structure encodes.
Definition: gshell.h:241
static const char * amtypes
Definition: gshell.h:105
Definition: gshell.h:51
int nval(int pi) const
Return the pi&#39;th r exponent for ECPs.
Definition: gshell.h:353
ShellType shell_type() const
The type of shell this object encodes information for.
Definition: gshell.h:157
Gaussian orbital shell.
Definition: gshell.h:222
GaussianType
Definition: gshell.h:45
int nc_
Atom number this shell goes to. Needed when indexing integral derivatives.
Definition: gshell.h:243
const double * center_
Atomic coordinates of this center.
Definition: gshell.h:245
const int * n_
R exponents for ECPs (of length nprimitives_)
Definition: gshell.h:238
GaussianShell()
Builds and empty GShell.
Definition: gshell.h:318
char amchar() const
The character symbol for the angular momentum of the given contraction.
Definition: gshell.h:167
int function_index() const
Basis function index where this shell starts.
Definition: gshell.h:204
int nprimitive_
The number of primitives in this shell.
Definition: gshell.h:252
const std::vector< double > & coefs() const
Return coefficient of pi&#39;th primitive and ci&#39;th contraction.
Definition: gshell.h:193
PrimitiveType
Definition: gshell.h:40
double exp(int prim) const
Returns the exponent of the given primitive.
Definition: gshell.h:347
double evaluate(double r, int l) const
Definition: gshell.cc:277
int start() const
Returns the first basis function in this shell.
Definition: gshell.h:344
int nfunction() const
Total number of basis functions.
Definition: gshell.cc:171
double original_coef(int pi) const
Return unnormalized coefficient of pi&#39;th primitive.
Definition: gshell.h:189
const double * exp_
Exponents (of length nprimitives_)
Definition: gshell.h:230
int nc_
Atom number this shell goes to. Needed when indexing integral derivatives.
Definition: gshell.h:83
int start_
Definition: gshell.h:86
int nfunction_
Definition: gshell.h:256
Definition: gshell.h:42
int l_
Angular momentum.
Definition: gshell.h:66
std::vector< double > exp_
Exponents (of length nprimitives_)
Definition: gshell.h:70
double primitive_normalization(int p)
Definition: gshell.cc:99
void set_function_index(int i)
Definition: gshell.h:370
const double * erd_coef_
Contraction coefficients normalized for the ERD integral package (of length nprimitives_) ...
Definition: gshell.h:236
int nprimitive() const
The number of primitive Gaussians.
Definition: gshell.cc:252
char AMCHAR() const
The character symbol for the angular momentum of the given contraction (upper case) ...
Definition: gshell.h:333
double coef(int pi) const
Return coefficient of pi&#39;th primitive.
Definition: gshell.h:349
int nval(int pi) const
Return r exponent for pi&#39;th ECP primitive.
Definition: gshell.h:185
std::vector< double > erd_coef_
ERD normalized contraction coefficients (of length nprimitives_)
Definition: gshell.h:76
const double * original_coef_
Original (un-normalized) contraction coefficients (of length nprimitives)
Definition: gshell.h:232
bool is_cartesian() const
Returns true if contraction is Cartesian.
Definition: gshell.h:171
const double * exps() const
Returns the exponents.
Definition: gshell.h:357
int ncartesian_
How many cartesian functions? (1=s, 3=p, 6=d, ...)
Definition: gshell.h:89
int ncartesian() const
Total number of functions if this shell was Cartesian.
Definition: gshell.h:327
const double * original_coefs() const
Return unnormalized coefficients.
Definition: gshell.h:361
int ncartesian() const
Total number of functions if this shell was Cartesian.
Definition: gshell.h:163
int nprimitive() const
The number of primitive Gaussians.
Definition: gshell.cc:176