class rgpot::CP2KPot

Overview

class CP2KPot: public rgpot::Potential< CP2KPot > {
public:
    // structs
 
    struct Impl;
 
    // fields
 
    static uint64_t kKernelVersion = 1;
 
    // construction
 
    CP2KPot();
    CP2KPot(const ::CP2KParams::Reader& params);
    CP2KPot(const CP2KPot&);
    ~CP2KPot();
 
    // methods
 
    CP2KPot& operator=(const CP2KPot&);
    void forceImpl(const ForceInput& in, ForceOut* out) const;
    virtual PotCaps caps() const;
    virtual uint64_t paramsKey() const;
    bool setParams(const ::CP2KParams::Reader& params);
    void getParams(::CP2KParams::Builder out) const;
    bool setPotentialConfig(const ::PotentialConfig::Reader& cfg, std::string* message_out = nullptr);
    void selectOrbitals(int64_t key);
    bool keepsOrbitalsPerKey() const;
    bool available() const;
    std::string loadError() const;
    std::string runDirectory() const;
    static bool probeAvailable();
    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. Positions and the box are Angstrom; the energy is eV and the forces eV/Angstrom. An unconverged SCF throws CP2KScfError on every rank. Any other 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

libcp2k keeps global state: serialize process-wide. The SCF and the convergence exchange are collectives on the calculator’s communicator.

virtual uint64_t paramsKey() const

FNV-1a over the serialized CP2KParams bytes plus kKernelVersion.

bool setParams(const ::CP2KParams::Reader& params)

Stores the params. A session built from other params is destroyed; the next force renders the deck again. Returns false when the shim cannot be loaded or inputTemplate lacks a geometry token.

void selectOrbitals(int64_t key)

Names the calculation the following forces belong to (a band image, a ring-polymer bead). The shim keeps one CP2K force environment per key, so each keeps its own wavefunction. Every rank of a calculator names the same key before the same force.

bool keepsOrbitalsPerKey() const

True when the loaded shim keeps a force environment per key.

bool available() const

True when the shim is loaded and the params are usable.

std::string loadError() const

Why available() is false; empty otherwise.

std::string runDirectory() const

Directory holding input.inp and the CP2K output of the live session; empty before the first force.

static int bindCalculators(int ranks_per_calc)

Collective on MPI_COMM_WORLD, as CPMDPot::bindCalculators : splits into calculators of ranks_per_calc ranks and hands the shim the calculator communicator. Returns the group index, or -1 when the shim has no communicator-adoption symbol.