# orthog.h

    00001
    00002 //
    00003 // orthog.h -- orthogonalize the basis set
    00004 //
    00005 // Copyright (C) 1996 Limit Point Systems, Inc.
    00006 //
    00007 // Author: Curtis Janssen <cljanss@ca.sandia.gov>
    00008 // Maintainer: LPS
    00009 //
    00010 // This file is part of the SC Toolkit.
    00011 //
    00012 // The SC Toolkit is free software; you can redistribute it and/or modify
    00013 // it under the terms of the GNU Library General Public License as published by
    00014 // the Free Software Foundation; either version 2, or (at your option)
    00015 // any later version.
    00016 //
    00017 // The SC Toolkit is distributed in the hope that it will be useful,
    00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00020 // GNU Library General Public License for more details.
    00021 //
    00022 // You should have received a copy of the GNU Library General Public License
    00023 // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
    00024 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
    00025 //
    00026 // The U.S. Government is granted a limited license as per AL 91-7.
    00027 //
    00028
    00029 #ifndef _chemistry_qc_basis_orthog_h
    00030 #define _chemistry_qc_basis_orthog_h
    00031
    00032 #include <util/state/state.h>
    00033 #include <math/scmat/matrix.h>
    00034
    00035 namespace sc {
    00036
    00038 class OverlapOrthog: virtual public SavableState {
    00039   public:
    00040
    00042     enum OrthogMethod { Symmetric=1, Canonical=2, GramSchmidt=3 };
    00043
    00044   private:
    00045     int debug_;
    00046
    00047     RefSCDimension dim_;
    00048     RefSCDimension orthog_dim_;
    00049
    00050     // The tolerance for linearly independent basis functions.
    00051     // The intepretation depends on the orthogonalization method.
    00052     double lindep_tol_;
    00053     // The number of linearly dependent functions
    00054     int nlindep_;
    00055     // The orthogonalization method
    00056     OrthogMethod orthog_method_;
    00057     // The orthogonalization matrices
    00058     RefSCMatrix orthog_trans_;
    00059     RefSCMatrix orthog_trans_inverse_;
    00060     // The maximum and minimum residuals from the orthogonalization
    00061     // procedure.  The interpretation depends on the method used.
    00062     // For symmetry and canonical, these are the min and max overlap
    00063     // eigenvalues.  These are the residuals for the basis functions
    00064     // that actually end up being used.
    00065     double min_orthog_res_;
    00066     double max_orthog_res_;
    00067
    00068     void compute_overlap_eig(RefSCMatrix& overlap_eigvec,
    00069                              RefDiagSCMatrix& overlap_isqrt_eigval,
    00070                              RefDiagSCMatrix& overlap_sqrt_eigval);
    00071     void compute_symmetric_orthog();
    00072     void compute_canonical_orthog();
    00073     void compute_gs_orthog();
    00074     void compute_orthog_trans();
    00075
    00076     // WARNING: after a SavableState save/restore, these two members will
    00077     // be null.  There is really no need to store these anyway--should be
    00078     // removed.
    00079     RefSymmSCMatrix overlap_;
    00080     Ref<SCMatrixKit> result_kit_; // this kit is used for the result matrices
    00081
    00082   public:
    00083     OverlapOrthog(OrthogMethod method,
    00084                   const RefSymmSCMatrix &overlap,
    00085                   const Ref<SCMatrixKit> &result_kit,
    00086                   double lindep_tolerance,
    00087                   int debug = 0);
    00088
    00089     OverlapOrthog(StateIn&);
    00090
    00091     virtual ~OverlapOrthog();
    00092
    00093     void save_data_state(StateOut&);
    00094
    00095     void reinit(OrthogMethod method,
    00096                 const RefSymmSCMatrix &overlap,
    00097                 const Ref<SCMatrixKit> &result_kit,
    00098                 double lindep_tolerance,
    00099                 int debug = 0);
    00100
    00101     double min_orthog_res() const { return min_orthog_res_; }
    00102     double max_orthog_res() const { return max_orthog_res_; }
    00103
    00104     Ref<OverlapOrthog> copy() const;
    00105
    00107     OrthogMethod orthog_method() const { return orthog_method_; }
    00108
    00110     double lindep_tol() const { return lindep_tol_; }
    00111
    00118     RefSCMatrix basis_to_orthog_basis();
    00119
    00123     RefSCMatrix basis_to_orthog_basis_inverse();
    00124
    00125     RefSCDimension dim();
    00126     RefSCDimension orthog_dim();
    00127
    00131     int nlindep();
    00132 };
    00133
    00134 }
    00135
    00136 #endif