# diis.h

    00001 //
    00002 // diis.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 _math_optimize_diis_h
    00029 #define _math_optimize_diis_h
    00030
    00031 #ifdef __GNUC__
    00032 #pragma interface
    00033 #endif
    00034
    00035 #include <math/optimize/scextrap.h>
    00036
    00037 namespace sc {
    00038
    00040 class DIIS: public SelfConsistentExtrapolation {
    00041   protected:
    00042     int start;
    00043     int ndiis;
    00044     int iter;
    00045     int ngroup;
    00046     int ngroupdiis;
    00047     double damping_factor;
    00048
    00049     double * btemp;
    00050     double ** bold;
    00051     double ** bmat;
    00052
    00053     Ref<SCExtrapData> dtemp_data;
    00054     Ref<SCExtrapError> dtemp_error;
    00055
    00056     Ref<SCExtrapData> Ldata;
    00057
    00058     Ref<SCExtrapData> *diism_data;
    00059     Ref<SCExtrapError> *diism_error;
    00060
    00061     void init();
    00062   public:
    00063     DIIS(int strt=1, int ndi=5, double dmp =0, int ngr=1, int ngrdiis=1);
    00064     DIIS(StateIn&);
    00090     DIIS(const Ref<KeyVal>&);
    00091     ~DIIS();
    00092
    00093     void save_data_state(StateOut&);
    00094
    00095     int extrapolate(const Ref<SCExtrapData>& data,
    00096                     const Ref<SCExtrapError>& error);
    00097
    00098     void start_extrapolation();
    00099
    00100     void reinitialize();
    00101
    00103     void print(std::ostream& = ExEnv::out0()) const;
    00104 };
    00105
    00106 }
    00107
    00108 #endif
    00109
    00110 // Local Variables:
    00111 // mode: c++
    00112 // c-file-style: "ETS"
    00113 // End: