41 template<
class T =
double>
49 inline T
df(T r)
const {
return -1.0 / (r * r); }
66 app_log() <<
"\n Creating CoulombHandler with the Esler Optimized Breakup. " << std::endl;
71 app_log() <<
"\n Creating CoulombHandler with the 3D Ewald Breakup. " << std::endl;
76 app_log() <<
"\n Creating CoulombHandler with the Natoli Optimized Breakup. " << std::endl;
81 app_log() <<
"\n Creating CoulombHandler with the 2D Ewald Breakup. " << std::endl;
86 app_log() <<
"\n Creating CoulombHandler using quasi-2D Ewald method for the slab. " << std::endl;
91 APP_ABORT(
"\n Long range breakup method not recognized.\n");
94 return std::unique_ptr<LRHandlerType>(
CoulombHandler->makeClone(ref));
98 app_log() <<
" Clone CoulombHandler. " << std::endl;
99 return std::unique_ptr<LRHandlerType>(
CoulombHandler->makeClone(ref));
110 app_log() <<
"\n Creating CoulombDerivHandler with the 3D Ewald Breakup. " << std::endl;
115 app_log() <<
"\n Creating CoulombDerivHandler with the Natoli Optimized Breakup. " << std::endl;
120 APP_ABORT(
"\n Derivatives are not supported with Esler Optimized Breakup.\n");
124 APP_ABORT(
"\n Long range breakup method for derivatives not recognized.\n");
131 app_log() <<
" Clone CoulombDerivHandler. " << std::endl;
142 const int ng = agrid.
size();
143 std::vector<T> v(ng);
146 v[0] = (r > std::numeric_limits<T>::epsilon()) ? r * aLR->
evaluate(r, 1.0 / r) : 0.0;
147 for (
int ig = 1; ig < ng - 1; ig++)
150 v[ig] = r * aLR->
evaluate(r, 1.0 / r);
152 v[0] = 2.0 * v[1] - v[2];
154 auto V0 = std::make_unique<func_type>(agrid.
makeClone(), v);
155 T deriv = (v[1] - v[0]) / (agrid[1] - agrid[0]);
156 V0->spline(0, deriv, ng - 1, 0.0);
166 int ng = agrid.
size();
167 std::vector<T> v(ng);
170 v[0] = (r > std::numeric_limits<T>::epsilon()) ? r * aLR->
evaluate(r, 1.0 / r) : 0.0;
174 for (
int ig = 1; ig < ng - 1; ig++)
178 v_deriv = aLR->
srDf(r, 1 / r);
180 v[ig] = v_val + v_deriv * r;
182 v[0] = 2.0 * v[1] - v[2];
184 auto dV0 = std::make_unique<func_type>(agrid.
makeClone(), v);
185 T deriv = (v[1] - v[0]) / (agrid[1] - agrid[0]);
186 dV0->spline(0, deriv, ng - 1, 0.0);
const auto & getLRBox() const
static std::unique_ptr< LRHandlerType > getDerivHandler(ParticleSet &ref)
This returns a force/stress optimized LR handler. If non existent, it creates one.
One-Dimensional linear-grid.
static std::unique_ptr< LRHandlerType > CoulombDerivHandler
Stores the force/stress optimized LR handler.
helper functions for EinsplineSetBuilder
static std::unique_ptr< RadFunctorType > createSpline4RbyVs(const LRHandlerType *aLR, mRealType rcut, const GridType &agrid)
create a linear spline function
std::unique_ptr< OneDimGridBase< T, CT > > makeClone() const override
A derivative of LRBasis class to provide the functionality of the LPQHI basis.
EwaldHandler3D::mRealType mRealType
std::unique_ptr< OneDimCubicSpline< T > > createSpline4RbyVs_temp(const LRHandlerBase *aLR, T rcut, const LinearGrid< T > &agrid)
static std::unique_ptr< LRHandlerType > CoulombHandler
Stores the energ optimized LR handler.
mRealType evaluate(const std::vector< int > &kshell, const pRealType *restrict rk1_r, const pRealType *restrict rk1_i, const pRealType *restrict rk2_r, const pRealType *restrict rk2_i) const
evaluate
Specialized paritlce class for atomistic simulations.
MakeReturn< UnaryNode< FnCos, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t cos(const Vector< T1, C1 > &l)
T integrate_r2(T r) const
A derivative of LRBasis class to provide the functionality of the LPQHI basis.
static std::unique_ptr< RadFunctorType > createSpline4RbyVsDeriv(const LRHandlerType *aLR, mRealType rcut, const GridType &agrid)
create a linear spline of the derivative of short-range potential
std::unique_ptr< OneDimCubicSpline< T > > createSpline4RbyVsDeriv_temp(const LRHandlerBase *aLR, T rcut, const LinearGrid< T > &agrid)
Define a LRHandler with two template parameters.
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
void reset(ParticleSet &ref)
void reset(ParticleSet &ref, T rs)
int size() const
returns the size of the grid
static std::unique_ptr< LRHandlerType > getHandler(ParticleSet &ref)
This returns an energy optimized LR handler. If non existent, it creates one.
T operator()(T r, T rinv) const
Define a LRHandler with two template parameters.
base class for LRHandlerTemp<FUNC,BASIS> and DummyLRHanlder<typename Func>
virtual mRealType srDf(mRealType r, mRealType rinv) const =0
Define a LRHandler with two template parameters.
static lr_type this_lr_type