Global Namespace

Overview

// namespaces
 
namespace cache;
namespace eonc;
namespace forcefields;
namespace forcefields;
namespace forcefields;
    namespace forcefields::unit_system;
    namespace forcefields::zhu_philpott_parameters;
namespace fortranpots;
namespace plugin;
namespace plugin;
namespace rgpot;
namespace rgpot;
namespace rgpot;
namespace rgpot;
namespace rgpot;
    namespace rgpot::abi;
        namespace rgpot::abi::detail;
    namespace rgpot::aoti_execstack;
    namespace rgpot::cache;
    namespace rgpot::details;
    namespace rgpot::engine;
    namespace rgpot::fortranpots;
    namespace rgpot::nlist;
    namespace rgpot::plugin;
        namespace rgpot::plugin::detail;
        namespace rgpot::plugin::dynlib;
    namespace rgpot::tools;
    namespace rgpot::types;
        namespace rgpot::types::adapt;
            namespace rgpot::types::adapt::capnp;
            namespace rgpot::types::adapt::eigen;
            namespace rgpot::types::adapt::xtensor;
    namespace rgpot::uma;
    namespace rgpot::units;
    namespace rgpot::vesin_compat;
namespace rgpot;
namespace rgpot;
namespace rgpot;
namespace rgpot;
namespace rgpot;
namespace rgpot;
namespace rgpot;
namespace rgpot;
namespace rgpot;
namespace rgpot_cuh2;
namespace rgpot_cuh2_capi;
namespace rgpot_eam_al;
namespace rgpot_eam_al_capi;
namespace rgpot_edip;
namespace rgpot_edip_capi;
namespace rgpot_fehe;
namespace rgpot_fehe_capi;
namespace rgpot_ferror;
namespace rgpot_kinds;
namespace rgpot_lenosky;
namespace rgpot_lenosky_capi;
namespace rgpot_neighbors;
namespace rgpot_sw;
namespace rgpot_sw_capi;
namespace rgpot_tersoff;
namespace rgpot_tersoff_capi;
namespace rgpot_water_h;
namespace rgpot_water_h_capi;
namespace rgpot_workspace;
namespace std;
namespace string_literals;
namespace vesin;
    namespace vesin::cpu;
namespace xckernel;
 
// typedefs
 
typedef struct rgpot_cxx_layout_stamp_t rgpot_cxx_layout_stamp_t;
typedef struct rgpot_mpi_group_t rgpot_mpi_group_t;
typedef struct rgpot_mpi_api_t rgpot_mpi_api_t;
typedef const rgpot_mpi_api_t* (*rgpot_mpi_api_fn)(void);
typedef struct CPMDCResult CPMDCResult;
typedef struct CPMDCSession CPMDCSession;
typedef enum CPMDCFeatureKind CPMDCFeatureKind;
typedef struct CPMDCFeatureEntry CPMDCFeatureEntry;
typedef vector<emt_parameters*>::iterator param_p_iter;
typedef double symTensor[6];
typedef TinyMatrix<double> TinyDoubleMatrix;
typedef struct RgpotEnginePot RgpotEnginePot;
 
typedef int (*rgpot_engine_coord_transform)(
    void *user,
    long nAtoms,
    double *positions,
    double *box
    );
 
typedef struct RgpotMtaPot RgpotMtaPot;
typedef struct RgpotMtaConfig RgpotMtaConfig;
typedef struct MopacCParams MopacCParams;
typedef struct MopacCResult MopacCResult;
typedef struct NWChemCResult NWChemCResult;
typedef struct PotClient PotClient;
typedef struct RgpotXtbPot RgpotXtbPot;
typedef struct RgpotXtbConfig RgpotXtbConfig;
typedef struct eindir_objective_t eindir_objective_t;
typedef struct eindir_abi_stamp_t eindir_abi_stamp_t;
typedef enum rgpot_plugin_status_t rgpot_plugin_status_t;
typedef enum rgpot_plugin_caps_t rgpot_plugin_caps_t;
typedef struct rgpot_plugin_input_t rgpot_plugin_input_t;
typedef struct rgpot_plugin_output_t rgpot_plugin_output_t;
typedef struct rgpot_plugin_instance rgpot_plugin_instance;
 
typedef rgpot_plugin_status_t (*rgpot_plugin_create_fn)(
    const char *config_json,
    rgpot_plugin_instance **out
    );
 
typedef rgpot_plugin_status_t (*rgpot_plugin_calculate_fn)(
    rgpot_plugin_instance *instance,
    const rgpot_plugin_input_t *input,
    rgpot_plugin_output_t *output
    );
 
typedef void (*rgpot_plugin_destroy_fn)(rgpot_plugin_instance *instance);
typedef uint32_t (*rgpot_plugin_capabilities_fn)(const rgpot_plugin_instance *instance);
typedef const char* (*rgpot_plugin_last_error_fn)(const rgpot_plugin_instance *instance);
typedef struct rgpot_plugin_descriptor_t rgpot_plugin_descriptor_t;
typedef const rgpot_plugin_descriptor_t* (*rgpot_plugin_init_fn)(void);
 
// enums
 
enum {
    RGPOT_XTB_METHOD_GFNFF = 0,
    RGPOT_XTB_METHOD_GFN0  = 1,
    RGPOT_XTB_METHOD_GFN1  = 2,
    RGPOT_XTB_METHOD_GFN2  = 3,
};
 
enum CPMDCFeatureKind;
enum rgpot_engine_acquire_reason;
enum rgpot_plugin_caps_t;
enum rgpot_plugin_status_t;
 
// structs
 
struct CPMDCFeatureEntry;
struct CPMDCResult;
struct Image;
struct MopacCParams;
struct MopacCResult;
struct NWChemCResult;
struct RgpotEngineAbiStamp;
struct RgpotEngineCallbacks;
struct RgpotEngineCaps;
struct RgpotEngineGprGate;
struct RgpotEngineNeighborOptions;
struct RgpotEnginePot;
struct RgpotMtaConfig;
struct RgpotMtaPot;
struct RgpotXtbConfig;
struct RgpotXtbPot;
struct eindir_abi_stamp_t;
struct eindir_objective_t;
struct emt_parameters;
struct rgpot_cxx_layout_stamp_t;
struct rgpot_mpi_api_t;
struct rgpot_mpi_group_t;
struct rgpot_plugin_descriptor_t;
struct rgpot_plugin_input_t;
struct rgpot_plugin_output_t;
 
// classes
 
class AsapPotential;
class AtomMatrix;
class Atoms;
class CellList;
class EAM;
class EMT;
class EMTDefaultParameterProvider;
class EMTParameterProvider;
class EMTRasmussenParameterProvider;
class Exception;
class GenericPotImpl;
class GhostAtoms;
class GhostPotential;
class NeighborList;
class PotClient;
class SuperCell;
 
template <class Type>
class TinyMatrix;
 
class Vec;
 
// global variables
 
static const CPMDCFeatureEntry g_features[];
int verbose;
int verbose = 0;
static const int stresscomp[3][3] = {{0, 5, 4}, {5, 1, 3}, {4, 3, 2}};
static const double Beta = 1.809;
int verbose;
size_t config_len;
size_t char* errbuf;
size_t char size_t errlen;
long nAtoms;
long const double* positions;
long const double const int* atomicNrs;
long const double const int double* forces;
long const double const int double double* energy;
long const double const int double double double* variance;
long const double const int double double double const double* box;
long const double const int double double double const double rgpot_engine_coord_transform transform;
long const double const int double double double const double rgpot_engine_coord_transform void* transform_user;
long nSystems;
long long const double const int double double* energies;
long long const double const int double double double* variances;
long long const double const int double double double const double* boxes;
const RgpotEngineCallbacks* callbacks;
const void* msg;
const void size_t msg_len;
RgpotEngineCaps* out;
char* buf;
char size_t len;
int intra_op;
int int inter_op;
int charge;
int int spin;
RgpotEngineNeighborOptions* opts;
RgpotEngineNeighborOptions long capacity;
char* errbuf;
char size_t errlen;
long nAtoms;
long const double* positions;
long const double const int* atomicNrs;
long const double const int double* forces;
long const double const int double double* energy;
long const double const int double double double* variance;
long const double const int double double double const double* box;
static const char* STUB_VERSION = “mopacc-stub/1.0.0”;
static const char* STUB_VERSION = “nwchemc-stub/1.0.0”;
char* errbuf;
char size_t errlen;
long nAtoms;
long const double* positions;
long const double const int* atomicNrs;
long const double const int double* forces;
long const double const int double double* energy;
long const double const int double double double* variance;
long const double const int double double double const double* box;
 
// global functions
 
rgpot_cxx_layout_stamp_t rgpot_cxx_layout_stamp(void);
int32_t rgpot_cxx_layout_compatible(const rgpot_cxx_layout_stamp_t* caller);
rgpot_cxx_layout_stamp_t rgpot_cxx_layout_stamp(void);
int32_t rgpot_cxx_layout_compatible(const rgpot_cxx_layout_stamp_t* caller);
const rgpot_mpi_api_t* rgpot_mpi_api_v1(void);
__attribute__((visibility(“default”))) const;
int cpmdc_set_params(const void* params_capnp, size_t params_capnp_size_bytes);
CPMDCResult cpmdc_energy_gradient(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params_capnp, size_t params_capnp_size_bytes, double* grad_h_bohr);
CPMDCResult cpmdc_energy(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params_capnp, size_t params_capnp_size_bytes);
CPMDCResult cpmdc_energy_forces(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params_capnp, size_t params_capnp_size_bytes, double* forces_h_bohr);
CPMDCSession* cpmdc_session_create(const void* params_capnp, size_t params_capnp_size_bytes);
int cpmdc_session_set_params(CPMDCSession* session, const void* params_capnp, size_t params_capnp_size_bytes);
void cpmdc_session_destroy(CPMDCSession* session);
int cpmdc_session_select_orbitals(CPMDCSession* session, long long key);
CPMDCResult cpmdc_session_energy_gradient(CPMDCSession* session, int n_atoms, const double* positions_ang, const int* atomic_numbers, double* grad_h_bohr);
CPMDCResult cpmdc_session_energy(CPMDCSession* session, int n_atoms, const double* positions_ang, const int* atomic_numbers);
CPMDCResult cpmdc_session_energy_forces(CPMDCSession* session, int n_atoms, const double* positions_ang, const int* atomic_numbers, double* forces_h_bohr);
CPMDCResult cpmdc_session_calculate_forces(CPMDCSession* session, const void* force_input_capnp, size_t force_input_capnp_size_bytes, double* forces_h_bohr, size_t forces_len);
CPMDCResult cpmdc_session_calculate_result(CPMDCSession* session, const void* force_input_capnp, size_t force_input_capnp_size_bytes, void* potential_result_capnp, size_t potential_result_capnp_capacity_bytes, size_t* potential_result_capnp_size_bytes);
CPMDCResult cpmdc_calculate_result(const void* params_capnp, size_t params_capnp_size_bytes, const void* force_input_capnp, size_t force_input_capnp_size_bytes, void* potential_result_capnp, size_t potential_result_capnp_capacity_bytes, size_t* potential_result_capnp_size_bytes);
size_t cpmdc_potential_result_size_for_force_input(const void* force_input_capnp, size_t force_input_capnp_size_bytes);
const char* cpmdc_version(void);
int cpmdc_available(void);
void cpmdc_finalize(void);
size_t cpmdc_feature_count(void);
const CPMDCFeatureEntry* cpmdc_feature_table(void);
const CPMDCFeatureEntry* cpmdc_feature_find(const char* feature_id);
static CPMDCResult stub_fail(void);
int cpmdc_set_params(const void* params_capnp, size_t params_capnp_size_bytes);
CPMDCResult cpmdc_energy_gradient(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params_capnp, size_t params_capnp_size_bytes, double* grad_h_bohr);
CPMDCResult cpmdc_energy(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params_capnp, size_t params_capnp_size_bytes);
CPMDCResult cpmdc_energy_forces(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params_capnp, size_t params_capnp_size_bytes, double* forces_h_bohr);
const char* cpmdc_version(void);
int cpmdc_available(void);
void cpmdc_finalize(void);
CPMDCSession* cpmdc_session_create(const void* params_capnp, size_t params_capnp_size_bytes);
int cpmdc_session_set_params(CPMDCSession* session, const void* params_capnp, size_t params_capnp_size_bytes);
void cpmdc_session_destroy(CPMDCSession* session);
int cpmdc_session_select_orbitals(CPMDCSession* session, long long key);
CPMDCResult cpmdc_session_energy(CPMDCSession* session, int n_atoms, const double* positions_ang, const int* atomic_numbers);
CPMDCResult cpmdc_session_energy_gradient(CPMDCSession* session, int n_atoms, const double* positions_ang, const int* atomic_numbers, double* grad_h_bohr);
CPMDCResult cpmdc_session_energy_forces(CPMDCSession* session, int n_atoms, const double* positions_ang, const int* atomic_numbers, double* forces_h_bohr);
CPMDCResult cpmdc_session_calculate_forces(CPMDCSession* session, const void* force_input_capnp, size_t force_input_capnp_size_bytes, double* forces_h_bohr, size_t forces_len);
CPMDCResult cpmdc_session_calculate_result(CPMDCSession* session, const void* force_input_capnp, size_t force_input_capnp_size_bytes, void* potential_result_capnp, size_t potential_result_capnp_capacity_bytes, size_t* potential_result_capnp_size_bytes);
CPMDCResult cpmdc_calculate_result(const void* params_capnp, size_t params_capnp_size_bytes, const void* force_input_capnp, size_t force_input_capnp_size_bytes, void* potential_result_capnp, size_t potential_result_capnp_capacity_bytes, size_t* potential_result_capnp_size_bytes);
size_t cpmdc_potential_result_size_for_force_input(const void* force_input_capnp, size_t force_input_capnp_size_bytes);
size_t cpmdc_feature_count(void);
const CPMDCFeatureEntry* cpmdc_feature_table(void);
const CPMDCFeatureEntry* cpmdc_feature_find(const char* feature_id);
void vsqrt(double res[], const double a[], const int* n);
void vexp(double res[], const double a[], const int* n);
void vrec(double res[], const double a[], const int* n);
void vlog(double res[], const double a[], const int* n);
ostream& operator<<(ostream& out, const Vec& v);
istream& operator>>(istream& in, Vec& v);
Vec Cross(const Vec& v1, const Vec& v2);
void Vaxpy(double a, const Vec& x, Vec& y);
double Length2(const Vec& v);
void vec_mul_scal_add_scal(double res[], const double a[], const double b, const double c, int n);
void vec_mul_indir_add_indir(double res[], const double a[], const double b[], const double c[], const int offset[], int n);
void vec_mul(double res[], const double a[], const double b[], int n);
void vec_mul_scal(double res[], const double a[], double b, int n);
void vec_mul_indir(double res[], const double a[], const double b[], const int offset[], int n);
void vec_eq_self_mul_addscal_mul(double res[], const double a[], double b, const double c[], int n);
void vec_self_mul_mul_indir(double res[], const double a[], const double b[], const int offset[], int n);
void vec_diffweight(double res[], const double a[], double b, int n);
void vec_mul_scal_add_mul(double res[], const double a[], double b, const double c[], const double d[], int n);
void vec_mul_indir_add_indir_mul(double res[], const double a[], const double b[], const double c[], const double d[], const int offset[], int n);
void vec_dbl_mul_indir_add(double res[], const double a[], const double b[], const double c[], const double d[], const int offset[], int n);
void vec_dEds(double res[], const double a[], const double b[], const double c[], const double d[], const double e[], const double f[], const int offset[], int n);
void vec_df(double* res, const double* a, const double* b, const double* c, double d, const double* e, double f, const double* g, const double* h, double x, const double* y, double z, int n);
void vec_add_scal(double res[], const double a[], double b, int n);
int rgpot_engine_abi_version(void);
int rgpot_engine_available(void);
const char* rgpot_engine_name(void);
const char* rgpot_engine_version(void);
RgpotEnginePot* rgpot_engine_create(const void* config, size_t config_len, char* errbuf, size_t errlen);
void rgpot_engine_destroy(RgpotEnginePot* pot);
int rgpot_engine_force(RgpotEnginePot* pot, long nAtoms, const double* positions, const int* atomicNrs, double* forces, double* energy, double* variance, const double* box, rgpot_engine_coord_transform transform, void* transform_user);
int rgpot_engine_force_batch(RgpotEnginePot* pot, long nSystems, long nAtoms, const double* positions, const int* atomicNrs, double* forces, double* energies, double* variances, const double* boxes, rgpot_engine_coord_transform transform, void* transform_user);
RgpotEngineAbiStamp rgpot_engine_abi_stamp(void);
int rgpot_engine_abi_compatible(const RgpotEngineAbiStamp* stamp);
int rgpot_engine_caps(const RgpotEnginePot* pot, RgpotEngineCaps* out);
size_t rgpot_engine_last_error(const RgpotEnginePot* pot, char* buf, size_t len);
size_t rgpot_engine_model_digest(const RgpotEnginePot* pot, char* buf, size_t len);
int rgpot_engine_set_num_threads(RgpotEnginePot* pot, int intra_op, int inter_op);
int rgpot_engine_set_charge_spin(RgpotEnginePot* pot, int charge, int spin);
__attribute__((visibility(“default”))) const;
program test_cuh2();
subroutine cu_slab_with_h2(integer, intent(in) cells, real(wp), intent(in) a, real(wp), intent(in) gap, real(wp), intent(in) height, real(wp), intent(in) bond, real(wp), dimension(:, :), intent(out), allocatable pos, integer(ip), dimension(:), intent(out), allocatable z, real(wp), dimension(3, 3), intent(out) box);
program test_eam_al();
subroutine fcc_lattice(integer, intent(in) cells, real(wp), intent(in) a, real(wp), dimension(:, :), intent(out), allocatable pos, real(wp), dimension(3, 3), intent(out) box);
program test_edip();
subroutine diamond_lattice(integer, intent(in) cells, real(wp), intent(in) a, real(wp), dimension(:, :), intent(out), allocatable pos, real(wp), dimension(3, 3), intent(out) box);
program test_fehe();
subroutine bcc_lattice(integer, intent(in) cells, real(wp), intent(in) a, real(wp), dimension(:, :), intent(out), allocatable pos, real(wp), dimension(3, 3), intent(out) box);
program test_lenosky();
subroutine diamond_lattice(integer, intent(in) cells, real(wp), intent(in) a, real(wp), dimension(:, :), intent(out), allocatable pos, real(wp), dimension(3, 3), intent(out) box);
program test_sw_gather();
subroutine diamond_lattice(integer, intent(in) cells, real(wp), intent(in) a, real(wp), dimension(:, :), intent(out), allocatable pos, real(wp), dimension(3, 3), intent(out) box);
program test_tersoff();
subroutine diamond_lattice(integer, intent(in) cells, real(wp), intent(in) a, real(wp), dimension(:, :), intent(out), allocatable pos, real(wp), dimension(3, 3), intent(out) box);
program test_water_h();
subroutine water_plus_h(real(wp), dimension(3, natoms), intent(out) pos, integer(ip), dimension(natoms), intent(out) atomic_numbers, real(wp), dimension(3, 3), intent(out) cellv);
__attribute__((visibility(“default”)));
static const char* nz(const char* s);
static void set_err(char* errbuf, size_t errlen, const char* msg);
int rgpot_mta_abi_version(void);
int rgpot_mta_available(void);
RgpotMtaPot* rgpot_mta_create(const RgpotMtaConfig* cfg, char* errbuf, size_t errlen);
void rgpot_mta_destroy(RgpotMtaPot* pot);
int rgpot_mta_force(RgpotMtaPot* pot, long nAtoms, const double* positions, const int* atomicNrs, double* forces, double* energy, double* variance, const double* box);
int mopacc_set_params(const void* params, size_t params_size_bytes);
MopacCResult mopacc_energy_gradient(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params, size_t params_size_bytes, double* grad_h_bohr);
int mopacc_c_abi_version(void);
int mopacc_available(void);
const char* mopacc_version(void);
int mopacc_set_params(const void* params, size_t params_size_bytes);
MopacCResult mopacc_energy_gradient(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params, size_t params_size_bytes, double* grad_h_bohr);
int mopacc_c_abi_version(void);
int mopacc_available(void);
const char* mopacc_version(void);
int nwchemc_set_params(const void* params_capnp, size_t params_capnp_size_bytes);
NWChemCResult nwchemc_energy_gradient(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params_capnp, size_t params_capnp_size_bytes, double* grad_h_bohr);
const char* nwchemc_version(void);
int nwchemc_available(void);
int nwchemc_set_params(const void* params_capnp, size_t params_capnp_size_bytes);
NWChemCResult nwchemc_energy_gradient(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params_capnp, size_t params_capnp_size_bytes, double* grad_h_bohr);
const char* nwchemc_version(void);
int nwchemc_available(void);
PotClient* pot_client_init(const char* host, int32_t port);
void pot_client_free(PotClient* client);
int32_t pot_calculate(PotClient* client, int32_t natoms, const double* pos, const int32_t* atmnrs, const double* box, double* out_energy, double* out_forces);
const char* pot_get_last_error(PotClient* client);
PotClient* pot_client_init(const char* host, int32_t port);
void pot_client_free(PotClient* client);
int32_t pot_calculate(PotClient* client, int32_t natoms, const double* pos, const int32_t* atmnrs, const double* box, double* out_energy, double* out_forces);
const char* pot_get_last_error(PotClient* client);
int runServer(int argc, char* argv[]);
int main(int argc, char** argv);
__attribute__((visibility(“default”)));
static rgpot::GFNMethod method_from_c(int m);
int rgpot_xtb_abi_version(void);
int rgpot_xtb_available(void);
RgpotXtbPot* rgpot_xtb_create(const RgpotXtbConfig* cfg, char* errbuf, size_t errlen);
void rgpot_xtb_destroy(RgpotXtbPot* pot);
int rgpot_xtb_force(RgpotXtbPot* pot, long nAtoms, const double* positions, const int* atomicNrs, double* forces, double* energy, double* variance, const double* box);
 
// macros
 
#define BUFLEN
#define CATCH_AND_REPORT(client, default_ret)
#define DEBUGPRINT
#define DEBUG_LEVEL_RETURN(x)
#define EINDIR_ABI_STAMP_T_DEFINED
#define EINDIR_OBJECTIVE_T_DEFINED
#define FORCEFIELDS_UNIT_SYSTEM_ANGSTROM_GRAMME_PER_MOL_FEMTOSECOND_ECHARGE
#define FORCEFIELDS_UNIT_SYSTEM_ANGSTROM_KILOGRAMME_PER_MOL_FEMTOSECOND_AMPERE_PER_MOL
#define FORCEFIELDS_UNIT_SYSTEM_ELECTRONVOLT_ANGSTROM_FEMTOSECOND_ECHARGE
#define FORCEFIELDS_UNIT_SYSTEM_HPP
#define FORCEFIELDS_UNIT_SYSTEM_KILOCALORY_PER_MOL_ANGSTROM_FEMTOSECOND_ECHARGE
#define FORCEFIELDS_UNIT_SYSTEM_METRE_KILOGRAMME_PER_MOL_SECOND_AMPERE_PER_MOL
#define FORCEFIELDS_UNIT_SYSTEM_SI_MKSA
#define MOPACC_MODEL_AM1
#define MOPACC_MODEL_PM6
#define MOPACC_MODEL_PM6_D3H4
#define MOPACC_MODEL_PM6_ORG
#define MOPACC_MODEL_PM7
#define MOPACC_MODEL_RM1
#define NMAXELEMENTS
#define NPARAMS
#define POT_BRIDGE_API
#define RGPOT_BUILD_REVISION
#define RGPOT_BUILD_VERSION
#define RGPOT_CPMDC_API
#define RGPOT_CXX_LAYOUT_API
#define RGPOT_CXX_LAYOUT_BUILDING
#define RGPOT_EINDIR_ABI_HPP
#define RGPOT_ENGINE_ABI_LAYOUT_REVISION
#define RGPOT_ENGINE_ABI_MINOR
#define RGPOT_ENGINE_ABI_VERSION
#define RGPOT_ENGINE_API
#define RGPOT_ENGINE_GPR_GATE_MAGIC
#define RGPOT_ENGINE_GPR_GATE_VERSION
#define RGPOT_ENGINE_PROJECT_VERSION
#define RGPOT_FORTRAN_POT_CLASS(ClassName, PotTypeValue)
#define RGPOT_FORTRAN_POT_IMPL(ClassName, Entry, Label)
#define RGPOT_FORTRAN_SPECIES_POT_IMPL(ClassName, Entry, Label)
#define RGPOT_MOPACC_API
#define RGPOT_MOPACC_C_ABI_VERSION
#define RGPOT_MPI_ABI_VERSION
#define RGPOT_MPI_API_SYMBOL
#define RGPOT_MPI_EXPORT
#define RGPOT_MPI_LIBRARY_NAME
#define RGPOT_MTA_ABI_VERSION
#define RGPOT_MTA_API
#define RGPOT_MTA_ENGINE_BUILD
#define RGPOT_NWCHEMC_API
#define RGPOT_PLUGIN_API_VERSION
#define RGPOT_PLUGIN_EXPORT
#define RGPOT_ROCKSDB_UNIQUE_PTR_OPEN
#define RGPOT_XTB_ABI_VERSION
#define RGPOT_XTB_API
#define VERB(x)
#define VERB(x)
#define XCK_HD

Detailed Documentation

Typedefs

typedef struct rgpot_cxx_layout_stamp_t rgpot_cxx_layout_stamp_t

Plain-C view of the stamp, returned by the exported function.

typedef struct CPMDCResult CPMDCResult

Result returned by energy / gradient / forces entry points.

typedef struct CPMDCSession CPMDCSession

Opaque handle for repeated evaluations with one Cap’n Proto parameter set.

typedef int (*rgpot_engine_coord_transform)(
    void *user,
    long nAtoms,
    double *positions,
    double *box
    )

Optional host-side transform applied by the engine to its scratch copy of (positions, box) before evaluation. positions holds 3*nAtoms doubles, box 9 doubles (row-major). Return 0 on success; nonzero aborts the force call with that code.

typedef struct RgpotMtaConfig RgpotMtaConfig

Flat config (subset of MetatomicConfig). NULL strings => empty/default.

typedef struct NWChemCResult NWChemCResult

Result of energy+gradient (atomic units).

typedef struct PotClient PotClient

Opaque handle to the client context.

Global Functions

rgpot_cxx_layout_stamp_t rgpot_cxx_layout_stamp(void)

Stamp of the loaded library, computed from the headers it was built with.

int32_t rgpot_cxx_layout_compatible(const rgpot_cxx_layout_stamp_t* caller)

Nonzero when caller equals the stamp of the loaded library.

rgpot_cxx_layout_stamp_t rgpot_cxx_layout_stamp(void)

Stamp of the loaded library, computed from the headers it was built with.

int32_t rgpot_cxx_layout_compatible(const rgpot_cxx_layout_stamp_t* caller)

Nonzero when caller equals the stamp of the loaded library.

__attribute__((visibility(“default”))) const

Create a potential from a Cap’n Proto flat-array message whose root struct is the engine’s params arm in Potentials.capnp (UmaParams for the UMA engine). config points at config_len bytes (word-aligned capnp framing as produced by capnp::messageToFlatArray). Returns NULL on failure with a message in errbuf.

Energy + forces. transform (with transform_user) may be NULL; variance may be NULL. Returns 0 on success.

Strided-uniform batched evaluation: nSystems systems sharing one composition (atomicNrs, nAtoms). positions and forces hold 3*nAtoms*nSystems doubles with system stride 3*nAtoms, energies nSystems doubles, variances likewise (may be NULL), boxes 9*nSystems doubles with system stride 9. The transform is applied per system to the engine’s scratch copy. For learning engines this call is also an incorporation boundary. A grouped variant (batches of uniform groups) is a separate symbol, never a flag here.

Monotone model-state counter for engines with internal mutable state. Increments on every refit / hyperparameter change / observation incorporation; host caches keyed on model output are valid only while the value is unchanged. Static engines omit the symbol (equivalent to a counter frozen at 0).

Register host callbacks. The struct is copied; ctx must outlive the potential or a subsequent call replacing it. Learning engines require an oracle before the first evaluation and fail create-time validation without one.

Runtime hint/tunable message: a Cap’n Proto flat-array whose root is the engine’s hint arm on the shared Potentials.capnp wire (never a string-keyed channel). Also the host-initiated incorporation boundary for learning engines. The engine validates the resulting configuration as a whole before it takes effect; on failure the previous configuration stays active and errbuf holds the reason.

The loaded engine’s identity.

Nonzero when the loaded engine serves a host built against stamp : equal major, equal layout revision, engine minor at least the host’s. NULL returns 0.

Message of the last failed call on this instance (create errors go to its errbuf). Copies at most len - 1 bytes and NUL-terminates; returns the full message length, 0 when there is none. Reading does not clear it; the next successful call does.

Short name of the backend the library serves, for example “uma”.

Version of the engine build: “<name>/<rgpot version>”. The pointer refers to static storage.

SHA-256 of the model file or archive the instance loaded, as 64 lowercase hexadecimal digits. Copies at most len - 1 bytes and NUL-terminates; returns the digest length (64), or 0 when the backend has no model file or the file cannot be read. The digest is computed on first request and kept.

Backend thread settings: intra-op and inter-op worker threads of the engine’s tensor runtime. A value below 1 leaves that setting alone. Process wide in effect, and the inter-op count can be set once before the first evaluation; a refused setting returns a positive code with the reason in last_error. Returns 0 on success and 3 for a backend without a tensor runtime. UmaParams and MetatomicParams carry the same two counts and apply them at create.

Change the total charge and spin multiplicity the next evaluations assume. The package was exported for one charge and spin; a mismatch is reported by the next force call. Returns 0 on success and 3 for a backend without a charge or spin.

Writes up to capacity declarations into opts and returns the total count (call with capacity 0 to size). Declarations may change after on_model_update; hosts re-query on that boundary.

Energy + forces. Returns 0 on success. variance may be NULL.

int cpmdc_set_params(const void* params_capnp, size_t params_capnp_size_bytes)

Apply CPMD method parameters from a Cap’n Proto message.

Parameters:

params_capnp

Pointer to an unpacked flat CPMDParams message.

params_capnp_size_bytes

Size of params_capnp in bytes.

Returns:

0 on success, -1 on parse or configuration failure.

CPMDCResult cpmdc_energy_gradient(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params_capnp, size_t params_capnp_size_bytes, double* grad_h_bohr)

Compute energy and nuclear gradient for an atomic configuration.

Positions are Angstrom; gradient is Hartree/Bohr (CPMD ionic forces are negated into a nuclear gradient for API symmetry with nwchemc).

CPMDCResult cpmdc_energy(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params_capnp, size_t params_capnp_size_bytes)

Compute total energy only (no gradient allocation).

CPMDCResult cpmdc_energy_forces(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params_capnp, size_t params_capnp_size_bytes, double* forces_h_bohr)

Compute energy and nuclear forces (negative gradient, Hartree/Bohr).

CPMDCSession* cpmdc_session_create(const void* params_capnp, size_t params_capnp_size_bytes)

Create a persistent evaluation session from a Cap’n Proto message.

The session owns a copy of the serialized message so callers may release the input buffer after this call returns.

int cpmdc_session_set_params(CPMDCSession* session, const void* params_capnp, size_t params_capnp_size_bytes)

Replace Cap’n Proto parameters before the session accepts topology.

void cpmdc_session_destroy(CPMDCSession* session)

Release a persistent evaluation session.

int cpmdc_session_select_orbitals(CPMDCSession* session, long long key)

Name the calculation the next evaluations of this session belong to.

The engine keeps the converged orbitals per key, so a calculator that evaluates several images or beads in turn starts each SCF from that image’s or bead’s own previous orbitals. Optional: an engine without the symbol keeps one stored copy.

CPMDCResult cpmdc_session_calculate_forces(CPMDCSession* session, const void* force_input_capnp, size_t force_input_capnp_size_bytes, double* forces_h_bohr, size_t forces_len)

Compute energy and forces for one Cap’n Proto ForceInput step.

Session keeps persistent CPMDParams; each call supplies geometry. Returned energy/forces use CPMD native units: Hartree and Hartree/Bohr.

CPMDCResult cpmdc_session_calculate_result(CPMDCSession* session, const void* force_input_capnp, size_t force_input_capnp_size_bytes, void* potential_result_capnp, size_t potential_result_capnp_capacity_bytes, size_t* potential_result_capnp_size_bytes)

Compute forces for one ForceInput step and write PotentialResult.

Direct-call socket entry point: method state in the session, geometry in ForceInput, output energy/forces converted to ForceInput.energyUnit and energyUnit / lengthUnit.

When potential_result_capnp_capacity_bytes is too small, returns ok == 0, writes the required byte count to potential_result_capnp_size_bytes, and does not evaluate CPMD.

CPMDCResult cpmdc_calculate_result(const void* params_capnp, size_t params_capnp_size_bytes, const void* force_input_capnp, size_t force_input_capnp_size_bytes, void* potential_result_capnp, size_t potential_result_capnp_capacity_bytes, size_t* potential_result_capnp_size_bytes)

One-shot Cap’n Proto entry point (params + ForceInput -> PotentialResult).

Multi-step callers should create one session and call cpmdc_session_calculate_result() per step.

size_t cpmdc_potential_result_size_for_force_input(const void* force_input_capnp, size_t force_input_capnp_size_bytes)

Byte count needed for a PotentialResult for the given ForceInput.

Parses geometry only; does not initialize or evaluate CPMD. Returns 0 when the message is invalid or too large for the C ABI.

const char* cpmdc_version(void)

Compiled library version string.

int cpmdc_available(void)

1 when the embedded OpenCPMD runtime is available.

void cpmdc_finalize(void)

Finalize an owned embedded CPMD runtime.

int cpmdc_set_params(const void* params_capnp, size_t params_capnp_size_bytes)

Apply CPMD method parameters from a Cap’n Proto message.

Parameters:

params_capnp

Pointer to an unpacked flat CPMDParams message.

params_capnp_size_bytes

Size of params_capnp in bytes.

Returns:

0 on success, -1 on parse or configuration failure.

CPMDCResult cpmdc_energy_gradient(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params_capnp, size_t params_capnp_size_bytes, double* grad_h_bohr)

Compute energy and nuclear gradient for an atomic configuration.

Positions are Angstrom; gradient is Hartree/Bohr (CPMD ionic forces are negated into a nuclear gradient for API symmetry with nwchemc).

CPMDCResult cpmdc_energy(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params_capnp, size_t params_capnp_size_bytes)

Compute total energy only (no gradient allocation).

CPMDCResult cpmdc_energy_forces(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params_capnp, size_t params_capnp_size_bytes, double* forces_h_bohr)

Compute energy and nuclear forces (negative gradient, Hartree/Bohr).

const char* cpmdc_version(void)

Compiled library version string.

int cpmdc_available(void)

1 when the embedded OpenCPMD runtime is available.

void cpmdc_finalize(void)

Finalize an owned embedded CPMD runtime.

CPMDCSession* cpmdc_session_create(const void* params_capnp, size_t params_capnp_size_bytes)

Create a persistent evaluation session from a Cap’n Proto message.

The session owns a copy of the serialized message so callers may release the input buffer after this call returns.

int cpmdc_session_set_params(CPMDCSession* session, const void* params_capnp, size_t params_capnp_size_bytes)

Replace Cap’n Proto parameters before the session accepts topology.

void cpmdc_session_destroy(CPMDCSession* session)

Release a persistent evaluation session.

int cpmdc_session_select_orbitals(CPMDCSession* session, long long key)

Name the calculation the next evaluations of this session belong to.

The engine keeps the converged orbitals per key, so a calculator that evaluates several images or beads in turn starts each SCF from that image’s or bead’s own previous orbitals. Optional: an engine without the symbol keeps one stored copy.

CPMDCResult cpmdc_session_calculate_forces(CPMDCSession* session, const void* force_input_capnp, size_t force_input_capnp_size_bytes, double* forces_h_bohr, size_t forces_len)

Compute energy and forces for one Cap’n Proto ForceInput step.

Session keeps persistent CPMDParams; each call supplies geometry. Returned energy/forces use CPMD native units: Hartree and Hartree/Bohr.

CPMDCResult cpmdc_session_calculate_result(CPMDCSession* session, const void* force_input_capnp, size_t force_input_capnp_size_bytes, void* potential_result_capnp, size_t potential_result_capnp_capacity_bytes, size_t* potential_result_capnp_size_bytes)

Compute forces for one ForceInput step and write PotentialResult.

Direct-call socket entry point: method state in the session, geometry in ForceInput, output energy/forces converted to ForceInput.energyUnit and energyUnit / lengthUnit.

When potential_result_capnp_capacity_bytes is too small, returns ok == 0, writes the required byte count to potential_result_capnp_size_bytes, and does not evaluate CPMD.

CPMDCResult cpmdc_calculate_result(const void* params_capnp, size_t params_capnp_size_bytes, const void* force_input_capnp, size_t force_input_capnp_size_bytes, void* potential_result_capnp, size_t potential_result_capnp_capacity_bytes, size_t* potential_result_capnp_size_bytes)

One-shot Cap’n Proto entry point (params + ForceInput -> PotentialResult).

Multi-step callers should create one session and call cpmdc_session_calculate_result() per step.

size_t cpmdc_potential_result_size_for_force_input(const void* force_input_capnp, size_t force_input_capnp_size_bytes)

Byte count needed for a PotentialResult for the given ForceInput.

Parses geometry only; does not initialize or evaluate CPMD. Returns 0 when the message is invalid or too large for the C ABI.

__attribute__((visibility(“default”))) const

Create a potential from a Cap’n Proto flat-array message whose root struct is the engine’s params arm in Potentials.capnp (UmaParams for the UMA engine). config points at config_len bytes (word-aligned capnp framing as produced by capnp::messageToFlatArray). Returns NULL on failure with a message in errbuf.

Energy + forces. transform (with transform_user) may be NULL; variance may be NULL. Returns 0 on success.

Strided-uniform batched evaluation: nSystems systems sharing one composition (atomicNrs, nAtoms). positions and forces hold 3*nAtoms*nSystems doubles with system stride 3*nAtoms, energies nSystems doubles, variances likewise (may be NULL), boxes 9*nSystems doubles with system stride 9. The transform is applied per system to the engine’s scratch copy. For learning engines this call is also an incorporation boundary. A grouped variant (batches of uniform groups) is a separate symbol, never a flag here.

Monotone model-state counter for engines with internal mutable state. Increments on every refit / hyperparameter change / observation incorporation; host caches keyed on model output are valid only while the value is unchanged. Static engines omit the symbol (equivalent to a counter frozen at 0).

Register host callbacks. The struct is copied; ctx must outlive the potential or a subsequent call replacing it. Learning engines require an oracle before the first evaluation and fail create-time validation without one.

Runtime hint/tunable message: a Cap’n Proto flat-array whose root is the engine’s hint arm on the shared Potentials.capnp wire (never a string-keyed channel). Also the host-initiated incorporation boundary for learning engines. The engine validates the resulting configuration as a whole before it takes effect; on failure the previous configuration stays active and errbuf holds the reason.

The loaded engine’s identity.

Nonzero when the loaded engine serves a host built against stamp : equal major, equal layout revision, engine minor at least the host’s. NULL returns 0.

Message of the last failed call on this instance (create errors go to its errbuf). Copies at most len - 1 bytes and NUL-terminates; returns the full message length, 0 when there is none. Reading does not clear it; the next successful call does.

Short name of the backend the library serves, for example “uma”.

Version of the engine build: “<name>/<rgpot version>”. The pointer refers to static storage.

SHA-256 of the model file or archive the instance loaded, as 64 lowercase hexadecimal digits. Copies at most len - 1 bytes and NUL-terminates; returns the digest length (64), or 0 when the backend has no model file or the file cannot be read. The digest is computed on first request and kept.

Backend thread settings: intra-op and inter-op worker threads of the engine’s tensor runtime. A value below 1 leaves that setting alone. Process wide in effect, and the inter-op count can be set once before the first evaluation; a refused setting returns a positive code with the reason in last_error. Returns 0 on success and 3 for a backend without a tensor runtime. UmaParams and MetatomicParams carry the same two counts and apply them at create.

Change the total charge and spin multiplicity the next evaluations assume. The package was exported for one charge and spin; a mismatch is reported by the next force call. Returns 0 on success and 3 for a backend without a charge or spin.

Writes up to capacity declarations into opts and returns the total count (call with capacity 0 to size). Declarations may change after on_model_update; hosts re-query on that boundary.

program test_cuh2()

Physics checks for the CuH2 embedded-atom gather kernel, run from pure Fortran so a failure points at the kernel rather than the bindings.

Checked: translational invariance of the energy, vanishing net force, invariance under a relabelling of the atoms, and agreement between the analytic forces and a central difference of the energy.

The finite-difference check is the acceptance gate for the gather rearrangement. An embedding force attributed to the wrong end of a pair leaves the energy exactly right, keeps the net force at zero, and shows up only here.

The reordering check is the gate for the species dispatch: energies and forces are compared against a run with the atom list reversed, so H no longer occupies the trailing indices.

subroutine cu_slab_with_h2(integer, intent(in) cells, real(wp), intent(in) a, real(wp), intent(in) gap, real(wp), intent(in) height, real(wp), intent(in) bond, real(wp), dimension(:, :), intent(out), allocatable pos, integer(ip), dimension(:), intent(out), allocatable z, real(wp), dimension(3, 3), intent(out) box)

FCC Cu slab of cells conventional cells per direction, with a vacuum gap stacked on top and an H2 molecule inside it.

The gap exceeds the 6.1 Angstrom cutoff, so the slab does not see its own periodic image through the vacuum.

program test_eam_al()

Physics checks for the embedded-atom aluminium gather kernel, run from pure Fortran so a failure points at the kernel rather than the bindings.

Checked: the force vanishes on the ideal FCC lattice, the net force vanishes on a rattled periodic cell, the energy is translation invariant, and the analytic forces agree with a central difference of the energy. The finite-difference check is the gate on the gather rearrangement: dropping a neighbour’s embedding derivative from f_i leaves the energy exactly right and the force wrong by order one.

subroutine fcc_lattice(integer, intent(in) cells, real(wp), intent(in) a, real(wp), dimension(:, :), intent(out), allocatable pos, real(wp), dimension(3, 3), intent(out) box)

Face-centred cubic lattice, cells conventional cells per direction.

program test_edip()

Physics checks for the EDIP gather kernel, run from pure Fortran so a failure points at the kernel rather than the bindings.

Checked: translational invariance of the energy, vanishing net force, and agreement between the analytic forces and a central difference of the energy. The checks run on a rattled diamond lattice, not the perfect one: at equilibrium every force vanishes by symmetry and the difference check compares zero against zero, which passes whatever the force expression says. Off equilibrium it pins the gather rearrangement, since a mis-attributed coordination or end-atom term breaks the difference check even where the energy stays right.

subroutine diamond_lattice(integer, intent(in) cells, real(wp), intent(in) a, real(wp), dimension(:, :), intent(out), allocatable pos, real(wp), dimension(3, 3), intent(out) box)

Diamond-cubic lattice, n_side conventional cells per direction.

program test_fehe()

Physics checks for the Fe-He gather kernel, run from pure Fortran so a failure points at the kernel rather than the bindings.

Checked: translational invariance of the energy, vanishing net force, agreement between the analytic forces and a central difference of the energy, and rejection of an atomic number the potential does not cover. The finite-difference check is the gate: an embedded-atom force splits into a pair part and two embedding parts weighted by dF/drho at both ends of the pair, and dropping either end leaves the energy correct.

The cell is body-centred iron with two substitutional helium atoms on a nearest-neighbour <111>/2 bond, which puts force into all three pair channels and both density channels at once. Four cells a side keeps the largest cutoff (5.4 A, He-He) below half the box edge (5.71 A), so each pair enters the neighbour table exactly once per direction and the check measures the potential rather than vesin’s multiple-image path.

subroutine bcc_lattice(integer, intent(in) cells, real(wp), intent(in) a, real(wp), dimension(:, :), intent(out), allocatable pos, real(wp), dimension(3, 3), intent(out) box)

Body-centred cubic lattice, cells conventional cells per direction. Site 1 is the corner of the first cell and site 2 its body centre, so substituting the first two atoms puts helium on a nearest-neighbour bond.

program test_lenosky()

Physics checks for the Lenosky gather kernel, run from pure Fortran so a failure points at the kernel rather than the bindings.

Checked: translational invariance of the energy, vanishing net force, and agreement between the analytic forces and a central difference of the energy. The checks run on a rattled diamond lattice, not the perfect one: at equilibrium every force vanishes by symmetry and the difference check compares zero against zero, which passes whatever the force expression says. Off equilibrium it pins the gather rearrangement, since a mis-attributed embedding or end-atom term breaks the difference check even where the energy stays right.

subroutine diamond_lattice(integer, intent(in) cells, real(wp), intent(in) a, real(wp), dimension(:, :), intent(out), allocatable pos, real(wp), dimension(3, 3), intent(out) box)

Diamond-cubic lattice, n_side conventional cells per direction.

program test_sw_gather()

Physics checks for the Stillinger-Weber gather kernel, run from pure Fortran so a failure points at the kernel rather than the bindings.

Checked: translational invariance of the energy, vanishing net force, and agreement between the analytic forces and a central difference of the energy. Together these pin the gather rearrangement: a mismatched end-atom term would break the finite-difference check even where the energy stayed right.

subroutine diamond_lattice(integer, intent(in) cells, real(wp), intent(in) a, real(wp), dimension(:, :), intent(out), allocatable pos, real(wp), dimension(3, 3), intent(out) box)

Diamond-cubic lattice, n_side conventional cells per direction.

program test_tersoff()

Physics checks for the Tersoff gather kernel, run from pure Fortran so a failure points at the kernel rather than the bindings.

Checked: translational invariance of the energy, vanishing net force, and agreement between the analytic forces and a central difference of the energy. The finite-difference check is the acceptance gate. A bond-order term attributed to the wrong atom leaves the energy exactly right, keeps the net force zero whenever the misattribution is antisymmetric, and shows up only here.

Two configurations carry the checks. The diamond lattice at its experimental constant places every bond inside the inner taper radius, where the cutoff function is flat and its derivative drops out; the expanded lattice places bonds in the taper window so the cutoff derivative enters both the pair term and the coordination sum. Both carry a fixed jitter, because a force that vanishes by symmetry tests nothing.

subroutine diamond_lattice(integer, intent(in) cells, real(wp), intent(in) a, real(wp), dimension(:, :), intent(out), allocatable pos, real(wp), dimension(3, 3), intent(out) box)

Diamond-cubic lattice, n_side conventional cells per direction.

program test_water_h()

Physics checks for the H-in-water star gather, run from pure Fortran so a failure points at the kernel rather than the bindings.

Checked: translational invariance of the energy, vanishing net force, agreement between the analytic forces and a central difference of the energy, independence of the energy from the order the water sites arrive in, and rejection of atom lists that are not a water plus H system.

The finite-difference check is the one that can fail. Newton’s third law holds by construction here (the lone H is handed the negated sum of the legs), so a vanishing net force says nothing about whether the radial derivatives are right; the central difference does.

subroutine water_plus_h(real(wp), dimension(3, natoms), intent(out) pos, integer(ip), dimension(natoms), intent(out) atomic_numbers, real(wp), dimension(3, 3), intent(out) cellv)

Two water molecules and one extra H in a cubic cell, laid out in the order the entry point expects: the hydrogens of every molecule, then the oxygens, then the lone H.

__attribute__((visibility(“default”)))

Energy + forces. Returns 0 on success. variance may be NULL.

int nwchemc_set_params(const void* params_capnp, size_t params_capnp_size_bytes)

Apply sticky method options from an unpacked flat NWChemParams message.

Returns:

0 on success, non-zero if embed unavailable or params are invalid

NWChemCResult nwchemc_energy_gradient(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params_capnp, size_t params_capnp_size_bytes, double* grad_h_bohr)

Energy + nuclear gradient.

Parameters:

n_atoms

atom count

positions_ang

n_atoms*3 Angstrom, row-major xyz

atomic_numbers

n_atoms Z values

params_capnp

unpacked flat NWChemParams message

params_capnp_size_bytes

size of params_capnp in bytes

grad_h_bohr

out n_atoms*3 Hartree/Bohr, row-major

const char* nwchemc_version(void)

Engine version string (static buffer).

int nwchemc_available(void)

1 if real embed (RGPOT_HAS_NWCHEM), 0 if stub.

int nwchemc_set_params(const void* params_capnp, size_t params_capnp_size_bytes)

Apply sticky method options from an unpacked flat NWChemParams message.

Returns:

0 on success, non-zero if embed unavailable or params are invalid

NWChemCResult nwchemc_energy_gradient(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params_capnp, size_t params_capnp_size_bytes, double* grad_h_bohr)

Energy + nuclear gradient.

Parameters:

n_atoms

atom count

positions_ang

n_atoms*3 Angstrom, row-major xyz

atomic_numbers

n_atoms Z values

params_capnp

unpacked flat NWChemParams message

params_capnp_size_bytes

size of params_capnp in bytes

grad_h_bohr

out n_atoms*3 Hartree/Bohr, row-major

const char* nwchemc_version(void)

Engine version string (static buffer).

int nwchemc_available(void)

1 if real embed (RGPOT_HAS_NWCHEM), 0 if stub.

PotClient* pot_client_init(const char* host, int32_t port)

Initializes the RPC client connection.

Constructs a string-based address from the host and port, then initializes a new capnp::EzRpcClient. The main capability is cast to the Potential interface defined in the schema.

Note

Returns nullptr if the connection cannot be established or if the address is malformed.

void pot_client_free(PotClient* client)

Frees all resources associated with the client.

Performs a standard delete on the client pointer. This triggers the PotClient destructor, which cleans up the unique_ptr and associated RPC state.

int32_t pot_calculate(PotClient* client, int32_t natoms, const double* pos, const int32_t* atmnrs, const double* box, double* out_energy, double* out_forces)

Executes a remote potential calculation.

This function performs the following steps:

  1. Resets the last_error buffer.

  2. Initializes a calculation request.

  3. Maps the input pointers to kj::arrayPtr views to avoid unnecessary copying before serialization.

  4. Waits for the RPC promise to resolve.

  5. Validates the size of the returned force array.

  6. Copies the results into the provided output buffers.

Warning

The server must return a force array matching natoms * 3. If the sizes do not match, a non-zero error code is returned.

const char* pot_get_last_error(PotClient* client)

Retrieves the most recent error message.

Checks if a valid client handle is provided and if the last_error buffer contains data. If no error is recorded, an empty string is returned.

PotClient* pot_client_init(const char* host, int32_t port)

Initializes the RPC client connection.

Constructs a string-based address from the host and port, then initializes a new capnp::EzRpcClient. The main capability is cast to the Potential interface defined in the schema.

Note

Returns nullptr if the connection cannot be established or if the address is malformed.

Parameters:

host

Target server hostname or IP address.

port

Network port of the potential server.

Returns:

Pointer to the client context or NULL on failure.

See also:

pot_get_last_error

void pot_client_free(PotClient* client)

Frees all resources associated with the client.

Performs a standard delete on the client pointer. This triggers the PotClient destructor, which cleans up the unique_ptr and associated RPC state.

Parameters:

client

The opaque client handle to release.

Returns:

Void.

int32_t pot_calculate(PotClient* client, int32_t natoms, const double* pos, const int32_t* atmnrs, const double* box, double* out_energy, double* out_forces)

Executes a remote potential calculation.

The client must be successfully initialized.

This function performs the following steps:

  1. Resets the last_error buffer.

  2. Initializes a calculation request.

  3. Maps the input pointers to kj::arrayPtr views to avoid unnecessary copying before serialization.

  4. Waits for the RPC promise to resolve.

  5. Validates the size of the returned force array.

  6. Copies the results into the provided output buffers.

Warning

The server must return a force array matching natoms * 3. If the sizes do not match, a non-zero error code is returned.

Parameters:

client

The opaque client handle.

natoms

Total number of atoms in the system.

pos

Array of flattened atomic coordinates.

atmnrs

Array of atomic numbers.

box

Simulation cell vectors in row-major order.

out_energy

Pointer to store the calculated energy.

out_forces

Buffer to store the calculated forces.

Returns:

0 on success, non-zero on failure.

const char* pot_get_last_error(PotClient* client)

Retrieves the most recent error message.

Checks if a valid client handle is provided and if the last_error buffer contains data. If no error is recorded, an empty string is returned.

Parameters:

client

The opaque client handle.

Returns:

String containing the error description.

int runServer(int argc, char* argv[])

The main entry point handles command-line arguments to specify the network port and the potential type. It instantiates the requested physics engine and blocks until the server is terminated.

Usage

````./potserv <port> <PotentialType>

Parameters:

argc

Argument count.

argv

Argument vector.

Returns:

0 on success, 1 on initialization failure.

__attribute__((visibility(“default”)))

Energy + forces. Returns 0 on success. variance may be NULL.

Macros

#define FORCEFIELDS_UNIT_SYSTEM_ANGSTROM_GRAMME_PER_MOL_FEMTOSECOND_ECHARGE

Angstrom, gramme/mol, femtosecond, e (proton charge)

#define FORCEFIELDS_UNIT_SYSTEM_ANGSTROM_KILOGRAMME_PER_MOL_FEMTOSECOND_AMPERE_PER_MOL

System based on angstrom, kg/mol, femtosecond, Ampere/mol.

#define FORCEFIELDS_UNIT_SYSTEM_ELECTRONVOLT_ANGSTROM_FEMTOSECOND_ECHARGE

Electron volt, angstrom, femtosecond, e (proton charge)

#define FORCEFIELDS_UNIT_SYSTEM_HPP

Default system of units.

#define FORCEFIELDS_UNIT_SYSTEM_KILOCALORY_PER_MOL_ANGSTROM_FEMTOSECOND_ECHARGE

Kilo calory per mole, angstrom, femtosecond, e (proton charge)

#define FORCEFIELDS_UNIT_SYSTEM_METRE_KILOGRAMME_PER_MOL_SECOND_AMPERE_PER_MOL

System based on Metre, kg/mol, second, Ampere/mol.

#define FORCEFIELDS_UNIT_SYSTEM_SI_MKSA

Systeme international.

#define POT_BRIDGE_API

C API for the RPC potential client bridge.

This header provides a C-compatible interface to the distributed potential calculation client, allowing integration with Fortran or other languages with a C interface, e.g. Julia.

#define RGPOT_ENGINE_ABI_VERSION

ABI identity. RGPOT_ENGINE_ABI_VERSION is the major: an incompatible change increments it, and a host compares it for equality. Additions that leave every existing call valid (a new optional symbol, a new field at the end of a size-prefixed struct) increment RGPOT_ENGINE_ABI_MINOR. The layout revision increments when an existing struct changes size or field order. Hosts that read only rgpot_engine_abi_version() keep working across minor bumps; rgpot_engine_abi_stamp() is optional and an engine without it is minor 0, layout 1.

#define RGPOT_ENGINE_GPR_GATE_MAGIC

Gate settings for a learning engine, passed as the config blob.

INTERIM. The config arm is specified as a Cap’n Proto message and becomes GprParams once Potentials.capnp carries a nested PotentialSpec (rgpot-b7zw). Until then a learning engine has no way to be configured at all, which leaves certifyBelowForce at zero and so leaves a driver’s convergence claim unbacked by ground truth the one guarantee such an engine exists to provide. A fixed-layout struct with a magic word closes that hole without pretending to be capnp: an engine dispatches on the magic, so the capnp message can replace it later without either side guessing which it received.

#define RGPOT_ROCKSDB_UNIQUE_PTR_OPEN

Header file for the PotentialCache class.

This file defines the caching mechanism for the rgpot library, utilizing RocksDB to store and retrieve potential energy and force calculations.