QMCPACK
SpaceWarpTransformation.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: Raymond Clay
8 //
9 // File created by: Raymond Clay, Sandia National Laboratory, rclay@sandia.gov
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 
13 #ifndef QMCPLUSPLUS_SPACEWARP_H
14 #define QMCPLUSPLUS_SPACEWARP_H
15 
16 #include "Configuration.h"
17 #include "Particle/ParticleSet.h"
18 
19 namespace qmcplusplus
20 {
21 /** @ingroup hamiltonian
22  *\brief This implements the differential space warp transformation for ZVZB estimators given by Sorella & Capriotti
23  * J. Chem. Phys., 133, 23411 (2010), https://doi.org/10.1063/1.3516208
24  *
25  */
27 {
31 
32 public:
34 
35  /** Space warp transformation function F(r).
36  *
37  * \param[in] r, the distance
38  * \param[out] value of F(r)
39  */
40  RealType f(RealType r);
41 
42  /** Derivative of space warp transformation function F(r) w.r.t. r.
43  *
44  * \param[in] r, the distance
45  * \param[out] value of F'(r)
46  */
47  RealType df(RealType r);
48 
49  /** Sets the exponent for power law space warp transformation
50  *
51  * \param[in] swpow_in the exponent
52  */
53  inline void setPow(RealType swpow_in) { swpow = swpow_in; };
54 
55  /** Generates required space warp quantities to generate the actual "Space Warp" contribution to the
56  * iat-th force component.
57  * \param[in] iat the ion index for the force.
58  * \param[out] w, w_iat(r_i) for each i, where i is the electron index.
59  * \param[out] grad_w, grad_i w_iat(r_i) for each i, where i is the electron index.
60  */
61  void getSWT(int iat, ParticleScalar& w, Force_t& grad_w);
62 
63  /** Takes in precomputed grad(E_L) and grad(logPsi) and computes the ZV and ZB space warp contributions
64  * to the force.
65  *
66  * \param[in] elec, electron particle set.
67  * \param[in] ions, ion particle set.
68  * \param[in] dEl, grad_i(E_L) for each electron i. E_L is the local energy.
69  * \param[in] dlogpsi, grad_i(logPsi) for each electron i.
70  * \param[out] el_contribution, The zero-variance contribution from space warp.
71  * \param[out] psi_contribution, the zero-bias contribution from space warp. Modifies the grad_I(logPsi) terms.
72  */
73  void computeSWT(ParticleSet& elec,
74  const ParticleSet& ions,
75  Force_t& dEl,
76  ParticleGradient& dlogpsi,
77  Force_t& el_contribution,
78  Force_t& psi_contribution);
79 
80 private:
81  /** Computes intermediate matrices required to build all space warp components and gradients.
82  * The intermediates calculated are "warpval" and "gradval".
83  *
84  * \param[in] P, the electron particle set.
85  * \param[in] ions, the ion particle set.
86  */
87  void computeSWTIntermediates(ParticleSet& P, const ParticleSet& ions);
88 
89 
90  ///The electron-ion table index in electron table.
91  const int myTableIndex;
92  const int Nelec;
93  const int Nions;
94 
95  /// Power of space warp transformation. Right now, r^{-swpow}.
97  /// Nelec x Nion matrix of F(|r_i-R_J|)
99  /// Nelec x Nion matrix of \nabla_i F(|r_i-R_J|)
101 };
102 } // namespace qmcplusplus
103 #endif
This implements the differential space warp transformation for ZVZB estimators given by Sorella & Cap...
Matrix< PosType > gradval
Nelec x Nion matrix of F(|r_i-R_J|)
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
ParticleSet::ParticleGradient ParticleGradient
RealType df(RealType r)
Derivative of space warp transformation function F(r) w.r.t.
RealType swpow
Power of space warp transformation. Right now, r^{-swpow}.
void setPow(RealType swpow_in)
Sets the exponent for power law space warp transformation.
Matrix< RealType > warpval
Nelec x Nion matrix of F(|r_i-R_J|)
Attaches a unit to a Vector for IO.
const int myTableIndex
The electron-ion table index in electron table.
ParticleSet::ParticleScalar ParticleScalar
Specialized paritlce class for atomistic simulations.
Definition: ParticleSet.h:55
RealType f(RealType r)
Space warp transformation function F(r).
void computeSWT(ParticleSet &elec, const ParticleSet &ions, Force_t &dEl, ParticleGradient &dlogpsi, Force_t &el_contribution, Force_t &psi_contribution)
Takes in precomputed grad(E_L) and grad(logPsi) and computes the ZV and ZB space warp contributions t...
void computeSWTIntermediates(ParticleSet &P, const ParticleSet &ions)
Computes intermediate matrices required to build all space warp components and gradients.
ParticleAttrib< SingleParticlePos > ParticlePos
Definition: Configuration.h:92
ParticleAttrib< QTFull::GradType > ParticleGradient
Definition: Configuration.h:95
traits for QMC variables
Definition: Configuration.h:49
void getSWT(int iat, ParticleScalar &w, Force_t &grad_w)
Generates required space warp quantities to generate the actual "Space Warp" contribution to the iat-...
ParticleAttrib< Scalar_t > ParticleScalar
Definition: Configuration.h:91
SpaceWarpTransformation(ParticleSet &elns, const ParticleSet &ions)