Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

petite.h

00001 //
00002 // petite.h --- definition of the PetiteList class
00003 //
00004 // Copyright (C) 1996 Limit Point Systems, Inc.
00005 //
00006 // Author: Edward Seidl <seidl@janed.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 _chemistry_qc_basis_petite_h
00029 #define _chemistry_qc_basis_petite_h
00030 
00031 #ifdef __GNUC__
00032 #pragma interface
00033 #endif
00034 
00035 #include <iostream>
00036 
00037 #include <util/misc/scint.h>
00038 #include <util/ref/ref.h>
00039 #include <util/container/array.h>
00040 #include <math/scmat/blocked.h>
00041 #include <math/scmat/offset.h>
00042 #include <chemistry/molecule/molecule.h>
00043 #include <chemistry/qc/basis/gaussbas.h>
00044 #include <chemistry/qc/basis/integral.h>
00045 
00046 // //////////////////////////////////////////////////////////////////////////
00047 
00048 namespace sc {
00049 
00050 inline sc_int_least64_t
00051 ij_offset64(sc_int_least64_t i, sc_int_least64_t j)
00052 {
00053   return (i>j) ? (((i*(i+1)) >> 1) + j) : (((j*(j+1)) >> 1) + i);
00054 }
00055 
00056 inline sc_int_least64_t
00057 i_offset64(sc_int_least64_t i)
00058 {
00059   return ((i*(i+1)) >> 1);
00060 }
00061 
00062 // //////////////////////////////////////////////////////////////////////////
00063 
00064 struct contribution {
00065     int bfn;
00066     double coef;
00067 
00068     contribution();
00069     contribution(int b, double c);
00070     ~contribution();
00071 };
00072 
00073 struct SO {
00074     int len;
00075     int length;
00076     contribution *cont;
00077 
00078     SO();
00079     SO(int);
00080     ~SO();
00081 
00082     SO& operator=(const SO&);
00083     
00084     void set_length(int);
00085     void reset_length(int);
00086     
00087     // is this equal to so to within a sign
00088     int equiv(const SO& so);
00089 };
00090 
00091 struct SO_block {
00092     int len;
00093     SO *so;
00094 
00095     SO_block();
00096     SO_block(int);
00097     ~SO_block();
00098 
00099     void set_length(int);
00100     void reset_length(int);
00101 
00102     int add(SO& s, int i);
00103     void print(const char *title);
00104 };
00105 
00106 // //////////////////////////////////////////////////////////////////////////
00107 // this should only be used from within a SymmGaussianBasisSet
00108 
00109 class PetiteList : public RefCount {
00110   private:
00111     int natom_;
00112     int nshell_;
00113     int ng_;
00114     int nirrep_;
00115     int nblocks_;
00116     int c1_;
00117 
00118     Ref<GaussianBasisSet> gbs_;
00119     Ref<Integral> ints_;
00120     
00121     char *p1_;        // p1[n] is 1 if shell n is in the group P1
00122     int **atom_map_;  // atom_map[n][g] is the atom that symop g maps atom n
00123                       // into
00124     int **shell_map_; // shell_map[n][g] is the shell that symop g maps shell n
00125                       // into
00126     char *lamij_;     // see Dupuis & King, IJQC 11,613,(1977)
00127 
00128     int *nbf_in_ir_;
00129 
00130     void init();
00131 
00132   public:
00133     PetiteList(const Ref<GaussianBasisSet>&, const Ref<Integral>&);
00134     ~PetiteList();
00135 
00136     int nirrep() const { return nirrep_; }
00137     int order() const { return ng_; }
00138     int atom_map(int n, int g) const { return (c1_) ? n : atom_map_[n][g]; }
00139     int shell_map(int n, int g) const { return (c1_) ? n : shell_map_[n][g]; }
00140     int lambda(int ij) const { return (c1_) ? 1 : (int) lamij_[ij]; }
00141     int lambda(int i, int j) const
00142                           { return (c1_) ? 1 : (int) lamij_[ij_offset(i,j)]; }
00143 
00144     int in_p1(int n) const { return (c1_) ? 1 : (int) p1_[n]; }
00145     int in_p2(int ij) const { return (c1_) ? 1 : (int) lamij_[ij]; }
00146     int in_p4(int ij, int kl, int i, int j, int k, int l) const;
00147     
00148     int nfunction(int i) const
00149                             { return (c1_) ? gbs_->nbasis() : nbf_in_ir_[i]; }
00150 
00151     int nblocks() const { return nblocks_; }
00152 
00153     void print(std::ostream& =ExEnv::out0(), int verbose=1);
00154 
00155     // these return blocked dimensions
00156     RefSCDimension AO_basisdim();
00157     RefSCDimension SO_basisdim();
00158 
00159     // return the basis function rotation matrix R(g)
00160     RefSCMatrix r(int g);
00161 
00162     // return information about the transformation from AOs to SOs
00163     SO_block * aotoso_info();
00164     RefSCMatrix aotoso();
00165     RefSCMatrix sotoao();
00166 
00167     // given a skeleton matrix, form the symmetrized matrix in the SO basis
00168     void symmetrize(const RefSymmSCMatrix& skel, const RefSymmSCMatrix& sym);
00169 
00170     // transform a matrix from AO->SO or SO->AO.
00171     // this can take either a blocked or non-blocked AO basis matrix.
00172     RefSymmSCMatrix to_SO_basis(const RefSymmSCMatrix&);
00173 
00174     // this returns a non-blocked AO basis matrix.
00175     RefSymmSCMatrix to_AO_basis(const RefSymmSCMatrix&);
00176 
00177     // these two are just for eigenvectors
00178     // returns non-blocked AO basis eigenvectors
00179     RefSCMatrix evecs_to_AO_basis(const RefSCMatrix&);
00180     // returns blocked SO basis eigenvectors
00181     RefSCMatrix evecs_to_SO_basis(const RefSCMatrix&);
00182 };
00183 
00184 inline int
00185 PetiteList::in_p4(int ij, int kl, int i, int j, int k, int l) const
00186 {
00187   if (c1_)
00188     return 1;
00189   
00190   sc_int_least64_t ijkl = i_offset64(ij)+kl;
00191   int nijkl=0;
00192 
00193   for (int g=0; g < ng_; g++) {
00194     int gij = ij_offset(shell_map_[i][g],shell_map_[j][g]);
00195     int gkl = ij_offset(shell_map_[k][g],shell_map_[l][g]);
00196     sc_int_least64_t gijkl = ij_offset64(gij,gkl);
00197 
00198     if (gijkl > ijkl)
00199       return 0;
00200     else if (gijkl == ijkl)
00201       nijkl++;
00202   }
00203 
00204   return ng_/nijkl;
00205 }
00206 
00207 }
00208 
00209 #endif
00210 
00211 // Local Variables:
00212 // mode: c++
00213 // c-file-style: "ETS"
00214 // End:

Generated at Fri Jan 10 08:14:09 2003 for MPQC 2.1.3 using the documentation package Doxygen 1.2.14.