class GenericPotImpl

Overview

Implementation of the standalone Cap’n Proto potential server. More…

class GenericPotImpl: public Potential::Server {
public:
    // construction

    GenericPotImpl(std::unique_ptr<rgpot::PotentialBase> pot);

    // methods

    kj::Promise calculate(CalculateContext context);
};

Detailed Documentation

Implementation of the standalone Cap’n Proto potential server.

This file implements a basic RPC server which exposes toy potentials over a network interface. It utilizes the EzRpcServer for handling requests.

Server implementation for the Potential RPC interface.

This class wraps a polymorphic PotentialBase instance and dispatches RPC calculate requests to the underlying physics engine.

Construction

GenericPotImpl(std::unique_ptr<rgpot::PotentialBase> pot)

Constructor for GenericPotImpl.

Parameters:

pot

Ownership of a PotentialBase derived object.

Methods

kj::Promise calculate(CalculateContext context)

This method performs the following translation steps:

  1. Extracts the ForceInput (fip) from the RPC context.

  2. Validates the size of the atomic number list.

  3. Converts Cap’n Proto lists into native AtomMatrix and std::vector types.

  4. Executes the calculation via the PotentialBase virtual operator.

  5. Populates the PotentialResult with energy and force data.

Parameters:

context

The Cap’n Proto RPC call context.

Returns:

An asynchronous promise for completion.