MPQC 2.3.1
|
00001 // 00002 // gaussbas.h 00003 // 00004 // Copyright (C) 1996 Limit Point Systems, Inc. 00005 // 00006 // Author: Curtis Janssen <cljanss@limitpt.com> 00007 // Maintainer: LPS 00008 // 00009 // This file is part of the SC Toolkit. 00010 // 00011 // The SC Toolkit is free software; you can redistribute it and/or modify 00012 // it under the terms of the GNU Library General Public License as published by 00013 // the Free Software Foundation; either version 2, or (at your option) 00014 // any later version. 00015 // 00016 // The SC Toolkit is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 // GNU Library General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU Library General Public License 00022 // along with the SC Toolkit; see the file COPYING.LIB. If not, write to 00023 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 00024 // 00025 // The U.S. Government is granted a limited license as per AL 91-7. 00026 // 00027 00028 #ifndef _chemistry_qc_basis_gaussbas_h 00029 #define _chemistry_qc_basis_gaussbas_h 00030 00031 #ifdef __GNUC__ 00032 #pragma interface 00033 #endif 00034 00035 #include <vector> 00036 #include <iostream> 00037 00038 #include <util/state/state.h> 00039 #include <util/keyval/keyval.h> 00040 #include <math/scmat/matrix.h> 00041 #include <math/scmat/vector3.h> 00042 #include <chemistry/molecule/molecule.h> 00043 00044 namespace sc { 00045 00046 class GaussianShell; 00047 class BasisFileSet; 00048 class Integral; 00049 00050 class CartesianIter; 00051 class SphericalTransformIter; 00052 00145 class GaussianBasisSet: public SavableState 00146 { 00147 private: 00148 // nonnull if keyword "name" was provided 00149 char* name_; 00150 // same as name_ if name_!=0, else something else 00151 char* label_; 00152 GaussianShell** shell_; 00153 std::vector<int> shell_to_function_; 00154 std::vector<int> function_to_shell_; 00155 00156 Ref<Molecule> molecule_; 00157 00158 Ref<SCMatrixKit> matrixkit_; 00159 Ref<SCMatrixKit> so_matrixkit_; 00160 RefSCDimension basisdim_; 00161 00162 int ncenter_; 00163 00164 std::vector<int> shell_to_center_; 00165 std::vector<int> shell_to_primitive_; 00166 std::vector<int> center_to_shell_; 00167 std::vector<int> center_to_nshell_; 00168 std::vector<int> center_to_nbasis_; 00169 00170 int nshell_; 00171 int nbasis_; 00172 int nprim_; 00173 bool has_pure_; 00174 00175 GaussianBasisSet(const char* name, const char* label, const Ref<Molecule>& molecule, 00176 const Ref<SCMatrixKit>& matrixkit, 00177 const RefSCDimension& basisdim, 00178 const int ncenter, const int nshell, 00179 GaussianShell** shell, 00180 const std::vector<int>& center_to_nshell); 00181 00182 // Counts shells in this basis for this chemical element 00183 int count_shells_(Ref<KeyVal>& keyval, const char* elemname, const char* sbasisname, BasisFileSet& bases, 00184 int havepure, int pure, bool missing_ok); 00185 // Constructs this basis 00186 void get_shells_(int& ishell, Ref<KeyVal>& keyval, const char* elemname, const char* sbasisname, BasisFileSet& bases, 00187 int havepure, int pure, bool missing_ok); 00188 // Counts shells in an even-tempered primitive basis 00189 int count_even_temp_shells_(Ref<KeyVal>& keyval, const char* elemname, const char* sbasisname, 00190 int havepure, int pure); 00191 // Constructs an even-tempered primitive basis 00192 void get_even_temp_shells_(int& ishell, Ref<KeyVal>& keyval, const char* elemname, const char* sbasisname, 00193 int havepure, int pure); 00194 // Constructs basis set specified as an array of shells 00195 void recursively_get_shell(int&,Ref<KeyVal>&, 00196 const char*,const char*,BasisFileSet&, 00197 int,int,int,bool missing_ok); 00198 00199 void init(Ref<Molecule>&,Ref<KeyVal>&, 00200 BasisFileSet&, 00201 int have_userkeyval, 00202 int pure); 00203 void init2(int skip_ghosts=0,bool include_q=0); 00204 00205 protected: 00206 GaussianBasisSet(const GaussianBasisSet&); 00207 virtual void set_matrixkit(const Ref<SCMatrixKit>&); 00208 00209 public: 00211 class ValueData { 00212 protected: 00213 CartesianIter **civec_; 00214 SphericalTransformIter **sivec_; 00215 int maxam_; 00216 public: 00217 ValueData(const Ref<GaussianBasisSet> &, const Ref<Integral> &); 00218 ~ValueData(); 00219 CartesianIter **civec() { return civec_; } 00220 SphericalTransformIter **sivec() { return sivec_; } 00221 }; 00222 00224 enum UnitType {Unit}; 00225 00381 GaussianBasisSet(const Ref<KeyVal>&); 00386 GaussianBasisSet(UnitType); 00387 GaussianBasisSet(StateIn&); 00388 virtual ~GaussianBasisSet(); 00389 00394 Ref<GaussianBasisSet> operator+(const Ref<GaussianBasisSet>& B); 00395 00396 void save_data_state(StateOut&); 00397 00399 const char* name() const { return name_; } 00403 const char* label() const { if (name()) { return name(); } else { return label_; } } 00404 00406 Ref<Molecule> molecule() const { return molecule_; } 00408 Ref<SCMatrixKit> matrixkit() { return matrixkit_; } 00410 Ref<SCMatrixKit> so_matrixkit() { return so_matrixkit_; } 00412 RefSCDimension basisdim() { return basisdim_; } 00413 00415 int ncenter() const; 00417 int nshell() const { return nshell_; } 00419 int nshell_on_center(int icenter) const; 00422 int shell_on_center(int icenter, int shell) const; 00424 int shell_to_center(int ishell) const { return shell_to_center_[ishell]; } 00426 int shell_to_primitive(int ishell) const {return shell_to_primitive_[ishell]; } 00428 int nbasis() const { return nbasis_; } 00430 int nbasis_on_center(int icenter) const; 00432 int nprimitive() const { return nprim_; } 00434 int has_pure() const { return has_pure_; } 00435 00437 int max_nfunction_in_shell() const; 00440 int max_ncartesian_in_shell(int aminc=0) const; 00442 int max_nprimitive_in_shell() const; 00444 int max_angular_momentum() const; 00446 int max_ncontraction() const; 00449 int max_am_for_contraction(int con) const; 00451 int max_cartesian() const; 00452 00454 int shell_to_function(int i) const { return shell_to_function_[i]; } 00456 int function_to_shell(int i) const; 00457 00459 const GaussianShell& operator()(int i) const { return *shell_[i]; } 00461 GaussianShell& operator()(int i) { return *shell_[i]; } 00463 const GaussianShell& operator[](int i) const { return *shell_[i]; } 00465 GaussianShell& operator[](int i) { return *shell_[i]; } 00467 const GaussianShell& shell(int i) const { return *shell_[i]; } 00469 GaussianShell& shell(int i) { return *shell_[i]; } 00470 00472 const GaussianShell& operator()(int icenter,int ishell) const; 00474 GaussianShell& operator()(int icenter,int ishell); 00476 const GaussianShell& shell(int i,int j) const { return operator()(i,j); } 00478 GaussianShell& shell(int i,int j) { return operator()(i,j); } 00479 00482 double r(int icenter,int xyz) const; 00483 00486 int values(const SCVector3& r, ValueData *, double* basis_values) const; 00491 int grad_values(const SCVector3& r, ValueData *, 00492 double*g_values,double* basis_values=0) const; 00497 int hessian_values(const SCVector3& r, ValueData *, double *h_values, 00498 double*g_values=0,double* basis_values=0) const; 00501 int shell_values(const SCVector3& r, int sh, 00502 ValueData *, double* basis_values) const; 00506 int grad_shell_values(const SCVector3& r, int sh, 00507 ValueData *, 00508 double*g_values, double* basis_values=0) const; 00512 int hessian_shell_values(const SCVector3& r, int sh, 00513 ValueData *, double *h_values, 00514 double*g_values=0,double* basis_values=0) const; 00515 00517 int equiv(const Ref<GaussianBasisSet> &b); 00518 00520 void print_brief(std::ostream& =ExEnv::out0()) const; 00522 void print(std::ostream& =ExEnv::out0()) const; 00523 }; 00524 00525 } 00526 00527 #endif 00528 00529 // Local Variables: 00530 // mode: c++ 00531 // c-file-style: "CLJ" 00532 // End: