QMCPACK
GradientTest.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2020 QMCPACK developers.
6 //
7 // File developed by: Mark Dewing, mdewing@anl.gov, Argonne National Laboratory
8 //
9 // File created by: Mark Dewing, mdewing@anl.gov, Argonne National Laboratory
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 #ifndef QMCPLUSPLUS_GRADIENTTEST_H
13 #define QMCPLUSPLUS_GRADIENTTEST_H
14 
15 #include "GradientTestInput.h"
17 #include <fstream>
18 
19 /**
20  * @file GradientTest.h
21  * Tests for variational parameter derivatives
22  *
23  * This optimization type will compare finite difference derivatives with the analytic derivatives.
24  * It can also output a file that can be used with 'qmca' to get error bars.
25  *
26  * The input is placed under the batched linear optimizer (method="opt_batch").
27  * It uses the 'optimize' tag with the 'method' attribute set to 'gradient_test'
28  * For example:
29  * \code
30  * <loop max="4">
31  * <qmc method="opt_batch" move="pbyp">
32  * <optimize method="gradient_test">
33  * <parameter name="output_param_file">yes</parameter>
34  * </optimize>
35  * ...
36  * </qmc>
37  * </loop>
38  * \endcode
39  *
40  * The output_param_file parameter defaults to 'no'.
41  * If 'yes', a file named "<project id>.param.s000.scalar.dat" is created. Each iteration of the optimizer
42  * loop outputs one line in the file. (The above example will produce 4 entries in the file).
43  * This is a hack to enable computing error bars on the parameter gradients.
44  *
45  */
46 
47 
48 namespace qmcplusplus
49 {
50 
51 
53 {
54 public:
56 
58 
59  // Compute and compare the numerical and analytic gradients
60  void run(QMCCostFunctionBase& costFunc, const std::string& root_name);
61 
62 private:
64 
65  std::ofstream param_deriv_file_;
66  bool first_;
68 };
69 
70 } // namespace qmcplusplus
71 
72 #endif
void run(QMCCostFunctionBase &costFunc, const std::string &root_name)
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
QTBase::RealType RealType
Definition: Configuration.h:58
Implements wave-function optimization.
GradientTestInput input_
Definition: GradientTest.h:63
QMCTraits::RealType Return_t
Definition: GradientTest.h:55
std::ofstream param_deriv_file_
Definition: GradientTest.h:65
GradientTest(GradientTestInput &&input)
Definition: GradientTest.h:57