Psi4
mospace.h
Go to the documentation of this file.
1 /*
2  * @BEGIN LICENSE
3  *
4  * Psi4: an open-source quantum chemistry software package
5  *
6  * Copyright (c) 2007-2017 The Psi4 Developers.
7  *
8  * The copyrights for code used from other parties are included in
9  * the corresponding files.
10  *
11  * This file is part of Psi4.
12  *
13  * Psi4 is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU Lesser General Public License as published by
15  * the Free Software Foundation, version 3.
16  *
17  * Psi4 is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public License along
23  * with Psi4; if not, write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25  *
26  * @END LICENSE
27  */
28 
29 #ifndef _PSI_SRC_LIB_LIBTRANS_MOSPACE_H_
30 #define _PSI_SRC_LIB_LIBTRANS_MOSPACE_H_
31 
32 #include "psi4/psi4-dec.h"
33 #include <map>
34 
35 namespace psi{
36 
41 class MOSpace{
42 
43  public:
44  ~MOSpace();
45  MOSpace(const char label, const std::vector<int> aOrbs, const std::vector<int> bOrbs,
46  const std::vector<int> aIndex, const std::vector<int> bIndex);
47  MOSpace(const char label, const std::vector<int> aOrbs, const std::vector<int> aIndex);
48  MOSpace(const char label, const std::vector<int> orbsPI);
49 
55  #define MOSPACE_FZC 'o'
56  static std::shared_ptr<MOSpace> fzc;
66  #define MOSPACE_OCC 'O'
67  static std::shared_ptr<MOSpace> occ;
73  #define MOSPACE_FZV 'v'
74  static std::shared_ptr<MOSpace> fzv;
84  #define MOSPACE_VIR 'V'
85  static std::shared_ptr<MOSpace> vir;
93  #define MOSPACE_ALL 'A'
94  static std::shared_ptr<MOSpace> all;
100  #define MOSPACE_NIL 'n'
101  static std::shared_ptr<MOSpace> nil;
108  #define MOSPACE_DUM 'd'
109  static std::shared_ptr<MOSpace> dum;
110 
111  // These are to allow the map to be used
112  friend bool operator==(const MOSpace &lhs, const MOSpace &rhs)
113  { return lhs.label_ == rhs.label_; }
114  friend bool operator>=(const MOSpace &lhs, const MOSpace &rhs)
115  { return lhs.label_ >= rhs.label_; }
116  friend bool operator!=(const MOSpace &lhs, const MOSpace &rhs)
117  { return lhs.label_ != rhs.label_; }
118  friend bool operator<=(const MOSpace &lhs, const MOSpace &rhs)
119  { return lhs.label_ <= rhs.label_; }
120  friend bool operator<(const MOSpace &lhs, const MOSpace &rhs)
121  { return lhs.label_ < rhs.label_; }
122  friend bool operator>(const MOSpace &lhs, const MOSpace &rhs)
123  { return lhs.label_ > rhs.label_; }
124  friend bool operator==(const MOSpace &lhs, const char c)
125  { return lhs.label_ == c; }
126  friend bool operator>=(const MOSpace &lhs, const char c)
127  { return lhs.label_ >= c; }
128  friend bool operator!=(const MOSpace &lhs, const char c)
129  { return lhs.label_ != c; }
130  friend bool operator<=(const MOSpace &lhs, const char c)
131  { return lhs.label_ <= c; }
132  friend bool operator<(const MOSpace &lhs, const char c)
133  { return lhs.label_ < c; }
134  friend bool operator>(const MOSpace &lhs, const char c)
135  { return lhs.label_ > c; }
136 
138  char label() {return label_;}
139 
141  const std::vector<int>& aOrbs() const {return aOrbs_;}
142 
144  const std::vector<int>& bOrbs() const {return bOrbs_;}
145 
147  const std::vector<int>& aIndex() {return aIndex_;}
148 
150  const std::vector<int>& bIndex() {return bIndex_.size() == 0 ? aIndex_ : bIndex_;}
151 
153  bool placeholder() const {return placeholder_;}
154  void set_placeholder(bool t_f) {placeholder_ = t_f;}
155 
156 
157  protected:
158  MOSpace(const char label);
164  const char label_;
165  // The indices (Pitzer) of the alpha orbitals
166  std::vector<int> aOrbs_;
167  // The indices (Pitzer) of the beta orbitals
168  std::vector<int> bOrbs_;
169  // The alpha reindexing array
170  std::vector<int> aIndex_;
171  // The beta reindexing array
172  std::vector<int> bIndex_;
173  // Whether this only describes dimensions, and has no orbitals associated with it
175 };
176 
177 } // End namespaces
178 
179 #endif // Header guard
const std::vector< int > & bIndex()
Get the beta orbital indexing array for IWL.
Definition: mospace.h:150
friend bool operator>(const MOSpace &lhs, const char c)
Definition: mospace.h:134
Definition: mospace.h:41
static std::shared_ptr< MOSpace > vir
Definition: mospace.h:85
const std::vector< int > & aIndex()
Get the alpha orbital indexing array for IWL.
Definition: mospace.h:147
static std::shared_ptr< MOSpace > nil
Definition: mospace.h:101
friend bool operator!=(const MOSpace &lhs, const MOSpace &rhs)
Definition: mospace.h:116
friend bool operator<(const MOSpace &lhs, const MOSpace &rhs)
Definition: mospace.h:120
static std::shared_ptr< MOSpace > dum
Definition: mospace.h:109
bool placeholder_
Definition: mospace.h:174
~MOSpace()
Definition: mospace.cc:119
friend bool operator==(const MOSpace &lhs, const char c)
Definition: mospace.h:124
const std::vector< int > & aOrbs() const
Get the alpha orbitals.
Definition: mospace.h:141
void set_placeholder(bool t_f)
Definition: mospace.h:154
static std::shared_ptr< MOSpace > all
Definition: mospace.h:94
MOSpace(const char label, const std::vector< int > aOrbs, const std::vector< int > bOrbs, const std::vector< int > aIndex, const std::vector< int > bIndex)
Definition: mospace.cc:93
std::vector< int > aOrbs_
Definition: mospace.h:166
char label()
Get the unique identifier for this space.
Definition: mospace.h:138
static std::shared_ptr< MOSpace > fzc
Keeps track of which labels have been assigned, for safety.
Definition: mospace.h:56
friend bool operator<=(const MOSpace &lhs, const char c)
Definition: mospace.h:130
friend bool operator==(const MOSpace &lhs, const MOSpace &rhs)
Definition: mospace.h:112
std::vector< int > aIndex_
Definition: mospace.h:170
const char label_
Definition: mospace.h:164
const std::vector< int > & bOrbs() const
Get the beta orbitals.
Definition: mospace.h:144
static std::shared_ptr< MOSpace > fzv
Definition: mospace.h:74
friend bool operator>=(const MOSpace &lhs, const MOSpace &rhs)
Definition: mospace.h:114
static std::shared_ptr< MOSpace > occ
Definition: mospace.h:67
friend bool operator!=(const MOSpace &lhs, const char c)
Definition: mospace.h:128
friend bool operator>=(const MOSpace &lhs, const char c)
Definition: mospace.h:126
friend bool operator>(const MOSpace &lhs, const MOSpace &rhs)
Definition: mospace.h:122
std::vector< int > bIndex_
Definition: mospace.h:172
friend bool operator<(const MOSpace &lhs, const char c)
Definition: mospace.h:132
bool placeholder() const
Whether this is just a placeholder.
Definition: mospace.h:153
friend bool operator<=(const MOSpace &lhs, const MOSpace &rhs)
Definition: mospace.h:118
std::vector< int > bOrbs_
Definition: mospace.h:168