ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
opt_DCsrch.h
Go to the documentation of this file.
1#ifndef OPT_DCSRCH_H
2#define OPT_DCSRCH_H
3
4#include <iostream>
5
6#include "constants.h"
7
8namespace ModuleBase
9{
10
16{
17 public:
19 {
20 this->isave_ = new int[3];
21 this->dsave_ = new double[14];
22 }
24 {
25 delete[] this->isave_;
26 delete[] this->dsave_;
27 }
28
29 //
30 //
31 //
46 void set_paras(double ftol = 1e-4,
47 double gtol = 2e-1,
48 double xtol = 1e-12,
49 double stpmin = 0.,
50 double stpmax = ModuleBase::PI)
51 {
52 this->ftol_ = ftol;
53 this->gtol_ = gtol;
54 this->xtol_ = xtol;
55 this->stpmin_ = stpmin;
56 this->stpmax_ = stpmax;
57 }
58
76 void dcSrch(double& f, double& g, double& rstp, char* rtask);
77
78 private:
79 double ftol_ = 1e-4; // nonnegative tolerance for the sufficient decrease condition.
80 double gtol_ = 2e-1; // nonnegative tolerance for the curvature condition.
81 double xtol_ = 1e-12; // nonnegative relative tolerance for an acceptable step. The subroutine exits with a warning
82 // if the relative difference between sty and stx is less than xtol.
83 double stpmin_ = 0.; // nonnegative lower bound for the step.
84 double stpmax_ = ModuleBase::PI; // nonnegative upper bound for the step.
85 int* isave_ = nullptr; // an integer work array of dimension 2.
86 double* dsave_ = nullptr; // a double precision work array of dimension 13.
87};
88} // namespace ModuleBase
89
90#endif
A interface to line search.
Definition opt_DCsrch.h:16
double stpmax_
Definition opt_DCsrch.h:84
double xtol_
Definition opt_DCsrch.h:81
double gtol_
Definition opt_DCsrch.h:80
double * dsave_
Definition opt_DCsrch.h:86
double ftol_
Definition opt_DCsrch.h:79
~Opt_DCsrch()
Definition opt_DCsrch.h:23
void dcSrch(double &f, double &g, double &rstp, char *rtask)
Interface to dcsrch, finding the optimal step length with line search.
Definition opt_DCsrch.cpp:718
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...
Definition opt_DCsrch.h:46
Opt_DCsrch()
Definition opt_DCsrch.h:18
int * isave_
Definition opt_DCsrch.h:85
double stpmin_
Definition opt_DCsrch.h:83
Definition array_pool.h:6
const double PI
Definition constants.h:19