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 program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License along
22  * with this program; if not, write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  *
25  * @END LICENSE
26  */
27 
28 #ifndef _PSI_SRC_LIB_LIBTRANS_MOSPACE_H_
29 #define _PSI_SRC_LIB_LIBTRANS_MOSPACE_H_
30 
31 #include "psi4/psi4-dec.h"
32 #include <map>
33 
34 namespace psi{
35 
40 class MOSpace{
41 
42  public:
43  ~MOSpace();
44  MOSpace(const char label, const std::vector<int> aOrbs, const std::vector<int> bOrbs,
45  const std::vector<int> aIndex, const std::vector<int> bIndex);
46  MOSpace(const char label, const std::vector<int> aOrbs, const std::vector<int> aIndex);
47  MOSpace(const char label, const std::vector<int> orbsPI);
48 
54  #define MOSPACE_FZC 'o'
55  static std::shared_ptr<MOSpace> fzc;
65  #define MOSPACE_OCC 'O'
66  static std::shared_ptr<MOSpace> occ;
72  #define MOSPACE_FZV 'v'
73  static std::shared_ptr<MOSpace> fzv;
83  #define MOSPACE_VIR 'V'
84  static std::shared_ptr<MOSpace> vir;
92  #define MOSPACE_ALL 'A'
93  static std::shared_ptr<MOSpace> all;
99  #define MOSPACE_NIL 'n'
100  static std::shared_ptr<MOSpace> nil;
107  #define MOSPACE_DUM 'd'
108  static std::shared_ptr<MOSpace> dum;
109 
110  // These are to allow the map to be used
111  friend bool operator==(const MOSpace &lhs, const MOSpace &rhs)
112  { return lhs.label_ == rhs.label_; }
113  friend bool operator>=(const MOSpace &lhs, const MOSpace &rhs)
114  { return lhs.label_ >= rhs.label_; }
115  friend bool operator!=(const MOSpace &lhs, const MOSpace &rhs)
116  { return lhs.label_ != rhs.label_; }
117  friend bool operator<=(const MOSpace &lhs, const MOSpace &rhs)
118  { return lhs.label_ <= rhs.label_; }
119  friend bool operator<(const MOSpace &lhs, const MOSpace &rhs)
120  { return lhs.label_ < rhs.label_; }
121  friend bool operator>(const MOSpace &lhs, const MOSpace &rhs)
122  { return lhs.label_ > rhs.label_; }
123  friend bool operator==(const MOSpace &lhs, const char c)
124  { return lhs.label_ == c; }
125  friend bool operator>=(const MOSpace &lhs, const char c)
126  { return lhs.label_ >= c; }
127  friend bool operator!=(const MOSpace &lhs, const char c)
128  { return lhs.label_ != c; }
129  friend bool operator<=(const MOSpace &lhs, const char c)
130  { return lhs.label_ <= c; }
131  friend bool operator<(const MOSpace &lhs, const char c)
132  { return lhs.label_ < c; }
133  friend bool operator>(const MOSpace &lhs, const char c)
134  { return lhs.label_ > c; }
135 
137  char label() {return label_;}
138 
140  const std::vector<int>& aOrbs() const {return aOrbs_;}
141 
143  const std::vector<int>& bOrbs() const {return bOrbs_;}
144 
146  const std::vector<int>& aIndex() {return aIndex_;}
147 
149  const std::vector<int>& bIndex() {return bIndex_.size() == 0 ? aIndex_ : bIndex_;}
150 
152  bool placeholder() const {return placeholder_;}
153  void set_placeholder(bool t_f) {placeholder_ = t_f;}
154 
155 
156  protected:
157  MOSpace(const char label);
163  const char label_;
164  // The indices (Pitzer) of the alpha orbitals
165  std::vector<int> aOrbs_;
166  // The indices (Pitzer) of the beta orbitals
167  std::vector<int> bOrbs_;
168  // The alpha reindexing array
169  std::vector<int> aIndex_;
170  // The beta reindexing array
171  std::vector<int> bIndex_;
172  // Whether this only describes dimensions, and has no orbitals associated with it
174 };
175 
176 } // End namespaces
177 
178 #endif // Header guard
const std::vector< int > & bIndex()
Get the beta orbital indexing array for IWL.
Definition: mospace.h:149
friend bool operator>(const MOSpace &lhs, const char c)
Definition: mospace.h:133
Definition: mospace.h:40
static std::shared_ptr< MOSpace > vir
Definition: mospace.h:84
const std::vector< int > & aIndex()
Get the alpha orbital indexing array for IWL.
Definition: mospace.h:146
static std::shared_ptr< MOSpace > nil
Definition: mospace.h:100
friend bool operator!=(const MOSpace &lhs, const MOSpace &rhs)
Definition: mospace.h:115
friend bool operator<(const MOSpace &lhs, const MOSpace &rhs)
Definition: mospace.h:119
static std::shared_ptr< MOSpace > dum
Definition: mospace.h:108
bool placeholder_
Definition: mospace.h:173
~MOSpace()
Definition: mospace.cc:118
friend bool operator==(const MOSpace &lhs, const char c)
Definition: mospace.h:123
const std::vector< int > & aOrbs() const
Get the alpha orbitals.
Definition: mospace.h:140
void set_placeholder(bool t_f)
Definition: mospace.h:153
static std::shared_ptr< MOSpace > all
Definition: mospace.h:93
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:92
std::vector< int > aOrbs_
Definition: mospace.h:165
char label()
Get the unique identifier for this space.
Definition: mospace.h:137
static std::shared_ptr< MOSpace > fzc
Keeps track of which labels have been assigned, for safety.
Definition: mospace.h:55
friend bool operator<=(const MOSpace &lhs, const char c)
Definition: mospace.h:129
friend bool operator==(const MOSpace &lhs, const MOSpace &rhs)
Definition: mospace.h:111
std::vector< int > aIndex_
Definition: mospace.h:169
const char label_
Definition: mospace.h:163
const std::vector< int > & bOrbs() const
Get the beta orbitals.
Definition: mospace.h:143
static std::shared_ptr< MOSpace > fzv
Definition: mospace.h:73
friend bool operator>=(const MOSpace &lhs, const MOSpace &rhs)
Definition: mospace.h:113
static std::shared_ptr< MOSpace > occ
Definition: mospace.h:66
friend bool operator!=(const MOSpace &lhs, const char c)
Definition: mospace.h:127
friend bool operator>=(const MOSpace &lhs, const char c)
Definition: mospace.h:125
friend bool operator>(const MOSpace &lhs, const MOSpace &rhs)
Definition: mospace.h:121
std::vector< int > bIndex_
Definition: mospace.h:171
friend bool operator<(const MOSpace &lhs, const char c)
Definition: mospace.h:131
bool placeholder() const
Whether this is just a placeholder.
Definition: mospace.h:152
friend bool operator<=(const MOSpace &lhs, const MOSpace &rhs)
Definition: mospace.h:117
std::vector< int > bOrbs_
Definition: mospace.h:167