QMCPACK
QMCCostFunction.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) 2016 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by: Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
8 // Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
9 // Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
10 //
11 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
12 //////////////////////////////////////////////////////////////////////////////////////
13 
14 
15 #ifndef QMCPLUSPLUS_COSTFUNCTION_H
16 #define QMCPLUSPLUS_COSTFUNCTION_H
17 
21 #include "HamiltonianRef.h"
22 
23 namespace qmcplusplus
24 {
25 /** @ingroup QMCDrivers
26  * @brief Implements wave-function optimization
27  *
28  * Optimization by correlated sampling method with configurations
29  * generated from VMC running on a single thread.
30  */
32 {
33 public:
34  ///Constructor.
36 
37  ///Destructor
38  ~QMCCostFunction() override;
39 
40  void getConfigurations(const std::string& aroot) override;
41  void checkConfigurations(EngineHandle& handle) override;
42 #ifdef HAVE_LMY_ENGINE
43  void engine_checkConfigurations(cqmc::engine::LMYEngine<Return_t>* EngineObj,
44  DescentEngine& descentEngineObj,
45  const std::string& MinMethod) override;
46 #endif
47 
48 
49  void resetPsi(bool final_reset = false) override;
50  void GradCost(std::vector<Return_rt>& PGradient, const std::vector<Return_rt>& PM, Return_rt FiniteDiff = 0) override;
51  Return_rt fillOverlapHamiltonianMatrices(Matrix<Return_rt>& Left, Matrix<Return_rt>& Right) override;
52 
53 protected:
54  std::vector<std::unique_ptr<HamiltonianRef>> H_KE_Node;
55  std::vector<Matrix<Return_rt>*> RecordsOnNode;
56 
57  /** Temp derivative properties and Hderivative properties of all the walkers
58  */
59  std::vector<Matrix<Return_t>*> DerivRecords;
60  std::vector<Matrix<Return_rt>*> HDerivRecords;
61  Return_rt CSWeight;
62 
63  EffectiveWeight correlatedSampling(bool needGrad = true) override;
64 
65 #ifdef HAVE_LMY_ENGINE
66  size_t total_samples();
67  Return_rt LMYEngineCost_detail(cqmc::engine::LMYEngine<Return_t>* EngineObj) override;
68 #endif
69 
71 };
72 } // namespace qmcplusplus
73 #endif
A set of walkers that are to be advanced by Metropolis Monte Carlo.
void checkConfigurations(EngineHandle &handle) override
evaluate everything before optimization
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
Manager clones for threaded applications.
Definition: CloneManager.h:34
void GradCost(std::vector< Return_rt > &PGradient, const std::vector< Return_rt > &PM, Return_rt FiniteDiff=0) override
~QMCCostFunction() override
Destructor.
Return_rt fillOverlapHamiltonianMatrices(Matrix< Return_rt > &Left, Matrix< Return_rt > &Right) override
Collection of Local Energy Operators.
EffectiveWeight correlatedSampling(bool needGrad=true) override
run correlated sampling return effective walkers ( w_i)^2/(Nw * w^2_i)
QMCTraits::QTFull::RealType EffectiveWeight
Timer accumulates time and call counts.
Definition: NewTimer.h:135
std::vector< std::unique_ptr< HamiltonianRef > > H_KE_Node
Wrapping information on parallelism.
Definition: Communicate.h:68
std::vector< Matrix< Return_t > * > DerivRecords
Temp derivative properties and Hderivative properties of all the walkers.
void resetPsi(bool final_reset=false) override
reset the wavefunction
Implements wave-function optimization.
void getConfigurations(const std::string &aroot) override
Class to represent a many-body trial wave function.
Manager class to handle multiple threads.
QMCCostFunction(MCWalkerConfiguration &w, TrialWaveFunction &psi, QMCHamiltonian &h, Communicate *comm)
Constructor.
std::vector< Matrix< Return_rt > * > HDerivRecords
std::vector< Matrix< Return_rt > * > RecordsOnNode
Implements wave-function optimization.