QMCPACK
BandInfoGroup Struct Reference

a group of bands More...

+ Collaboration diagram for BandInfoGroup:

Public Member Functions

 BandInfoGroup ()
 constructor More...
 
int getNumDistinctOrbitals () const
 return the size of this band More...
 
int getFirstSPO () const
 return the indext of the first SPO set More...
 
int getLastSPO () const
 return the indext of the last SPO set More...
 
int getNumSPOs () const
 return the number of SPOs More...
 
void selectBands (const std::vector< BandInfo > &bigspace, double emin, double emax)
 select the bands within an energy range [emin,emax) More...
 
void selectBands (const std::vector< BandInfo > &bigspace, int first_orb, int num_spos, bool relative)
 get the bands within [first_spo,first_spo+num_spos) More...
 

Public Attributes

int GroupID
 index of the group More...
 
int FirstSPO
 starting SPO More...
 
int NumSPOs
 number of SPOs handled by this object More...
 
int FirstBand
 starting band More...
 
int TwistIndex
 twist index set by the full band not by the subset More...
 
std::vector< BandInfomyBands
 Bands that belong to this group. More...
 
std::string myName
 name of this band More...
 

Detailed Description

a group of bands

Definition at line 66 of file BandInfo.h.

Constructor & Destructor Documentation

◆ BandInfoGroup()

constructor

Definition at line 20 of file BandInfo.cpp.

20 : FirstSPO(0), NumSPOs(0), FirstBand(0) {}
int FirstBand
starting band
Definition: BandInfo.h:75
int NumSPOs
number of SPOs handled by this object
Definition: BandInfo.h:73
int FirstSPO
starting SPO
Definition: BandInfo.h:71

Member Function Documentation

◆ getFirstSPO()

int getFirstSPO ( ) const
inline

return the indext of the first SPO set

Definition at line 87 of file BandInfo.h.

References BandInfoGroup::FirstSPO.

Referenced by BsplineReader::check_twists().

87 { return FirstSPO; }
int FirstSPO
starting SPO
Definition: BandInfo.h:71

◆ getLastSPO()

int getLastSPO ( ) const
inline

return the indext of the last SPO set

Definition at line 89 of file BandInfo.h.

References BandInfoGroup::FirstSPO, and BandInfoGroup::NumSPOs.

Referenced by BsplineReader::check_twists().

89 { return NumSPOs + FirstSPO; }
int NumSPOs
number of SPOs handled by this object
Definition: BandInfo.h:73
int FirstSPO
starting SPO
Definition: BandInfo.h:71

◆ getNumDistinctOrbitals()

int getNumDistinctOrbitals ( ) const
inline

return the size of this band

Definition at line 85 of file BandInfo.h.

References BandInfoGroup::myBands.

Referenced by BsplineReader::check_twists(), HybridRepSetReader< SA >::initialize_hybrid_pio_gather(), and SplineSetReader< typename SA::SplineBase >::initialize_spline_pio_gather().

85 { return myBands.size(); }
std::vector< BandInfo > myBands
Bands that belong to this group.
Definition: BandInfo.h:79

◆ getNumSPOs()

int getNumSPOs ( ) const
inline

return the number of SPOs

Definition at line 91 of file BandInfo.h.

References BandInfoGroup::NumSPOs.

Referenced by BsplineReader::check_twists().

91 { return NumSPOs; }
int NumSPOs
number of SPOs handled by this object
Definition: BandInfo.h:73

◆ selectBands() [1/2]

void selectBands ( const std::vector< BandInfo > &  bigspace,
double  emin,
double  emax 
)

select the bands within an energy range [emin,emax)

Parameters
bigspacea set of sorted bands
eminminimum energy
emaxmaxmimum energy

Definition at line 22 of file BandInfo.cpp.

References APP_ABORT, qmcplusplus::app_log(), BandInfoGroup::FirstBand, BandInfoGroup::FirstSPO, BandInfoGroup::myBands, qmcplusplus::Units::force::N, and BandInfoGroup::NumSPOs.

Referenced by BsplineReader::create_spline_set().

23 {
24  myBands.clear();
25  if (emin > emax)
26  return;
27 
28  int iorb = 0;
29  int N = bigspace.size();
30  int n_lower = 0;
31  do
32  {
33  if (bigspace[iorb].Energy >= emin)
34  break;
35  n_lower += (bigspace[iorb].MakeTwoCopies) ? 2 : 1;
36  ++iorb;
37  } while (iorb < N);
38 
39  if (iorb >= N)
40  {
41  APP_ABORT("BandInfoGroup::selectBands failed due to iorb>=N");
42  }
43 
44  FirstSPO = n_lower;
45  FirstBand = iorb;
46  NumSPOs = 0;
47  while (iorb < N)
48  {
49  if (bigspace[iorb].Energy >= emax)
50  break;
51  myBands.push_back(bigspace[iorb]);
52  NumSPOs += (bigspace[iorb].MakeTwoCopies) ? 2 : 1;
53  ++iorb;
54  }
55 
56  app_log() << "BandInfoGroup::selectBands using energy [" << emin << "," << emax << ")" << std::endl;
57  app_log() << " Number of distinct bands " << myBands.size() << std::endl;
58  app_log() << " First Band index " << FirstBand << std::endl;
59  app_log() << " First SPO index " << FirstSPO << std::endl;
60  app_log() << " Size of SPOs " << NumSPOs << std::endl;
61 
62  //for(int i=0; i<myBands.size(); ++i)
63  // app_log() << myBands[i].TwistIndex << " " << myBands[i].Energy << std::endl;
64  app_log().flush();
65 }
std::ostream & app_log()
Definition: OutputManager.h:65
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27
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

◆ selectBands() [2/2]

void selectBands ( const std::vector< BandInfo > &  bigspace,
int  first_orb,
int  num_spos,
bool  relative 
)

get the bands within [first_spo,first_spo+num_spos)

Parameters
bigspacea set of sorted bands
first_orbindex of the first uniquie orbitals
num_sposnumber of SPOs to be created
relativeif(relative) FirstSPO is set to any valid state index $[0,\infty)$

Definition at line 67 of file BandInfo.cpp.

References APP_ABORT, qmcplusplus::app_log(), BandInfoGroup::FirstBand, BandInfoGroup::FirstSPO, BandInfoGroup::myBands, qmcplusplus::Units::force::N, and BandInfoGroup::NumSPOs.

68 {
69  app_log() << "BandInfoGroup::selectBands bigspace has " << bigspace.size() << " distinct orbitals " << std::endl;
70  myBands.clear();
71 
72  int iorb = 0;
73  int N = bigspace.size();
74  int n_lower = 0;
75  do
76  {
77  if (iorb >= first_orb)
78  break;
79  n_lower += (bigspace[iorb].MakeTwoCopies) ? 2 : 1;
80  ++iorb;
81  } while (iorb < N);
82 
83  if (iorb >= N)
84  {
85  APP_ABORT("BandInfoGroup::selectBands failed due to iorb>=N");
86  }
87 
88  FirstSPO = (relative) ? n_lower : 0;
89  FirstBand = iorb;
90  NumSPOs = 0;
91  int ns_max = num_spos - 1;
92  while (iorb < N && NumSPOs < num_spos)
93  {
94  //if(myBands.size()>=num_orbs) break;
95  myBands.push_back(bigspace[iorb]);
96  NumSPOs += (NumSPOs < ns_max && bigspace[iorb].MakeTwoCopies) ? 2 : 1;
97  ++iorb;
98  }
99 
100  app_log() << "BandInfoGroup::selectBands using distinct orbitals [" << first_orb << "," << iorb << ")" << std::endl;
101  app_log() << " Number of distinct bands " << myBands.size() << std::endl;
102  app_log() << " First Band index " << FirstBand << std::endl;
103  app_log() << " First SPO index " << FirstSPO << std::endl;
104  app_log() << " Size of SPOs " << NumSPOs << std::endl;
105 }
std::ostream & app_log()
Definition: OutputManager.h:65
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27
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

Member Data Documentation

◆ FirstBand

int FirstBand

starting band

Definition at line 75 of file BandInfo.h.

Referenced by BandInfoGroup::selectBands().

◆ FirstSPO

int FirstSPO

starting SPO

Definition at line 71 of file BandInfo.h.

Referenced by BandInfoGroup::getFirstSPO(), BandInfoGroup::getLastSPO(), and BandInfoGroup::selectBands().

◆ GroupID

int GroupID

index of the group

Definition at line 69 of file BandInfo.h.

Referenced by BsplineReader::create_spline_set().

◆ myBands

◆ myName

std::string myName

name of this band

Definition at line 81 of file BandInfo.h.

Referenced by BsplineReader::create_spline_set(), and BsplineReader::getSplineDumpFileName().

◆ NumSPOs

int NumSPOs

number of SPOs handled by this object

Definition at line 73 of file BandInfo.h.

Referenced by BandInfoGroup::getLastSPO(), BandInfoGroup::getNumSPOs(), and BandInfoGroup::selectBands().

◆ TwistIndex

int TwistIndex

twist index set by the full band not by the subset

Definition at line 77 of file BandInfo.h.

Referenced by BsplineReader::check_twists(), and BsplineReader::create_spline_set().


The documentation for this struct was generated from the following files: