ARTS  2.4.0(git:4fb77825)
quantum.h File Reference
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <stdexcept>
#include "array.h"
#include "interpolation.h"
#include "matpack.h"
#include "mystring.h"
#include "rational.h"

Go to the source code of this file.

Classes

class  QuantumNumbers
 Container class for Quantum Numbers. More...
 
class  QuantumIdentifier
 Class to identify and match lines by their quantum numbers. More...
 

Macros

#define INPUT_QUANTUM(ID)    if (s == #ID) return QuantumNumberType::ID
 
#define INPUT_QUANTUM(ID)    if (s == QuantumNumberType::ID) return #ID
 

Typedefs

typedef Array< QuantumNumbersArrayOfQuantumNumbers
 
typedef Array< QuantumIdentifierArrayOfQuantumIdentifier
 

Enumerations

enum  QuantumNumberType : Index {
  QuantumNumberType::J = 0, QuantumNumberType::dJ, QuantumNumberType::M, QuantumNumberType::N,
  QuantumNumberType::dN, QuantumNumberType::S, QuantumNumberType::tau, QuantumNumberType::n,
  QuantumNumberType::F, QuantumNumberType::Ka, QuantumNumberType::Kc, QuantumNumberType::Omega,
  QuantumNumberType::i, QuantumNumberType::Lambda, QuantumNumberType::alpha, QuantumNumberType::Sym,
  QuantumNumberType::parity, QuantumNumberType::kronigParity, QuantumNumberType::v1, QuantumNumberType::v2,
  QuantumNumberType::v3, QuantumNumberType::v4, QuantumNumberType::v5, QuantumNumberType::v6,
  QuantumNumberType::v7, QuantumNumberType::v8, QuantumNumberType::v9, QuantumNumberType::v10,
  QuantumNumberType::v11, QuantumNumberType::v12, QuantumNumberType::l1, QuantumNumberType::l2,
  QuantumNumberType::l3, QuantumNumberType::l4, QuantumNumberType::l5, QuantumNumberType::l6,
  QuantumNumberType::l7, QuantumNumberType::l8, QuantumNumberType::l9, QuantumNumberType::l10,
  QuantumNumberType::l11, QuantumNumberType::l12, QuantumNumberType::pm, QuantumNumberType::r,
  QuantumNumberType::S_global, QuantumNumberType::ElectronState, QuantumNumberType::n_global, QuantumNumberType::C,
  QuantumNumberType::Hund, QuantumNumberType::FINAL_ENTRY
}
 Enum for Quantum Numbers used for indexing. More...
 
enum  Hund : Index { Hund::CaseA = int('a'), Hund::CaseB = int('b') }
 Enum for Hund cases. More...
 

Functions

QuantumNumberType string2quantumnumbertype (const String &s)
 
String quantumnumbertype2string (QuantumNumberType s)
 
bool operator== (const QuantumIdentifier &a, const QuantumIdentifier &b)
 Is everything the same between the identifiers. More...
 
bool operator!= (const QuantumIdentifier &a, const QuantumIdentifier &b)
 Is anything different between the identifiers. More...
 
bool operator== (const QuantumNumbers &a, const QuantumNumbers &b)
 Check if all quantum numbers are the same between a and b. More...
 
bool IsValidQuantumNumberName (String name)
 Check for valid quantum number name. More...
 
void ThrowIfQuantumNumberNameInvalid (String name)
 Check for valid quantum number name and throws if it is invalid. More...
 
std::istream & operator>> (std::istream &is, QuantumNumbers &qn)
 Input operator. More...
 
std::ostream & operator<< (std::ostream &os, const QuantumNumbers &qn)
 Output operator. More...
 
std::ostream & operator<< (std::ostream &os, const QuantumIdentifier &qi)
 Output operator. More...
 
std::ostream & operator<< (std::ostream &os, QuantumNumberType t)
 
void update_id (QuantumIdentifier &qid, const std::vector< std::array< String, 2 > > &upper_list, const std::vector< std::array< String, 2 > > &lower_list)
 Updates the quantum identifier based on a lists of strings. More...
 

Macro Definition Documentation

◆ INPUT_QUANTUM [1/2]

#define INPUT_QUANTUM (   ID)     if (s == #ID) return QuantumNumberType::ID

◆ INPUT_QUANTUM [2/2]

#define INPUT_QUANTUM (   ID)     if (s == QuantumNumberType::ID) return #ID

Typedef Documentation

◆ ArrayOfQuantumIdentifier

Definition at line 747 of file quantum.h.

◆ ArrayOfQuantumNumbers

Definition at line 365 of file quantum.h.

Enumeration Type Documentation

◆ Hund

enum Hund : Index
strong

Enum for Hund cases.

Enumerator
CaseA 
CaseB 

Definition at line 219 of file quantum.h.

◆ QuantumNumberType

enum QuantumNumberType : Index
strong

Enum for Quantum Numbers used for indexing.

If you add anything here, remember to also adapt operator<<(ostream&, const QuantumNumbers&) and operator>>(istream&, QuantumNumbers&) to handle the added numbers.

Enumerator
dJ 
dN 
tau 
Ka 
Kc 
Omega 
Lambda 
alpha 
Sym 
parity 
kronigParity 
v1 
v2 
v3 
v4 
v5 
v6 
v7 
v8 
v9 
v10 
v11 
v12 
l1 
l2 
l3 
l4 
l5 
l6 
l7 
l8 
l9 
l10 
l11 
l12 
pm 
S_global 
ElectronState 
n_global 
Hund 
FINAL_ENTRY 

Definition at line 48 of file quantum.h.

Function Documentation

◆ IsValidQuantumNumberName()

bool IsValidQuantumNumberName ( String  name)

Check for valid quantum number name.

Parameters
[in]nameParameter
Returns
true If the parameter exist
false Otherwise

Definition at line 164 of file quantum.cc.

References J, and string2quantumnumbertype().

Referenced by string2vecqn(), and ThrowIfQuantumNumberNameInvalid().

◆ operator!=()

bool operator!= ( const QuantumIdentifier a,
const QuantumIdentifier b 
)
inline

Is anything different between the identifiers.

May throw if different Qtypes are compared.

Parameters
[in]aOne identifier
[in]bAnother identifier
Returns
true If some quantum numbers mismatch
false Otherwise

Definition at line 732 of file quantum.h.

References operator==().

◆ operator<<() [1/3]

◆ operator<<() [2/3]

std::ostream& operator<< ( std::ostream &  os,
const QuantumNumbers qn 
)

Output operator.

Definition at line 187 of file quantum.cc.

References J, and quantumnumbertype2string().

◆ operator<<() [3/3]

std::ostream& operator<< ( std::ostream &  os,
QuantumNumberType  t 
)

Definition at line 409 of file quantum.cc.

References quantumnumbertype2string().

◆ operator==() [1/2]

bool operator== ( const QuantumIdentifier a,
const QuantumIdentifier b 
)
inline

Is everything the same between the identifiers.

May throw if different Qtypes are compared.

Parameters
[in]aOne identifier
[in]bAnother identifier
Returns
true If all quantum numbers match
false Otherwise

Definition at line 702 of file quantum.h.

References QuantumIdentifier::ALL, QuantumIdentifier::ENERGY_LEVEL, QuantumIdentifier::ENERGY_LEVEL_INDEX, QuantumIdentifier::Isotopologue(), QuantumIdentifier::NONE, QuantumIdentifier::QuantumMatch(), QuantumIdentifier::Species(), QuantumIdentifier::TRANSITION, QuantumIdentifier::TRANSITION_LOWER_INDEX, QuantumIdentifier::TRANSITION_UPPER_INDEX, and QuantumIdentifier::Type().

Referenced by operator!=().

◆ operator==() [2/2]

bool operator== ( const QuantumNumbers a,
const QuantumNumbers b 
)
inline

Check if all quantum numbers are the same between a and b.

Parameters
[in]aOne set of quantum numbers
[in]bAnother set of quantum numbers
Returns
true If all quantum numbers match
false Otherwise

Definition at line 743 of file quantum.h.

References QuantumNumbers::Compare().

◆ operator>>()

std::istream& operator>> ( std::istream &  is,
QuantumNumbers qn 
)

Input operator.

Definition at line 176 of file quantum.cc.

References QuantumNumbers::Set().

◆ quantumnumbertype2string()

String quantumnumbertype2string ( QuantumNumberType  s)
inline

◆ string2quantumnumbertype()

◆ ThrowIfQuantumNumberNameInvalid()

void ThrowIfQuantumNumberNameInvalid ( String  name)

Check for valid quantum number name and throws if it is invalid.

Parameters
[in]nameParameter

Definition at line 168 of file quantum.cc.

References IsValidQuantumNumberName().

Referenced by QuantumIdentifier::SetFromString().

◆ update_id()

void update_id ( QuantumIdentifier qid,
const std::vector< std::array< String, 2 > > &  upper_list,
const std::vector< std::array< String, 2 > > &  lower_list 
)

Updates the quantum identifier based on a lists of strings.

The input lists of strings should be paired as {key, value}

Parameters
[in,out]qidIdentifier to update
[in]upper_listList of strings to update upper state
[in]lower_listList of strings to update lower state

Definition at line 435 of file quantum.cc.

References interpret_stringdata(), J, QuantumIdentifier::LowerQuantumNumber(), RATIONAL_UNDEFINED, string2quantumnumbertype(), and QuantumIdentifier::UpperQuantumNumber().