Main Page   Class Hierarchy   Compound List   File List   Compound Members   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_tranform_h
00033 #define _chemistry_qc_basis_tranform_h
00034 
00035 // ///////////////////////////////////////////////////////////////////////////
00036 
00037 class SphericalTransformComponent {
00038   protected:
00039     double coef_;
00040     int a_, b_, c_, cartindex_, pureindex_;
00041 
00042   public:
00043     int a() const { return a_; }
00044     int b() const { return b_; }
00045     int c() const { return c_; }
00046     int cartindex() const { return cartindex_; }
00047     int pureindex() const { return pureindex_; }
00048     double coef() const { return coef_; }
00049 
00050     virtual void init(int a, int b, int c, double coef, int pureindex) =0;
00051 };
00052 
00053 // ///////////////////////////////////////////////////////////////////////////
00054 
00055 class SphericalTransform {
00056   protected:
00057     int n_;
00058     int l_;
00059     int subl_;
00060     SphericalTransformComponent *components_;
00061 
00062     SphericalTransform();
00063     SphericalTransform(int l, int subl = -1);
00064 
00065     virtual void init();
00066     
00067   public:
00068     virtual ~SphericalTransform();
00069 
00070     void add(int a, int b, int c, double coef, int pureindex);
00071 
00072     int cartindex(int i) const { return components_[i].cartindex(); }
00073     int pureindex(int i) const { return components_[i].pureindex(); }
00074     double coef(int i) const { return components_[i].coef(); }
00075     int a(int i) const { return components_[i].a(); }
00076     int b(int i) const { return components_[i].b(); }
00077     int c(int i) const { return components_[i].c(); }
00078     int l() const { return l_; }
00079     int n() const { return n_; }
00080 
00081     virtual SphericalTransformComponent * new_components() = 0;
00082 };
00083 
00084 // The inverse transforms
00085 class ISphericalTransform: public SphericalTransform {
00086   protected:
00087     ISphericalTransform();
00088     ISphericalTransform(int l,int subl=-1);
00089     void init();
00090 };
00091 
00092 // ///////////////////////////////////////////////////////////////////////////
00093 
00094 class SphericalTransformIter {
00095   private:
00096     int i_;
00097 
00098   protected:
00099     const SphericalTransform *transform_;
00100     
00101   public:
00102     SphericalTransformIter();
00103     SphericalTransformIter(const SphericalTransform*);
00104 
00105     void begin() { i_ = 0; }
00106     void start() { begin(); }
00107     void next() { i_++; }
00108     int ready() { return i_ < transform_->n(); }
00109     operator int() { return ready(); }
00110     int l() { return transform_->l(); }
00111     int cartindex() { return transform_->cartindex(i_); }
00112     int pureindex() { return transform_->pureindex(i_); }
00113     int bfn() { return pureindex(); }
00114     double coef() { return transform_->coef(i_); }
00115     int a() { return transform_->a(i_); }
00116     int b() { return transform_->b(i_); }
00117     int c() { return transform_->c(i_); }
00118     int l(int i) { return i?(i==1?b():c()):a(); }
00119     int n() { return 2*l() + 1; }
00120 };
00121 
00122 #endif
00123 
00124 // Local Variables:
00125 // mode: c++
00126 // c-file-style: "ETS"
00127 // End:

Generated at Thu Oct 4 18:08:47 2001 for MPQC 2.0.0 using the documentation package Doxygen 1.2.5.