コード例 #1
0
ファイル: JAABuilder.cpp プロジェクト: digideskio/qmcpack
  bool JAABuilder::put(xmlNodePtr cur) {

    string spinOpt("no");
    string typeOpt("Two-Body");
    string jastfunction("pade");
    OhmmsAttributeSet aAttrib;
    aAttrib.add(spinOpt,"spin");
    aAttrib.add(typeOpt,"type");
    aAttrib.add(jastfunction,"function");
    aAttrib.put(cur);

    IgnoreSpin=(spinOpt=="no");
    bool success=false;
    //if(jastfunction == "pade") {
    //  app_log() << "  Two-Body Jastrow Function = " << jastfunction << endl;
    //  PadeJastrow<RealType> *dummy = 0;
    //  success = createJAA(cur,dummy);
    //} else 
    if(jastfunction == "short") {
      app_log() << "  Modified Jastrow function Two-Body Jastrow Function = " << jastfunction << endl;
      IgnoreSpin=true;
      //ModPadeFunctor<RealType> *dummy = 0;
      success = createJAA<ModPadeFunctor<RealType> >(cur,jastfunction);
    }else if(jastfunction == "modMcMillan")
    {
      app_log() << "  Modified McMillan Jastrow function Two-Body Jastrow Function = " << jastfunction << endl;
      IgnoreSpin=true;
      success = createJAA<ModMcMillanJ2Functor<RealType> >(cur,jastfunction);
    }else if(jastfunction == "McMillan")
    {
      app_log() << "  McMillan Jastrow (LONG RANGE!) function Two-Body Jastrow Function = " << jastfunction << endl;
      IgnoreSpin=true;
      success = createJAA<McMillanJ2Functor<RealType> >(cur,jastfunction);
    }else if(jastfunction == "Gaussian")
    {
      app_log() << "  Gaussian function Two-Body Jastrow Function = " << jastfunction << endl;
      IgnoreSpin=true;
      success = createJAA<GaussianFunctor<RealType> >(cur,jastfunction);
    } else if(jastfunction == "shiftedGaussian")
    {
      app_log() << "  Gaussian function Two-Body Jastrow Function = " << jastfunction << endl;
      IgnoreSpin=true;
      success = createJAA<TruncatedShiftedGaussianFunctor<RealType> >(cur,jastfunction);
    }
    //} else if(jastfunction == "rpa") {
    //  app_log() << "  Two-Body Jastrow Function = " << jastfunction << endl;
    //  RPAJastrow<RealType> *dummy = 0;
    //  success = createJAA(cur,dummy);
    //}
    return success;
  }
コード例 #2
0
  bool TwoBodyJastrowBuilder::put(xmlNodePtr cur) {

    string functionOpt("pade");
    string transformOpt("no");
    string sourceOpt("9NONE");
    string spinOpt("yes");
    OhmmsAttributeSet oAttrib;
    oAttrib.add(functionOpt,"function");
    oAttrib.add(transformOpt,"transform");
    oAttrib.add(sourceOpt,"source");
    oAttrib.add(spinOpt,"spin");
    oAttrib.put(cur);

    IgnoreSpin = (spinOpt == "no");

    if(sourceOpt[0] != '9') {
      map<string,ParticleSet*>::iterator pa_it(ptclPool.find(sourceOpt));
      if(pa_it != ptclPool.end()) {
        sourcePtcl=(*pa_it).second;
      }
    }

    bool success=false;
    OrbitalConstraintsBase* control=0;

    //@todo automatically set it to yes with PBC
    bool useSpline= (transformOpt == "yes");

    app_log() << "  TwoBodyJastrowBuilder for " << functionOpt << endl;

    if(functionOpt == "pade") {
      //control = new PadeConstraints(IgnoreSpin);
      //Transform is ignored. Cutoff function is not too good
      if(useSpline) {
        control = new PadeOnGridConstraints(IgnoreSpin);
      } else {
        control = new PadeConstraints(IgnoreSpin);
      }
    } else if(functionOpt == "scaledpade") {
      control = new ScaledPadeConstraints(IgnoreSpin);
    } else if(functionOpt == "rpa") {
      if(useSpline) {
        control = new RPAPBCConstraints(IgnoreSpin);
      } else {
        control = new RPAConstraints(IgnoreSpin);
      }
    } else if(functionOpt == "WM") {
      control = new WMConstraints(IgnoreSpin);
    }

     if(control==0) { //try generic JAABuilder and NJAABuilder
      OrbitalBuilderBase* jbuilder=0;
      if(useSpline) {
        jbuilder = new NJAABuilder(targetPtcl,targetPsi);
      } else {
        jbuilder = new JAABuilder(targetPtcl,targetPsi);
      }
      return jbuilder->put(cur);
    }

    success=control->put(cur);
    if(!control->put(cur)) {
      delete control;
      return false;
    }

    ComboOrbital* jcombo=new ComboOrbital(control);

    control->addTwoBodyPart(targetPtcl, jcombo);

    if(sourcePtcl) { // add one-body term using Zeff and e-e B
      OrbitalBase* j1=control->createOneBody(targetPtcl,*sourcePtcl);
      if(j1) jcombo->Psi.push_back(j1);
    }

    control->addOptimizables(targetPsi.VarList);
    targetPsi.addOrbital(jcombo);
    return success;
  }
コード例 #3
0
ファイル: JAABuilder.cpp プロジェクト: digideskio/qmcpack
  bool JAABuilder::put(xmlNodePtr cur)
  {

    string spinOpt("no");
    string typeOpt("Two-Body");
    string jastfunction("pade");
    OhmmsAttributeSet aAttrib;
    aAttrib.add(spinOpt,"spin");
    aAttrib.add(typeOpt,"type");
    aAttrib.add(jastfunction,"function");
    aAttrib.put(cur);

    IgnoreSpin=(spinOpt=="no");
    OrbitalBase* newJ = 0;
    //if(jastfunction == "pade") {
    //  app_log() << "  Two-Body Jastrow Function = " << jastfunction << endl;
    //  PadeJastrow<RealType> *dummy = 0;
    //  success = createJAA(cur,dummy);
    //} else
    if (jastfunction == "short")
      {
        app_log() << "  Modified Jastrow function Two-Body Jastrow Function = " << jastfunction << endl;
        IgnoreSpin=true;
        //ModPadeFunctor<RealType> *dummy = 0;
        newJ = createJAA<ModPadeFunctor<RealType> >(cur,jastfunction);
      }
    else if (jastfunction == "modmcmillan")
      {
        app_log() << "  Modified McMillan Jastrow function Two-Body Jastrow Function = " << jastfunction << endl;
        IgnoreSpin=true;
        newJ = createJAA<ModMcMillanJ2Functor<RealType> >(cur,jastfunction);
      }
    else if (jastfunction == "combomcmillan")
      {
        app_log() << "  Combo McMillan Jastrow function Two-Body Jastrow Function = " << jastfunction << endl;
        IgnoreSpin=true;
        newJ = createJAA<comboMcMillanJ2Functor<RealType> >(cur,jastfunction);
      }
    else if (jastfunction == "mcmillan")
      {
        app_log() << "  McMillan (LONG RANGE!) Two-Body Jastrow Function = " << jastfunction << endl;
        IgnoreSpin=true;

        SpeciesSet& species(targetPtcl.getSpeciesSet());
        TwoBodyJastrowOrbital<McMillanJ2Functor<RealType> >* a = createJAA<McMillanJ2Functor<RealType> >(cur,jastfunction);
        species(species.addAttribute("J2_A"),species.addSpecies(species.speciesName[targetPtcl.GroupID[0]])) = (a->F[a->F.size()-1])->A;
        species(species.addAttribute("J2_B"),species.addSpecies(species.speciesName[targetPtcl.GroupID[0]])) = (a->F[a->F.size()-1])->B;
        newJ = a;
      }
    else if (jastfunction == "mcmillanj2g")
      {
        app_log() << "  McMillan Two-Body Jastrow Function (Gaussian for r < 2.5) = " << jastfunction << endl;
        IgnoreSpin=true;

        SpeciesSet& species(targetPtcl.getSpeciesSet());
        TwoBodyJastrowOrbital<McMillanJ2GFunctor<RealType> >* a = createJAA<McMillanJ2GFunctor<RealType> >(cur,jastfunction);
        species(species.addAttribute("J2_A"),species.addSpecies(species.speciesName[targetPtcl.GroupID[0]])) = (a->F[a->F.size()-1])->A;
        species(species.addAttribute("J2_B"),species.addSpecies(species.speciesName[targetPtcl.GroupID[0]])) = (a->F[a->F.size()-1])->B;
        newJ = a;
      }
    else if (jastfunction == "gaussian")
      {
        app_log() << "  Gaussian function Two-Body Jastrow Function = " << jastfunction << endl;
        IgnoreSpin=true;
        newJ = createJAA<GaussianFunctor<RealType> >(cur,jastfunction);
      }
    else if (jastfunction == "shiftedgaussian")
      {
        app_log() << "  Gaussian function Two-Body Jastrow Function = " << jastfunction << endl;
        IgnoreSpin=true;
        newJ = createJAA<TruncatedShiftedGaussianFunctor<RealType> >(cur,jastfunction);
      }
    else if (jastfunction == "padetwo2ndorderfunctor")
      {
        app_log() << "  PadeTwo2ndOrderFunctor Jastrow function Two-Body Jastrow Function = " << jastfunction << endl;
        //IgnoreSpin=true;
        newJ = createJAA<PadeTwo2ndOrderFunctor<RealType> >(cur,jastfunction);
      }
//} else if(jastfunction == "rpa") {
    //  app_log() << "  Two-Body Jastrow Function = " << jastfunction << endl;
    //  RPAJastrow<RealType> *dummy = 0;
    //  success = createJAA(cur,dummy);
    //}
    return (newJ != 0);
  }
コード例 #4
0
ファイル: TwoBodyJastrowBuilder.cpp プロジェクト: jyamu/qmc
bool TwoBodyJastrowBuilder::put(xmlNodePtr cur)
{
  myNode=cur;
  string functionOpt("pade");
  string transformOpt("no");
  string sourceOpt(targetPtcl.getName());
  string spinOpt("yes");
  OhmmsAttributeSet oAttrib;
  oAttrib.add(functionOpt,"function");
  oAttrib.add(transformOpt,"transform");
  oAttrib.add(sourceOpt,"source");
  oAttrib.add(spinOpt,"spin");
  oAttrib.put(cur);
  bool IgnoreSpin = (spinOpt == "no");
  bool success=false;
  OrbitalConstraintsBase* control=0;
  //@todo automatically set it to yes with PBC
  bool useSpline= (transformOpt == "yes");
  app_log() << "  TwoBodyJastrowBuilder for " << functionOpt << endl;
  if(functionOpt == "pade")
  {
    app_log() << "    Using analytic Pade Jastrow Functor " <<endl;
    control = new PadeConstraints(targetPtcl,targetPsi,IgnoreSpin);
  }
  else
    if(functionOpt == "scaledpade")
    {
      app_log() << "    Using analytic Scaled Pade Jastrow Functor " <<endl;
      control = new ScaledPadeConstraints(targetPtcl,targetPsi,IgnoreSpin);
    }
    else
      if(functionOpt == "rpa")
      {
        if(useSpline)
          control = new RPAPBCConstraints(targetPtcl,targetPsi,IgnoreSpin);
        else
          control = new RPAConstraints(targetPtcl,targetPsi,IgnoreSpin);
      }
      else //known analytic function
      {
        OrbitalBuilderBase* jbuilder=0;
        jbuilder = new JAABuilder(targetPtcl,targetPsi);
        Children.push_back(jbuilder);
        return jbuilder->put(cur);
      }
  success=control->put(cur);
  if(!success)
  {
    delete control;
    return false;
  }
  ComboOrbital* jcombo=new ComboOrbital(control);
  control->addTwoBodyPart(jcombo);
  if(sourceOpt != targetPtcl.getName())
  {
    app_log() << "    Adding one-body Jastrow function dependent upon two-body " << functionOpt << endl;
    map<string,ParticleSet*>::iterator pa_it(ptclPool.find(sourceOpt));
    if(pa_it == ptclPool.end())
    {
      return false;
    }
    ParticleSet* sourcePtcl= sourcePtcl=(*pa_it).second;
    OrbitalBase* j1=control->createOneBody(*sourcePtcl);
    if(j1)
      jcombo->Psi.push_back(j1);
  }
  control->addOptimizables(targetPsi.VarList);
  targetPsi.addOrbital(jcombo);
  return success;
}