From 84798008e9abeaf6221f41bc4678e3a4edc55d9d Mon Sep 17 00:00:00 2001 From: jiri Date: Thu, 8 Dec 2005 10:35:50 +0000 Subject: [PATCH] *** empty log message *** --- fourindex.h | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/fourindex.h b/fourindex.h index f80359a..b50402d 100644 --- a/fourindex.h +++ b/fourindex.h @@ -22,7 +22,17 @@ struct matel4 packedindex index; }; -typedef enum {nosymmetry=0, twoelectronreal=1, twoelectroncomplex=2, twobodyantisym=3} fourindexsymtype; //if twoelectron, only permutation-nonequivalent elements are stored +typedef enum {nosymmetry=0, twoelectronrealmullikan=1, twoelectronrealdirac=2, T2ijab_real=3} fourindexsymtype; //if twoelectron, only permutation-nonequivalent elements are stored +// these should actually be static private members of the fourindex class, but leads to an ICE on gcc3.2 +static const int fourindex_n_symmetrytypes=4; +static const int fourindex_permnumbers[fourindex_n_symmetrytypes]={0,7,7,3}; +static const int fourindex_permutations[fourindex_n_symmetrytypes][8][5]= + { + {{0,1,2,3,1},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0}}, + {{0,1,2,3,1}, {1,0,2,3,1}, {0,1,3,2,1}, {1,0,3,2,1}, {2,3,0,1,1}, {3,2,0,1,1}, {2,3,1,0,1}, {3,2,1,0,1}}, + {{0,1,2,3,1},{2,1,0,3,1},{0,3,2,1,1},{2,3,0,1,1},{1,0,3,2,1},{3,0,1,2,1},{1,2,3,0,1},{3,2,1,0,1}}, + {{0,1,2,3,1},{1,0,2,3,-1},{0,1,3,2,-1},{1,0,3,2,1},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0}} + }; template class fourindex { @@ -43,8 +53,8 @@ public: iterator() {}; ~iterator() {}; iterator(matel4 *list): p(list) {}; - bool operator==(const iterator rhs) const {return p==rhs.p;} - bool operator!=(const iterator rhs) const {return p!=rhs.p;} + bool operator==(const iterator &rhs) const {return p==rhs.p;} + bool operator!=(const iterator &rhs) const {return p!=rhs.p;} iterator operator++() {return p=p->next;} iterator operator++(int) {matel4 *q=p; p=p->next; return q;} matel4 & operator*() const {return *p;} @@ -52,6 +62,33 @@ public: }; iterator begin() const {return list;} iterator end() const {return NULL;} + + //permiterator ... iterates also over all permutations, with a possibly scaled matrix element or skips permutations yielding equivalent result + //has to take into account the symmetry type of the fourindex + typedef class piterator { + private: + matel4 *p; + matel4 my; + int permindex; + void setup(void) + { + switch (symmetry) { + case twoelectronreal: + break; + default: laerror("piterator not supported for this symmetry type yet"); + } + }; + public: + piterator() {}; + ~piterator() {}; + piterator(matel4 *list): p(list),permindex(0) {setup();}; + piterator operator++() {} + piterator operator++(int) {laerror("postincrement not possible on permute-iterator");} + bool operator==(const piterator &rhs) const {return p==rhs.p && permindex==rhs.permindex;} + bool operator!=(const piterator &rhs) const {return p!=rhs.p || permindex!=rhs.permindex;} + }; + piterator pbegin() const {return list;} + piterator pend() const {return NULL;} //constructors etc. inline fourindex() :nn(0),count(NULL),list(NULL) {};