QMCPACK
qmc-extract-eshdf-kvectors.cpp File Reference
+ Include dependency graph for qmc-extract-eshdf-kvectors.cpp:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 22 of file qmc-extract-eshdf-kvectors.cpp.

References hdf_archive::close(), hdf_archive::open(), and hdf_archive::read().

23 {
24 #ifdef HAVE_MPI
25  mpi3::environment env(argc, argv);
26 #endif
27 
28  using namespace qmcplusplus;
29  if (argc != 2)
30  {
31  std::cout << "Program must take as an argument a single input eshdf file to parse" << std::endl;
32  return 1;
33  }
34  std::string fname(argv[1]);
35  //cout << "Input file is: " << fname << std::endl;
36  hdf_archive hin;
37  hin.open(fname, H5F_ACC_RDONLY);
38  const std::string dataset = "electrons/number_of_kpoints";
39  // Get the number of kpoints from the eshdf file
40  int data;
41  hin.read(data, dataset);
42  // get all of the reduced kpoints from the file
43  std::array<float, 3> kpt;
44  for (int i = 0; i < data; i++)
45  {
46  std::ostringstream os;
47  os << "electrons/kpoint_" << i << "/reduced_k";
48  hin.read(kpt, os.str());
49  std::cout << kpt[0] << " " << kpt[1] << " " << kpt[2] << "\n";
50  }
51  hin.close();
52  return 0;
53 }
bool open(const std::filesystem::path &fname, unsigned flags=H5F_ACC_RDWR)
open a file
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
void close()
close all the open groups and file
Definition: hdf_archive.cpp:38
class to handle hdf file
Definition: hdf_archive.h:51
void read(T &data, const std::string &aname)
read the data from the group aname and check status runtime error is issued on I/O error ...
Definition: hdf_archive.h:306