class rgpot::CPMDPot

Overview

class CPMDPot: public rgpot::Potential< CPMDPot > {
public:
    // structs
 
    struct Impl;
 
    // fields
 
    static uint64_t kKernelVersion = 1;
 
    // construction
 
    CPMDPot();
    CPMDPot(const ::CPMDParams::Reader& params);
    CPMDPot(const CPMDPot&);
    ~CPMDPot();
 
    // methods
 
    CPMDPot& operator=(const CPMDPot&);
    void forceImpl(const ForceInput& in, ForceOut* out) const;
    virtual PotCaps caps() const;
    virtual uint64_t paramsKey() const;
    bool setParams(const ::CPMDParams::Reader& params);
    void selectOrbitals(int64_t key);
    bool keepsOrbitalsPerKey() const;
    void getParams(::CPMDParams::Builder out) const;
    bool setPotentialConfig(const ::PotentialConfig::Reader& cfg, std::string* message_out = nullptr);
    bool available() const;
    static bool probe_available();
    static bool abi_available();
    static int bindCalculators(int ranks_per_calc);
};

Detailed Documentation

Fields

static uint64_t kKernelVersion = 1

Bump whenever the engine-facing numerics change.

Methods

void forceImpl(const ForceInput& in, ForceOut* out) const

Every rank of the calling calculator enters this call together; other calculators need not (a host may give them no system in a batch). The call fills ForceOut on the rank that calls it. A failure is printed on every rank of the calculator, then MPI_Abort runs on MPI_COMM_WORLD, and then the exception leaves the call.

virtual PotCaps caps() const

The dlopen’d engine keeps global session state: serialize process-wide. Every rank of a calculator enters forceImpl together: the engine’s SCF and the error exchange are collectives on the calculator’s communicator.

virtual uint64_t paramsKey() const

FNV-1a over the serialized CPMDParams bytes plus kKernelVersion, so two CPMDPot instances with different params never share result-cache entries. Recomputed by the constructors and setParams.

void selectOrbitals(int64_t key)

Names the calculation the following forces belong to: an image of a band, a bead of a ring polymer. The engine keeps the converged orbitals per key, so a calculator that evaluates several of them in turn starts each SCF from that key’s own previous orbitals instead of from whichever calculation it ran last. Every rank of a calculator names the same key before the same force. An engine without cpmdc_session_select_orbitals ignores the key.

bool keepsOrbitalsPerKey() const

True when the loaded engine keeps orbitals per key.

static int bindCalculators(int ranks_per_calc)

Collective on MPI_COMM_WORLD. rgpot splits into calculators of ranks_per_calc ranks and cpmdc_adopt_calculator_comm gives the engine that same communicator. One NEB image is one calculator. A second band calls this on its own world. Every rank must call it before the first force. Returns the group index, or -1 before the split when the engine has no communicator-adoption symbol.

Instances may be constructed before or after calculator binding. Every rank uses the same construction and binding order. Each engine adopts the split once and stays loaded through process exit. Constructing an instance after rgpot::bindCalculators gives its engine the existing communicator without another split.