QMCPACK
BandInfo.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: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
8 // Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
9 //
10 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
11 //////////////////////////////////////////////////////////////////////////////////////
12 
13 
14 /** @file BandInfo.h
15  *
16  * Define helper class to sort bands according to the band and twist and functions
17  */
18 #ifndef QMCPLUSPLUS_BANDINFO_H
19 #define QMCPLUSPLUS_BANDINFO_H
20 #include <Configuration.h>
21 
22 namespace qmcplusplus
23 {
24 class SPOSetInfo;
25 
26 struct BandInfo
27 {
28  ///twist index
30  ///band index
31  int BandIndex;
32  /// band group index
33  int BandGroup;
34  ///spin index
35  int Spin;
36  ///energy associated with this band
37  double Energy;
38  /// This is true if we should make distinct copies represeninting a +k, -k pair
40  ///default constructor
42  : TwistIndex(0), BandIndex(-1), BandGroup(0), Spin(0), Energy(1e9), MakeTwoCopies(false)
43  {}
44 
45  /** operator to determine the order of any band
46  *
47  * - energy
48  * - twist index if the energies are similar
49  */
50  inline bool operator<(BandInfo other) const
51  {
52  if ((Energy < other.Energy + 1e-6) && (Energy > other.Energy - 1e-6))
53  {
54  if (TwistIndex == other.TwistIndex)
55  return BandIndex < other.BandIndex;
56  else
57  return TwistIndex < other.TwistIndex;
58  }
59  else
60  return Energy < other.Energy;
61  }
62 };
63 
64 /** a group of bands
65  */
67 {
68  ///index of the group
69  int GroupID;
70  ///starting SPO
71  int FirstSPO;
72  ///number of SPOs handled by this object
73  int NumSPOs;
74  ///starting band
75  int FirstBand;
76  ///twist index set by the full band not by the subset
78  ///Bands that belong to this group
79  std::vector<BandInfo> myBands;
80  ///name of this band
81  std::string myName;
82  ///constructor
83  BandInfoGroup();
84  ///return the size of this band
85  inline int getNumDistinctOrbitals() const { return myBands.size(); }
86  ///return the indext of the first SPO set
87  inline int getFirstSPO() const { return FirstSPO; }
88  ///return the indext of the last SPO set
89  inline int getLastSPO() const { return NumSPOs + FirstSPO; }
90  ///return the number of SPOs
91  inline int getNumSPOs() const { return NumSPOs; }
92 
93  /** select the bands within an energy range [emin,emax)
94  *
95  * @param bigspace a set of sorted bands
96  * @param emin minimum energy
97  * @param emax maxmimum energy
98  */
99  void selectBands(const std::vector<BandInfo>& bigspace, double emin, double emax);
100 
101  /** get the bands within [first_spo,first_spo+num_spos)
102  * @param bigspace a set of sorted bands
103  * @param first_orb index of the first uniquie orbitals
104  * @param num_spos number of SPOs to be created
105  * @param relative if(relative) FirstSPO is set to any valid state index \f$[0,\infty)\f$
106  */
107  void selectBands(const std::vector<BandInfo>& bigspace, int first_orb, int num_spos, bool relative);
108 };
109 
110 } // namespace qmcplusplus
111 
112 #endif
double Energy
energy associated with this band
Definition: BandInfo.h:37
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
int getLastSPO() const
return the indext of the last SPO set
Definition: BandInfo.h:89
std::string myName
name of this band
Definition: BandInfo.h:81
int BandIndex
band index
Definition: BandInfo.h:31
BandInfoGroup()
constructor
Definition: BandInfo.cpp:20
int getNumSPOs() const
return the number of SPOs
Definition: BandInfo.h:91
bool operator<(BandInfo other) const
operator to determine the order of any band
Definition: BandInfo.h:50
int getNumDistinctOrbitals() const
return the size of this band
Definition: BandInfo.h:85
int GroupID
index of the group
Definition: BandInfo.h:69
a group of bands
Definition: BandInfo.h:66
BandInfo()
default constructor
Definition: BandInfo.h:41
void selectBands(const std::vector< BandInfo > &bigspace, double emin, double emax)
select the bands within an energy range [emin,emax)
Definition: BandInfo.cpp:22
int TwistIndex
twist index set by the full band not by the subset
Definition: BandInfo.h:77
int getFirstSPO() const
return the indext of the first SPO set
Definition: BandInfo.h:87
bool MakeTwoCopies
This is true if we should make distinct copies represeninting a +k, -k pair.
Definition: BandInfo.h:39
int TwistIndex
twist index
Definition: BandInfo.h:29
int BandGroup
band group index
Definition: BandInfo.h:33
int FirstBand
starting band
Definition: BandInfo.h:75
int NumSPOs
number of SPOs handled by this object
Definition: BandInfo.h:73
std::vector< BandInfo > myBands
Bands that belong to this group.
Definition: BandInfo.h:79
int FirstSPO
starting SPO
Definition: BandInfo.h:71
int Spin
spin index
Definition: BandInfo.h:35