QMCPACK
L2Potential.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: Jaron T. Krogel, krogeljt@ornl.gov, Oak Ridge National Laboratory
8 //
9 // File created by: Jaron T. Krogel, krogeljt@ornl.gov, Oak Ridge National Laboratory
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 
13 #ifndef QMCPLUSPLUS_L2POTENTIAL_H
14 #define QMCPLUSPLUS_L2POTENTIAL_H
15 #include "Particle/ParticleSet.h"
22 
23 namespace qmcplusplus
24 {
26 {
29 
30  std::unique_ptr<RadialPotentialType> vL2;
32 
33  RealType evaluate(RealType r) { return vL2->splint(r); }
34 
36  {
37  if (r < rcut)
38  return vL2->splint(r);
39  else
40  return 0.0;
41  }
42 
44  {
45  auto c = new L2RadialPotential();
46  c->vL2.reset(vL2->makeClone());
47  c->rcut = rcut;
48  return c;
49  }
50 };
51 
52 
53 /** @ingroup hamiltonian
54  * \brief Evaluate the L2 potentials around each ion.
55  */
56 
57 struct L2Potential : public OperatorBase
58 {
59  ///reference to the ionic configuration
61  ///the number of ions
62  int NumIons;
63  ///distance table index
65  ///unique set of L2 PP to cleanup
66  std::vector<std::unique_ptr<L2RadialPotential>> PPset;
67  ///PP[iat] is the L2 potential for the iat-th particle
68  std::vector<L2RadialPotential*> PP;
69  ///Associated trial wavefunction
71 
72  L2Potential(const ParticleSet& ions, ParticleSet& els, TrialWaveFunction& psi);
73 
74  bool dependsOnWaveFunction() const override { return true; }
75  std::string getClassName() const override { return "L2Potential"; }
76 
77  void resetTargetParticleSet(ParticleSet& P) override;
78 
79  Return_t evaluate(ParticleSet& P) override;
80 
81  void evaluateDK(ParticleSet& P, int iel, TensorType& D, PosType& K);
82  void evaluateD(ParticleSet& P, int iel, TensorType& D);
83 
84  bool put(xmlNodePtr cur) override { return true; }
85 
86  bool get(std::ostream& os) const override
87  {
88  os << "L2Potential: " << IonConfig.getName();
89  return true;
90  }
91 
92  std::unique_ptr<OperatorBase> makeClone(ParticleSet& qp, TrialWaveFunction& psi) final;
93 
94  /** Add a RadialPotentialType of a species
95  * @param groupID index of the ion species
96  * @param ppot L2 pseudopotential
97  */
98  void add(int groupID, std::unique_ptr<L2RadialPotential>&& ppot);
99 };
100 } // namespace qmcplusplus
101 #endif
void resetTargetParticleSet(ParticleSet &P) override
Reset the data with the target ParticleSet.
Definition: L2Potential.cpp:32
Evaluate the L2 potentials around each ion.
Definition: L2Potential.h:57
const std::string & getName() const
return the name
void add(int groupID, std::unique_ptr< L2RadialPotential > &&ppot)
Add a RadialPotentialType of a species.
Definition: L2Potential.cpp:42
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
bool dependsOnWaveFunction() const override
return true if this operator depends on a wavefunction
Definition: L2Potential.h:74
QTBase::RealType RealType
Definition: Configuration.h:58
std::unique_ptr< OperatorBase > makeClone(ParticleSet &qp, TrialWaveFunction &psi) final
TrialWaveFunction * psi_ref
Associated trial wavefunction.
Definition: L2Potential.h:70
Declaration of OperatorBase.
std::string getClassName() const override
return class name
Definition: L2Potential.h:75
const ParticleSet & IonConfig
reference to the ionic configuration
Definition: L2Potential.h:60
int myTableIndex
distance table index
Definition: L2Potential.h:64
RealType evaluate_guard(RealType r)
Definition: L2Potential.h:35
An abstract base class to implement a One-Dimensional grid.
L2RadialPotential * makeClone()
Definition: L2Potential.h:43
Decalaration of One-Dimesional grids.
Specialized paritlce class for atomistic simulations.
Definition: ParticleSet.h:55
Return_t evaluate(ParticleSet &P) override
Evaluate the local energy contribution of this component.
Definition: L2Potential.cpp:51
std::vector< std::unique_ptr< L2RadialPotential > > PPset
unique set of L2 PP to cleanup
Definition: L2Potential.h:66
void evaluateD(ParticleSet &P, int iel, TensorType &D)
Declaration of a TrialWaveFunction.
An abstract class for Local Energy operators.
Definition: OperatorBase.h:59
Class to represent a many-body trial wave function.
int NumIons
the number of ions
Definition: L2Potential.h:62
std::unique_ptr< RadialPotentialType > vL2
Definition: L2Potential.h:30
traits for QMC variables
Definition: Configuration.h:49
L2Potential(const ParticleSet &ions, ParticleSet &els, TrialWaveFunction &psi)
Definition: L2Potential.cpp:20
QTBase::TensorType TensorType
Definition: Configuration.h:63
RealType evaluate(RealType r)
Definition: L2Potential.h:33
BareKineticEnergy::Return_t Return_t
void evaluateDK(ParticleSet &P, int iel, TensorType &D, PosType &K)
Definition: L2Potential.cpp:97
std::vector< L2RadialPotential * > PP
PP[iat] is the L2 potential for the iat-th particle.
Definition: L2Potential.h:68
bool put(xmlNodePtr cur) override
Read the input parameter.
Definition: L2Potential.h:84