MPQC 2.3.1

- Main Page
- Related Pages
- Classes
- Files

- File List

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
145 class GaussianBasisSet: public SavableState
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,
176 const Ref<SCMatrixKit>& matrixkit,
177 const RefSCDimension& basisdim,
178 const int ncenter, const int nshell,
179 GaussianShell** shell,
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:
206 GaussianBasisSet(const GaussianBasisSet&);
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:
217 ValueData(const Ref<GaussianBasisSet> &, const Ref<Integral> &);
218 ~ValueData();
219 CartesianIter **civec() { return civec_; }
220 SphericalTransformIter **sivec() { return sivec_; }
221 };
222
224 enum UnitType {Unit};
225
381 GaussianBasisSet(const Ref<KeyVal>&);
386 GaussianBasisSet(UnitType);
387 GaussianBasisSet(StateIn&);
388 virtual ~GaussianBasisSet();
389
394 Ref<GaussianBasisSet> operator+(const Ref<GaussianBasisSet>& B);
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: