00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
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
00103
00104
00105