Expand description
C API for the potential handle lifecycle: create, calculate, free.
These three functions form the core public interface for potential energy calculations. The typical usage pattern from C/C++ is:
// 1. Create a handle from a callback
rgpot_potential_t *pot = rgpot_potential_new(my_callback, my_data, NULL);
// 2. Prepare input/output
rgpot_force_input_t input = rgpot_force_input_create(n, pos, types, box);
rgpot_force_out_t output = rgpot_force_out_create();
// 3. Calculate
rgpot_status_t s = rgpot_potential_calculate(pot, &input, &output);
if (s != RGPOT_SUCCESS) { /* handle error */ }
// output.forces is now a DLPack tensor — use it, then free:
rgpot_tensor_free(output.forces);
// 4. Clean up
rgpot_force_input_free(&input);
rgpot_potential_free(pot);Functions§
- rgpot_
potential_ ⚠calculate - Perform a force/energy calculation using the potential handle.
- rgpot_
potential_ ⚠free - Free a potential handle previously obtained from
rgpot_potential_new. - rgpot_
potential_ ⚠new - Create a new potential handle from a callback function pointer.