src/QMCWaveFunctions/SPOSet.cpp
/** read data from a hdf5 file
 * @param norb number of orbitals to be initialized
 * @param fname hdf5 file name
 * @param coeff_ptr xmlnode for coefficients
 */
read data from a hdf5 file
@param norb number of orbitals to be initialized
@param fname hdf5 file name
@param coeff_ptr xmlnode for coefficients
read data from a hdf5 file @param norb number of orbitals to be initialized @param fname hdf5 file name @param coeff_ptr xmlnode for coefficients
bool SPOSet::putFromH5(const std::string& fname, xmlNodePtr coeff_ptr)
{
#if defined(HAVE_LIBHDF5)
  int norbs  = OrbitalSetSize;
  int neigs  = BasisSetSize;
  int setVal = -1;
  std::string setname;
  OhmmsAttributeSet aAttrib;
  aAttrib.add(setVal, "spindataset");
  aAttrib.add(neigs, "size");
  aAttrib.add(neigs, "orbitals");
  aAttrib.put(coeff_ptr);
  setIdentity(false);
  hdf_archive hin(myComm);
  if (myComm->rank() == 0)
  {
    if (!hin.open(fname, H5F_ACC_RDONLY))
      APP_ABORT("SPOSet::putFromH5 missing or incorrect path to H5 file.");
    Matrix<RealType> Ctemp(neigs, BasisSetSize);
    char name[72];
    sprintf(name, "%s%d", "/KPTS_0/eigenset_", setVal);
    setname = name;
    if (!hin.readEntry(Ctemp, setname))
    {
      setname = "SPOSet::putFromH5 Missing " + setname + " from HDF5 File.";
      APP_ABORT(setname.c_str());
    }
    hin.close();
    int n = 0, i = 0;
    while (i < norbs)
    {
      if (Occ[n] > 0.0)
      {
        std::copy(Ctemp[n], Ctemp[n + 1], (*C)[i]);
        i++;
      }
      n++;
    }
  }
  myComm->bcast(C->data(), C->size());
#else
  APP_ABORT("SPOSet::putFromH5 HDF5 is disabled.")
#endif
  return true;
}
bool SPOSet :: putFromH5 ( const std :: string & fname , xmlNodePtr coeff_ptr ) { #if defined ( HAVE_LIBHDF5 ) int norbs = OrbitalSetSize ; int neigs = BasisSetSize ; int setVal = -1 ; std :: string setname ; OhmmsAttributeSet aAttrib ; aAttrib . add ( setVal , " " ) ; aAttrib . add ( neigs , " " ) ; aAttrib . add ( neigs , " " ) ; aAttrib . put ( coeff_ptr ) ; setIdentity ( false ) ; hdf_archive hin ( myComm ) ; if ( myComm -> rank ( ) == 0 ) { if ( ! hin . open ( fname , H5F_ACC_RDONLY ) ) APP_ABORT ( " " ) ; Matrix < RealType > Ctemp ( neigs , BasisSetSize ) ; char name [ 72 ] ; sprintf ( name , " " , " " , setVal ) ; setname = name ; if ( ! hin . readEntry ( Ctemp , setname ) ) { setname = " " + setname + " " ; APP_ABORT ( setname . c_str ( ) ) ; } hin . close ( ) ; int n = 0 , i = 0 ; while ( i < norbs ) { if ( Occ [ n ] > 0.0 ) { std :: copy ( Ctemp [ n ] , Ctemp [ n + 1 ] , ( * C ) [ i ] ) ; i ++ ; } n ++ ; } } myComm -> bcast ( C -> data ( ) , C -> size ( ) ) ; #else APP_ABORT ( " " ) #endif return true ; }
read data from a hdf5 file
 @param norb number of orbitals to be initialized
 @param fname hdf5 file name
 @param coeff_ptr xmlnode for coefficients
read data from a hdf5 file @param norb number of orbitals to be initialized @param fname hdf5 file name @param coeff_ptr xmlnode for coefficients