mod rpc¶
- module rpc¶
Cap’n Proto RPC module for distributed potential calculations.
This module is only compiled when the
rpcCargo feature is enabled. It reuses the existingCppCore/rgpot/rpc/Potentials.capnpschema that the C++ server also uses, ensuring full wire-format compatibility between Rust and C++ endpoints.Schema
The
schemasubmodule contains the Rust code generated fromPotentials.capnpbycapnpcduringbuild.rs. The schema defines:ForceInput— positions, atomic numbers, simulation cell.PotentialResult— energy and forces.Potentialinterface — a singlecalculateRPC method.
Client
client::RpcClientconnects to a remote rgpot server and provides a synchronouscalculate()method. Internally it owns a tokio runtime so that the blocking C API can drive async I/O. Exposed to C viargpot_rpc_client_new/rgpot_rpc_calculate/rgpot_rpc_client_free.Server
server::rgpot_rpc_server_startaccepts argpot_potential_thandle (callback-backed) and listens for incoming Cap’n Proto RPC connections. Eachcalculatecall is dispatched to the callback. The server blocks the calling thread.Modules
Re-exports
:rust:any:
rgpot_core::Potentials_capnpRe-export of the generated Cap’n Proto schema from the crate root.The generated code uses
crate::Potentials_capnpinternally, so the module must live at the crate root. This re-export provides a convenientrpc::schemaalias.