ARTS  2.2.66
quantum.h
Go to the documentation of this file.
1 /* Copyright (C) 2013
2  Oliver Lemke <olemke@core-dump.info>
3 
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU General Public License as published by the
6  Free Software Foundation; either version 2, or (at your option) any
7  later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17  USA. */
18 
25 #ifndef quantum_h
26 #define quantum_h
27 
28 #include <map>
29 #include <iostream>
30 #include "matpack.h"
31 #include "rational.h"
32 
33 
35 /*
36  If you add anything here, remember to also adapt
37  operator<<(ostream&, const QuantumNumbers&) and
38  operator>>(istream&, QuantumNumbers&)
39  to handle the added numbers.
40  */
41 typedef enum {
42  QN_J, // Total
43  QN_N, // Total-Spin
44  QN_S, // Electronic spin
45  QN_F, // Total + nuclear spin
46  QN_Omega, // Absolute of projection of total + projection of spin
47  QN_K1, // Either K or Ka in HITRAN (This is a projection of J along one axis)
48  QN_K2, // Either Kb in HITRAN (This is a projection of J along another axis)
49  QN_v1, // Vibrational mode 1
50  QN_v2, // Vibrational mode 2
51  QN_v3, // Vibrational mode 3
52  QN_FINAL_ENTRY // We need this to determine the number of elements in this enum
54 
55 
58 {
59 public:
60  typedef std::map<Index, Rational> QuantumContainer;
61 
63  const Rational operator[](const Index qn) const
64  {
65  QuantumContainer::const_iterator it = mqnumbers.find(qn);
66  if (it != mqnumbers.end())
67  return it->second;
68  else
69  return RATIONAL_UNDEFINED;
70  }
71 
73  void Set(Index qn, Rational r) { assert(qn < QN_FINAL_ENTRY); mqnumbers[qn] = r; }
74 
75  const QuantumContainer& GetNumbers() const { return mqnumbers; }
76 
78 
85  bool Compare(const QuantumNumbers& qn) const;
86 
87 private:
89 };
90 
91 
94 {
95 public:
97  void SetLower(const Index i, const Rational r) { mqn_lower.Set(i, r); }
98 
100  void SetUpper(const Index i, const Rational r) { mqn_upper.Set(i, r); }
101 
103  Rational Lower(Index i) const { return mqn_lower[i]; }
104 
106  Rational Upper(Index i) const { return mqn_upper[i]; }
107 
110 
112  const QuantumNumbers& Lower() const { return mqn_lower; }
113 
116 
118  const QuantumNumbers& Upper() const { return mqn_upper; }
119 
120 private:
125 };
126 
127 
128 std::istream& operator>>(std::istream& is, QuantumNumbers& qn);
129 std::ostream& operator<<(std::ostream& os, const QuantumNumbers& qn);
130 
131 std::ostream& operator<<(std::ostream& os, const QuantumNumberRecord& qr);
132 
133 #endif
134 
QN_J
@ QN_J
Definition: quantum.h:42
RATIONAL_UNDEFINED
#define RATIONAL_UNDEFINED
Definition: rational.h:75
QuantumNumbers
Container class for Quantum Numbers.
Definition: quantum.h:58
QuantumNumberRecord::mqn_upper
QuantumNumbers mqn_upper
Upper state quantum numbers.
Definition: quantum.h:122
matpack.h
QuantumNumbers::GetNumbers
const QuantumContainer & GetNumbers() const
Definition: quantum.h:75
rational.h
Contains the rational class definition.
QuantumIds
QuantumIds
Enum for Quantum Numbers used for indexing.
Definition: quantum.h:41
QN_v1
@ QN_v1
Definition: quantum.h:49
QN_F
@ QN_F
Definition: quantum.h:45
QuantumNumbers::QuantumContainer
std::map< Index, Rational > QuantumContainer
Definition: quantum.h:60
QuantumNumberRecord::Upper
Rational Upper(Index i) const
Get upper quantum number.
Definition: quantum.h:106
QN_K1
@ QN_K1
Definition: quantum.h:47
QuantumNumberRecord::Upper
QuantumNumbers & Upper()
Get upper quantum numbers.
Definition: quantum.h:115
QN_Omega
@ QN_Omega
Definition: quantum.h:46
QN_K2
@ QN_K2
Definition: quantum.h:48
QuantumNumberRecord::Lower
QuantumNumbers & Lower()
Get lower quantum numbers.
Definition: quantum.h:109
QuantumNumberRecord::Lower
Rational Lower(Index i) const
Get lower quantum number.
Definition: quantum.h:103
QN_v3
@ QN_v3
Definition: quantum.h:51
QN_v2
@ QN_v2
Definition: quantum.h:50
QN_N
@ QN_N
Definition: quantum.h:43
QuantumNumbers::operator[]
const Rational operator[](const Index qn) const
Return copy of quantum number.
Definition: quantum.h:63
operator<<
std::ostream & operator<<(std::ostream &os, const QuantumNumbers &qn)
Definition: quantum.cc:93
operator>>
std::istream & operator>>(std::istream &is, QuantumNumbers &qn)
Definition: quantum.cc:60
QuantumNumberRecord::Upper
const QuantumNumbers & Upper() const
Get upper quantum numbers.
Definition: quantum.h:118
QN_S
@ QN_S
Definition: quantum.h:44
QuantumNumbers::mqnumbers
QuantumContainer mqnumbers
Definition: quantum.h:88
QuantumNumberRecord
Record containing upper and lower quantum numbers.
Definition: quantum.h:94
QuantumNumberRecord::SetLower
void SetLower(const Index i, const Rational r)
Set lower quantum number.
Definition: quantum.h:97
QuantumNumbers::Compare
bool Compare(const QuantumNumbers &qn) const
Compare Quantum Numbers.
Definition: quantum.cc:31
QuantumNumberRecord::SetUpper
void SetUpper(const Index i, const Rational r)
Set upper quantum number.
Definition: quantum.h:100
QN_FINAL_ENTRY
@ QN_FINAL_ENTRY
Definition: quantum.h:52
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:35
QuantumNumbers::Set
void Set(Index qn, Rational r)
Set quantum number.
Definition: quantum.h:73
QuantumNumberRecord::mqn_lower
QuantumNumbers mqn_lower
Lower state quantum numbers.
Definition: quantum.h:124
Rational
Definition: rational.h:35
QuantumNumberRecord::Lower
const QuantumNumbers & Lower() const
Get lower quantum numbers.
Definition: quantum.h:112