src/QMCWaveFunctions/lcao/CuspCorrection.cpp
// Optimize the cutoff radius.  There is an inner loop optimizing for phi0 for each value of Rc.
// Elcurr and ELideal are expected to have the correct size on input (same size as pos)
// Output is parameter values in cusp.cparam
Optimize the cutoff radius.  There is an inner loop optimizing for phi0 for each value of Rc.
Elcurr and ELideal are expected to have the correct size on input (same size as pos)
Output is parameter values in cusp.cparam
Optimize the cutoff radius . There is an inner loop optimizing for phi0 for each value of Rc . Elcurr and ELideal are expected to have the correct size on input ( same size as pos ) Output is parameter values in cusp . cparam
void minimizeForRc(CuspCorrection& cusp,
                   OneMolecularOrbital& phiMO,
                   RealType Z,
                   RealType Rc_init,
                   RealType Rc_max,
                   RealType eta0,
                   ValueVector_t& pos,
                   ValueVector_t& ELcurr,
                   ValueVector_t& ELideal)
{
  RealType Rc = Rc_init;
  Bracket_min_t<RealType> bracket(Rc_init, 0.0, 0.0, false);
  RealType start_phi0 = phiMO.phi(0.0);
  try
  {
    bracket = bracket_minimum(
        [&](RealType x) -> RealType {
          cusp.cparam.Rc = x;
          return minimizeForPhiAtZero(cusp, phiMO, Z, eta0, pos, ELcurr, ELideal, start_phi0);
        },
        Rc_init, Rc_max);
  }
  catch (const std::runtime_error& e)
  {
    APP_ABORT("Bracketing minimum failed for finding rc. \n");
  }
  if (bracket.success)
  {
    auto min_res = find_minimum(
        [&](RealType x) -> RealType {
          cusp.cparam.Rc = x;
          return minimizeForPhiAtZero(cusp, phiMO, Z, eta0, pos, ELcurr, ELideal, start_phi0);
        },
        bracket);
  }
  else
  {
    cusp.cparam.Rc = bracket.a;
    minimizeForPhiAtZero(cusp, phiMO, Z, eta0, pos, ELcurr, ELideal, start_phi0);
  }
}
void minimizeForRc ( CuspCorrection & cusp , OneMolecularOrbital & phiMO , RealType Z , RealType Rc_init , RealType Rc_max , RealType eta0 , ValueVector_t & pos , ValueVector_t & ELcurr , ValueVector_t & ELideal ) { RealType Rc = Rc_init ; Bracket_min_t < RealType > bracket ( Rc_init , 0.0 , 0.0 , false ) ; RealType start_phi0 = phiMO . phi ( 0.0 ) ; try { bracket = bracket_minimum ( [ & ] ( RealType x ) -> RealType { cusp . cparam . Rc = x ; return minimizeForPhiAtZero ( cusp , phiMO , Z , eta0 , pos , ELcurr , ELideal , start_phi0 ) ; } , Rc_init , Rc_max ) ; } catch ( const std :: runtime_error & e ) { APP_ABORT ( " \n " ) ; } if ( bracket . success ) { auto min_res = find_minimum ( [ & ] ( RealType x ) -> RealType { cusp . cparam . Rc = x ; return minimizeForPhiAtZero ( cusp , phiMO , Z , eta0 , pos , ELcurr , ELideal , start_phi0 ) ; } , bracket ) ; } else { cusp . cparam . Rc = bracket . a ; minimizeForPhiAtZero ( cusp , phiMO , Z , eta0 , pos , ELcurr , ELideal , start_phi0 ) ; } }
Optimize the cutoff radius.
Optimize the cutoff radius .