- Main Page
- Classes
- Files
- Related Pages

# transform.h

    00001 //
    00002 // transform.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 #if defined(__GNUC__)
    00029 #pragma interface
    00030 #endif
    00031
    00032 #ifndef _chemistry_qc_basis_transform_h
    00033 #define _chemistry_qc_basis_transform_h
    00034
    00035 namespace sc {
    00036
    00037 // ///////////////////////////////////////////////////////////////////////////
    00038
    00041 class SphericalTransformComponent {
    00042   protected:
    00043     double coef_;
    00044     int a_, b_, c_, cartindex_, pureindex_;
    00045
    00046   public:
    00048     int a() const { return a_; }
    00050     int b() const { return b_; }
    00052     int c() const { return c_; }
    00054     int cartindex() const { return cartindex_; }
    00056     int pureindex() const { return pureindex_; }
    00058     double coef() const { return coef_; }
    00059
    00068     virtual void init(int a, int b, int c, double coef, int pureindex) =0;
    00069 };
    00070
    00071 // ///////////////////////////////////////////////////////////////////////////
    00072
    00075 class SphericalTransform {
    00076   protected:
    00077     int n_;
    00078     int l_;
    00079     int subl_;
    00080     SphericalTransformComponent *components_;
    00081
    00082     SphericalTransform();
    00083
    00091     SphericalTransform(int l, int subl = -1);
    00092
    00097     virtual void init();
    00098
    00099   public:
    00100     virtual ~SphericalTransform();
    00101
    00103     void add(int a, int b, int c, double coef, int pureindex);
    00104
    00106     int cartindex(int i) const { return components_[i].cartindex(); }
    00108     int pureindex(int i) const { return components_[i].pureindex(); }
    00110     double coef(int i) const { return components_[i].coef(); }
    00112     int a(int i) const { return components_[i].a(); }
    00114     int b(int i) const { return components_[i].b(); }
    00116     int c(int i) const { return components_[i].c(); }
    00118     int l() const { return l_; }
    00120     int n() const { return n_; }
    00121
    00124     virtual SphericalTransformComponent * new_components() = 0;
    00125 };
    00126
    00128 class ISphericalTransform: public SphericalTransform {
    00129   protected:
    00130     ISphericalTransform();
    00131     ISphericalTransform(int l,int subl=-1);
    00132     void init();
    00133 };
    00134
    00135 // ///////////////////////////////////////////////////////////////////////////
    00136
    00138 class SphericalTransformIter {
    00139   private:
    00140     int i_;
    00141
    00142   protected:
    00143     const SphericalTransform *transform_;
    00144
    00145   public:
    00146     SphericalTransformIter();
    00147     SphericalTransformIter(const SphericalTransform*);
    00148
    00149     void begin() { i_ = 0; }
    00150     void start() { begin(); }
    00151     void next() { i_++; }
    00152     int ready() { return i_ < transform_->n(); }
    00153     operator int() { return ready(); }
    00154     int l() { return transform_->l(); }
    00155     int cartindex() { return transform_->cartindex(i_); }
    00156     int pureindex() { return transform_->pureindex(i_); }
    00157     int bfn() { return pureindex(); }
    00158     double coef() { return transform_->coef(i_); }
    00159     int a() { return transform_->a(i_); }
    00160     int b() { return transform_->b(i_); }
    00161     int c() { return transform_->c(i_); }
    00162     int l(int i) { return i?(i==1?b():c()):a(); }
    00163     int n() { return 2*l() + 1; }
    00164 };
    00165
    00166 }
    00167
    00168 #endif
    00169
    00170 // Local Variables:
    00171 // mode: c++
    00172 // c-file-style: "ETS"
    00173 // End: