MADNESS 0.10.1
Public Member Functions | Public Attributes | Private Attributes | List of all members
madness::SCFProtocol Class Reference

struct for running a protocol of subsequently tightening precision More...

#include <SCFProtocol.h>

Collaboration diagram for madness::SCFProtocol:
Collaboration graph
[legend]

Public Member Functions

 SCFProtocol (World &w, const CalculationParameters &param)
 
bool approx (const double a, const double b) const
 compare two positive doubles to be equal
 
void drop_last_rung ()
 drop the last rung, i.e. stop one step short of the full precision
 
bool finished () const
 
void infer_thresholds (const double prec)
 infer thresholds for a given rung of the ladder
 
void initialize ()
 
bool on_last_rung () const
 true if the current rung is the last one
 
SCFProtocoloperator++ ()
 go to the next rung of the ladder
 
void set_start_index (const std::size_t i)
 start at a given rung rather than at the first
 
std::size_t size () const
 number of rungs in the ladder
 
std::size_t start_index () const
 index of the rung this protocol will start at
 

Public Attributes

bool converged
 flag if protocol has converged
 
double current_prec
 current precision
 
double dconv
 density convergence of SCF calculations
 
double econv
 energy convergence of SCF calculations
 
double end_prec
 final precision
 
double start_prec
 starting precision, typically 1.e-4
 
double thresh
 numerical precision of representing functions
 
Worldworld
 

Private Attributes

std::size_t index
 current rung
 
std::vector< doubleprotocol
 the ladder, from CalculationParameters
 
double user_dconv
 density convergence provided by user
 
double user_econv
 energy convergence provided by user
 

Detailed Description

struct for running a protocol of subsequently tightening precision

The ladder is CalculationParameters::protocol() and nothing else – the same list moldft walks, so both engines refine through identical steps and k follows from SCF::set_protocol's thresh->k table. econv and dconv are convergence criteria applied at each rung, relaxed to the rung's own threshold the way SCF::solve already relaxes dconv: you cannot converge a quantity tighter than the basis represents it.

Constructor & Destructor Documentation

◆ SCFProtocol()

madness::SCFProtocol::SCFProtocol ( World w,
const CalculationParameters param 
)
inline

Member Function Documentation

◆ approx()

bool madness::SCFProtocol::approx ( const double  a,
const double  b 
) const
inline

compare two positive doubles to be equal

References a, std::abs(), and b.

◆ drop_last_rung()

void madness::SCFProtocol::drop_last_rung ( )
inline

drop the last rung, i.e. stop one step short of the full precision

used for cheap pre-iterations; never empties the ladder

References end_prec, index, protocol, and set_start_index().

◆ finished()

bool madness::SCFProtocol::finished ( ) const
inline

References converged.

◆ infer_thresholds()

void madness::SCFProtocol::infer_thresholds ( const double  prec)
inline

infer thresholds for a given rung of the ladder

The rung sets the representation threshold. econv and dconv are the user's, but never tighter than the rung can support.

dconv needs care. The BSH residual cannot fall much below the threshold the orbitals are represented at, and nemo tests bsh_norm < dconv strictly, so a dconv equal to the rung's threshold is unreachable and the rung burns maxiter without converging. Intermediate rungs therefore use the long-standing 0.1*sqrt(thresh) relaxation – 1e-3 at thresh 1e-4, 1e-4 at thresh 1e-6 – which is comfortably looser than the rung; they are only a stepping stone, so there is nothing to gain from converging them tightly. The last rung is the answer, so it honours the user's dconv (never demanding tighter than the representation supports).

References dconv, econv, madness::nonlinear_vector_solver(), on_last_rung(), thresh, user_dconv, and user_econv.

Referenced by SCFProtocol(), initialize(), operator++(), and set_start_index().

◆ initialize()

void madness::SCFProtocol::initialize ( )
inline

◆ on_last_rung()

bool madness::SCFProtocol::on_last_rung ( ) const
inline

true if the current rung is the last one

References index, and protocol.

Referenced by infer_thresholds().

◆ operator++()

SCFProtocol & madness::SCFProtocol::operator++ ( )
inline

go to the next rung of the ladder

References converged, current_prec, index, infer_thresholds(), and protocol.

◆ set_start_index()

void madness::SCFProtocol::set_start_index ( const std::size_t  i)
inline

start at a given rung rather than at the first

used to skip rungs a restart has already converged through

References current_prec, index, infer_thresholds(), MADNESS_CHECK_THROW, protocol, and start_prec.

Referenced by drop_last_rung().

◆ size()

std::size_t madness::SCFProtocol::size ( ) const
inline

number of rungs in the ladder

References protocol.

◆ start_index()

std::size_t madness::SCFProtocol::start_index ( ) const
inline

index of the rung this protocol will start at

References index.

Member Data Documentation

◆ converged

bool madness::SCFProtocol::converged

flag if protocol has converged

Referenced by finished(), initialize(), and operator++().

◆ current_prec

double madness::SCFProtocol::current_prec

current precision

Referenced by SCFProtocol(), initialize(), operator++(), and set_start_index().

◆ dconv

double madness::SCFProtocol::dconv

density convergence of SCF calculations

Referenced by infer_thresholds(), and initialize().

◆ econv

double madness::SCFProtocol::econv

energy convergence of SCF calculations

Referenced by infer_thresholds(), and initialize().

◆ end_prec

double madness::SCFProtocol::end_prec

final precision

Referenced by SCFProtocol(), drop_last_rung(), and initialize().

◆ index

std::size_t madness::SCFProtocol::index
private

◆ protocol

std::vector<double> madness::SCFProtocol::protocol
private

◆ start_prec

double madness::SCFProtocol::start_prec

starting precision, typically 1.e-4

Referenced by SCFProtocol(), and set_start_index().

◆ thresh

double madness::SCFProtocol::thresh

numerical precision of representing functions

Referenced by infer_thresholds(), and initialize().

◆ user_dconv

double madness::SCFProtocol::user_dconv
private

density convergence provided by user

Referenced by infer_thresholds().

◆ user_econv

double madness::SCFProtocol::user_econv
private

energy convergence provided by user

Referenced by infer_thresholds().

◆ world

World& madness::SCFProtocol::world

Referenced by initialize().


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