MPQC  2.3.1
gaussbas.h
1 //
2 // gaussbas.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_gaussbas_h
29 #define _chemistry_qc_basis_gaussbas_h
30 
31 #ifdef __GNUC__
32 #pragma interface
33 #endif
34 
35 #include <vector>
36 #include <iostream>
37 
38 #include <util/state/state.h>
39 #include <util/keyval/keyval.h>
40 #include <math/scmat/matrix.h>
41 #include <math/scmat/vector3.h>
42 #include <chemistry/molecule/molecule.h>
43 
44 namespace sc {
45 
46 class GaussianShell;
47 class BasisFileSet;
48 class Integral;
49 
50 class CartesianIter;
51 class SphericalTransformIter;
52 
146 {
147  private:
148  // nonnull if keyword "name" was provided
149  char* name_;
150  // same as name_ if name_!=0, else something else
151  char* label_;
152  GaussianShell** shell_;
153  std::vector<int> shell_to_function_;
154  std::vector<int> function_to_shell_;
155 
156  Ref<Molecule> molecule_;
157 
158  Ref<SCMatrixKit> matrixkit_;
159  Ref<SCMatrixKit> so_matrixkit_;
160  RefSCDimension basisdim_;
161 
162  int ncenter_;
163 
164  std::vector<int> shell_to_center_;
165  std::vector<int> shell_to_primitive_;
166  std::vector<int> center_to_shell_;
167  std::vector<int> center_to_nshell_;
168  std::vector<int> center_to_nbasis_;
169 
170  int nshell_;
171  int nbasis_;
172  int nprim_;
173  bool has_pure_;
174 
175  GaussianBasisSet(const char* name, const char* label, const Ref<Molecule>& molecule,
177  const RefSCDimension& basisdim,
178  const int ncenter, const int nshell,
180  const std::vector<int>& center_to_nshell);
181 
182  // Counts shells in this basis for this chemical element
183  int count_shells_(Ref<KeyVal>& keyval, const char* elemname, const char* sbasisname, BasisFileSet& bases,
184  int havepure, int pure, bool missing_ok);
185  // Constructs this basis
186  void get_shells_(int& ishell, Ref<KeyVal>& keyval, const char* elemname, const char* sbasisname, BasisFileSet& bases,
187  int havepure, int pure, bool missing_ok);
188  // Counts shells in an even-tempered primitive basis
189  int count_even_temp_shells_(Ref<KeyVal>& keyval, const char* elemname, const char* sbasisname,
190  int havepure, int pure);
191  // Constructs an even-tempered primitive basis
192  void get_even_temp_shells_(int& ishell, Ref<KeyVal>& keyval, const char* elemname, const char* sbasisname,
193  int havepure, int pure);
194  // Constructs basis set specified as an array of shells
195  void recursively_get_shell(int&,Ref<KeyVal>&,
196  const char*,const char*,BasisFileSet&,
197  int,int,int,bool missing_ok);
198 
199  void init(Ref<Molecule>&,Ref<KeyVal>&,
200  BasisFileSet&,
201  int have_userkeyval,
202  int pure);
203  void init2(int skip_ghosts=0,bool include_q=0);
204 
205  protected:
207  virtual void set_matrixkit(const Ref<SCMatrixKit>&);
208 
209  public:
211  class ValueData {
212  protected:
213  CartesianIter **civec_;
214  SphericalTransformIter **sivec_;
215  int maxam_;
216  public:
218  ~ValueData();
219  CartesianIter **civec() { return civec_; }
220  SphericalTransformIter **sivec() { return sivec_; }
221  };
222 
224  enum UnitType {Unit};
225 
388  virtual ~GaussianBasisSet();
389 
395 
396  void save_data_state(StateOut&);
397 
399  const char* name() const { return name_; }
403  const char* label() const { if (name()) { return name(); } else { return label_; } }
404 
406  Ref<Molecule> molecule() const { return molecule_; }
408  Ref<SCMatrixKit> matrixkit() { return matrixkit_; }
410  Ref<SCMatrixKit> so_matrixkit() { return so_matrixkit_; }
412  RefSCDimension basisdim() { return basisdim_; }
413 
415  int ncenter() const;
417  int nshell() const { return nshell_; }
419  int nshell_on_center(int icenter) const;
422  int shell_on_center(int icenter, int shell) const;
424  int shell_to_center(int ishell) const { return shell_to_center_[ishell]; }
426  int shell_to_primitive(int ishell) const {return shell_to_primitive_[ishell]; }
428  int nbasis() const { return nbasis_; }
430  int nbasis_on_center(int icenter) const;
432  int nprimitive() const { return nprim_; }
434  int has_pure() const { return has_pure_; }
435 
437  int max_nfunction_in_shell() const;
440  int max_ncartesian_in_shell(int aminc=0) const;
442  int max_nprimitive_in_shell() const;
444  int max_angular_momentum() const;
446  int max_ncontraction() const;
449  int max_am_for_contraction(int con) const;
451  int max_cartesian() const;
452 
454  int shell_to_function(int i) const { return shell_to_function_[i]; }
456  int function_to_shell(int i) const;
457 
459  const GaussianShell& operator()(int i) const { return *shell_[i]; }
461  GaussianShell& operator()(int i) { return *shell_[i]; }
463  const GaussianShell& operator[](int i) const { return *shell_[i]; }
465  GaussianShell& operator[](int i) { return *shell_[i]; }
467  const GaussianShell& shell(int i) const { return *shell_[i]; }
469  GaussianShell& shell(int i) { return *shell_[i]; }
470 
472  const GaussianShell& operator()(int icenter,int ishell) const;
474  GaussianShell& operator()(int icenter,int ishell);
476  const GaussianShell& shell(int i,int j) const { return operator()(i,j); }
478  GaussianShell& shell(int i,int j) { return operator()(i,j); }
479 
482  double r(int icenter,int xyz) const;
483 
486  int values(const SCVector3& r, ValueData *, double* basis_values) const;
491  int grad_values(const SCVector3& r, ValueData *,
492  double*g_values,double* basis_values=0) const;
497  int hessian_values(const SCVector3& r, ValueData *, double *h_values,
498  double*g_values=0,double* basis_values=0) const;
501  int shell_values(const SCVector3& r, int sh,
502  ValueData *, double* basis_values) const;
506  int grad_shell_values(const SCVector3& r, int sh,
507  ValueData *,
508  double*g_values, double* basis_values=0) const;
512  int hessian_shell_values(const SCVector3& r, int sh,
513  ValueData *, double *h_values,
514  double*g_values=0,double* basis_values=0) const;
515 
517  int equiv(const Ref<GaussianBasisSet> &b);
518 
520  void print_brief(std::ostream& =ExEnv::out0()) const;
522  void print(std::ostream& =ExEnv::out0()) const;
523 };
524 
525 }
526 
527 #endif
528 
529 // Local Variables:
530 // mode: c++
531 // c-file-style: "CLJ"
532 // End:
sc::GaussianBasisSet::max_ncontraction
int max_ncontraction() const
Return the maximum number of Gaussians in a contraction in any shell.
sc::GaussianBasisSet::ncenter
int ncenter() const
Return the number of centers.
sc::GaussianBasisSet::max_nprimitive_in_shell
int max_nprimitive_in_shell() const
Return the maximum number of primitive Gaussian that any shell has.
sc::GaussianBasisSet::shell_to_center
int shell_to_center(int ishell) const
Return the center on which the given shell is located.
Definition: gaussbas.h:424
sc::GaussianBasisSet::has_pure
int has_pure() const
Return true if basis contains solid harmonics Gaussians.
Definition: gaussbas.h:434
sc::GaussianBasisSet::operator[]
GaussianShell & operator[](int i)
Return a reference to GaussianShell number i.
Definition: gaussbas.h:465
sc::CartesianIter
CartesianIter gives the ordering of the Cartesian functions within a shell for the particular integra...
Definition: cartiter.h:39
sc::Ref
A template class that maintains references counts.
Definition: ref.h:332
sc::GaussianBasisSet::hessian_shell_values
int hessian_shell_values(const SCVector3 &r, int sh, ValueData *, double *h_values, double *g_values=0, double *basis_values=0) const
Like values(...), but computes first and second derivatives of the shell function values,...
sc::GaussianBasisSet::nbasis_on_center
int nbasis_on_center(int icenter) const
Return the number of basis functions on the given center.
sc::GaussianBasisSet::shell
const GaussianShell & shell(int i) const
Return a reference to GaussianShell number i.
Definition: gaussbas.h:467
sc::GaussianBasisSet::print
void print(std::ostream &=ExEnv::out0()) const
Print a detailed description of the basis set.
sc::GaussianBasisSet::operator()
const GaussianShell & operator()(int i) const
Return a reference to GaussianShell number i.
Definition: gaussbas.h:459
sc::GaussianBasisSet::shell
GaussianShell & shell(int i, int j)
Return a reference to GaussianShell number j on center i.
Definition: gaussbas.h:478
sc::GaussianBasisSet::shell
GaussianShell & shell(int i)
Return a reference to GaussianShell number i.
Definition: gaussbas.h:469
sc::GaussianBasisSet::values
int values(const SCVector3 &r, ValueData *, double *basis_values) const
Compute the values for this basis set at position r.
sc::GaussianBasisSet::grad_shell_values
int grad_shell_values(const SCVector3 &r, int sh, ValueData *, double *g_values, double *basis_values=0) const
Like values(...), but computes gradients of the shell function values, too.
sc::SphericalTransformIter
This iterates through the components of a SphericalTransform.
Definition: chemistry/qc/basis/transform.h:138
sc::GaussianBasisSet::basisdim
RefSCDimension basisdim()
Returns the SCDimension object for the dimension.
Definition: gaussbas.h:412
sc::StateIn
Restores objects that derive from SavableState.
Definition: statein.h:70
sc::RefSCDimension
The RefSCDimension class is a smart pointer to an SCDimension specialization.
Definition: dim.h:156
sc::GaussianBasisSet::shell_values
int shell_values(const SCVector3 &r, int sh, ValueData *, double *basis_values) const
Compute the values for the given shell functions at position r.
sc::GaussianBasisSet::function_to_shell
int function_to_shell(int i) const
Return the shell to which the given function belongs.
sc::GaussianBasisSet::nbasis
int nbasis() const
Return the number of basis functions.
Definition: gaussbas.h:428
sc::GaussianBasisSet::label
const char * label() const
Return the label of the basis set.
Definition: gaussbas.h:403
sc::GaussianBasisSet::shell_to_primitive
int shell_to_primitive(int ishell) const
Return the overall index of the first primitive from the given shell.
Definition: gaussbas.h:426
sc::GaussianBasisSet::UnitType
UnitType
This can be given to a CTOR to construct a unit basis function.
Definition: gaussbas.h:224
sc::GaussianBasisSet::max_am_for_contraction
int max_am_for_contraction(int con) const
Return the maximum angular momentum found in the given contraction number for any shell.
sc::GaussianBasisSet::nprimitive
int nprimitive() const
Return the number of primitive Gaussians.
Definition: gaussbas.h:432
sc::GaussianBasisSet::max_nfunction_in_shell
int max_nfunction_in_shell() const
Return the maximum number of functions that any shell has.
sc::GaussianBasisSet::molecule
Ref< Molecule > molecule() const
Return the Molecule object.
Definition: gaussbas.h:406
sc::GaussianBasisSet::equiv
int equiv(const Ref< GaussianBasisSet > &b)
Returns true if this and the argument are equivalent.
sc::StateOut
Serializes objects that derive from SavableState.
Definition: stateout.h:61
sc::GaussianBasisSet::shell_on_center
int shell_on_center(int icenter, int shell) const
Return an overall shell number, given a center and the shell number on that center.
sc::GaussianBasisSet::save_data_state
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
sc::GaussianBasisSet::matrixkit
Ref< SCMatrixKit > matrixkit()
Returns the SCMatrixKit that is to be used for AO bases.
Definition: gaussbas.h:408
sc::GaussianBasisSet::operator()
GaussianShell & operator()(int i)
Return a reference to GaussianShell number i.
Definition: gaussbas.h:461
sc::GaussianBasisSet::max_cartesian
int max_cartesian() const
Return the maximum number of Cartesian functions in any shell.
sc::GaussianBasisSet::r
double r(int icenter, int xyz) const
The location of center icenter.
sc::GaussianBasisSet
The GaussianBasisSet class is used describe a basis set composed of atomic gaussian orbitals.
Definition: gaussbas.h:145
sc::SCVector3
Definition: vector3.h:45
sc::ExEnv::out0
static std::ostream & out0()
Return an ostream that writes from node 0.
sc::GaussianBasisSet::ValueData
This holds scratch data needed to compute basis function values.
Definition: gaussbas.h:211
sc::BasisFileSet
Definition: files.h:35
sc::GaussianBasisSet::so_matrixkit
Ref< SCMatrixKit > so_matrixkit()
Returns the SCMatrixKit that is to be used for SO bases.
Definition: gaussbas.h:410
sc::GaussianBasisSet::max_ncartesian_in_shell
int max_ncartesian_in_shell(int aminc=0) const
Return the maximum number of Cartesian functions that any shell has.
sc::GaussianBasisSet::shell
const GaussianShell & shell(int i, int j) const
Return a reference to GaussianShell number j on center i.
Definition: gaussbas.h:476
sc::GaussianBasisSet::grad_values
int grad_values(const SCVector3 &r, ValueData *, double *g_values, double *basis_values=0) const
Like values(...), but computes gradients of the basis function values, too.
sc::GaussianBasisSet::hessian_values
int hessian_values(const SCVector3 &r, ValueData *, double *h_values, double *g_values=0, double *basis_values=0) const
Like values(...), but computes first and second derivatives of the basis function values,...
sc::GaussianBasisSet::name
const char * name() const
Return the name of the basis set (is nonnull only if keyword "name" was provided)
Definition: gaussbas.h:399
sc::SavableState
Base class for objects that can save/restore state.
Definition: state.h:46
sc::GaussianBasisSet::max_angular_momentum
int max_angular_momentum() const
Return the highest angular momentum in any shell.
sc::GaussianBasisSet::operator[]
const GaussianShell & operator[](int i) const
Return a reference to GaussianShell number i.
Definition: gaussbas.h:463
sc::GaussianBasisSet::shell_to_function
int shell_to_function(int i) const
Return the number of the first function in the given shell.
Definition: gaussbas.h:454
sc::GaussianBasisSet::nshell_on_center
int nshell_on_center(int icenter) const
Return the number of shells on the given center.
sc::GaussianBasisSet::nshell
int nshell() const
Return the number of shells.
Definition: gaussbas.h:417
sc::GaussianBasisSet::operator+
Ref< GaussianBasisSet > operator+(const Ref< GaussianBasisSet > &B)
Returns a GaussianBasisSet object that consists of the basis functions for each atom in this followed...
sc::GaussianBasisSet::print_brief
void print_brief(std::ostream &=ExEnv::out0()) const
Print a brief description of the basis set.
sc::GaussianShell
A Gaussian orbital shell.
Definition: gaussshell.h:47

Generated at Sun Jan 26 2020 23:33:03 for MPQC 2.3.1 using the documentation package Doxygen 1.8.16.