Loading...
Searching...
No Matches
eon_relax_engine.h
Go to the documentation of this file.
1/*
2** This file is part of eOn.
3**
4** SPDX-License-Identifier: BSD-3-Clause
5**
6** Copyright (c) 2010--present, eOn Development Team
7** All rights reserved.
8**
9** Repo:
10** https://github.com/TheochemUI/eOn
11*/
49#pragma once
50
51#include <stddef.h>
52#include <stdint.h>
53
54#ifdef __cplusplus
55extern "C" {
56#endif
57
58#ifdef _WIN32
59#ifdef EON_RELAX_ENGINE_BUILD
60#define EON_RELAX_API __declspec(dllexport)
61#else
62#define EON_RELAX_API __declspec(dllimport)
63#endif
64#else
65#define EON_RELAX_API __attribute__((visibility("default")))
66#endif
67
69
70#define EON_RELAX_ABI_MAJOR 2u
71#define EON_RELAX_ABI_MINOR 1u
72
74typedef struct {
75 uint32_t major;
76 uint32_t minor;
78
79#define EON_RELAX_VERSION_INIT \
80 { \
81 EON_RELAX_ABI_MAJOR, EON_RELAX_ABI_MINOR \
82 }
83
89
90#define EON_RELAX_KIND_IS_KNOWN(k) \
91 ((k) == EON_RELAX_KIND_NEB || (k) == EON_RELAX_KIND_SADDLE)
92
119
128
129#define EON_RELAX_IMAGE_NONE INT64_C(-1)
130
147typedef struct {
149 uint64_t flags;
150 int64_t n_images;
151 int64_t n_atoms;
152 double *positions;
153 const int32_t *atomic_nrs;
154 const double *boxes;
155 const int32_t *is_fixed;
156 const double *mode;
157 const int64_t *image_ids;
158 const double *masses;
160
162typedef struct {
164 uint64_t flags;
165 int32_t kind;
166 int32_t status;
167 int64_t iterations;
169 double max_force;
170 uint64_t version_hash;
173
183typedef struct {
185 uint64_t flags;
186 int64_t n_images;
187 int64_t n_atoms;
188 const double *positions;
189 const int32_t *atomic_nrs;
190 const double *boxes;
191 const int64_t *image_ids;
192 double *energies;
193 double *forces;
194 double *variances;
195 uint64_t *epoch_out;
197
199typedef int (*eon_relax_surface_fn)(void *user,
201
203EON_RELAX_API int eon_relax_abi_version(void);
204EON_RELAX_API int eon_relax_available(void);
205EON_RELAX_API int eon_relax_abi_stamp(eon_relax_version_t *out);
207EON_RELAX_API const char *eon_relax_version_hash_str(void);
210EON_RELAX_API uint64_t eon_relax_version_hash(void);
211
220EON_RELAX_API EonRelaxEngine *eon_relax_create(const void *config,
221 size_t config_len, char *errbuf,
222 size_t errlen);
223
224EON_RELAX_API int eon_relax_set_surface_epoch(EonRelaxEngine *eng,
225 uint64_t epoch);
227EON_RELAX_API int eon_relax_last_error(const EonRelaxEngine *eng);
228
241
259EON_RELAX_API int eon_relax_step(EonRelaxEngine *eng, eon_relax_band_t *band,
262
269EON_RELAX_API int eon_relax_reset(EonRelaxEngine *eng);
270
271EON_RELAX_API void eon_relax_destroy(EonRelaxEngine *eng);
272
274EON_RELAX_API const char *eon_relax_status_name(eon_relax_kind_t kind,
275 int status);
276
277#ifdef __cplusplus
278}
279#endif
#define EON_RELAX_API
struct EonRelaxEngine EonRelaxEngine
eon_relax_band_t eon_relax_surface_fn void eon_relax_outcome_t * out
eon_relax_neb_status_t
@ EON_RELAX_NEB_GOOD
@ EON_RELAX_NEB_MAX_UNCERTAINTY
@ EON_RELAX_NEB_BAD_MAX_ITERATIONS
@ EON_RELAX_NEB_RUNNING
@ EON_RELAX_NEB_INIT
eon_relax_band_t eon_relax_surface_fn surface
size_t char size_t errlen
int status
eon_relax_band_t * band
uint64_t epoch
size_t char * errbuf
size_t config_len
eon_relax_rc_t
@ EON_RELAX_NULL_BAND
@ EON_RELAX_ALLOC
@ EON_RELAX_OK
@ EON_RELAX_SURFACE_FATAL
@ EON_RELAX_NULL_ENGINE
@ EON_RELAX_BAND_SIZE
@ EON_RELAX_NULL_ATOMIC_NRS
@ EON_RELAX_NULL_POSITIONS
@ EON_RELAX_NULL_BOXES
@ EON_RELAX_NULL_SURFACE
@ EON_RELAX_UNKNOWN_STATUS
@ EON_RELAX_CAPNP_ROOT
@ EON_RELAX_ABI_MISMATCH
@ EON_RELAX_UNKNOWN_KIND
@ EON_RELAX_SADDLE_NIMAGES
@ EON_RELAX_BAND_TOO_SHORT
@ EON_RELAX_NULL_OUTCOME
@ EON_RELAX_INVALID_PARAMETER
@ EON_RELAX_NATOMS
@ EON_RELAX_UNAVAILABLE
@ EON_RELAX_NULL_MODE
int(* eon_relax_surface_fn)(void *user, eon_relax_surface_request_t *req)
eon_relax_kind_t
@ EON_RELAX_KIND_INVALID
@ EON_RELAX_KIND_SADDLE
@ EON_RELAX_KIND_NEB
eon_relax_band_t eon_relax_surface_fn void * user
eon_relax_version_t version
const int32_t * atomic_nrs
const double * boxes
const double * masses
const int32_t * is_fixed
const double * mode
const int64_t * image_ids
eon_relax_version_t version