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) 2021 QMCPACK developers.
6 //
7 // File developed by: Ye Luo, yeluo@anl.gov, Argonne National Laboratory
8 //
9 // File created by: Ye Luo, yeluo@anl.gov, Argonne National Laboratory
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 
13 #ifndef QMCPLUSPLUS_PSDISPATCH_H
14 #define QMCPLUSPLUS_PSDISPATCH_H
15 
16 #include "ParticleSet.h"
17 
18 namespace qmcplusplus
19 {
20 /** Wrappers for dispatching to ParticleSet single walker APIs or mw_ APIs.
21  * This should be only used by QMC drivers.
22  * member function names must match mw_ APIs in TrialWaveFunction
23  */
24 class PSdispatcher
25 {
26 public:
27   using Walker_t            = ParticleSet::Walker_t;
28   using SingleParticlePos_t = ParticleSet::SingleParticlePos_t;
29 
30   PSdispatcher(bool use_batch);
31 
32   void flex_loadWalker(const RefVectorWithLeader<ParticleSet>& p_list,
33                        const RefVector<Walker_t>& walkers,
34                        const std::vector<bool>& recompute,
35                        bool pbyp) const;
36 
37   void flex_update(const RefVectorWithLeader<ParticleSet>& p_list, bool skipSK = false) const;
38 
39   void flex_makeMove(const RefVectorWithLeader<ParticleSet>& p_list,
40                      int iat,
41                      const std::vector<SingleParticlePos_t>& displs) const;
42 
43   void flex_accept_rejectMove(const RefVectorWithLeader<ParticleSet>& p_list,
44                               int iat,
45                               const std::vector<bool>& isAccepted,
46                               bool forward_mode = true) const;
47 
48   void flex_saveWalker(const RefVectorWithLeader<ParticleSet>& p_list, const RefVector<Walker_t>& walkers) const;
49 
50   void flex_donePbyP(const RefVectorWithLeader<ParticleSet>& p_list) const;
51 
52 private:
53   bool use_batch_;
54 };
55 } // namespace qmcplusplus
56 
57 #endif
58