ampsci
c++ program for high-precision atomic structure calculations of single-valence systems
AtomData.hpp
1 #pragma once
2 #include "Angular/Wigner369j.hpp"
3 #include "Physics/AtomData_PeriodicTable.hpp"
4 #include "qip/Template.hpp"
5 #include <string>
6 #include <utility>
7 #include <vector>
8 
10 namespace AtomData {
11 
12 //==============================================================================
14 struct NonRelConfig : qip::Comparison<NonRelConfig>,
15  qip::Arithmetic<NonRelConfig> {
16  int n;
17  int l;
18  int num;
19 
20  constexpr NonRelConfig(int in_n = 0, int in_l = -1, int in_num = 0)
21  : n(in_n), l(in_l), num(in_num) {}
22 
24  std::string symbol() const;
25 
27  bool ok() const;
28 
30  double frac() const;
31 
33  friend bool operator==(const NonRelConfig &lhs, const NonRelConfig &rhs);
34  friend bool operator<(const NonRelConfig &lhs, const NonRelConfig &rhs);
35 
38  NonRelConfig &operator-=(const NonRelConfig &rhs);
39 };
40 
41 //==============================================================================
43 struct DiracConfig { // name OK? too short?
44  int n;
45  int k;
46  double en;
47  DiracConfig(int in_n = 0, int in_k = 0, double in_en = 0)
48  : n(in_n), k(in_k), en(in_en){};
49 };
50 
51 //==============================================================================
52 //==============================================================================
53 
55 int defaultA(int Z);
56 
58 std::string atomicSymbol(int Z);
60 std::string atomicName(int Z);
61 
63 int atomic_Z(const std::string &at);
65 inline int atomic_Z(int z) { return z; }
66 
68 std::string l_symbol(int l);
70 std::string L_symbol(int l);
72 int symbol_to_l(std::string_view l_str);
74 std::string kappa_symbol(int kappa);
75 
77 std::string shortSymbol(int n, int kappa);
78 
80 std::pair<int, int> parse_symbol(std::string_view symbol);
81 
83 double diracen(double z, double n, int k, double alpha = 0.00729735256635);
84 
86 void printTable();
87 
89 std::string coreConfig(const std::string &in_ng);
90 
92 std::string niceCoreOutput(const std::string &full_core);
93 
98 std::vector<NonRelConfig> core_parser(const std::string &str_core_in);
99 
101 std::string configs_to_string(const std::vector<NonRelConfig> &configs);
102 
104 NonRelConfig term_parser(std::string_view term);
105 
108 std::vector<NonRelConfig> state_parser(const std::string &str_states);
110 void state_parser(std::vector<NonRelConfig> *states,
111  const std::string &str_states);
112 
114 std::string guessCoreConfigStr(const int total_core_electrons);
115 
117 std::vector<NonRelConfig> core_guess(const int total_core_electrons);
118 
120 std::vector<DiracConfig> listOfStates_nk(const std::string &in_list);
121 
123 std::vector<DiracConfig> listOfStates_singlen(const std::string &in_list);
124 
127 std::vector<std::pair<int, int>> n_kappa_list(const std::string &basis_string);
128 
129 } // namespace AtomData
Helper template for Arithmetic operations. Derive from this to provide +,-,*,/, given +=,...
Definition: Template.hpp:41
Helper template for comparisons. Derive from this to provide !=,>,<=,>=, given == and <.
Definition: Template.hpp:32
Useful atomic data/functions.
Definition: AtomData.cpp:14
std::vector< NonRelConfig > core_guess(const int total_core_electrons)
Given a number of electrons, guesses the configuration, returns list of NonRelConfigs.
Definition: AtomData.cpp:453
std::string l_symbol(int l)
l (int) to symbol (e.g., 0->'s', 1->'p')
Definition: AtomData.cpp:110
std::string configs_to_string(const std::vector< NonRelConfig > &configs)
Given a list of NonRelConfigs, returns full string.
Definition: AtomData.cpp:238
std::vector< std::pair< int, int > > n_kappa_list(const std::string &basis_string)
Given a "basis string", returns list of {n, kappa}. e.g., 6sp5d ->{{6,-1}, {6,1}, {6,...
Definition: AtomData.cpp:529
std::pair< int, int > parse_symbol(std::string_view symbol)
Parses electron 'symbol' or 'shortSymbol' to {n,kappa}, e.g., "6s+" -> {6,-1}; "6p-" -> {6,...
Definition: AtomData.cpp:148
std::string atomicName(int Z)
e.g., 55 -> "Cesium"
Definition: AtomData.cpp:73
std::string kappa_symbol(int kappa)
kappa (int) to symbol, e.g., -1 -> s_1/2
Definition: AtomData.cpp:123
std::string niceCoreOutput(const std::string &full_core)
Given a full electron config., returns nicer format by recognising nobel gas.
Definition: AtomData.cpp:198
std::string coreConfig(const std::string &in_ng)
Given a nobel-gas conifg (e.g., '[Xe]') returns full electron config.
Definition: AtomData.cpp:185
std::vector< DiracConfig > listOfStates_singlen(const std::string &in_list)
Generates a list of DiracConfig from string: just max n for each kappa.
Definition: AtomData.cpp:500
NonRelConfig term_parser(std::string_view term)
Given a term symbol 'nLm', returns corresponding NonRelConfig.
Definition: AtomData.cpp:326
std::string L_symbol(int l)
L (int) to symbol (e.g., 0->'S', 1->'P')
Definition: AtomData.cpp:116
int atomic_Z(const std::string &at)
Converts atomic symbol to integer Z (e.g., 'Cs' to 55 )
Definition: AtomData.cpp:84
std::string atomicSymbol(int Z)
e.g., 55 -> "Cs"
Definition: AtomData.cpp:64
std::vector< NonRelConfig > state_parser(const std::string &str_states)
Takes a string of states in form "nLm,nLm,..." converts to vector of NonRelConfig....
Definition: AtomData.cpp:367
int defaultA(int Z)
Looks up default A (most common) for given Z.
Definition: AtomData.cpp:53
std::vector< NonRelConfig > core_parser(const std::string &str_core_in)
Takes a "core string" in form "[X],nLm,nLm,..." converts to vector of NonRelConfig,...
Definition: AtomData.cpp:265
std::vector< DiracConfig > listOfStates_nk(const std::string &in_list)
Generates a list of DiracConfig from string: full list.
Definition: AtomData.cpp:469
void printTable()
Prints a periodic table to screen.
Definition: AtomData.cpp:572
int symbol_to_l(std::string_view l_str)
e.g., 'p' -> 1
Definition: AtomData.cpp:133
std::string guessCoreConfigStr(const int total_core_electrons)
Given a number of electrons, guesses the configuration, returns as string.
Definition: AtomData.cpp:408
std::string shortSymbol(int n, int kappa)
Returns shortSymbol, given n and kappa: (6,-1)->"6s+".
Definition: AtomData.cpp:128
double diracen(double z, double n, int k, double alpha)
Exact H-like energy.
Definition: AtomData.cpp:249
Stores relativistic single-electron state {n, kappa, energy}.
Definition: AtomData.hpp:43
Stores non-relativistic single-electron config: {n, l, number}.
Definition: AtomData.hpp:15
bool ok() const
Checks if consistent (l>n etc.)
Definition: AtomData.cpp:21
friend bool operator==(const NonRelConfig &lhs, const NonRelConfig &rhs)
Provides comparitor overloads. Compares n first, then l.
Definition: AtomData.cpp:33
std::string symbol() const
Returns symbol (e.g., 1s2 or 5p3)
Definition: AtomData.cpp:17
double frac() const
Filling fraction (accounting for spin) = num/[2*(2l+1)].
Definition: AtomData.cpp:27
NonRelConfig & operator+=(const NonRelConfig &rhs)
Provides addition and subtraction: adds 'num' iff n and l same.
Definition: AtomData.cpp:40