MPQC  3.0.0-alpha
orthog.h
1 
2 //
3 // orthog.h -- orthogonalize the basis set
4 //
5 // Copyright (C) 1996 Limit Point Systems, Inc.
6 //
7 // Author: Curtis Janssen <cljanss@ca.sandia.gov>
8 // Maintainer: LPS
9 //
10 // This file is part of the SC Toolkit.
11 //
12 // The SC Toolkit is free software; you can redistribute it and/or modify
13 // it under the terms of the GNU Library General Public License as published by
14 // the Free Software Foundation; either version 2, or (at your option)
15 // any later version.
16 //
17 // The SC Toolkit is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU Library General Public License for more details.
21 //
22 // You should have received a copy of the GNU Library General Public License
23 // along with the SC Toolkit; see the file COPYING.LIB. If not, write to
24 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
25 //
26 // The U.S. Government is granted a limited license as per AL 91-7.
27 //
28 
29 #ifndef _chemistry_qc_basis_orthog_h
30 #define _chemistry_qc_basis_orthog_h
31 
32 #include <util/state/state.h>
33 #include <math/scmat/matrix.h>
34 
35 namespace sc {
36 
38 class OverlapOrthog: virtual public SavableState {
39  public:
40 
42  enum OrthogMethod { Symmetric=1, Canonical=2, GramSchmidt=3 };
44  static OrthogMethod default_orthog_method() { return Symmetric; }
46  static double default_lindep_tol() { return 1e-8; }
47 
48  private:
49  int debug_;
50 
51  RefSCDimension dim_;
52  RefSCDimension orthog_dim_;
53 
54  // The tolerance for linearly independent basis functions.
55  // The intepretation depends on the orthogonalization method.
56  double lindep_tol_;
57  // The number of linearly dependent functions
58  int nlindep_;
59  // The orthogonalization method
60  OrthogMethod orthog_method_;
61  // The orthogonalization matrices
62  RefSCMatrix orthog_trans_;
63  RefSCMatrix orthog_trans_inverse_;
64  // The maximum and minimum residuals from the orthogonalization
65  // procedure. The interpretation depends on the method used.
66  // For symmetry and canonical, these are the min and max overlap
67  // eigenvalues. These are the residuals for the basis functions
68  // that actually end up being used.
69  double min_orthog_res_;
70  double max_orthog_res_;
71 
72  void compute_overlap_eig(RefSCMatrix& overlap_eigvec,
73  RefDiagSCMatrix& overlap_isqrt_eigval,
74  RefDiagSCMatrix& overlap_sqrt_eigval);
75  void compute_symmetric_orthog();
76  void compute_canonical_orthog();
77  void compute_gs_orthog();
78  void compute_orthog_trans();
79 
80  // WARNING: after a SavableState save/restore, these two members will
81  // be null. There is really no need to store these anyway--should be
82  // removed.
83  RefSymmSCMatrix overlap_;
84  Ref<SCMatrixKit> result_kit_; // this kit is used for the result matrices
85 
86  public:
95  const RefSymmSCMatrix &overlap,
96  const Ref<SCMatrixKit> &result_kit,
97  double lindep_tolerance,
98  int debug = 0);
99 
101 
102  virtual ~OverlapOrthog();
103 
104  void save_data_state(StateOut&);
105 
106  void reinit(OrthogMethod method,
107  const RefSymmSCMatrix &overlap,
108  const Ref<SCMatrixKit> &result_kit,
109  double lindep_tolerance,
110  int debug = 0);
111 
112  double min_orthog_res() const { return min_orthog_res_; }
113  double max_orthog_res() const { return max_orthog_res_; }
114 
115  Ref<OverlapOrthog> copy() const;
116 
118  OrthogMethod orthog_method() const { return orthog_method_; }
119 
121  double lindep_tol() const { return lindep_tol_; }
122 
136 
150 
153 
154  RefSCDimension dim();
155  RefSCDimension orthog_dim();
156 
160  int nlindep();
161 };
162 
163 }
164 
165 #endif
sc::overlap
RefSCMatrix overlap(const OrbitalSpace &space2, const OrbitalSpace &space1, const Ref< SCMatrixKit > &kit=SCMatrixKit::default_matrixkit())
overlap(s2,s1) returns the overlap matrix between s2 and s1.
sc::OverlapOrthog::default_lindep_tol
static double default_lindep_tol()
default orthog threshold is 1e-8
Definition: orthog.h:46
sc::RefSymmSCMatrix
The RefSymmSCMatrix class is a smart pointer to an SCSymmSCMatrix specialization.
Definition: matrix.h:265
sc::OverlapOrthog::OrthogMethod
OrthogMethod
An enum for the types of orthogonalization.
Definition: orthog.h:42
sc::RefSCMatrix
The RefSCMatrix class is a smart pointer to an SCMatrix specialization.
Definition: matrix.h:135
sc::Ref
A template class that maintains references counts.
Definition: ref.h:361
sc::OverlapOrthog::nlindep
int nlindep()
Returns the number of linearly dependent functions eliminated from the orthogonal basis.
sc::OverlapOrthog::basis_to_orthog_basis
RefSCMatrix basis_to_orthog_basis()
Returns a matrix which does the requested transform from a basis to an orthogonal basis.
sc::OverlapOrthog
This class computes the orthogonalizing transform for a basis set.
Definition: orthog.h:38
sc::RefDiagSCMatrix
The RefDiagSCMatrix class is a smart pointer to an DiagSCMatrix specialization.
Definition: matrix.h:389
sc::StateIn
Definition: statein.h:79
sc::RefSCDimension
The RefSCDimension class is a smart pointer to an SCDimension specialization.
Definition: dim.h:152
sc::OverlapOrthog::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::StateOut
Definition: stateout.h:71
sc::OverlapOrthog::OverlapOrthog
OverlapOrthog(OrthogMethod method, const RefSymmSCMatrix &overlap, const Ref< SCMatrixKit > &result_kit, double lindep_tolerance, int debug=0)
sc::OverlapOrthog::lindep_tol
double lindep_tol() const
Returns the tolerance for linear dependencies.
Definition: orthog.h:121
sc::OverlapOrthog::basis_to_orthog_basis_inverse
RefSCMatrix basis_to_orthog_basis_inverse()
Returns the inverse of the transformation returned by basis_to_orthog_basis() .
sc::OverlapOrthog::overlap_inverse
RefSymmSCMatrix overlap_inverse()
Return an $S^{-1}$.
sc::SavableState
Base class for objects that can save/restore state.
Definition: state.h:45
sc::OverlapOrthog::default_orthog_method
static OrthogMethod default_orthog_method()
default is to use Symmetric orthogonalization
Definition: orthog.h:44
sc::OverlapOrthog::orthog_method
OrthogMethod orthog_method() const
Returns the orthogonalization method.
Definition: orthog.h:118
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14

Generated at Sun Jan 26 2020 23:23:57 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.