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 |
|
---|
37 | /// This class computes the orthogonalizing transform for a basis set.
|
---|
38 | class OverlapOrthog: virtual public SavableState {
|
---|
39 | public:
|
---|
40 |
|
---|
41 | /// An enum for the types of orthogonalization.
|
---|
42 | enum OrthogMethod { Symmetric=1, Canonical=2, GramSchmidt=3 };
|
---|
43 |
|
---|
44 | private:
|
---|
45 | int debug_;
|
---|
46 |
|
---|
47 | RefSCDimension dim_;
|
---|
48 | RefSCDimension orthog_dim_;
|
---|
49 |
|
---|
50 | // The tolerance for linearly independent basis functions.
|
---|
51 | // The intepretation depends on the orthogonalization method.
|
---|
52 | double lindep_tol_;
|
---|
53 | // The number of linearly dependent functions
|
---|
54 | int nlindep_;
|
---|
55 | // The orthogonalization method
|
---|
56 | OrthogMethod orthog_method_;
|
---|
57 | // The orthogonalization matrices
|
---|
58 | RefSCMatrix orthog_trans_;
|
---|
59 | RefSCMatrix orthog_trans_inverse_;
|
---|
60 | // The maximum and minimum residuals from the orthogonalization
|
---|
61 | // procedure. The interpretation depends on the method used.
|
---|
62 | // For symmetry and canonical, these are the min and max overlap
|
---|
63 | // eigenvalues. These are the residuals for the basis functions
|
---|
64 | // that actually end up being used.
|
---|
65 | double min_orthog_res_;
|
---|
66 | double max_orthog_res_;
|
---|
67 |
|
---|
68 | void compute_overlap_eig(RefSCMatrix& overlap_eigvec,
|
---|
69 | RefDiagSCMatrix& overlap_isqrt_eigval,
|
---|
70 | RefDiagSCMatrix& overlap_sqrt_eigval);
|
---|
71 | void compute_symmetric_orthog();
|
---|
72 | void compute_canonical_orthog();
|
---|
73 | void compute_gs_orthog();
|
---|
74 | void compute_orthog_trans();
|
---|
75 |
|
---|
76 | // WARNING: after a SavableState save/restore, these two members will
|
---|
77 | // be null. There is really no need to store these anyway--should be
|
---|
78 | // removed.
|
---|
79 | RefSymmSCMatrix overlap_;
|
---|
80 | Ref<SCMatrixKit> result_kit_; // this kit is used for the result matrices
|
---|
81 |
|
---|
82 | public:
|
---|
83 | OverlapOrthog(OrthogMethod method,
|
---|
84 | const RefSymmSCMatrix &overlap,
|
---|
85 | const Ref<SCMatrixKit> &result_kit,
|
---|
86 | double lindep_tolerance,
|
---|
87 | int debug = 0);
|
---|
88 |
|
---|
89 | OverlapOrthog(StateIn&);
|
---|
90 |
|
---|
91 | virtual ~OverlapOrthog();
|
---|
92 |
|
---|
93 | void save_data_state(StateOut&);
|
---|
94 |
|
---|
95 | void reinit(OrthogMethod method,
|
---|
96 | const RefSymmSCMatrix &overlap,
|
---|
97 | const Ref<SCMatrixKit> &result_kit,
|
---|
98 | double lindep_tolerance,
|
---|
99 | int debug = 0);
|
---|
100 |
|
---|
101 | double min_orthog_res() const { return min_orthog_res_; }
|
---|
102 | double max_orthog_res() const { return max_orthog_res_; }
|
---|
103 |
|
---|
104 | Ref<OverlapOrthog> copy() const;
|
---|
105 |
|
---|
106 | /// Returns the orthogonalization method
|
---|
107 | OrthogMethod orthog_method() const { return orthog_method_; }
|
---|
108 |
|
---|
109 | /// Returns the tolerance for linear dependencies.
|
---|
110 | double lindep_tol() const { return lindep_tol_; }
|
---|
111 |
|
---|
112 | /** Returns a matrix which does the requested transform from a basis to
|
---|
113 | an orthogonal basis. This could be either the symmetric or
|
---|
114 | canonical orthogonalization matrix. The row dimension is the basis
|
---|
115 | dimension and the column dimension is orthogonal basis dimension.
|
---|
116 | An operator \f$O\f$ in the orthogonal basis is given by \f$X O
|
---|
117 | X^T\f$ where \f$X\f$ is the return value of this function. */
|
---|
118 | RefSCMatrix basis_to_orthog_basis();
|
---|
119 |
|
---|
120 | /** Returns the inverse of the transformation returned by
|
---|
121 | * basis_to_orthog_basis.
|
---|
122 | */
|
---|
123 | RefSCMatrix basis_to_orthog_basis_inverse();
|
---|
124 |
|
---|
125 | RefSCDimension dim();
|
---|
126 | RefSCDimension orthog_dim();
|
---|
127 |
|
---|
128 | /** Returns the number of linearly dependent functions eliminated from
|
---|
129 | the orthogonal basis.
|
---|
130 | */
|
---|
131 | int nlindep();
|
---|
132 | };
|
---|
133 |
|
---|
134 | }
|
---|
135 |
|
---|
136 | #endif
|
---|