QMCPACK
QMCCostFunctionBatched.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_BATCHED_H
16 #define QMCPLUSPLUS_COSTFUNCTION_BATCHED_H
17 
21 
22 namespace qmcplusplus
23 {
24 /** @ingroup QMCDrivers
25  * @brief Implements wave-function optimization
26  *
27  * Optimization by correlated sampling method with configurations
28  * generated from VMC running on a single thread.
29  */
30 
31 class CostFunctionCrowdData;
32 
33 namespace testing
34 {
35 class LinearMethodTestSupport;
36 };
37 
38 
40 {
41 public:
42  ///Constructor.
44  TrialWaveFunction& psi,
45  QMCHamiltonian& h,
46  SampleStack& samples,
47  const std::vector<int>& walkers_per_crowd,
48  Communicate* comm);
49 
50  ///Destructor
51  ~QMCCostFunctionBatched() override;
52 
53  void getConfigurations(const std::string& aroot) override;
54  void checkConfigurations(EngineHandle& handle) override;
55 #ifdef HAVE_LMY_ENGINE
56  void engine_checkConfigurations(cqmc::engine::LMYEngine<Return_t>* EngineObj,
57  DescentEngine& descentEngineObj,
58  const std::string& MinMethod) override;
59 #endif
60 
61 
62  void resetPsi(bool final_reset = false) override;
63  void GradCost(std::vector<Return_rt>& PGradient, const std::vector<Return_rt>& PM, Return_rt FiniteDiff = 0) override;
64  Return_rt fillOverlapHamiltonianMatrices(Matrix<Return_rt>& Left, Matrix<Return_rt>& Right) override;
65 
66 protected:
67  /// H components used in correlated sampling. It can be KE or KE+NLPP
68  std::vector<std::string> H_KE_node_names_;
69 
71 
72  /** Temp derivative properties and Hderivative properties of all the walkers
73  */
76 
77  EffectiveWeight correlatedSampling(bool needGrad = true) override;
78 
80 
81  // Number of samples local to each MPI rank
83 
84  // Number of walkers per crowd. Size of vector is number of crowds.
85  std::vector<int> walkers_per_crowd_;
86 
90 
91 
92 #ifdef HAVE_LMY_ENGINE
93  size_t total_samples();
94  Return_rt LMYEngineCost_detail(cqmc::engine::LMYEngine<Return_t>* EngineObj) override;
95 #endif
96 
98 };
99 } // namespace qmcplusplus
100 #endif
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
~QMCCostFunctionBatched() override
Destructor.
void checkConfigurations(EngineHandle &handle) override
evaluate everything before optimization
Collection of Local Energy Operators.
QMCTraits::QTFull::RealType EffectiveWeight
Timer accumulates time and call counts.
Definition: NewTimer.h:135
void GradCost(std::vector< Return_rt > &PGradient, const std::vector< Return_rt > &PM, Return_rt FiniteDiff=0) override
Wrapping information on parallelism.
Definition: Communicate.h:68
Specialized paritlce class for atomistic simulations.
Definition: ParticleSet.h:55
std::vector< std::string > H_KE_node_names_
H components used in correlated sampling. It can be KE or KE+NLPP.
Implements wave-function optimization.
void resetPsi(bool final_reset=false) override
reset the wavefunction
EffectiveWeight correlatedSampling(bool needGrad=true) override
run correlated sampling return effective walkers ( w_i)^2/(Nw * w^2_i)
Class to represent a many-body trial wave function.
Manager class to handle multiple threads.
traits for QMC variables
Definition: Configuration.h:49
QMCCostFunctionBatched(ParticleSet &w, TrialWaveFunction &psi, QMCHamiltonian &h, SampleStack &samples, const std::vector< int > &walkers_per_crowd, Communicate *comm)
Constructor.
Matrix< Return_t > DerivRecords_
Temp derivative properties and Hderivative properties of all the walkers.
Return_rt fillOverlapHamiltonianMatrices(Matrix< Return_rt > &Left, Matrix< Return_rt > &Right) override
void getConfigurations(const std::string &aroot) override