00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
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
00114 class GaussianBasisSet: public SavableState
00115 {
00116 private:
00117 char* name_;
00118 GaussianShell** shell_;
00119 std::vector<int> shell_to_function_;
00120 std::vector<int> function_to_shell_;
00121
00122 Ref<Molecule> molecule_;
00123
00124 Ref<SCMatrixKit> matrixkit_;
00125 Ref<SCMatrixKit> so_matrixkit_;
00126 RefSCDimension basisdim_;
00127
00128 int ncenter_;
00129
00130 std::vector<int> shell_to_center_;
00131 std::vector<int> shell_to_primitive_;
00132 std::vector<int> center_to_shell_;
00133 std::vector<int> center_to_nshell_;
00134 std::vector<int> center_to_nbasis_;
00135
00136 int nshell_;
00137 int nbasis_;
00138 int nprim_;
00139
00140 void recursively_get_shell(int&,Ref<KeyVal>&,
00141 const char*,const char*,BasisFileSet&,
00142 int,int,int);
00143
00144 void init(Ref<Molecule>&,Ref<KeyVal>&,
00145 BasisFileSet&,
00146 int have_userkeyval,
00147 int pure);
00148 void init2(int skip_ghosts=0);
00149
00150 protected:
00151 GaussianBasisSet(const GaussianBasisSet&);
00152 virtual void set_matrixkit(const Ref<SCMatrixKit>&);
00153
00154 public:
00156 class ValueData {
00157 protected:
00158 CartesianIter **civec_;
00159 SphericalTransformIter **sivec_;
00160 int maxam_;
00161 public:
00162 ValueData(const Ref<GaussianBasisSet> &, const Ref<Integral> &);
00163 ~ValueData();
00164 CartesianIter **civec() { return civec_; }
00165 SphericalTransformIter **sivec() { return sivec_; }
00166 };
00167
00278 GaussianBasisSet(const Ref<KeyVal>&);
00279 GaussianBasisSet(StateIn&);
00280 virtual ~GaussianBasisSet();
00281
00282 void save_data_state(StateOut&);
00283
00285 const char* name() const { return name_; }
00286
00288 Ref<Molecule> molecule() const { return molecule_; }
00290 Ref<SCMatrixKit> matrixkit() { return matrixkit_; }
00292 Ref<SCMatrixKit> so_matrixkit() { return so_matrixkit_; }
00294 RefSCDimension basisdim() { return basisdim_; }
00295
00297 int ncenter() const;
00299 int nshell() const { return nshell_; }
00301 int nshell_on_center(int icenter) const;
00304 int shell_on_center(int icenter, int shell) const;
00306 int shell_to_center(int ishell) const { return shell_to_center_[ishell]; }
00308 int shell_to_primitive(int ishell) const {return shell_to_primitive_[ishell]; }
00310 int nbasis() const { return nbasis_; }
00312 int nbasis_on_center(int icenter) const;
00314 int nprimitive() const { return nprim_; }
00315
00317 int max_nfunction_in_shell() const;
00320 int max_ncartesian_in_shell(int aminc=0) const;
00322 int max_nprimitive_in_shell() const;
00324 int max_angular_momentum() const;
00326 int max_ncontraction() const;
00329 int max_am_for_contraction(int con) const;
00331 int max_cartesian() const;
00332
00334 int shell_to_function(int i) const { return shell_to_function_[i]; }
00336 int function_to_shell(int i) const;
00337
00339 const GaussianShell& operator()(int i) const { return *shell_[i]; }
00341 GaussianShell& operator()(int i) { return *shell_[i]; }
00343 const GaussianShell& operator[](int i) const { return *shell_[i]; }
00345 GaussianShell& operator[](int i) { return *shell_[i]; }
00347 const GaussianShell& shell(int i) const { return *shell_[i]; }
00349 GaussianShell& shell(int i) { return *shell_[i]; }
00350
00352 const GaussianShell& operator()(int icenter,int ishell) const;
00354 GaussianShell& operator()(int icenter,int ishell);
00356 const GaussianShell& shell(int i,int j) const { return operator()(i,j); }
00358 GaussianShell& shell(int i,int j) { return operator()(i,j); }
00359
00362 double r(int icenter,int xyz) const;
00363
00366 int values(const SCVector3& r, ValueData *, double* basis_values) const;
00371 int grad_values(const SCVector3& r, ValueData *,
00372 double*g_values,double* basis_values=0) const;
00377 int hessian_values(const SCVector3& r, ValueData *, double *h_values,
00378 double*g_values=0,double* basis_values=0) const;
00381 int shell_values(const SCVector3& r, int sh,
00382 ValueData *, double* basis_values) const;
00386 int grad_shell_values(const SCVector3& r, int sh,
00387 ValueData *,
00388 double*g_values, double* basis_values=0) const;
00392 int hessian_shell_values(const SCVector3& r, int sh,
00393 ValueData *, double *h_values,
00394 double*g_values=0,double* basis_values=0) const;
00395
00397 int equiv(const Ref<GaussianBasisSet> &b);
00398
00400 void print_brief(std::ostream& =ExEnv::out0()) const;
00402 void print(std::ostream& =ExEnv::out0()) const;
00403 };
00404
00405 }
00406
00407 #endif
00408
00409
00410
00411
00412