class pot::PotentialWrapper

Overview

Type-erased wrapper around any potential that provides a force() interface. More…

#include <PotentialWrapper.h>
 
class PotentialWrapper {
public:
    // typedefs
 
    typedef std::function<void(long N, const double*R, const int*atomicNrs, double*F, double*U, double*variance, const double*box)> ForceFn;
 
    // construction
 
    PotentialWrapper(ForceFn fn);
 
    // methods
 
    void force(long N, const double* R, const int* atomicNrs, double* F, double* U, double* variance, const double* box);
 
    template <typename RgPot>
    static PotentialWrapper from_rgpot(RgPot& pot);
};

Detailed Documentation

Type-erased wrapper around any potential that provides a force() interface.

Accepts a std::function with the legacy EON force() signature, allowing any potential (EAM, Morse, rgpot, RPC, lambda) to be used without templates.

Methods

void force(long N, const double* R, const int* atomicNrs, double* F, double* U, double* variance, const double* box)

Invoke the wrapped potential.

template <typename RgPot>
static PotentialWrapper from_rgpot(RgPot& pot)

Factory: adapt an rgpot PotentialBase subclass.

Bridges rgpot’s operator()(AtomMatrix, vector<int>, box) -> (energy, AtomMatrix) to the legacy force() signature.