Tier-2 C ABI: eOn as a dlopen relaxation engine. More...
#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Classes | |
| struct | eon_relax_version_t |
| Version head carried by every wire struct (dlpack DLPackVersion). More... | |
| struct | eon_relax_band_t |
| Caller-owned band. More... | |
| struct | eon_relax_outcome_t |
| Engine-written result. More... | |
| struct | eon_relax_surface_request_t |
| Host-surface request: one struct, engine-stamped version, so the callback contract grows behind the version head instead of by new symbols. More... | |
Macros | |
| #define | EON_RELAX_API __attribute__((visibility("default"))) |
| #define | EON_RELAX_ABI_MAJOR 2u |
| #define | EON_RELAX_ABI_MINOR 1u |
| #define | EON_RELAX_VERSION_INIT {EON_RELAX_ABI_MAJOR, EON_RELAX_ABI_MINOR} |
| #define | EON_RELAX_KIND_IS_KNOWN(k) |
| #define | EON_RELAX_IMAGE_NONE INT64_C(-1) |
Typedefs | |
| typedef struct EonRelaxEngine | EonRelaxEngine |
| typedef int(* | eon_relax_surface_fn) (void *user, eon_relax_surface_request_t *req) |
| Return 0 on success, positive recoverable, negative fatal. | |
Functions | |
| EON_RELAX_API int | eon_relax_abi_version (void) |
| (major << 16) | minor. | |
| EON_RELAX_API int | eon_relax_available (void) |
| EON_RELAX_API int | eon_relax_abi_stamp (eon_relax_version_t *out) |
| EON_RELAX_API const char * | eon_relax_version_hash_str (void) |
| Immortal dest identity string. | |
| EON_RELAX_API uint64_t | eon_relax_version_hash (void) |
| 64-bit FNV-1a hash of eon_relax_version_hash_str(). | |
| EON_RELAX_API EonRelaxEngine * | eon_relax_create (const void *config, size_t config_len, char *errbuf, size_t errlen) |
| Create. | |
| EON_RELAX_API int | eon_relax_set_surface_epoch (EonRelaxEngine *eng, uint64_t epoch) |
| EON_RELAX_API int | eon_relax_last_error (const EonRelaxEngine *eng) |
| Last named create/run/step/reset/set_epoch rc on this handle. | |
| EON_RELAX_API int | eon_relax_run (EonRelaxEngine *eng, eon_relax_band_t *band, eon_relax_surface_fn surface, void *user, eon_relax_outcome_t *out) |
| Run the bound engine to completion. | |
| EON_RELAX_API int | eon_relax_step (EonRelaxEngine *eng, eon_relax_band_t *band, eon_relax_surface_fn surface, void *user, eon_relax_outcome_t *out) |
| One band optimizer step (kind=NEB only). | |
| EON_RELAX_API int | eon_relax_reset (EonRelaxEngine *eng) |
| Drop the stepper's band state and optimizer history; the next eon_relax_step reinitializes from the caller's band. | |
| EON_RELAX_API void | eon_relax_destroy (EonRelaxEngine *eng) |
| EON_RELAX_API const char * | eon_relax_status_name (eon_relax_kind_t kind, int status) |
| NULL if kind or status is unknown. | |
Tier-2 C ABI: eOn as a dlopen relaxation engine.
Reverse of include/eon/potentials/Rgpot/engine_c_abi.h: the host supplies the surface (energy/forces/variance for a band), eOn owns NudgedElasticBand / MinModeSaddleSearch. Configuration is a Cap'n Proto flat-array whose root is RelaxEngineParams in schema/eon_relax_engine.capnp (NebParams / SaddleParams arms). NULL config selects Parameters NSDMI defaults and kind=NEB.
Units: positions Angstrom, energy eV, forces eV/Angstrom.
Plugin Matters use the Matter default (PBC on for a non-isolated pot). fill and endpoint dirty write positions with PBC off so the caller frame is kept (a 10 A box must not map x=-0.3 to 9.7).
Layout discipline (dlpack.h is the model):
Definition in file eon_relax_engine.h.
| #define EON_RELAX_ABI_MAJOR 2u |
Definition at line 72 of file eon_relax_engine.h.
| #define EON_RELAX_ABI_MINOR 1u |
Definition at line 73 of file eon_relax_engine.h.
| #define EON_RELAX_API __attribute__((visibility("default"))) |
Definition at line 67 of file eon_relax_engine.h.
| #define EON_RELAX_IMAGE_NONE INT64_C(-1) |
Definition at line 128 of file eon_relax_engine.h.
| #define EON_RELAX_KIND_IS_KNOWN | ( | k | ) |
Definition at line 89 of file eon_relax_engine.h.
| #define EON_RELAX_VERSION_INIT {EON_RELAX_ABI_MAJOR, EON_RELAX_ABI_MINOR} |
Definition at line 81 of file eon_relax_engine.h.
| typedef int(* eon_relax_surface_fn) (void *user, eon_relax_surface_request_t *req) |
Return 0 on success, positive recoverable, negative fatal.
Definition at line 198 of file eon_relax_engine.h.
| typedef struct EonRelaxEngine EonRelaxEngine |
Definition at line 70 of file eon_relax_engine.h.
| enum eon_relax_kind_t |
| Enumerator | |
|---|---|
| EON_RELAX_KIND_INVALID | |
| EON_RELAX_KIND_NEB | |
| EON_RELAX_KIND_SADDLE | |
Definition at line 83 of file eon_relax_engine.h.
NudgedElasticBand::NEBStatus integers.
Written to outcome.status for NEB.
| Enumerator | |
|---|---|
| EON_RELAX_NEB_GOOD | |
| EON_RELAX_NEB_INIT | |
| EON_RELAX_NEB_BAD_MAX_ITERATIONS | |
| EON_RELAX_NEB_RUNNING | |
| EON_RELAX_NEB_MAX_UNCERTAINTY | |
Definition at line 120 of file eon_relax_engine.h.
| enum eon_relax_rc_t |
Call rc: 0 success (read outcome), positive recoverable, negative a named fail.
SURFACE_FATAL makes the instance unusable. Every other named fail leaves the handle reusable.
Definition at line 95 of file eon_relax_engine.h.
| EON_RELAX_API int eon_relax_abi_stamp | ( | eon_relax_version_t * | out | ) |
Definition at line 262 of file RelaxEngineAbi.cpp.
| EON_RELAX_API int eon_relax_abi_version | ( | void | ) |
(major << 16) | minor.
Definition at line 256 of file RelaxEngineAbi.cpp.
| EON_RELAX_API int eon_relax_available | ( | void | ) |
Definition at line 260 of file RelaxEngineAbi.cpp.
| EON_RELAX_API EonRelaxEngine * eon_relax_create | ( | const void * | config, |
| size_t | config_len, | ||
| char * | errbuf, | ||
| size_t | errlen ) |
Create.
NULL config && config_len==0 selects Parameters NSDMI defaults and kind=NEB. A non-empty buffer is a Cap'n Proto flat-array whose root is RelaxEngineParams. kind tokens are "neb" and "saddle"; any other token fails closed (EON_RELAX_UNKNOWN_KIND). An unparseable buffer is EON_RELAX_CAPNP_ROOT. config!=NULL && config_len==0 is refused.
Definition at line 282 of file RelaxEngineAbi.cpp.
| EON_RELAX_API void eon_relax_destroy | ( | EonRelaxEngine * | eng | ) |
Definition at line 637 of file RelaxEngineAbi.cpp.
| EON_RELAX_API int eon_relax_last_error | ( | const EonRelaxEngine * | eng | ) |
Last named create/run/step/reset/set_epoch rc on this handle.
0 if none.
Definition at line 331 of file RelaxEngineAbi.cpp.
| EON_RELAX_API int eon_relax_reset | ( | EonRelaxEngine * | eng | ) |
Drop the stepper's band state and optimizer history; the next eon_relax_step reinitializes from the caller's band.
This is the host's model-update hook: quasi-Newton memory taken on one surface epoch must not survive onto the next.
Definition at line 625 of file RelaxEngineAbi.cpp.
| EON_RELAX_API int eon_relax_run | ( | EonRelaxEngine * | eng, |
| eon_relax_band_t * | band, | ||
| eon_relax_surface_fn | surface, | ||
| void * | user, | ||
| eon_relax_outcome_t * | out ) |
Run the bound engine to completion.
Writes updated interior coordinates into band->positions (caller-owned); endpoints stay in the caller frame. Endpoint minimization stays with the host (NudgedElasticBand::compute does not minimize endpoints). surface may not be NULL. Kind is bound at create (NULL config => NEB). Returns eon_relax_rc_t; on 0, out->status is the dest NEB or saddle table.
Definition at line 338 of file RelaxEngineAbi.cpp.
| EON_RELAX_API int eon_relax_set_surface_epoch | ( | EonRelaxEngine * | eng, |
| uint64_t | epoch ) |
Definition at line 316 of file RelaxEngineAbi.cpp.
| EON_RELAX_API const char * eon_relax_status_name | ( | eon_relax_kind_t | kind, |
| int | status ) |
NULL if kind or status is unknown.
Definition at line 641 of file RelaxEngineAbi.cpp.
| EON_RELAX_API int eon_relax_step | ( | EonRelaxEngine * | eng, |
| eon_relax_band_t * | band, | ||
| eon_relax_surface_fn | surface, | ||
| void * | user, | ||
| eon_relax_outcome_t * | out ) |
One band optimizer step (kind=NEB only).
The first call on a fresh or reset engine initializes the band state from the caller's positions and captures the baseline force; every call syncs band->positions in (the host may have moved images between steps), assembles NEB forces on the host surface, takes ONE optimizer step, and writes the stepped INTERIOR positions back (endpoints are the caller's and are never rewritten, so the caller's frame survives eOn's own cell wrapping). Climbing-image activation follows the engine's own trigger rule; saddle POLICY (MMF bursts, resampling, acquisition) stays with the host. outcome.status is RUNNING until convergenceForce() reaches the configured tolerance (GOOD), host variance exceeds the GP-surrogate threshold (MAX_UNCERTAINTY), or neb.max_iterations is hit (BAD_MAX_ITERATIONS). surface and user must not change across steps without an eon_relax_reset.
Definition at line 460 of file RelaxEngineAbi.cpp.
| EON_RELAX_API uint64_t eon_relax_version_hash | ( | void | ) |
64-bit FNV-1a hash of eon_relax_version_hash_str().
Copied to outcome.version_hash.
Definition at line 278 of file RelaxEngineAbi.cpp.
| EON_RELAX_API const char * eon_relax_version_hash_str | ( | void | ) |
Immortal dest identity string.
Never NULL.
Definition at line 271 of file RelaxEngineAbi.cpp.