ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
ModuleBase::Opt_DCsrch Class Reference

A interface to line search. More...

#include <opt_DCsrch.h>

Collaboration diagram for ModuleBase::Opt_DCsrch:

Public Member Functions

 Opt_DCsrch ()
 
 ~Opt_DCsrch ()
 
void set_paras (double ftol=1e-4, double gtol=2e-1, double xtol=1e-12, double stpmin=0., double stpmax=ModuleBase::PI)
 Reset following parameters. The default setting in PROFESS is TN ftol = 1e-4 gtol = 2e-1 CG ftol = 1e-4 gtol = 1e-2 BFGS ftol = 1e-4 gtol = 2e-1.
 
void dcSrch (double &f, double &g, double &rstp, char *rtask)
 Interface to dcsrch, finding the optimal step length with line search.
 

Private Attributes

double ftol_ = 1e-4
 
double gtol_ = 2e-1
 
double xtol_ = 1e-12
 
double stpmin_ = 0.
 
double stpmax_ = ModuleBase::PI
 
int * isave_ = nullptr
 
double * dsave_ = nullptr
 

Detailed Description

A interface to line search.

Constructor & Destructor Documentation

◆ Opt_DCsrch()

ModuleBase::Opt_DCsrch::Opt_DCsrch ( )
inline

◆ ~Opt_DCsrch()

ModuleBase::Opt_DCsrch::~Opt_DCsrch ( )
inline

Member Function Documentation

◆ dcSrch()

void ModuleBase::Opt_DCsrch::dcSrch ( double &  f,
double &  g,
double &  rstp,
char *  rtask 
)

Interface to dcsrch, finding the optimal step length with line search.

Parameters
fthe value of the function at x on initial entry. On subsequent entries f is the value of the function at x + stp * d.
gthe derivative of the function at 0 on initial entry. On subsequent entries g is the derivative of the function at x + stp * d.
rstpthe optimized step length, assert the initial value is larger than zero.
rtaska character variable of length at least 60. On initial entry task must be set to 'START'. On exit task indicates the required action: If task(1:2) = 'FG' then evaluate the function and derivative at stp and call dcsrch again. If task(1:4) = 'CONV' then the search is successful. If task(1:4) = 'WARN' then the subroutine is not able to satisfy the convergence conditions. The exit value of stp contains the best point found during the search. If task(1:5) = 'ERROR' then there is an error in the input arguments.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_paras()

void ModuleBase::Opt_DCsrch::set_paras ( double  ftol = 1e-4,
double  gtol = 2e-1,
double  xtol = 1e-12,
double  stpmin = 0.,
double  stpmax = ModuleBase::PI 
)
inline

Reset following parameters. The default setting in PROFESS is TN ftol = 1e-4 gtol = 2e-1 CG ftol = 1e-4 gtol = 1e-2 BFGS ftol = 1e-4 gtol = 2e-1.

Parameters
ftolnonnegative tolerance for the sufficient decrease condition.
gtolnonnegative tolerance for the curvature condition.
xtolnonnegative relative tolerance for an acceptable step. The subroutine exits with a warning if the relative difference between sty and stx is less than xtol.
stpminnonnegative lower bound for the step.
stpmaxnonnegative upper bound for the step.
Here is the caller graph for this function:

Member Data Documentation

◆ dsave_

double* ModuleBase::Opt_DCsrch::dsave_ = nullptr
private

◆ ftol_

double ModuleBase::Opt_DCsrch::ftol_ = 1e-4
private

◆ gtol_

double ModuleBase::Opt_DCsrch::gtol_ = 2e-1
private

◆ isave_

int* ModuleBase::Opt_DCsrch::isave_ = nullptr
private

◆ stpmax_

double ModuleBase::Opt_DCsrch::stpmax_ = ModuleBase::PI
private

◆ stpmin_

double ModuleBase::Opt_DCsrch::stpmin_ = 0.
private

◆ xtol_

double ModuleBase::Opt_DCsrch::xtol_ = 1e-12
private

The documentation for this class was generated from the following files: