.. index:: pair: class; rgpot::HessianVectorCache .. _doxid-classrgpot_1_1_hessian_vector_cache: class rgpot::HessianVectorCache =============================== .. toctree:: :hidden: struct_rgpot_HessianVectorCache_Cached.rst struct_rgpot_HessianVectorCache_Geometry.rst struct_rgpot_HessianVectorCache_Key.rst Overview ~~~~~~~~ Centre forces and counters for Hessian-vector products. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class HessianVectorCache { public: // structs struct :ref:`Cached`; struct :ref:`Geometry`; struct :ref:`Key`; // construction :target:`HessianVectorCache`(); :target:`HessianVectorCache`(const HessianVectorCache&); // methods HessianVectorCache& :target:`operator=`(const HessianVectorCache&); template :ref:`HvpCentre` :ref:`centre`(Pot& pot, const :ref:`ForceInput`& in); template void :ref:`apply`(Pot& pot, const :ref:`ForceInput`& in, const double* v, double* hv, double step = 0.0, :ref:`HvpScheme` scheme = :ref:`HvpScheme::Auto`); void :ref:`invalidate`(); :ref:`HvpCounts` :target:`counts`() const; void :ref:`resetCounts`(); }; .. _details-classrgpot_1_1_hessian_vector_cache: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Centre forces and counters for Hessian-vector products. Safe to share between threads; the lock covers the cached centre, not the force calls. The potential passed to each call must be the one the cache was filled with, or ``:ref:`invalidate() ``` must be called in between. Methods ------- .. index:: pair: function; centre .. _doxid-classrgpot_1_1_hessian_vector_cache_1a18e372aabdbf54f82db4bed25e708b9e: .. ref-code-block:: cpp :class: doxyrest-title-code-block template :ref:`HvpCentre` centre(Pot& pot, const :ref:`ForceInput`& in) Energy and forces at *in*. Served from the cached centre when its positions, species and cell carry the same bits, otherwise one force call that becomes the centre. A search that needs the centre forces asks here, so the products that follow reuse them. .. index:: pair: function; apply .. _doxid-classrgpot_1_1_hessian_vector_cache_1a64a09ff8f867598b6e74ee3659d581bc: .. ref-code-block:: cpp :class: doxyrest-title-code-block template void apply(Pot& pot, const :ref:`ForceInput`& in, const double* v, double* hv, double step = 0.0, :ref:`HvpScheme` scheme = :ref:`HvpScheme::Auto`) Write :math:`H v` to *hv*. *v* and *hv* hold ``3*in``.nAtoms doubles and must not overlap. *step* 0 selects ``kHvpDefaultStep``. A zero direction gives a zero product without a call. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - std::invalid_argument - for a malformed request. * - std::domain_error - when the kernel returns a non-finite value. .. index:: pair: function; invalidate .. _doxid-classrgpot_1_1_hessian_vector_cache_1a11c6b78fccbaded2ebb959abedf00a19: .. ref-code-block:: cpp :class: doxyrest-title-code-block void invalidate() Drop the cached centre. Call it when the potential changes while the geometry does not. .. index:: pair: function; resetCounts .. _doxid-classrgpot_1_1_hessian_vector_cache_1ad4767507af3daf497807e0ec0cd99f5e: .. ref-code-block:: cpp :class: doxyrest-title-code-block void resetCounts() Zero the counters. The cached centre stays.