MPQC 2.3.1
|
00001 // 00002 // cartit.h 00003 // 00004 // Copyright (C) 2001 Edward Valeev 00005 // 00006 // Author: Edward Valeev <edward.valeev@chemistry.gatech.edu> 00007 // Maintainer: EV 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_cints_cartit_h 00029 #define _chemistry_qc_cints_cartit_h 00030 00031 #include <chemistry/qc/basis/cartiter.h> 00032 00033 namespace sc { 00034 00035 class CartesianIterCints : public CartesianIter { 00036 int *avec, *bvec, *cvec; 00037 00038 public: 00039 CartesianIterCints(int l) : CartesianIter(l) {} 00040 00041 void start() { 00042 bfn_=b_=c_=0; 00043 a_=l_; 00044 } 00045 00046 void next() { 00047 if (c_ < l_ - a_) { 00048 b_--; 00049 c_++; 00050 } 00051 else { 00052 a_--; 00053 c_ = 0; 00054 b_ = l_ - a_; 00055 } 00056 bfn_++; 00057 } 00058 00059 operator int() { 00060 return (a_ >= 0); 00061 } 00062 }; 00063 00064 class RedundantCartesianIterCints : public RedundantCartesianIter { 00065 public: 00066 RedundantCartesianIterCints(int l) : RedundantCartesianIter(l) {} 00067 00068 int bfn() { 00069 int i = a(); 00070 int am = l(); 00071 if (am == i) 00072 return 0; 00073 else { 00074 int j = b(); 00075 int c = am - i; 00076 return ((((c+1)*c)>>1)+c-j); 00077 } 00078 } 00079 }; 00080 00081 class RedundantCartesianSubIterCints : public RedundantCartesianSubIter { 00082 public: 00083 RedundantCartesianSubIterCints(int l) : RedundantCartesianSubIter(l) {} 00084 00085 int bfn() { 00086 int i = a(); 00087 int am = l(); 00088 if (am == i) 00089 return 0; 00090 else { 00091 int j = b(); 00092 int c = am - i; 00093 return ((((c+1)*c)>>1)+c-j); 00094 } 00095 } 00096 }; 00097 00098 } 00099 00100 #endif 00101 00102 // Local Variables: 00103 // mode: c++ 00104 // c-file-style: "CLJ" 00105 // End: