gaussbas.h

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: virtual 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:
00208     GaussianBasisSet();
00209     GaussianBasisSet(const GaussianBasisSet&);
00210     virtual void set_matrixkit(const Ref<SCMatrixKit>&);
00211 
00216     void init(char *name,
00217               char *label,
00218               const Ref<Molecule> &molecule,
00219               const Ref<SCMatrixKit> &matrixkit,
00220               const Ref<SCMatrixKit> &so_matrixkit,
00221               GaussianShell **shell,
00222               const std::vector<int> shell_to_center);
00223     
00224   public:
00226     class ValueData {
00227       protected:
00228         CartesianIter **civec_;
00229         SphericalTransformIter **sivec_;
00230         int maxam_;
00231       public:
00232         ValueData(const Ref<GaussianBasisSet> &, const Ref<Integral> &);
00233         ~ValueData();
00234         CartesianIter **civec() { return civec_; }
00235         SphericalTransformIter **sivec() { return sivec_; }
00236     };
00237 
00239     enum UnitType {Unit};
00240 
00396     GaussianBasisSet(const Ref<KeyVal>&);
00401     GaussianBasisSet(UnitType);
00402     GaussianBasisSet(StateIn&);
00403     virtual ~GaussianBasisSet();
00404 
00409     Ref<GaussianBasisSet> operator+(const Ref<GaussianBasisSet>& B);
00410 
00411     void save_data_state(StateOut&);
00412 
00414     const char* name() const { return name_; }
00418     const char* label() const { if (name()) { return name(); } else { return label_; } }
00419 
00421     Ref<Molecule> molecule() const { return molecule_; }
00423     Ref<SCMatrixKit> matrixkit() { return matrixkit_; }
00425     Ref<SCMatrixKit> so_matrixkit() { return so_matrixkit_; }
00427     RefSCDimension basisdim() { return basisdim_; }
00428 
00430     int ncenter() const;
00432     int nshell() const { return nshell_; }
00434     int nshell_on_center(int icenter) const;
00437     int shell_on_center(int icenter, int shell) const;
00439     int shell_to_center(int ishell) const { return shell_to_center_[ishell]; }
00441     int shell_to_primitive(int ishell) const {return shell_to_primitive_[ishell]; }
00443     int nbasis() const { return nbasis_; }
00445     int nbasis_on_center(int icenter) const;
00447     int nprimitive() const { return nprim_; }
00449     int has_pure() const { return has_pure_; }
00450 
00452     int max_nfunction_in_shell() const;
00455     int max_ncartesian_in_shell(int aminc=0) const;
00457     int max_nprimitive_in_shell() const;
00459     int max_angular_momentum() const;
00461     int max_ncontraction() const;
00464     int max_am_for_contraction(int con) const;
00466     int max_cartesian() const;
00467 
00469     int shell_to_function(int i) const { return shell_to_function_[i]; }
00471     int function_to_shell(int i) const;
00472 
00474     const GaussianShell& operator()(int i) const { return *shell_[i]; }
00476     GaussianShell& operator()(int i) { return *shell_[i]; }
00478     const GaussianShell& operator[](int i) const { return *shell_[i]; }
00480     GaussianShell& operator[](int i) { return *shell_[i]; }
00482     const GaussianShell& shell(int i) const { return *shell_[i]; }
00484     GaussianShell& shell(int i) { return *shell_[i]; }
00485 
00487     const GaussianShell& operator()(int icenter,int ishell) const;
00489     GaussianShell& operator()(int icenter,int ishell);
00491     const GaussianShell& shell(int i,int j) const { return operator()(i,j); }
00493     GaussianShell& shell(int i,int j) { return operator()(i,j); }
00494 
00497     double r(int icenter,int xyz) const;
00498     
00501     int values(const SCVector3& r, ValueData *, double* basis_values) const;
00506     int grad_values(const SCVector3& r, ValueData *,
00507                     double*g_values,double* basis_values=0) const;
00512     int hessian_values(const SCVector3& r, ValueData *, double *h_values,
00513                        double*g_values=0,double* basis_values=0) const;
00516     int shell_values(const SCVector3& r, int sh,
00517                      ValueData *, double* basis_values) const;
00521     int grad_shell_values(const SCVector3& r, int sh,
00522                           ValueData *,
00523                           double*g_values, double* basis_values=0) const;
00527     int hessian_shell_values(const SCVector3& r, int sh,
00528                        ValueData *, double *h_values,
00529                        double*g_values=0,double* basis_values=0) const;
00530 
00532     int equiv(const Ref<GaussianBasisSet> &b);
00533 
00535     void print_brief(std::ostream& =ExEnv::out0()) const;
00537     void print(std::ostream& =ExEnv::out0()) const;
00538 };
00539 
00541 Ref<GaussianBasisSet>
00542 operator+(const Ref<GaussianBasisSet>& A, const Ref<GaussianBasisSet>& B);
00543 
00544 }
00545 
00546 #endif
00547 
00548 // Local Variables:
00549 // mode: c++
00550 // c-file-style: "CLJ"
00551 // End:

Generated at Wed Sep 5 14:02:29 2007 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.5.2.
These pages are hosted on SourceForge.net