src/QMCWaveFunctions/lcao/CuspCorrection.cpp
// Optimize free parameter (value of phi at zero) to minimize distance to ideal local energy.
// Output is return value and parameter values are in cusp.cparam
Optimize free parameter (value of phi at zero) to minimize distance to ideal local energy.
Output is return value and parameter values are in cusp.cparam
Optimize free parameter ( value of phi at zero ) to minimize distance to ideal local energy . Output is return value and parameter values are in cusp . cparam
RealType minimizeForPhiAtZero(CuspCorrection& cusp,
                              OneMolecularOrbital& phiMO,
                              RealType Z,
                              RealType eta0,
                              ValueVector_t& pos,
                              ValueVector_t& ELcurr,
                              ValueVector_t& ELideal,
                              RealType start_phi0)
{
  ValGradLap vglAtRc;
  ValueVector_t tmp_pos(0);
  ValueVector_t ELorig(0);
  RealType Zeff = getZeff(Z, eta0, cusp.phiBar(0.0, phiMO));
  RealType ELorigAtRc = getOriginalLocalEnergy(tmp_pos, Zeff, cusp.cparam.Rc, phiMO, ELorig);
  getIdealLocalEnergy(pos, Z, cusp.cparam.Rc, ELorigAtRc, ELideal);
  phiMO.phi_vgl(cusp.cparam.Rc, vglAtRc.val, vglAtRc.grad, vglAtRc.lap);
  Bracket_min_t<RealType> bracket(start_phi0, 0.0, 0.0, false);
  try
  {
    bracket = bracket_minimum(
        [&](RealType x) -> RealType {
          return evaluateForPhi0Body(x, pos, ELcurr, ELideal, cusp, phiMO, vglAtRc, eta0, ELorigAtRc, Z);
        },
        start_phi0);
  }
  catch (const std::runtime_error& e)
  {
    APP_ABORT("Bracketing minimum failed for finding phi0. \n");
  }
  auto min_res = find_minimum(
      [&](RealType x) -> RealType {
        return evaluateForPhi0Body(x, pos, ELcurr, ELideal, cusp, phiMO, vglAtRc, eta0, ELorigAtRc, Z);
      },
      bracket);
  start_phi0 = min_res.first;
  return min_res.second;
}
RealType minimizeForPhiAtZero ( CuspCorrection & cusp , OneMolecularOrbital & phiMO , RealType Z , RealType eta0 , ValueVector_t & pos , ValueVector_t & ELcurr , ValueVector_t & ELideal , RealType start_phi0 ) { ValGradLap vglAtRc ; ValueVector_t tmp_pos ( 0 ) ; ValueVector_t ELorig ( 0 ) ; RealType Zeff = getZeff ( Z , eta0 , cusp . phiBar ( 0.0 , phiMO ) ) ; RealType ELorigAtRc = getOriginalLocalEnergy ( tmp_pos , Zeff , cusp . cparam . Rc , phiMO , ELorig ) ; getIdealLocalEnergy ( pos , Z , cusp . cparam . Rc , ELorigAtRc , ELideal ) ; phiMO . phi_vgl ( cusp . cparam . Rc , vglAtRc . val , vglAtRc . grad , vglAtRc . lap ) ; Bracket_min_t < RealType > bracket ( start_phi0 , 0.0 , 0.0 , false ) ; try { bracket = bracket_minimum ( [ & ] ( RealType x ) -> RealType { return evaluateForPhi0Body ( x , pos , ELcurr , ELideal , cusp , phiMO , vglAtRc , eta0 , ELorigAtRc , Z ) ; } , start_phi0 ) ; } catch ( const std :: runtime_error & e ) { APP_ABORT ( " \n " ) ; } auto min_res = find_minimum ( [ & ] ( RealType x ) -> RealType { return evaluateForPhi0Body ( x , pos , ELcurr , ELideal , cusp , phiMO , vglAtRc , eta0 , ELorigAtRc , Z ) ; } , bracket ) ; start_phi0 = min_res . first ; return min_res . second ; }
Optimize free parameter (value of phi at zero) to minimize distance to ideal local energy.
Optimize free parameter ( value of phi at zero ) to minimize distance to ideal local energy .