From b925cac7e2d79c4144b4c1e980a99b44522906c1 Mon Sep 17 00:00:00 2001 From: v1j4y Date: Sun, 9 Oct 2022 00:04:15 +0200 Subject: [PATCH] Added provide local energy. --- org/qmckl_local_energy.org | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/org/qmckl_local_energy.org b/org/qmckl_local_energy.org index fbee7ae..a2314f1 100644 --- a/org/qmckl_local_energy.org +++ b/org/qmckl_local_energy.org @@ -177,6 +177,42 @@ typedef struct qmckl_local_energy_struct { Some values are initialized by default, and are not concerned by this mechanism. +** Access functions + + When all the data for the local energy have been provided, the following + function returns ~true~. + + #+begin_src c :comments org :tangle (eval h_func) +bool qmckl_local_energy_provided (const qmckl_context context); + #+end_src + + #+begin_src c :comments org :tangle (eval c) :noweb yes :exports none +bool qmckl_local_energy_provided(const qmckl_context context) { + + if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { + return false; + } + + qmckl_context_struct* const ctx = (qmckl_context_struct*) context; + assert (ctx != NULL); + + qmckl_exit_code rc; + + if(!qmckl_electron_provided(context)) return QMCKL_NOT_PROVIDED; + + if(!qmckl_nucleus_provided(context)) return QMCKL_NOT_PROVIDED; + + rc = qmckl_provide_ao_basis_ao_vgl(context); + if (rc != QMCKL_SUCCESS) return rc; + + rc = qmckl_provide_mo_basis_mo_vgl(context); + if (rc != QMCKL_SUCCESS) return rc; + + ctx->local_energy.provided = (ctx->local_energy.uninitialized == 0); + return ctx->local_energy.provided; +} + #+end_src + * Computation ** Kinetic energy :PROPERTIES: