QMCPACK
SPOInfo.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2016 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by: Jaron T. Krogel, krogeljt@ornl.gov, Oak Ridge National Laboratory
8 // Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
9 //
10 // File created by: Jaron T. Krogel, krogeljt@ornl.gov, Oak Ridge National Laboratory
11 //////////////////////////////////////////////////////////////////////////////////////
12 
13 
14 #ifndef QMCPLUSPLUS_SPO_INFO_H
15 #define QMCPLUSPLUS_SPO_INFO_H
16 
17 #include <Configuration.h>
18 
19 namespace qmcplusplus
20 {
21 /** base class to describe a single orbital in an SPOSet
22  */
23 struct SPOInfo
24 {
26 
27  enum
28  {
30  };
31 
32  static const int no_index;
33  static const int no_degeneracy;
34  static const RealType no_energy;
35 
36  /// original orbital index in the maximal basis
37  int index;
38 
39  /// energetic degeneracy of the orbital
41 
42  /// energy of the orbital (in Hartree units)
44 
45  SPOInfo();
46 
47  SPOInfo(int orb_index, RealType en = no_energy);
48 
49  virtual ~SPOInfo() {}
50 
51 
52  inline bool has_index() const { return index != no_index; }
53 
54  inline bool has_energy() const { return energy != no_energy; }
55 
56  inline bool has_degeneracy() const { return degeneracy != no_degeneracy; }
57 
58  inline SPOInfo* copy() { return new SPOInfo(*this); }
59 
60  /// write orbital info to stdout
61  void report(const std::string& pad = "") const;
62 };
63 
64 
65 namespace spoinfo
66 {
67 /// enumeration of possible orbital info orderings
69 {
75 };
76 
77 /// comparison function for sorting SPOInfo based on orbital index
78 inline bool index_order(const SPOInfo* left, const SPOInfo* right) { return left->index < right->index; }
79 
80 /// comparison functor for sorting SPOInfo based on energy
82 {
85  EnergyOrder(RealType tol = 1e-6) : energy_tol(tol){};
87  inline bool operator()(const SPOInfo* left, const SPOInfo* right)
88  {
89  if (std::abs(left->energy - right->energy) < energy_tol)
90  return index_order(left, right);
91  else
92  return left->energy < right->energy;
93  }
94 };
95 } // namespace spoinfo
96 
97 
98 } // namespace qmcplusplus
99 
100 #endif
bool index_order(const SPOInfo *left, const SPOInfo *right)
comparison function for sorting SPOInfo based on orbital index
Definition: SPOInfo.h:78
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
EnergyOrder(RealType tol=1e-6)
Definition: SPOInfo.h:85
QTBase::RealType RealType
Definition: Configuration.h:58
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
bool has_energy() const
Definition: SPOInfo.h:54
static const RealType no_energy
Definition: SPOInfo.h:34
bool has_degeneracy() const
Definition: SPOInfo.h:56
int index
original orbital index in the maximal basis
Definition: SPOInfo.h:37
comparison functor for sorting SPOInfo based on energy
Definition: SPOInfo.h:81
#define OHMMS_DIM
Definition: config.h:64
RealType energy
energy of the orbital (in Hartree units)
Definition: SPOInfo.h:43
bool operator()(const SPOInfo *left, const SPOInfo *right)
Definition: SPOInfo.h:87
static const int no_index
Definition: SPOInfo.h:32
base class to describe a single orbital in an SPOSet
Definition: SPOInfo.h:23
QMCTraits::RealType RealType
Definition: SPOInfo.h:83
SPOInfo * copy()
Definition: SPOInfo.h:58
static const int no_degeneracy
Definition: SPOInfo.h:33
bool has_index() const
Definition: SPOInfo.h:52
virtual ~SPOInfo()
Definition: SPOInfo.h:49
void report(const std::string &pad="") const
write orbital info to stdout
Definition: SPOInfo.cpp:40
int degeneracy
energetic degeneracy of the orbital
Definition: SPOInfo.h:40
QMCTraits::RealType RealType
Definition: SPOInfo.h:25
orderings
enumeration of possible orbital info orderings
Definition: SPOInfo.h:68