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 #include <vector>
35 
36 namespace psi{
37 
42 class MOSpace{
43 
44  public:
45  ~MOSpace();
46  MOSpace(const char label, const std::vector<int> aOrbs, const std::vector<int> bOrbs,
47  const std::vector<int> aIndex, const std::vector<int> bIndex);
48  MOSpace(const char label, const std::vector<int> aOrbs, const std::vector<int> aIndex);
49  MOSpace(const char label, const std::vector<int> orbsPI);
50 
56  #define MOSPACE_FZC 'o'
57  static std::shared_ptr<MOSpace> fzc;
67  #define MOSPACE_OCC 'O'
68  static std::shared_ptr<MOSpace> occ;
74  #define MOSPACE_FZV 'v'
75  static std::shared_ptr<MOSpace> fzv;
85  #define MOSPACE_VIR 'V'
86  static std::shared_ptr<MOSpace> vir;
94  #define MOSPACE_ALL 'A'
95  static std::shared_ptr<MOSpace> all;
101  #define MOSPACE_NIL 'n'
102  static std::shared_ptr<MOSpace> nil;
109  #define MOSPACE_DUM 'd'
110  static std::shared_ptr<MOSpace> dum;
111 
112  // These are to allow the map to be used
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 MOSpace &rhs)
124  { return lhs.label_ > rhs.label_; }
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  friend bool operator>(const MOSpace &lhs, const char c)
136  { return lhs.label_ > c; }
137 
139  char label() {return label_;}
140 
142  const std::vector<int>& aOrbs() const {return aOrbs_;}
143 
145  const std::vector<int>& bOrbs() const {return bOrbs_;}
146 
148  const std::vector<int>& aIndex() {return aIndex_;}
149 
151  const std::vector<int>& bIndex() {return bIndex_.size() == 0 ? aIndex_ : bIndex_;}
152 
154  bool placeholder() const {return placeholder_;}
155  void set_placeholder(bool t_f) {placeholder_ = t_f;}
156 
157 
158  protected:
159  MOSpace(const char label);
165  const char label_;
166  // The indices (Pitzer) of the alpha orbitals
167  std::vector<int> aOrbs_;
168  // The indices (Pitzer) of the beta orbitals
169  std::vector<int> bOrbs_;
170  // The alpha reindexing array
171  std::vector<int> aIndex_;
172  // The beta reindexing array
173  std::vector<int> bIndex_;
174  // Whether this only describes dimensions, and has no orbitals associated with it
176 };
177 
178 } // End namespaces
179 
180 #endif // Header guard
const std::vector< int > & bIndex()
Get the beta orbital indexing array for IWL.
Definition: mospace.h:151
friend bool operator>(const MOSpace &lhs, const char c)
Definition: mospace.h:135
Definition: mospace.h:42
static std::shared_ptr< MOSpace > vir
Definition: mospace.h:86
const std::vector< int > & aIndex()
Get the alpha orbital indexing array for IWL.
Definition: mospace.h:148
static std::shared_ptr< MOSpace > nil
Definition: mospace.h:102
friend bool operator!=(const MOSpace &lhs, const MOSpace &rhs)
Definition: mospace.h:117
friend bool operator<(const MOSpace &lhs, const MOSpace &rhs)
Definition: mospace.h:121
static std::shared_ptr< MOSpace > dum
Definition: mospace.h:110
bool placeholder_
Definition: mospace.h:175
~MOSpace()
Definition: mospace.cc:119
friend bool operator==(const MOSpace &lhs, const char c)
Definition: mospace.h:125
const std::vector< int > & aOrbs() const
Get the alpha orbitals.
Definition: mospace.h:142
void set_placeholder(bool t_f)
Definition: mospace.h:155
static std::shared_ptr< MOSpace > all
Definition: mospace.h:95
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:167
char label()
Get the unique identifier for this space.
Definition: mospace.h:139
static std::shared_ptr< MOSpace > fzc
Keeps track of which labels have been assigned, for safety.
Definition: mospace.h:57
friend bool operator<=(const MOSpace &lhs, const char c)
Definition: mospace.h:131
friend bool operator==(const MOSpace &lhs, const MOSpace &rhs)
Definition: mospace.h:113
std::vector< int > aIndex_
Definition: mospace.h:171
const char label_
Definition: mospace.h:165
const std::vector< int > & bOrbs() const
Get the beta orbitals.
Definition: mospace.h:145
static std::shared_ptr< MOSpace > fzv
Definition: mospace.h:75
friend bool operator>=(const MOSpace &lhs, const MOSpace &rhs)
Definition: mospace.h:115
static std::shared_ptr< MOSpace > occ
Definition: mospace.h:68
friend bool operator!=(const MOSpace &lhs, const char c)
Definition: mospace.h:129
friend bool operator>=(const MOSpace &lhs, const char c)
Definition: mospace.h:127
friend bool operator>(const MOSpace &lhs, const MOSpace &rhs)
Definition: mospace.h:123
std::vector< int > bIndex_
Definition: mospace.h:173
friend bool operator<(const MOSpace &lhs, const char c)
Definition: mospace.h:133
bool placeholder() const
Whether this is just a placeholder.
Definition: mospace.h:154
friend bool operator<=(const MOSpace &lhs, const MOSpace &rhs)
Definition: mospace.h:119
std::vector< int > bOrbs_
Definition: mospace.h:169