/* Copyright (C) 2008 Jiri Pittner or This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef _basic_h #define _basic_h #include "version.h" #include #include #ifdef COMPLEX_VERSION typedef std::complex FIELD; #else typedef double FIELD; #endif typedef double REAL; typedef std::complex COMPLEX; typedef unsigned int lexindex; typedef unsigned char index4type; //max 256 orbitals typedef short Q2index; //must be at least index4type + sign typedef unsigned char electronindex; //max 256 electrons typedef index4type orbindex; typedef short spinorbindex; typedef /*signed*/ char occnum; //signed type is crucial to ensure correct processing of tests >=0 in loops typedef unsigned char index4type; //must be able to hold up to number of orbitals ... possibly enlarge to unsigned short #include "la.h" using namespace LA; //pure virtual base class for second quantized operators (just for general pointers) template class general_implicit_operator { public: general_implicit_operator() {}; virtual void gemv(const F beta, NRVec &r, const char trans, const F alpha, const NRVec &x) const =0; virtual REAL norm() const =0; virtual lexindex nrows() const =0; virtual lexindex ncols() const =0; virtual void printme(std::ostream &o) const {}; virtual ~general_implicit_operator() {}; }; typedef general_implicit_operator implicit_operator; //abstract base class with purely virtual functions template class general_secondquantized_hamiltonian : public general_implicit_operator { public: general_secondquantized_hamiltonian() {}; virtual const F *diagonalof(NRVec &d,const bool divide, bool cache) const =0; virtual void gemv(const F beta, NRVec &r, const char trans, const F alpha, const NRVec &x) const =0; virtual lexindex nrows() const =0; virtual lexindex ncols() const =0; virtual bool issymmetric() const =0; virtual ~general_secondquantized_hamiltonian() {}; virtual void printme(std::ostream &o) const {}; //print terms if applicable virtual int sort(int direction=0, int from=0, int to= -1, int *perm=NULL) {return 0;}; //sort the terms if well defined }; typedef general_secondquantized_hamiltonian secondquantized_hamiltonian; enum hamiltonian_type {quantchem=0, quantchem_uhf=1, hubbard=2, general_2body=3, relativistic=4}; //relativistic: spinors in the standard numbering A = 1..n, B = n+1..2n (doc/cauga3.tex) typedef NRSMat_from1 OneElInt; typedef NRSMat_from1 > Ugenerators; typedef NRVec > > Ugenerators_resorted; typedef matel4 MATEL4; typedef matel4stored MATEL4STORED; #endif