src/QMCWaveFunctions/lcao/LCAOrbitalBuilder.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 LCAOrbitalBuilder::loadMO(LCAOrbitalSet& spo, xmlNodePtr cur)
{
#undef FunctionName
#define FunctionName                                      \
  printf("Calling FunctionName from %s\n", __FUNCTION__); \
  FunctionNameReal
  ReportEngine PRE("LCAOrbitalBuilder", "put(xmlNodePtr)");
  int norb = spo.getBasisSetSize();
  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);
  spo.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;
    }
    else if (cname == "opt_vars")
    {
      spo.params_supplied = true;
      putContent(spo.params, cur);
    }
    cur = cur->next;
  }
  if (coeff_ptr == NULL)
  {
    app_log() << "   Using Identity for the LCOrbitalSet " << std::endl;
    return spo.setIdentity(true);
  }
  bool success = putOccupation(spo, occ_ptr);
  if (h5_path == "")
    success = putFromXML(spo, coeff_ptr);
  else
  {
    hdf_archive hin(myComm);
    if (myComm->rank() == 0)
    {
      if (!hin.open(h5_path, H5F_ACC_RDONLY))
        APP_ABORT("LCAOrbitalBuilder::putFromH5 missing or incorrect path to H5 file.");
      hin.push("PBC");
      PBC = false;
      hin.read(PBC, "PBC");
      hin.close();
    }
    myComm->bcast(PBC);
    if (PBC)
      success = putPBCFromH5(spo, coeff_ptr);
    else
      success = putFromH5(spo, coeff_ptr);
  }
  if (debugc == "yes")
  {
    app_log() << "   Single-particle orbital coefficients dims=" << spo.C->rows() << " x " << spo.C->cols()
              << std::endl;
    app_log() << *spo.C << std::endl;
  }
  return success;
}
bool LCAOrbitalBuilder :: loadMO ( LCAOrbitalSet & spo , xmlNodePtr cur ) { #undef  FunctionName #define FunctionName                                       \
  printf("Calling FunctionName from %s\n", __FUNCTION__); \
  FunctionNameReal ReportEngine PRE ( " " , " " ) ; int norb = spo . getBasisSetSize ( ) ; 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 ) ; spo . 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 ; } else if ( cname == " " ) { spo . params_supplied = true ; putContent ( spo . params , cur ) ; } cur = cur -> next ; } if ( coeff_ptr == NULL ) { app_log ( ) << " " << std :: endl ; return spo . setIdentity ( true ) ; } bool success = putOccupation ( spo , occ_ptr ) ; if ( h5_path == " " ) success = putFromXML ( spo , coeff_ptr ) ; else { hdf_archive hin ( myComm ) ; if ( myComm -> rank ( ) == 0 ) { if ( ! hin . open ( h5_path , H5F_ACC_RDONLY ) ) APP_ABORT ( " " ) ; hin . push ( " " ) ; PBC = false ; hin . read ( PBC , " " ) ; hin . close ( ) ; } myComm -> bcast ( PBC ) ; if ( PBC ) success = putPBCFromH5 ( spo , coeff_ptr ) ; else success = putFromH5 ( spo , coeff_ptr ) ; } if ( debugc == " " ) { app_log ( ) << " " << spo . C -> rows ( ) << " " << spo . C -> cols ( ) << std :: endl ; app_log ( ) << * spo . C << std :: endl ; } return success ; }
Parse the xml file for information on the Dirac determinants.
Parse the xml file for information on the Dirac determinants .
//Check if HDF5 present //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.readEntry(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...
        */ // Ye: used to construct cusp correction //bool success2 = transformSPOSet(); //init_LCOrbitalSetOpt(orbital_mix_magnitude);