QMCPACK
DriftModifierUNR.cpp
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) 2020 QMCPACK developers.
6 //
7 // File developed by: Ye Luo, yeluo@anl.gov, Argonne National Laboratory
8 // Peter Doak, doakpw@ornl.gov, Oak Ridge National Laboratory
9 //
10 // File created by: Ye Luo, yeluo@anl.gov, Argonne National Laboratory
11 //////////////////////////////////////////////////////////////////////////////////////
12 
13 #include <sstream>
14 #include "DriftModifierUNR.h"
15 #include "OhmmsData/ParameterSet.h"
17 
18 namespace qmcplusplus
19 {
20 void DriftModifierUNR::getDrift(RealType tau, const GradType& qf, PosType& drift) const
21 {
22  // convert the complex WF gradient to real
23  convertToReal(qf, drift);
24  RealType vsq = dot(drift, drift);
25  RealType sc = vsq < std::numeric_limits<RealType>::epsilon()
26  ? tau
27  : ((-1.0 + std::sqrt(1.0 + 2.0 * a_ * tau * vsq)) / (a_ * vsq));
28  //Apply the umrigar scaling to drift.
29  drift *= sc;
30 }
31 
33 {
34  // convert the complex WF gradient to real
35  convertToReal(qf, drift);
36  RealType vsq = drift * drift;
37  RealType sc = vsq < std::numeric_limits<RealType>::epsilon()
38  ? tau
39  : ((-1.0 + std::sqrt(1.0 + 2.0 * a_ * tau * vsq)) / (a_ * vsq));
40  //Apply the umrigar scaling to drift.
41  drift *= sc;
42 }
43 
44 void DriftModifierUNR::getDrifts(RealType tau, const std::vector<GradType>& qf, std::vector<PosType>& drift) const
45 {
46  for (int i = 0; i < qf.size(); ++i)
47  getDrift(tau, qf[i], drift[i]);
48 }
49 
51  const std::vector<ComplexType>& qf,
52  std::vector<ParticleSet::Scalar_t>& drift) const
53 {
54  for (int i = 0; i < qf.size(); ++i)
55  getDrift(tau, qf[i], drift[i]);
56 }
57 
58 bool DriftModifierUNR::parseXML(xmlNodePtr cur)
59 {
60  ParameterSet m_param;
61  m_param.add(a_, "drift_UNR_a");
62  m_param.put(cur);
63  app_log() << " Set drift_modifier UNR parameter a = " << a_ << std::endl;
64  return true;
65 }
66 
67 } // namespace qmcplusplus
Fixed-size array.
Definition: OhmmsTinyMeta.h:30
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
std::ostream & app_log()
Definition: OutputManager.h:65
void getDrift(RealType tau, const GradType &qf, PosType &drift) const final
evaluate a drift with a real force
void convertToReal(const T1 &in, T2 &out)
generic conversion from type T1 to type T2 using implicit conversion
Definition: ConvertToReal.h:32
bool parseXML(xmlNodePtr cur) final
void getDrifts(RealType tau, const std::vector< GradType > &qf, std::vector< PosType > &) const final
bool put(std::istream &is) override
read from std::istream
Definition: ParameterSet.h:42
RealType a_
JCP1993 Umrigar et eq. (35) "a" parameter is set to 1.0.
class to handle a set of parameters
Definition: ParameterSet.h:27
void add(PDT &aparam, const std::string &aname_in, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new parameter corresponding to an xmlNode <parameter>
QMCTraits::ComplexType ComplexType
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot(const AntiSymTensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)