src/QMCWaveFunctions/SPOSet.cpp
/** Parse the xml file for information on the Dirac determinants.
 *@param cur the current xmlNode
 */
Parse the xml file for information on the Dirac determinants.
@param cur the current xmlNode
Parse the xml file for information on the Dirac determinants . @param cur the current xmlNode
bool SPOSet::put(xmlNodePtr cur)
{
#undef FunctionName
#define FunctionName                                      \
  printf("Calling FunctionName from %s\n", __FUNCTION__); \
  FunctionNameReal
  ReportEngine PRE("SPOSet", "put(xmlNodePtr)");
  OhmmsAttributeSet locAttrib;
  std::string cur_name;
  locAttrib.add(cur_name, "name");
  locAttrib.put(cur);
  xmlNodePtr curtemp;
  if (cur_name == "spo-up" || cur_name == "spo-dn")
    curtemp = cur->parent;
  else
    curtemp = cur->parent->parent;
  std::string MOtype, MOhref;
  bool H5file = false;
  OhmmsAttributeSet H5checkAttrib;
  H5checkAttrib.add(MOtype, "type");
  H5checkAttrib.add(MOhref, "href");
  H5checkAttrib.put(curtemp);
  std::string MOhref2;
  if (MOtype == "MolecularOrbital" && MOhref != "")
  {
    MOhref2 = XMLAttrString(curtemp, "href");
    H5file  = true;
    PRE.echo(curtemp);
  }
  int norb = BasisSetSize;
  std::string debugc("no");
  double orbital_mix_magnitude = 0.0;
  bool PBC                     = false;
  OhmmsAttributeSet aAttrib;
  aAttrib.add(norb, "orbitals");
  aAttrib.add(norb, "size");
  aAttrib.add(debugc, "debug");
  aAttrib.add(orbital_mix_magnitude, "orbital_mix_magnitude");
  aAttrib.put(cur);
  setOrbitalSetSize(norb);
  xmlNodePtr occ_ptr   = NULL;
  xmlNodePtr coeff_ptr = NULL;
  cur                  = cur->xmlChildrenNode;
  while (cur != NULL)
  {
    std::string cname((const char*)(cur->name));
    if (cname == "occupation")
    {
      occ_ptr = cur;
    }
    else if (cname.find("coeff") < cname.size() || cname == "parameter" || cname == "Var")
    {
      coeff_ptr = cur;
    }
    cur = cur->next;
  }
  if (coeff_ptr == NULL)
  {
    app_log() << "   Using Identity for the LCOrbitalSet " << std::endl;
    return setIdentity(true);
  }
  bool success = putOccupation(occ_ptr);
  if (H5file == false)
    success = putFromXML(coeff_ptr);
  else
  {
    hdf_archive hin(myComm);
    if (myComm->rank() == 0)
    {
      if (!hin.open(MOhref2, H5F_ACC_RDONLY))
        APP_ABORT("SPOSet::putFromH5 missing or incorrect path to H5 file.");
      hin.push("PBC");
      PBC = false;
      hin.read(PBC, "PBC");
      hin.close();
      if (PBC)
        APP_ABORT("SPOSet::putFromH5 PBC is not supported by AoS builds");
    }
    myComm->bcast(PBC);
    success = putFromH5(MOhref2, coeff_ptr);
  }
  bool success2 = transformSPOSet();
  if (debugc == "yes")
  {
    app_log() << "   Single-particle orbital coefficients dims=" << C->rows() << " x " << C->cols() << std::endl;
    app_log() << C << std::endl;
  }
  init_LCOrbitalSetOpt(orbital_mix_magnitude);
  return success && success2;
}
bool SPOSet :: put ( xmlNodePtr cur ) { #undef  FunctionName #define FunctionName                                       \
  printf("Calling FunctionName from %s\n", __FUNCTION__); \
  FunctionNameReal ReportEngine PRE ( " " , " " ) ; OhmmsAttributeSet locAttrib ; std :: string cur_name ; locAttrib . add ( cur_name , " " ) ; locAttrib . put ( cur ) ; xmlNodePtr curtemp ; if ( cur_name == " " || cur_name == " " ) curtemp = cur -> parent ; else curtemp = cur -> parent -> parent ; std :: string MOtype , MOhref ; bool H5file = false ; OhmmsAttributeSet H5checkAttrib ; H5checkAttrib . add ( MOtype , " " ) ; H5checkAttrib . add ( MOhref , " " ) ; H5checkAttrib . put ( curtemp ) ; std :: string MOhref2 ; if ( MOtype == " " && MOhref != " " ) { MOhref2 = XMLAttrString ( curtemp , " " ) ; H5file = true ; PRE . echo ( curtemp ) ; } int norb = BasisSetSize ; std :: string debugc ( " " ) ; double orbital_mix_magnitude = 0.0 ; bool PBC = false ; OhmmsAttributeSet aAttrib ; aAttrib . add ( norb , " " ) ; aAttrib . add ( norb , " " ) ; aAttrib . add ( debugc , " " ) ; aAttrib . add ( orbital_mix_magnitude , " " ) ; aAttrib . put ( cur ) ; setOrbitalSetSize ( norb ) ; xmlNodePtr occ_ptr = NULL ; xmlNodePtr coeff_ptr = NULL ; cur = cur -> xmlChildrenNode ; while ( cur != NULL ) { std :: string cname ( ( const char * ) ( cur -> name ) ) ; if ( cname == " " ) { occ_ptr = cur ; } else if ( cname . find ( " " ) < cname . size ( ) || cname == " " || cname == " " ) { coeff_ptr = cur ; } cur = cur -> next ; } if ( coeff_ptr == NULL ) { app_log ( ) << " " << std :: endl ; return setIdentity ( true ) ; } bool success = putOccupation ( occ_ptr ) ; if ( H5file == false ) success = putFromXML ( coeff_ptr ) ; else { hdf_archive hin ( myComm ) ; if ( myComm -> rank ( ) == 0 ) { if ( ! hin . open ( MOhref2 , H5F_ACC_RDONLY ) ) APP_ABORT ( " " ) ; hin . push ( " " ) ; PBC = false ; hin . read ( PBC , " " ) ; hin . close ( ) ; if ( PBC ) APP_ABORT ( " " ) ; } myComm -> bcast ( PBC ) ; success = putFromH5 ( MOhref2 , coeff_ptr ) ; } bool success2 = transformSPOSet ( ) ; if ( debugc == " " ) { app_log ( ) << " " << C -> rows ( ) << " " << C -> cols ( ) << std :: endl ; app_log ( ) << C << std :: endl ; } init_LCOrbitalSetOpt ( orbital_mix_magnitude ) ; return success && success2 ; }
Parse the xml file for information on the Dirac determinants.
Parse the xml file for information on the Dirac determinants .
//Check if HDF5 present //Special case for sposet hierarchy: go up only once. //initialize the number of orbital by the basis set size //TO REVIEWERS:: IDEAL BEHAVIOUR SHOULD BE: /*
       if(!hin.push("PBC")
           PBC=false;
       else
          if (!hin.read(PBC,"PBC"))
              APP_ABORT("Could not read PBC dataset in H5 file. Probably corrupt file!!!.");
      // However, it always succeeds to enter the if condition even if the group does not exists...
      */