moindexspace.h
//
// moindexspace.h
//
// Copyright (C) 2004 Edward Valeev
//
// Author: Edward Valeev <edward.valeev@chemistry.gatech.edu>
// Maintainer: EV
//
// This file is part of the SC Toolkit.
//
// The SC Toolkit is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library General Public License as published by
// the Free Software Foundation; either version 2, or (at your option)
// any later version.
//
// The SC Toolkit 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 Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public License
// along with the SC Toolkit; see the file COPYING.LIB. If not, write to
// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
//
// The U.S. Government is granted a limited license as per AL 91-7.
//
#ifdef __GNUG__
#pragma interface
#endif
#ifndef _chemistry_qc_mbptr12_moindexspace_h
#define _chemistry_qc_mbptr12_moindexspace_h
#include <vector>
#include <util/ref/ref.h>
#include <util/state/statein.h>
#include <util/state/stateout.h>
#include <math/scmat/abstract.h>
#include <util/state/statein.h>
#include <chemistry/qc/basis/basis.h>
using namespace std;
namespace sc {
class MOIndexSpace : virtual public SavableState {
public:
enum IndexOrder { symmetry = 0, energy = 1, undefined = 2 };
MOIndexSpace(StateIn&);
MOIndexSpace(std::string name, const RefSCMatrix& full_coefs,
const Ref<GaussianBasisSet> basis, const Ref<Integral>& integral,
const vector<int>& offsets, const vector<int>& nmopi,
IndexOrder moorder = symmetry,
const RefDiagSCMatrix& evals = 0);
MOIndexSpace(std::string name, const RefSCMatrix& full_coefs,
const Ref<GaussianBasisSet> basis, const Ref<Integral>& integral,
const RefDiagSCMatrix& evals, int nfzc, int nfzv, IndexOrder moorder = energy);
MOIndexSpace(std::string name, const RefSCMatrix& full_coefs,
const Ref<GaussianBasisSet> basis, const Ref<Integral>& integral);
MOIndexSpace(std::string name, const Ref<MOIndexSpace>& orig_space,
const RefSCMatrix& new_coefs,
const Ref<GaussianBasisSet>& new_basis);
~MOIndexSpace();
void save_data_state(StateOut&);
const std::string name() const;
const Ref<GaussianBasisSet> basis() const;
Ref<Integral> integral() const;
const RefSCMatrix coefs() const;
const RefDiagSCMatrix evals() const;
vector<int> mosym() const;
IndexOrder moorder() const;
int rank() const;
int full_rank() const;
int nblocks() const;
vector<int> nmo() const;
vector<int> offsets() const;
int to_full_space(const int i) const;
size_t memory_in_use() const;
void print(std::ostream&o=ExEnv::out0()) const;
void print_summary(std::ostream& os) const;
private:
std::string name_; // String identifier for the orbital space
Ref<GaussianBasisSet> basis_; // The AO basis
Ref<Integral> integral_; // The integral factory
RefSCMatrix coefs_; // AO->MO transformation coefficients (nao by nmo matrix)
RefDiagSCMatrix evals_; // "eigenvalues" associated with the MOs
RefSCDimension modim_; // The MO dimension
vector<int> mosym_; // irrep of each orbital
int rank_; // The rank of this space
int full_rank_; // Rank of the full space, i.e. number of MOs
int nblocks_; // Number of blocks
vector<int> nmo_; // Number of MOs in each block
vector<int> offsets_; // Index of the first MO in each block relative to the first MO of that block in full space
vector<int> map_to_full_space_; // Full-space index
IndexOrder moorder_;
// checks mosym_ for irrep indices outside of the allowed range
void check_mosym() const;
// determines offsets_ and nmo_ from nfzc, nfzv, and evals
void frozen_to_blockinfo(const int nfzc, const int nfzv, const RefDiagSCMatrix& evals);
// computes coefficient matrix from the full coefficient matrix. If moorder_ == energy
// then the MO vectors will be sorted by their eigenvalues
void full_coefs_to_coefs(const RefSCMatrix& full_coefs, const RefDiagSCMatrix& evals);
// initialize the object
void init();
// sorting functions borrowed from mbpt.cc
static void dquicksort(double *item,int *index,int n);
static void dqs(double *item,int *index,int left,int right);
};
}
#endif
// Local Variables:
// mode: c++
// c-file-style: "CLJ"
// End: