QNANO
Orbital_Index.h
1 #ifndef QNANO_NEW_ORBITAL_INDEX_DEFINED_H_
2 #define QNANO_NEW_ORBITAL_INDEX_DEFINED_H_
3 
4 #include <cstdlib>
5 #include <iostream>
6 #include <vector>
7 
17 public:
19  class Orbnames{
20 public:
21  size_t size_per_spin;
22  std::vector<std::vector<std::string> > names;
23  std::vector<std::string> group;
24 
25  Orbnames(){
26  size_per_spin=10;
27  group.resize(size_per_spin);
28  group[0]="s";
29  group[1]=group[2]=group[3]="p";
30  group[4]="sstar";
31  group[5]=group[6]=group[7]=group[8]=group[9]="d";
32 
33  names.resize(size_per_spin);
34  names[0].push_back("s");
35  names[1].push_back("px");
36  names[2].push_back("py");
37  names[3].push_back("pz");
38  names[4].push_back("sstar");names[4].push_back("s*");
39  names[5].push_back("dxy");names[5].push_back("dyx");
40  names[6].push_back("dyz");names[6].push_back("dzy");
41  names[7].push_back("dxz");names[7].push_back("dzx");
42  names[8].push_back("dx2-y2");names[8].push_back("dx2y2");
43  names[9].push_back("dz2");names[9].push_back("d3z-r2");names[9].push_back("d2z2-x2-y2");
44  }
45  };
46 private:
47  static Orbnames orbnames;
48 
49 public:
50 
51 
52 
53  static int max_nr_orbs(){return 20;};
54  static int max_nr_orbs_per_spin(){return 10;};
55 
56 
57  int selected;
58 
59  static bool is_valid(int orb);
60  static void quit_if_invalid(int orb);
61  static std::string ud_suffix(int orb);
62 
63  static std::string get_name(int i, bool withspin=false);
64  static const std::vector<std::string>& get_names_nospin(int i);
65  static std::string get_name_nospin(int i);
66  static std::string get_group_name(int i);
67  static int get_index(const std::string &str_);
68  static int get_index_check(const std::string &str);
69 
70  operator int() const{ return selected; }
71  operator std::string() const{ return get_name(selected); }
72 
73  Orbital_Index(){ selected=0; }
74  Orbital_Index(int orb_, bool spinup_=false){
75  selected=orb_;
76  quit_if_invalid(selected);
77  if(spinup_)selected+=max_nr_orbs_per_spin();
78  }
79  Orbital_Index(const std::string &name, bool spinup_=false){
80  selected=get_index(name);
81  quit_if_invalid(selected);
82  if(spinup_)selected+=max_nr_orbs_per_spin();
83  }
84 };
85 
86 #endif
Names of orbitals.
Definition: Orbital_Index.h:19
Definition: Orbital_Index.h:16