QMCPACK
PWParameterSet Struct Reference

class to handle various name conventions for hdf5 file More...

+ Inheritance diagram for PWParameterSet:
+ Collaboration diagram for PWParameterSet:

Public Member Functions

 PWParameterSet (Communicate *comm)
 
bool put (xmlNodePtr cur)
 
void checkVersion (hdf_archive &h)
 
double getEcut (double ecut)
 
bool getEigVectorType (hid_t h)
 get the dimensions of the eigenvectors More...
 
bool hasComplexData (hdf_archive &h)
 
std::string getTwistAngleName ()
 
std::string getTwistName ()
 
std::string getTwistName (int i)
 
std::string getBandName (int ib, int ispin)
 
std::string getBandName (int ib)
 
std::string getSpinName (int ispin)
 
std::string getEigVectorName (const std::string &hg, int ib, int ispin)
 
std::string getEigVectorName (int ib, int ispin)
 
std::string getCenterName (const std::string &hg, int ib)
 
std::string getOriginName (const std::string &hg, int ib)
 
- Public Member Functions inherited from MPIObjectBase
 MPIObjectBase (Communicate *c)
 constructor with communicator More...
 
int rank () const
 return the rank of the communicator More...
 
int getGroupID () const
 return the group id of the communicator More...
 
CommunicategetCommunicator () const
 return myComm More...
 
CommunicategetCommRef () const
 return a TEMPORARY reference to Communicate More...
 
mpi_comm_type getMPI () const
 return MPI communicator if one wants to use MPI directly More...
 
bool is_manager () const
 return true if the rank == 0 More...
 
const std::string & getName () const
 return the name More...
 
void setName (const std::string &aname)
 

Public Attributes

bool hasSpin
 true if spin channel exists More...
 
TinyVector< int, 2 > version
 version More...
 
int twistIndex
 index of the twist angle More...
 
int numBands
 number of input bands More...
 
double Ecut
 energy cutoff for QMC wavefunction More...
 
double Rcut
 cutoff radius for truncated orbitals More...
 
double BufferRadius
 radius of buffer layer for truncated orbitals More...
 
TinyVector< int, OHMMS_DIMBoxDup
 cell multiplications More...
 
std::string paramTag
 tag for the parameters More...
 
std::string basisTag
 tag for the basis More...
 
std::string pwTag
 tag for the planewaves More...
 
std::string pwMultTag
 tag for the multipliers of the planewaves More...
 
std::string eigTag
 tag for eigentstates More...
 
std::string twistTag
 tag for twist angles More...
 
std::string bandTag
 tag for the band More...
 
std::string spinTag
 tag for the spin More...
 
std::string eigvecTag
 tag for eigvector More...
 
ParameterSet m_param
 xml processor More...
 

Additional Inherited Members

- Public Types inherited from MPIObjectBase
using mpi_comm_type = Communicate::mpi_comm_type
 
- Protected Attributes inherited from MPIObjectBase
CommunicatemyComm
 pointer to Communicate More...
 
std::string ClassName
 class Name More...
 
std::string myName
 name of the object More...
 

Detailed Description

class to handle various name conventions for hdf5 file

Definition at line 30 of file PWParameterSet.h.

Constructor & Destructor Documentation

◆ PWParameterSet()

Definition at line 25 of file PWParameterSet.cpp.

References ParameterSet::add(), PWParameterSet::bandTag, PWParameterSet::basisTag, PWParameterSet::BoxDup, PWParameterSet::BufferRadius, PWParameterSet::eigTag, PWParameterSet::eigvecTag, PWParameterSet::m_param, PWParameterSet::paramTag, PWParameterSet::pwMultTag, PWParameterSet::pwTag, PWParameterSet::Rcut, OhmmsElementBase::setName(), PWParameterSet::spinTag, PWParameterSet::twistIndex, and PWParameterSet::twistTag.

27  hasSpin(true),
28  twistIndex(0),
29  numBands(0),
30  Ecut(-1),
31  Rcut(-1),
32  BufferRadius(-1),
33  BoxDup(1),
34  paramTag("parameters"),
35  basisTag("basis"),
36  pwTag("planewaves"),
37  pwMultTag("multipliers"),
38  eigTag("eigenstates"),
39  twistTag("twist"),
40  bandTag("band"),
41  spinTag("spin"),
42  eigvecTag("eigenvector")
43 {
44  m_param.setName("h5tag");
45  m_param.add(twistIndex, "twistIndex");
46  m_param.add(Rcut, "rcut");
47  m_param.add(BufferRadius, "bufferLayer");
48  m_param.add(BoxDup, "expand");
49  m_param.add(paramTag, "parameters");
50  m_param.add(basisTag, "basis");
51  m_param.add(pwTag, "planewaves");
52  m_param.add(pwMultTag, "multiplers");
53  m_param.add(eigTag, "eigenstates");
54  m_param.add(twistTag, "twist");
55  m_param.add(bandTag, "band");
56  m_param.add(spinTag, "spin");
57  m_param.add(eigvecTag, "eigenvector");
58 }
std::string eigTag
tag for eigentstates
std::string bandTag
tag for the band
ParameterSet m_param
xml processor
std::string basisTag
tag for the basis
std::string pwTag
tag for the planewaves
TinyVector< int, OHMMS_DIM > BoxDup
cell multiplications
void setName(const std::string &aname)
set name
int twistIndex
index of the twist angle
double BufferRadius
radius of buffer layer for truncated orbitals
std::string pwMultTag
tag for the multipliers of the planewaves
double Ecut
energy cutoff for QMC wavefunction
int numBands
number of input bands
double Rcut
cutoff radius for truncated orbitals
void add(PDT &aparam, const std::string &aname_in, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new parameter corresponding to an xmlNode <parameter>
std::string spinTag
tag for the spin
std::string paramTag
tag for the parameters
bool hasSpin
true if spin channel exists
MPIObjectBase(Communicate *c)
constructor with communicator
std::string eigvecTag
tag for eigvector
std::string twistTag
tag for twist angles

Member Function Documentation

◆ checkVersion()

void checkVersion ( hdf_archive h)

Definition at line 183 of file PWParameterSet.cpp.

References APP_ABORT, qmcplusplus::app_log(), PWParameterSet::bandTag, PWParameterSet::basisTag, Communicate::bcast(), PWParameterSet::eigTag, hdf_archive::getFileID(), PWParameterSet::hasSpin, MPIObjectBase::is_manager(), MPIObjectBase::myComm, PWParameterSet::paramTag, PWParameterSet::pwMultTag, PWParameterSet::pwTag, hdf_archive::read(), PWParameterSet::twistTag, and PWParameterSet::version.

184 {
185  if (is_manager())
186  {
187  hid_t dataset = H5Dopen(h.getFileID(), "version", H5P_DEFAULT);
188  hid_t datatype = H5Dget_type(dataset);
189  H5T_class_t classtype = H5Tget_class(datatype);
190  H5Tclose(datatype);
191  H5Dclose(dataset);
192  if (classtype == H5T_INTEGER)
193  {
194  h.read(version, "version");
195  }
196  else if (classtype == H5T_FLOAT)
197  {
199  h.read(vt, "version");
200  version[0] = static_cast<int>(vt[0]);
201  version[1] = static_cast<int>(vt[1]);
202  }
203  else
204  {
205  APP_ABORT("PWParameterSet::checkVersion The type of version is not integer or double.");
206  }
207  }
208  myComm->bcast(version);
209  app_log() << "\tWavefunction HDF version: " << version[0] << "." << version[1] << std::endl;
210  if (version[0] == 0)
211  {
212  if (version[1] == 11)
213  {
214  hasSpin = false;
215  paramTag = "parameters_0";
216  basisTag = "basis_1";
217  pwTag = "planewaves";
218  pwMultTag = "multipliers";
219  eigTag = "eigenstates_3";
220  twistTag = "twist_";
221  bandTag = "band_";
222  }
223  else if (version[1] == 10)
224  {
225  pwMultTag = "planewaves";
226  pwTag = "0";
227  }
228  }
229 }
std::string eigTag
tag for eigentstates
std::string bandTag
tag for the band
std::string basisTag
tag for the basis
std::string pwTag
tag for the planewaves
std::ostream & app_log()
Definition: OutputManager.h:65
std::string pwMultTag
tag for the multipliers of the planewaves
Communicate * myComm
pointer to Communicate
Definition: MPIObjectBase.h:62
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27
TinyVector< int, 2 > version
version
std::string paramTag
tag for the parameters
bool is_manager() const
return true if the rank == 0
Definition: MPIObjectBase.h:51
void bcast(T &)
bool hasSpin
true if spin channel exists
std::string twistTag
tag for twist angles

◆ getBandName() [1/2]

std::string getBandName ( int  ib,
int  ispin 
)

Definition at line 121 of file PWParameterSet.cpp.

122 {
123  std::ostringstream oss;
124  oss << "spin_" << ispin << "/"
125  << "state_" << ib;
126  return oss.str();
127 }

◆ getBandName() [2/2]

std::string getBandName ( int  ib)

Definition at line 169 of file PWParameterSet.cpp.

References PWParameterSet::bandTag.

170 {
171  std::ostringstream oss;
172  oss << bandTag << ib;
173  return oss.str();
174 }
std::string bandTag
tag for the band

◆ getCenterName()

std::string getCenterName ( const std::string &  hg,
int  ib 
)

Definition at line 142 of file PWParameterSet.cpp.

References PWParameterSet::bandTag.

143 {
144  std::ostringstream oss;
145  oss << hg << "/" << bandTag << ib << "/center";
146  return oss.str();
147 }
std::string bandTag
tag for the band

◆ getEcut()

double getEcut ( double  ecut)

Definition at line 60 of file PWParameterSet.cpp.

References PWParameterSet::Ecut.

61 {
62  if (Ecut < 0 || Ecut >= ecut)
63  Ecut = ecut;
64  return Ecut;
65 }
double Ecut
energy cutoff for QMC wavefunction

◆ getEigVectorName() [1/2]

std::string getEigVectorName ( const std::string &  hg,
int  ib,
int  ispin 
)

Definition at line 129 of file PWParameterSet.cpp.

References PWParameterSet::bandTag, PWParameterSet::hasSpin, and PWParameterSet::spinTag.

130 {
131  std::ostringstream oss;
132  oss << hg << "/" << bandTag << ib;
133  //if(version[1]==10)
134  if (hasSpin)
135  {
136  oss << "/" << spinTag << ispin;
137  }
138  oss << "/eigenvector";
139  return oss.str();
140 }
std::string bandTag
tag for the band
std::string spinTag
tag for the spin
bool hasSpin
true if spin channel exists

◆ getEigVectorName() [2/2]

std::string getEigVectorName ( int  ib,
int  ispin 
)

Definition at line 156 of file PWParameterSet.cpp.

References PWParameterSet::bandTag, PWParameterSet::eigTag, PWParameterSet::hasSpin, PWParameterSet::spinTag, PWParameterSet::twistIndex, and PWParameterSet::twistTag.

157 {
158  std::ostringstream oss;
159  oss << "/" << eigTag << "/" << twistTag << twistIndex << "/" << bandTag << ib;
160  //if(version[1]==10)
161  if (hasSpin)
162  {
163  oss << "/" << spinTag << ispin;
164  }
165  oss << "/eigenvector";
166  return oss.str();
167 }
std::string eigTag
tag for eigentstates
std::string bandTag
tag for the band
int twistIndex
index of the twist angle
std::string spinTag
tag for the spin
bool hasSpin
true if spin channel exists
std::string twistTag
tag for twist angles

◆ getEigVectorType()

bool getEigVectorType ( hid_t  h)

get the dimensions of the eigenvectors

Parameters
hfileid
Returns
true, if the data is complex

Definition at line 67 of file PWParameterSet.cpp.

References PWParameterSet::bandTag, Communicate::bcast(), PWParameterSet::eigTag, PWParameterSet::hasSpin, MPIObjectBase::is_manager(), MPIObjectBase::myComm, MPIObjectBase::rank(), PWParameterSet::spinTag, PWParameterSet::twistIndex, and PWParameterSet::twistTag.

68 {
69  int rank = 0;
70  if (is_manager())
71  {
72  std::ostringstream oss;
73  oss << "/" << eigTag << "/" << twistTag << twistIndex << "/" << bandTag << 0;
74  //if(version[1]==10)
75  if (hasSpin)
76  oss << "/" << spinTag << 0;
77  oss << "/eigenvector";
78  hsize_t dimTot[4];
79  hid_t dataset = H5Dopen(h, oss.str().c_str(), H5P_DEFAULT);
80  hid_t dataspace = H5Dget_space(dataset);
81  rank = H5Sget_simple_extent_ndims(dataspace);
82  int status_n = H5Sget_simple_extent_dims(dataspace, dimTot, NULL);
83  }
84  myComm->bcast(rank);
85  return rank == 4;
86 }
std::string eigTag
tag for eigentstates
std::string bandTag
tag for the band
int twistIndex
index of the twist angle
Communicate * myComm
pointer to Communicate
Definition: MPIObjectBase.h:62
std::string spinTag
tag for the spin
bool is_manager() const
return true if the rank == 0
Definition: MPIObjectBase.h:51
void bcast(T &)
bool hasSpin
true if spin channel exists
int rank() const
return the rank of the communicator
Definition: MPIObjectBase.h:35
std::string twistTag
tag for twist angles

◆ getOriginName()

std::string getOriginName ( const std::string &  hg,
int  ib 
)

Definition at line 149 of file PWParameterSet.cpp.

References PWParameterSet::bandTag.

150 {
151  std::ostringstream oss;
152  oss << hg << "/" << bandTag << ib << "/origin";
153  return oss.str();
154 }
std::string bandTag
tag for the band

◆ getSpinName()

std::string getSpinName ( int  ispin)

Definition at line 176 of file PWParameterSet.cpp.

References PWParameterSet::spinTag.

177 {
178  std::ostringstream oss;
179  oss << spinTag << ispin;
180  return oss.str();
181 }
std::string spinTag
tag for the spin

◆ getTwistAngleName()

std::string getTwistAngleName ( )

Definition at line 105 of file PWParameterSet.cpp.

References PWParameterSet::eigTag, PWParameterSet::twistIndex, and PWParameterSet::twistTag.

106 {
107  std::ostringstream oss;
108  oss << eigTag << "/" << twistTag << twistIndex << "/twist_angle";
109  return oss.str();
110 }
std::string eigTag
tag for eigentstates
int twistIndex
index of the twist angle
std::string twistTag
tag for twist angles

◆ getTwistName() [1/2]

std::string getTwistName ( )

Definition at line 112 of file PWParameterSet.cpp.

References PWParameterSet::twistIndex.

112 { return getTwistName(twistIndex); }
int twistIndex
index of the twist angle

◆ getTwistName() [2/2]

std::string getTwistName ( int  i)

Definition at line 114 of file PWParameterSet.cpp.

References PWParameterSet::twistTag.

115 {
116  std::ostringstream oss;
117  oss << twistTag << i;
118  return oss.str();
119 }
std::string twistTag
tag for twist angles

◆ hasComplexData()

bool hasComplexData ( hdf_archive h)

Definition at line 88 of file PWParameterSet.cpp.

References Communicate::bcast(), MPIObjectBase::is_manager(), MPIObjectBase::myComm, PWParameterSet::paramTag, and hdf_archive::read().

89 {
90  int iscomplex = 0;
91  // Should be the tag "/electrons/psi_r_is_complex", but the test HDF files
92  // don't have this set
93 #if 0
94  if(is_manager())
95  {
96  std::ostringstream oss;
97  oss << paramTag << "/complex_coefficients";
98  h_file.read(iscomplex, oss.str());
99  }
100 #endif
101  myComm->bcast(iscomplex);
102  return iscomplex;
103 }
Communicate * myComm
pointer to Communicate
Definition: MPIObjectBase.h:62
std::string paramTag
tag for the parameters
bool is_manager() const
return true if the rank == 0
Definition: MPIObjectBase.h:51
void bcast(T &)

◆ put()

bool put ( xmlNodePtr  cur)
inline

Definition at line 71 of file PWParameterSet.h.

References PWParameterSet::m_param, and ParameterSet::put().

71 { return m_param.put(cur); }
ParameterSet m_param
xml processor
bool put(std::istream &is) override
read from std::istream
Definition: ParameterSet.h:42

Member Data Documentation

◆ bandTag

◆ basisTag

std::string basisTag

tag for the basis

Definition at line 51 of file PWParameterSet.h.

Referenced by PWParameterSet::checkVersion(), and PWParameterSet::PWParameterSet().

◆ BoxDup

TinyVector<int, OHMMS_DIM> BoxDup

cell multiplications

Definition at line 47 of file PWParameterSet.h.

Referenced by PWParameterSet::PWParameterSet().

◆ BufferRadius

double BufferRadius

radius of buffer layer for truncated orbitals

Definition at line 45 of file PWParameterSet.h.

Referenced by PWParameterSet::PWParameterSet().

◆ Ecut

double Ecut

energy cutoff for QMC wavefunction

Definition at line 41 of file PWParameterSet.h.

Referenced by PWParameterSet::getEcut().

◆ eigTag

◆ eigvecTag

std::string eigvecTag

tag for eigvector

Definition at line 65 of file PWParameterSet.h.

Referenced by PWParameterSet::PWParameterSet().

◆ hasSpin

bool hasSpin

true if spin channel exists

Definition at line 33 of file PWParameterSet.h.

Referenced by PWParameterSet::checkVersion(), PWParameterSet::getEigVectorName(), and PWParameterSet::getEigVectorType().

◆ m_param

ParameterSet m_param

xml processor

Definition at line 67 of file PWParameterSet.h.

Referenced by PWParameterSet::put(), and PWParameterSet::PWParameterSet().

◆ numBands

int numBands

number of input bands

Definition at line 39 of file PWParameterSet.h.

◆ paramTag

std::string paramTag

tag for the parameters

Definition at line 49 of file PWParameterSet.h.

Referenced by PWParameterSet::checkVersion(), PWParameterSet::hasComplexData(), and PWParameterSet::PWParameterSet().

◆ pwMultTag

std::string pwMultTag

tag for the multipliers of the planewaves

Definition at line 55 of file PWParameterSet.h.

Referenced by PWParameterSet::checkVersion(), and PWParameterSet::PWParameterSet().

◆ pwTag

std::string pwTag

tag for the planewaves

Definition at line 53 of file PWParameterSet.h.

Referenced by PWParameterSet::checkVersion(), and PWParameterSet::PWParameterSet().

◆ Rcut

double Rcut

cutoff radius for truncated orbitals

Definition at line 43 of file PWParameterSet.h.

Referenced by PWParameterSet::PWParameterSet().

◆ spinTag

◆ twistIndex

◆ twistTag

◆ version

TinyVector<int, 2> version

version

Definition at line 35 of file PWParameterSet.h.

Referenced by PWParameterSet::checkVersion().


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