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) 2019 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by: Raymond Clay, Sandia National Laboratories
8 //
9 // File created by: Raymond Clay, rclay@sandia.gov, Sandia National Laboratories
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 
13 /**@file ACForce.h
14  *@brief Declaration of ACForce, Assaraf-Caffarel ZVZB style force estimation.
15  */
16 #ifndef QMCPLUSPLUS_ACFORCE_H
17 #define QMCPLUSPLUS_ACFORCE_H
18 
19 #include "QMCHamiltonians/OperatorBase.h"
20 #include "QMCWaveFunctions/TrialWaveFunction.h"
21 #include "QMCHamiltonians/QMCHamiltonian.h"
22 #include "QMCHamiltonians/SpaceWarpTransformation.h"
23 
24 namespace qmcplusplus
25 {
26 struct ACForce : public OperatorBase
27 {
28   typedef ParticleSet::ParticlePos_t Force_t;
29   /** Constructor **/
30   ACForce(ParticleSet& source, ParticleSet& target, TrialWaveFunction& psi, QMCHamiltonian& H);
31   /** Destructor **/
~ACForceACForce32   ~ACForce(){};
33   /** Copy constructor **/
34   //ACForce(const ACForce& ac)  {};
35 
36   /** I/O Routines */
37   bool put(xmlNodePtr cur);
getACForce38   bool get(std::ostream& os) const { return true; };
39 
40   /** Cloning **/
41   //We don't actually use this makeClone method.  We just put an APP_ABORT here
42   OperatorBase* makeClone(ParticleSet& qp, TrialWaveFunction& psi);
43   //Not derived from base class.  But we need it to properly set the Hamiltonian reference.
44   OperatorBase* makeClone(ParticleSet& qp, TrialWaveFunction& psi, QMCHamiltonian& H);
45 
46   /** Initialization/assignment **/
resetTargetParticleSetACForce47   void resetTargetParticleSet(ParticleSet& P){};
48   void addObservables(PropertySetType& plist, BufferType& collectables);
49   void setObservables(PropertySetType& plist);
50   void setParticlePropertyList(PropertySetType& plist, int offset);
51 
52   /** Since we store a reference to QMCHamiltonian, the baseclass method add2Hamiltonian
53  *  isn't sufficient.  We override it here. **/
54   void add2Hamiltonian(ParticleSet& qp, TrialWaveFunction& psi, QMCHamiltonian& targetH);
55   /** Evaluate **/
56   Return_t evaluate(ParticleSet& P);
57 
58   ///Finite difference timestep
59   RealType delta;
60 
61   //** Internal variables **/
62   //  I'm assuming that psi, ions, elns, and the hamiltonian are bound to this
63   //  instantiation.  Making sure no crosstalk happens is the job of whatever clones this.
64   ParticleSet& ions;
65   ParticleSet& elns;
66   TrialWaveFunction& psi;
67   QMCHamiltonian& ham;
68 
69   ///For indexing observables
70   IndexType FirstForceIndex;
71   const IndexType Nions;
72 
73   ///Temporary Nion x 3 dimensional arrays for force storage.
74   Force_t hf_force;
75   Force_t pulay_force;
76   Force_t wf_grad;
77   Force_t sw_pulay;
78   Force_t sw_grad;
79 
80   bool useSpaceWarp;
81 
82   ///The space warp transformation class.
83   SpaceWarpTransformation swt;
84 
85   //Class info.
86   std::string prefix;
87   //We also set the following from the OperatorBase class.
88   //std::string myName;
89 };
90 
91 } // namespace qmcplusplus
92 #endif
93