mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-12-23 04:44:03 +01:00
Working on context.
This commit is contained in:
parent
fe0d51b968
commit
b63f28ee72
@ -3,7 +3,152 @@
|
||||
#+INCLUDE: ../tools/lib.org
|
||||
|
||||
Functions for the calculation of the Jastrow factor \(f_{ee}, f_{en}, f_{een}\).
|
||||
|
||||
These are stored in the ~factor_ee~, ~factor_en~, and ~factor_een~ variables.
|
||||
The ~jastrow~ structure contains all the information required to build
|
||||
these factors along with their derivatives.
|
||||
|
||||
* Headers :noexport:
|
||||
#+begin_src elisp :noexport :results none
|
||||
(org-babel-lob-ingest "../tools/lib.org")
|
||||
#+end_src
|
||||
|
||||
|
||||
#+begin_src c :tangle (eval h_private_type)
|
||||
#ifndef QMCKL_JASTROW_HPT
|
||||
#define QMCKL_JASTROW_HPT
|
||||
#include <stdbool.h>
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval c_test) :noweb yes
|
||||
#include "qmckl.h"
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "chbrclf.h"
|
||||
|
||||
int main() {
|
||||
qmckl_context context;
|
||||
context = qmckl_context_create();
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval c)
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#elif HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "qmckl.h"
|
||||
#include "qmckl_context_private_type.h"
|
||||
#include "qmckl_memory_private_type.h"
|
||||
#include "qmckl_memory_private_func.h"
|
||||
#include "qmckl_jastrow_private_func.h"
|
||||
#+end_src
|
||||
|
||||
|
||||
* Context
|
||||
:PROPERTIES:
|
||||
:Name: qmckl_jastrow
|
||||
:CRetType: qmckl_exit_code
|
||||
:FRetType: qmckl_exit_code
|
||||
:END:
|
||||
|
||||
The following data stored in the context:
|
||||
|
||||
#+NAME: qmckl_jastrow_args
|
||||
| ~uninitialized~ | ~int32_t~ | in | Keeps bit set for uninitialized data |
|
||||
| ~aord_num~ | ~int64_t~ | in | The number of a coeffecients |
|
||||
| ~bord_num~ | ~int64_t~ | in | The number of b coeffecients |
|
||||
| ~cord_num~ | ~int64_t~ | in | The number of c coeffecients |
|
||||
| ~type_nuc_num~ | ~uint64_t~ | in | Number of Nucleii types |
|
||||
| ~dim_cord_vec~ | ~uint64_t~ | in | Number of unique C coefficients |
|
||||
| ~aord_vector~ | ~double[aord_num + 1][type_nuc_num]~ | in | Order of a polynomial coefficients |
|
||||
| ~bord_vector~ | ~double[bord_num + 1]~ | in | Order of b polynomial coefficients |
|
||||
| ~cord_vector~ | ~double[cord_num][type_nuc_num]~ | in | Order of c polynomial coefficients |
|
||||
|
||||
** Data structure
|
||||
|
||||
#+CALL: generate_c_header(table=qmckl_jastrow_args,rettyp=get_value("CRetType"),fname=get_value("Name"))
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src c :tangle (eval h_func) :comments org
|
||||
qmckl_exit_code qmckl_jastrow (
|
||||
const uninitialized int32_t,
|
||||
const aord_num int64_t,
|
||||
const bord_num int64_t,
|
||||
const cord_num int64_t,
|
||||
const type_nuc_num uint64_t,
|
||||
const dim_cord_vec uint64_t,
|
||||
const aord_vector* double,
|
||||
const bord_vector* double,
|
||||
const cord_vector* double );
|
||||
#+end_src
|
||||
|
||||
|
||||
The ~uninitialized~ integer contains one bit set to one for each
|
||||
initialization function which has not been called. It becomes equal
|
||||
to zero after all initialization functions have been called. The
|
||||
struct is then initialized and ~provided == true~.
|
||||
Some values are initialized by default, and are not concerned by
|
||||
this mechanism.
|
||||
|
||||
#+begin_src c :comments org :tangle (eval h_private_func)
|
||||
qmckl_exit_code qmckl_init_jastrow(qmckl_context context);
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :comments org :tangle (eval c)
|
||||
qmckl_exit_code qmckl_init_jastrow(qmckl_context context) {
|
||||
|
||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
|
||||
assert (ctx != NULL);
|
||||
|
||||
ctx->jastrow.uninitialized = (1 << 2) - 1;
|
||||
|
||||
/* Default values */
|
||||
ctx->jastrow.rescale_factor_kappa_ee = 1.0;
|
||||
ctx->jastrow.rescale_factor_kappa_en = 1.0;
|
||||
|
||||
return QMCKL_SUCCESS;
|
||||
}
|
||||
#+end_src
|
||||
|
||||
|
||||
#+begin_src c :comments org :tangle (eval h_func)
|
||||
bool qmckl_jastrow_provided (const qmckl_context context);
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :comments org :tangle (eval c) :noweb yes :exports none
|
||||
bool qmckl_jastrow_provided(const qmckl_context context) {
|
||||
|
||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
|
||||
assert (ctx != NULL);
|
||||
|
||||
return ctx->jastrow.provided;
|
||||
}
|
||||
#+end_src
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user