1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-11-19 04:22:46 +01:00

Merge branch 'rescaled_deriv_vj' into chameleon_build_vj

This commit is contained in:
vijay gopal chilkuri 2021-06-23 11:31:07 +05:30
commit a0087ee4f2
18 changed files with 1988 additions and 577 deletions

40
.gitignore vendored
View File

@ -1,17 +1,10 @@
*.la
*.lo
.deps/
compile
depcomp
generated.mk
stamp-h1
libtool
ltmain.sh
missing
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
.dirstamp
.libs
Makefile
Makefile.in
aclocal.m4
autom4te.cache/
config.guess
@ -19,13 +12,20 @@ config.log
config.status
config.sub
configure
install-sh
qmckl.pc
Makefile.in
test-driver
.libs
.dirstamp
*.la
*.lo
generated.mk
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
qmckl-*.tar.gz
qmckl.mod
qmckl.pc
stamp-h1
tools/compile
tools/depcomp
tools/install-sh
tools/libtool
tools/ltmain.sh
tools/missing
tools/test-driver

View File

@ -159,14 +159,16 @@ tests/chbrclf.h: $(qmckl_h)
generated.mk: $(ORG_FILES)
python $(srcdir)/tools/build_makefile.py
$(PYTHON) $(srcdir)/tools/build_makefile.py
cppcheck: cppcheck.out
cppcheck.out: $(qmckl_h)
cd src/ && \
cppcheck --addon=cert -q --error-exitcode=0 \
--enable=all \
--enable=all --suppress="unusedStructMember"\
--suppress="unusedFunction" \
--suppress="missingIncludeSystem" \
--language=c --std=c99 -rp --platform=unix64 \
-I../include *.c *.h 2>../$@

View File

@ -1,6 +1,6 @@
# QMCkl: Quantum Monte Carlo Kernel Library
![Build Status](https://github.com/TREX-CoE/qmckl/workflows/test-build/badge.svg?branch=main)
![Build Status](https://github.com/TREX-CoE/qmckl/workflows/test-build/badge.svg?branch=master)
The domain of quantum chemistry needs a library in which the main
kernels of Quantum Monte Carlo (QMC) methods are implemented. In the
@ -9,7 +9,7 @@ simple language and provide a standard API and tests to enable the
development of high-performance QMCkl implementations taking
advantage of modern hardware.
See the [source code](https://github.com/TREX-CoE/qmckl/tree/main/src)
See the [source code](https://github.com/TREX-CoE/qmckl/blob/master/org/qmckl.org)
to read the documentation.

View File

@ -38,13 +38,13 @@ AC_PREREQ([2.69])
AC_INIT([qmckl],[0.1.1],
[https://github.com/TREX-CoE/qmckl/issues], [],
[https://trex-coe.github.io/qmckl/index.html])
AC_CONFIG_AUX_DIR(tools)
AM_INIT_AUTOMAKE([subdir-objects color-tests parallel-tests silent-rules 1.11])
AM_MAINTAINER_MODE()
LT_INIT
AC_CONFIG_SRCDIR([Makefile.in])
AC_CONFIG_HEADERS([include/config.h])
AC_CONFIG_MACRO_DIR([m4])
#AM_MAINTAINER_MODE
VERSION_MAJOR=`echo ${PACKAGE_VERSION} | cut -d. -f1`
VERSION_MINOR=`echo ${PACKAGE_VERSION} | cut -d. -f2`
@ -64,6 +64,9 @@ AC_LANG(C)
# Checks for programs.
AC_PROG_CC
# Make sure the c compiler supports C99
m4_version_prereq([2.70],[], [AC_PROG_CC_C99])
AS_IF([test "$ac_cv_prog_cc_c99" = "no"], [AC_MSG_ERROR([The compiler does not support C99])])
AC_PROG_CC_C_O
AC_PROG_FC
AC_PROG_FC_C_O
@ -72,13 +75,10 @@ AC_FC_FREEFORM
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_CC_C99
PKG_PROG_PKG_CONFIG([])
PKG_LIBS=""
PKG_CFLAGS=""
AC_SUBST([HAS_CPPCHECK])
# Checks for libraries.
AC_FC_LIBRARY_LDFLAGS
@ -231,15 +231,8 @@ if test "x${QMCKL_DEVEL}" != "x"; then
QMCKL_DEVEL=" -- Developer mode"
AC_PROG_AWK
AC_CHECK_PROGS([PYTHON],[python python3 python2],[no])
if test x${PYTHON} == xno ; then
AC_MSG_ERROR([
--------------------------------------------
Error: Python is required to build makefiles
--------------------------------------------
])
fi
python ${srcdir}/tools/build_makefile.py
AM_PATH_PYTHON
${PYTHON} ${srcdir}/tools/build_makefile.py
AC_CHECK_PROGS([EMACS],[emacs26 emacs],[no])
if test x${EMACS} == xno ; then
@ -264,6 +257,8 @@ LIBS="${LAPACK_LIBS} ${BLAS_LIBS} ${LIBS}"
PKG_LIBS="${PKG_LIBS} ${LIBS}"
AC_SUBST([PKG_LIBS])
AC_SUBST([PKG_CFLAGS])
AC_SUBST([HAS_CPPCHECK])
AC_CONFIG_FILES([Makefile
pkgconfig/qmckl.pc

1
org/.gitignore vendored
View File

@ -1,2 +1,3 @@
ltximg/
*.tangled
*.exported

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,9 @@ int main() {
#include "qmckl_nucleus_private_type.h"
#include "qmckl_electron_private_type.h"
#include "qmckl_ao_private_type.h"
#include "qmckl_nucleus_private_func.h"
#include "qmckl_electron_private_func.h"
#include "qmckl_ao_private_func.h"
#+end_src
#+begin_src c :tangle (eval c)
@ -213,17 +216,26 @@ qmckl_context qmckl_context_create() {
}
/* Initialize data */
{
ctx->tag = VALID_TAG;
const qmckl_context context = (const qmckl_context) ctx;
assert ( qmckl_context_check(context) != QMCKL_NULL_CONTEXT );
qmckl_exit_code rc;
ctx->numprec.precision = QMCKL_DEFAULT_PRECISION;
ctx->numprec.range = QMCKL_DEFAULT_RANGE;
ctx->ao_basis.uninitialized = (1 << 10) - 1;
ctx->nucleus.uninitialized = (1 << 4) - 1;
ctx->electron.uninitialized = (1 << 3) - 1;
rc = qmckl_init_electron(context);
assert (rc == QMCKL_SUCCESS);
rc = qmckl_init_nucleus(context);
assert (rc == QMCKL_SUCCESS);
rc = qmckl_init_ao_basis(context);
assert (rc == QMCKL_SUCCESS);
}
/* Allocate qmckl_memory_struct */
{

View File

@ -115,15 +115,40 @@ typedef struct qmckl_electron_struct {
int32_t uninitialized;
bool provided;
} qmckl_electron_struct;
#+end_src
The ~uninitialized~ integer contains one bit set to one for each
initialization function which has not bee called. It becomes equal
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_electron(qmckl_context context);
#+end_src
#+begin_src c :comments org :tangle (eval c)
qmckl_exit_code qmckl_init_electron(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->electron.uninitialized = (1 << 2) - 1;
/* Default values */
ctx->electron.rescale_factor_kappa_ee = 1.0;
ctx->electron.rescale_factor_kappa_en = 1.0;
return QMCKL_SUCCESS;
}
#+end_src
When all the data relative to electrons have been set, the
following function returns ~true~.
#+begin_src c :comments org :tangle (eval h_func)
bool qmckl_electron_provided (const qmckl_context context);
@ -295,13 +320,13 @@ qmckl_get_electron_walk_num (const qmckl_context context, int64_t* const walk_nu
*** Scaling factors Kappa
#+begin_src c :comments org :tangle (eval h_func) :exports none
qmckl_exit_code qmckl_get_kappa_ee (const qmckl_context context, double* const rescale_factor_kappa_ee);
qmckl_exit_code qmckl_get_kappa_en (const qmckl_context context, double* const rescale_factor_kappa_en);
qmckl_exit_code qmckl_get_electron_rescale_factor_ee (const qmckl_context context, double* const rescale_factor_kappa_ee);
qmckl_exit_code qmckl_get_electron_rescale_factor_en (const qmckl_context context, double* const rescale_factor_kappa_en);
#+end_src
#+begin_src c :comments org :tangle (eval c) :noweb yes :exports none
qmckl_exit_code
qmckl_get_kappa_ee (const qmckl_context context, double* const rescale_factor_kappa_ee) {
qmckl_get_electron_rescale_factor_ee (const qmckl_context context, double* const rescale_factor_kappa_ee) {
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
return QMCKL_INVALID_CONTEXT;
@ -310,27 +335,22 @@ qmckl_get_kappa_ee (const qmckl_context context, double* const rescale_factor_ka
if (rescale_factor_kappa_ee == NULL) {
return qmckl_failwith( context,
QMCKL_INVALID_ARG_2,
"qmckl_get_kappa_ee",
"qmckl_get_electron_rescale_factor_ee",
"rescale_factor_kappa_ee is a null pointer");
}
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
assert (ctx != NULL);
int32_t mask = 1 << 2;
assert (ctx->electron.rescale_factor_kappa_ee > 0.0);
if ( (ctx->electron.uninitialized & mask) != 0) {
return QMCKL_NOT_PROVIDED;
}
// TODO: assert (ctx->electron.rescale_factor_kappa_ee > (double) 0);
,*rescale_factor_kappa_ee = ctx->electron.rescale_factor_kappa_ee;
*rescale_factor_kappa_ee = ctx->electron.rescale_factor_kappa_ee;
return QMCKL_SUCCESS;
}
qmckl_exit_code
qmckl_get_kappa_en (const qmckl_context context, double* const rescale_factor_kappa_en) {
qmckl_get_electron_rescale_factor_en (const qmckl_context context, double* const rescale_factor_kappa_en) {
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
return QMCKL_INVALID_CONTEXT;
}
@ -338,21 +358,15 @@ qmckl_get_kappa_en (const qmckl_context context, double* const rescale_factor_ka
if (rescale_factor_kappa_en == NULL) {
return qmckl_failwith( context,
QMCKL_INVALID_ARG_2,
"qmckl_get_kappa_en",
"qmckl_get_electron_rescale_factor_en",
"rescale_factor_kappa_en is a null pointer");
}
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
assert (ctx != NULL);
int32_t mask = 1 << 2;
if ( (ctx->electron.uninitialized & mask) != 0) {
return QMCKL_NOT_PROVIDED;
}
// TODO: assert (ctx->electron.rescale_factor_kappa_en > (double) 0);
,*rescale_factor_kappa_en = ctx->electron.rescale_factor_kappa_en;
assert (ctx->electron.rescale_factor_kappa_en > 0.0);
*rescale_factor_kappa_en = ctx->electron.rescale_factor_kappa_en;
return QMCKL_SUCCESS;
}
#+end_src
@ -444,9 +458,11 @@ qmckl_get_electron_coord (const qmckl_context context, const char transp, double
#+begin_src c :comments org :tangle (eval h_func)
qmckl_exit_code qmckl_set_electron_num (qmckl_context context, const int64_t up_num, const int64_t down_num);
qmckl_exit_code qmckl_set_kappa (qmckl_context context, const double rescale_factor_kappa_ee, const double rescale_factor_kappa_en);
qmckl_exit_code qmckl_set_electron_walk_num (qmckl_context context, const int64_t walk_num);
qmckl_exit_code qmckl_set_electron_coord (qmckl_context context, const char transp, const double* coord);
qmckl_exit_code qmckl_set_electron_rescale_factor_ee (qmckl_context context, const double kappa_ee);
qmckl_exit_code qmckl_set_electron_rescale_factor_en (qmckl_context context, const double kappa_en);
#+end_src
#+NAME:pre2
@ -559,32 +575,37 @@ qmckl_set_electron_walk_num(qmckl_context context, const int64_t walk_num) {
#+begin_src c :comments org :tangle (eval c) :noweb yes :exports none
qmckl_exit_code
qmckl_set_kappa(qmckl_context context,
const double rescale_factor_kappa_ee,
qmckl_set_electron_rescale_factor_ee(qmckl_context context,
const double rescale_factor_kappa_ee) {
<<pre2>>
if (rescale_factor_kappa_ee <= 0.0) {
return qmckl_failwith( context,
QMCKL_INVALID_ARG_2,
"qmckl_set_electron_rescale_factor_ee",
"rescale_factor_kappa_ee <= 0.0");
}
ctx->electron.rescale_factor_kappa_ee = rescale_factor_kappa_ee;
return QMCKL_SUCCESS;
}
qmckl_exit_code
qmckl_set_electron_rescale_factor_en(qmckl_context context,
const double rescale_factor_kappa_en) {
<<pre2>>
// TODO: Check for 0 values
//if (rescale_factor_kappa_ee != 0) {
// return qmckl_failwith( context,
// QMCKL_INVALID_ARG_2,
// "qmckl_set_kappa",
// "rescale_factor_kappa_ee == 0");
//}
if (rescale_factor_kappa_en <= 0.0) {
return qmckl_failwith( context,
QMCKL_INVALID_ARG_2,
"qmckl_set_electron_rescale_factor_en",
"rescale_factor_kappa_en <= 0.0");
}
//if (rescale_factor_kappa_en <= 0) {
// return qmckl_failwith( context,
// QMCKL_INVALID_ARG_3,
// "qmckl_set_kappa",
// "rescale_factor_kappa_en == 0");
//}
int32_t mask = 1 << 2;
ctx->electron.rescale_factor_kappa_ee = rescale_factor_kappa_ee;
ctx->electron.rescale_factor_kappa_en = rescale_factor_kappa_en;
<<post2>>
return QMCKL_SUCCESS;
}
#+end_src
@ -688,14 +709,14 @@ int64_t walk_num = chbrclf_walk_num;
int64_t elec_num = chbrclf_elec_num;
int64_t elec_up_num = chbrclf_elec_up_num;
int64_t elec_dn_num = chbrclf_elec_dn_num;
double rescale_factor_kappa_ee = 1.0; // TODO Get rescale_factor_kappa_ee from chbrclf
double rescale_factor_kappa_en = 1.0; // TODO Get rescale_factor_kappa_en from chbrclf
double rescale_factor_kappa_ee = 1.0;
double rescale_factor_kappa_en = 1.0;
double nucl_rescale_factor_kappa = 1.0;
double* elec_coord = &(chbrclf_elec_coord[0][0][0]);
int64_t nucl_num = chbrclf_nucl_num;
double* charge = chbrclf_charge;
double* nucl_coord = &(chbrclf_nucl_coord[0][0]);
double nucl_rescale_factor_kappa = 1.0; // TODO Change get rescale_factor_kappa from chbrclf example
/* --- */
@ -730,23 +751,27 @@ rc = qmckl_get_electron_num (context, &n);
assert(rc == QMCKL_SUCCESS);
assert(n == elec_num);
double k_ee;
double k_en;
rc = qmckl_get_kappa_ee (context, &k_ee);
assert(rc == QMCKL_NOT_PROVIDED);
rc = qmckl_get_kappa_en (context, &k_en);
assert(rc == QMCKL_NOT_PROVIDED);
rc = qmckl_set_kappa (context, rescale_factor_kappa_ee, rescale_factor_kappa_en);
double k_ee = 0.;
double k_en = 0.;
rc = qmckl_get_electron_rescale_factor_ee (context, &k_ee);
assert(rc == QMCKL_SUCCESS);
assert(!qmckl_electron_provided(context));
assert(k_ee == 1.0);
rc = qmckl_get_kappa_ee (context, &k_ee);
rc = qmckl_get_electron_rescale_factor_en (context, &k_en);
assert(rc == QMCKL_SUCCESS);
assert(k_en == 1.0);
rc = qmckl_set_electron_rescale_factor_en(context, rescale_factor_kappa_en);
assert(rc == QMCKL_SUCCESS);
rc = qmckl_set_electron_rescale_factor_ee(context, rescale_factor_kappa_ee);
assert(rc == QMCKL_SUCCESS);
rc = qmckl_get_electron_rescale_factor_ee (context, &k_ee);
assert(rc == QMCKL_SUCCESS);
assert(k_ee == rescale_factor_kappa_ee);
rc = qmckl_get_kappa_en (context, &k_en);
rc = qmckl_get_electron_rescale_factor_en (context, &k_en);
assert(rc == QMCKL_SUCCESS);
assert(k_en == rescale_factor_kappa_en);
@ -1538,7 +1563,10 @@ qmckl_exit_code qmckl_provide_en_distance(qmckl_context context)
assert (ctx != NULL);
if (!(ctx->nucleus.provided)) {
return QMCKL_NOT_PROVIDED;
return qmckl_failwith( context,
QMCKL_NOT_PROVIDED,
"qmckl_provide_en_distance",
NULL);
}
/* Compute if necessary */
@ -1719,9 +1747,6 @@ assert(qmckl_electron_provided(context));
rc = qmckl_set_nucleus_num (context, nucl_num);
assert(rc == QMCKL_SUCCESS);
rc = qmckl_set_nucleus_kappa (context, nucl_rescale_factor_kappa);
assert(rc == QMCKL_SUCCESS);
rc = qmckl_set_nucleus_charge (context, charge);
assert (rc == QMCKL_SUCCESS);
@ -2009,9 +2034,6 @@ assert(qmckl_electron_provided(context));
rc = qmckl_set_nucleus_num (context, nucl_num);
assert(rc == QMCKL_SUCCESS);
rc = qmckl_set_nucleus_kappa (context, nucl_rescale_factor_kappa);
assert(rc == QMCKL_SUCCESS);
rc = qmckl_set_nucleus_charge (context, charge);
assert (rc == QMCKL_SUCCESS);
@ -2023,6 +2045,7 @@ assert(qmckl_nucleus_provided(context));
double en_distance_rescaled[walk_num][nucl_num][elec_num];
rc = qmckl_get_electron_en_distance_rescaled(context, &(en_distance_rescaled[0][0][0]));
assert (rc == QMCKL_SUCCESS);
// (e,n,w) in Fortran notation
@ -2276,7 +2299,7 @@ assert(qmckl_electron_provided(context));
rc = qmckl_set_nucleus_num (context, nucl_num);
assert(rc == QMCKL_SUCCESS);
rc = qmckl_set_nucleus_kappa (context, nucl_rescale_factor_kappa);
rc = qmckl_set_nucleus_rescale_factor (context, nucl_rescale_factor_kappa);
assert(rc == QMCKL_SUCCESS);
rc = qmckl_set_nucleus_charge (context, charge);
@ -2290,27 +2313,28 @@ assert(qmckl_nucleus_provided(context));
double en_distance_rescaled_deriv_e[walk_num][4][nucl_num][elec_num];
rc = qmckl_get_electron_en_distance_rescaled_deriv_e(context, &(en_distance_rescaled_deriv_e[0][0][0][0]));
assert (rc == QMCKL_SUCCESS);
// TODO: check exact values
//// (e,n,w) in Fortran notation
//// (1,1,1)
//assert(fabs(en_distance[0][0][0] - 7.546738741619978) < 1.e-12);
//assert(fabs(en_distance_rescaled[0][0][0] - 7.546738741619978) < 1.e-12);
//
//// (1,2,1)
//assert(fabs(en_distance[0][1][0] - 8.77102435246984) < 1.e-12);
//assert(fabs(en_distance_rescaled[0][1][0] - 8.77102435246984) < 1.e-12);
//
//// (2,1,1)
//assert(fabs(en_distance[0][0][1] - 3.698922010513608) < 1.e-12);
//assert(fabs(en_distance_rescaled[0][0][1] - 3.698922010513608) < 1.e-12);
//
//// (1,1,2)
//assert(fabs(en_distance[1][0][0] - 5.824059436060509) < 1.e-12);
//assert(fabs(en_distance_rescaled[1][0][0] - 5.824059436060509) < 1.e-12);
//
//// (1,2,2)
//assert(fabs(en_distance[1][1][0] - 7.080482110317645) < 1.e-12);
//assert(fabs(en_distance_rescaled[1][1][0] - 7.080482110317645) < 1.e-12);
//
//// (2,1,2)
//assert(fabs(en_distance[1][0][1] - 3.1804527583077356) < 1.e-12);
//assert(fabs(en_distance_rescaled[1][0][1] - 3.1804527583077356) < 1.e-12);
#+end_src

View File

@ -104,7 +104,8 @@ typedef int32_t qmckl_exit_code;
| ~QMCKL_ALLOCATION_FAILED~ | 104 | 'Allocation failed' |
| ~QMCKL_DEALLOCATION_FAILED~ | 105 | 'De-allocation failed' |
| ~QMCKL_NOT_PROVIDED~ | 106 | 'Not provided' |
| ~QMCKL_INVALID_EXIT_CODE~ | 107 | 'Invalid exit code' |
| ~QMCKL_OUT_OF_BOUNDS~ | 107 | 'Index out of bounds' |
| ~QMCKL_INVALID_EXIT_CODE~ | 108 | 'Invalid exit code' |
# We need to force Emacs not to indent the Python code:
# -*- org-src-preserve-indentation: t
@ -162,7 +163,8 @@ return '\n'.join(result)
#define QMCKL_ALLOCATION_FAILED ((qmckl_exit_code) 104)
#define QMCKL_DEALLOCATION_FAILED ((qmckl_exit_code) 105)
#define QMCKL_NOT_PROVIDED ((qmckl_exit_code) 106)
#define QMCKL_INVALID_EXIT_CODE ((qmckl_exit_code) 107)
#define QMCKL_OUT_OF_BOUNDS ((qmckl_exit_code) 107)
#define QMCKL_INVALID_EXIT_CODE ((qmckl_exit_code) 108)
#+end_src
#+begin_src f90 :comments org :tangle (eval fh_type) :exports none
@ -193,7 +195,8 @@ return '\n'.join(result)
integer(qmckl_exit_code), parameter :: QMCKL_ALLOCATION_FAILED = 104
integer(qmckl_exit_code), parameter :: QMCKL_DEALLOCATION_FAILED = 105
integer(qmckl_exit_code), parameter :: QMCKL_NOT_PROVIDED = 106
integer(qmckl_exit_code), parameter :: QMCKL_INVALID_EXIT_CODE = 107
integer(qmckl_exit_code), parameter :: QMCKL_OUT_OF_BOUNDS = 107
integer(qmckl_exit_code), parameter :: QMCKL_INVALID_EXIT_CODE = 108
#+end_src
:end:

View File

@ -92,20 +92,49 @@ typedef struct qmckl_nucleus_struct {
int32_t uninitialized;
bool provided;
} qmckl_nucleus_struct;
#+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_nucleus(qmckl_context context);
#+end_src
#+begin_src c :comments org :tangle (eval c)
qmckl_exit_code qmckl_init_nucleus(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->nucleus.uninitialized = (1 << 3) - 1;
/* Default values */
ctx->nucleus.rescale_factor_kappa = 1.0;
return QMCKL_SUCCESS;
}
#+end_src
** Access functions
#+begin_src c :comments org :tangle (eval h_func) :exports none
qmckl_exit_code qmckl_get_nucleus_num (const qmckl_context context, int64_t* const num);
qmckl_exit_code qmckl_get_nucleus_charge (const qmckl_context context, double* const charge);
qmckl_exit_code qmckl_get_nucleus_kappa (const qmckl_context context, double* const rescale_factor_kappa);
qmckl_exit_code qmckl_get_nucleus_coord (const qmckl_context context, const char transp, double* const coord);
qmckl_exit_code qmckl_get_nucleus_rescale_factor (const qmckl_context context, double* const rescale_factor_kappa);
#+end_src
#+NAME:post
@ -136,7 +165,7 @@ qmckl_get_nucleus_num (const qmckl_context context, int64_t* const num) {
int32_t mask = 1 << 0;
if ( (ctx->nucleus.uninitialized & mask) != 0) {
*num = (int64_t) 0;
,*num = (int64_t) 0;
return qmckl_failwith( context,
QMCKL_NOT_PROVIDED,
"qmckl_get_nucleus_num",
@ -187,23 +216,25 @@ qmckl_get_nucleus_charge (const qmckl_context context, double* const charge) {
qmckl_exit_code
qmckl_get_nucleus_kappa (const qmckl_context context, double* const rescale_factor_kappa) {
qmckl_get_nucleus_rescale_factor (const qmckl_context context,
double* const rescale_factor_kappa)
{
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
return QMCKL_INVALID_CONTEXT;
}
if (rescale_factor_kappa == NULL) {
return qmckl_failwith( context,
QMCKL_INVALID_ARG_2,
"qmckl_get_nucleus_rescale_factor",
"rescale_factor_kappa is a null pointer");
}
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
assert (ctx != NULL);
int32_t mask = 1 << 2;
if ( (ctx->nucleus.uninitialized & mask) != 0) {
return qmckl_failwith( context,
QMCKL_NOT_PROVIDED,
"qmckl_get_nucleus_kappa",
"nucleus data is not provided");
}
assert (ctx->nucleus.rescale_factor_kappa > 0.0);
(*rescale_factor_kappa) = ctx->nucleus.rescale_factor_kappa;
@ -235,7 +266,7 @@ qmckl_get_nucleus_coord (const qmckl_context context, const char transp, double*
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
assert (ctx != NULL);
int32_t mask = 1 << 3;
int32_t mask = 1 << 2;
if ( (ctx->nucleus.uninitialized & mask) != 0) {
return qmckl_failwith( context,
@ -295,8 +326,9 @@ bool qmckl_nucleus_provided(const qmckl_context context) {
#+begin_src c :comments org :tangle (eval h_func)
qmckl_exit_code qmckl_set_nucleus_num (qmckl_context context, const int64_t num);
qmckl_exit_code qmckl_set_nucleus_charge (qmckl_context context, const double* charge);
qmckl_exit_code qmckl_set_nucleus_kappa (qmckl_context context, const double rescale_factor_kappa);
qmckl_exit_code qmckl_set_nucleus_coord (qmckl_context context, const char transp, const double* coord);
qmckl_exit_code qmckl_set_nucleus_rescale_factor (qmckl_context context, const double rescale_factor_kappa);
#+end_src
#+NAME:pre2
@ -331,7 +363,7 @@ qmckl_set_nucleus_num(qmckl_context context, const int64_t num) {
"num <= 0");
}
int32_t mask = 1;
int32_t mask = 1 << 0;
ctx->nucleus.num = num;
@ -388,25 +420,19 @@ qmckl_set_nucleus_charge(qmckl_context context, const double* charge) {
#+begin_src c :comments org :tangle (eval c) :noweb yes :exports none
qmckl_exit_code
qmckl_set_nucleus_kappa(qmckl_context context, const double rescale_factor_kappa) {
qmckl_set_nucleus_rescale_factor(qmckl_context context, const double rescale_factor_kappa) {
<<pre2>>
//TODO: Check for small values of kappa
//if (rescale_factor_kappa == 0) {
// return qmckl_failwith( context,
// QMCKL_INVALID_ARG_2,
// "qmckl_set_nucleus_kappa",
// "rescale_factor_kappa cannot be 0");
//}
int32_t mask = 1 << 2;
int64_t num;
qmckl_exit_code rc;
if (rescale_factor_kappa <= 0.0) {
return qmckl_failwith( context,
QMCKL_INVALID_ARG_2,
"qmckl_set_nucleus_rescale_factor",
"rescale_factor_kappa cannot be <= 0.");
}
ctx->nucleus.rescale_factor_kappa = rescale_factor_kappa;
<<post2>>
return QMCKL_SUCCESS;
}
#+end_src
@ -421,7 +447,7 @@ qmckl_set_nucleus_coord(qmckl_context context, const char transp, const double*
int64_t nucl_num = (int64_t) 0;
qmckl_exit_code rc;
int32_t mask = 1 << 3;
int32_t mask = 1 << 2;
rc = qmckl_get_nucleus_num(context, &nucl_num);
if (rc != QMCKL_SUCCESS) return rc;
@ -462,7 +488,7 @@ qmckl_set_nucleus_coord(qmckl_context context, const char transp, const double*
const int64_t nucl_num = chbrclf_nucl_num;
const double* nucl_charge = chbrclf_charge;
const double* nucl_coord = &(chbrclf_nucl_coord[0][0]);
const double nucl_rescale_factor_kappa = 1.0; // TODO Change get rescale_factor_kappa from chbrclf example
const double nucl_rescale_factor_kappa = 2.0;
/* --- */
@ -484,15 +510,15 @@ assert(rc == QMCKL_SUCCESS);
assert(n == nucl_num);
double k;
rc = qmckl_get_nucleus_kappa (context, &k);
assert(rc == QMCKL_NOT_PROVIDED);
rc = qmckl_set_nucleus_kappa (context, nucl_rescale_factor_kappa);
rc = qmckl_get_nucleus_rescale_factor (context, &k);
assert(rc == QMCKL_SUCCESS);
assert(!qmckl_nucleus_provided(context));
assert(k == 1.0);
rc = qmckl_get_nucleus_kappa (context, &k);
rc = qmckl_set_nucleus_rescale_factor (context, nucl_rescale_factor_kappa);
assert(rc == QMCKL_SUCCESS);
rc = qmckl_get_nucleus_rescale_factor (context, &k);
assert(rc == QMCKL_SUCCESS);
assert(k == nucl_rescale_factor_kappa);

View File

@ -523,6 +523,344 @@ F 1
#+END_example
#+begin_src c :tangle ../tests/chbrclf.h
#define chbrclf_shell_num 72
#define chbrclf_prim_num 297
int64_t chbrclf_basis_nucleus_index[chbrclf_nucl_num] = {0, 14, 23, 27, 53};
int64_t chbrclf_basis_nucleus_shell_num[chbrclf_nucl_num] = {14, 9, 14, 16, 19};
int32_t chbrclf_basis_shell_ang_mom[chbrclf_shell_num] =
{0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 0, 0, 0, 0, 1, 1, 1, 2, 2, 0,
0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
2, 2, 2, 3, 3, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3};
int64_t chbrclf_basis_shell_prim_num[chbrclf_shell_num] =
{10, 10, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 10,
10, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 15, 15, 15, 1, 1, 1, 9, 9, 1, 1, 1,
1, 1, 1, 1, 1, 20, 20, 20, 20, 1, 1, 1, 13, 13, 13, 1, 1, 1, 8, 1, 1, 1, 1,
1};
int64_t chbrclf_basis_shell_prim_index[chbrclf_shell_num] =
{0, 10, 20, 21, 22, 23, 28, 29, 30, 31, 32, 33, 34, 35, 36, 41, 42, 43, 44,
45, 46, 47, 48, 49, 59, 69, 70, 71, 72, 77, 78, 79, 80, 81, 82, 83, 84, 85,
100, 115, 130, 131, 132, 133, 142, 151, 152, 153, 154, 155, 156, 157, 158,
159, 179, 199, 219, 239, 240, 241, 242, 255, 268, 281, 282, 283, 284, 292,
293, 294, 295, 296};
double chbrclf_basis_shell_factor[chbrclf_shell_num] =
{1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.};
double chbrclf_basis_exponent[chbrclf_prim_num] =
{8.2360000000000000e+03, 1.2350000000000000e+03, 2.8080000000000001e+02,
7.9269999999999996e+01, 2.5590000000000000e+01, 8.9969999999999999e+00,
3.3190000000000000e+00, 9.0590000000000004e-01, 3.6430000000000001e-01,
1.2850000000000000e-01, 8.2360000000000000e+03, 1.2350000000000000e+03,
2.8080000000000001e+02, 7.9269999999999996e+01, 2.5590000000000000e+01,
8.9969999999999999e+00, 3.3190000000000000e+00, 9.0590000000000004e-01,
3.6430000000000001e-01, 1.2850000000000000e-01, 9.0590000000000004e-01,
1.2850000000000000e-01, 4.4019999999999997e-02, 1.8710000000000001e+01,
4.1330000000000000e+00, 1.2000000000000000e+00, 3.8269999999999998e-01,
1.2089999999999999e-01, 3.8269999999999998e-01, 1.2089999999999999e-01,
3.5690000000000000e-02, 1.0970000000000000e+00, 3.1800000000000000e-01,
1.0000000000000001e-01, 7.6100000000000001e-01, 2.6800000000000002e-01,
3.3869999999999997e+01, 5.0949999999999998e+00, 1.1590000000000000e+00,
3.2579999999999998e-01, 1.0270000000000000e-01, 3.2579999999999998e-01,
1.0270000000000000e-01, 2.5260000000000001e-02, 1.4070000000000000e+00,
3.8800000000000001e-01, 1.0199999999999999e-01, 1.0569999999999999e+00,
2.4700000000000000e-01, 1.9500000000000000e+04, 2.9230000000000000e+03,
6.6450000000000000e+02, 1.8750000000000000e+02, 6.0619999999999997e+01,
2.1420000000000002e+01, 7.9500000000000002e+00, 2.2570000000000001e+00,
8.8149999999999995e-01, 3.0409999999999998e-01, 1.9500000000000000e+04,
2.9230000000000000e+03, 6.6450000000000000e+02, 1.8750000000000000e+02,
6.0619999999999997e+01, 2.1420000000000002e+01, 7.9500000000000002e+00,
2.2570000000000001e+00, 8.8149999999999995e-01, 3.0409999999999998e-01,
2.2570000000000001e+00, 3.0409999999999998e-01, 9.1579999999999995e-02,
4.3880000000000003e+01, 9.9260000000000002e+00, 2.9300000000000002e+00,
9.1320000000000001e-01, 2.6719999999999999e-01, 9.1320000000000001e-01,
2.6719999999999999e-01, 7.3609999999999995e-02, 3.1070000000000002e+00,
8.5499999999999998e-01, 2.9199999999999998e-01, 1.9170000000000000e+00,
7.2399999999999998e-01, 4.5610000000000000e+05, 6.8330000000000000e+04,
1.5550000000000000e+04, 4.4050000000000000e+03, 1.4390000000000000e+03,
5.2039999999999998e+02, 2.0309999999999999e+02, 8.3959999999999994e+01,
3.6200000000000003e+01, 1.5830000000000000e+01, 6.3339999999999996e+00,
2.6940000000000000e+00, 9.7680000000000000e-01, 4.3130000000000002e-01,
1.6250000000000001e-01, 4.5610000000000000e+05, 6.8330000000000000e+04,
1.5550000000000000e+04, 4.4050000000000000e+03, 1.4390000000000000e+03,
5.2039999999999998e+02, 2.0309999999999999e+02, 8.3959999999999994e+01,
3.6200000000000003e+01, 1.5830000000000000e+01, 6.3339999999999996e+00,
2.6940000000000000e+00, 9.7680000000000000e-01, 4.3130000000000002e-01,
1.6250000000000001e-01, 4.5610000000000000e+05, 6.8330000000000000e+04,
1.5550000000000000e+04, 4.4050000000000000e+03, 1.4390000000000000e+03,
5.2039999999999998e+02, 2.0309999999999999e+02, 8.3959999999999994e+01,
3.6200000000000003e+01, 1.5830000000000000e+01, 6.3339999999999996e+00,
2.6940000000000000e+00, 9.7680000000000000e-01, 4.3130000000000002e-01,
1.6250000000000001e-01, 9.7680000000000000e-01, 1.6250000000000001e-01,
5.9100000000000000e-02, 6.6329999999999995e+02, 1.5680000000000001e+02,
4.9979999999999997e+01, 1.8420000000000002e+01, 7.2400000000000002e+00,
2.9220000000000002e+00, 1.0220000000000000e+00, 3.8179999999999997e-01,
1.3009999999999999e-01, 6.6329999999999995e+02, 1.5680000000000001e+02,
4.9979999999999997e+01, 1.8420000000000002e+01, 7.2400000000000002e+00,
2.9220000000000002e+00, 1.0220000000000000e+00, 3.8179999999999997e-01,
1.3009999999999999e-01, 1.0220000000000000e+00, 1.3009999999999999e-01,
4.1900000000000000e-02, 1.0460000000000000e+00, 3.4399999999999997e-01,
1.3500000000000001e-01, 7.0599999999999996e-01, 3.1200000000000000e-01,
1.0639000000000000e+07, 1.5934000000000000e+06, 3.6261000000000000e+05,
1.0270000000000000e+05, 3.3501000000000000e+04, 1.2093000000000000e+04,
4.7158999999999996e+03, 1.9555999999999999e+03, 8.5261000000000001e+02,
3.8767000000000002e+02, 1.8268000000000001e+02, 8.8245000000000005e+01,
3.9262999999999998e+01, 1.9234000000000002e+01, 9.4056999999999995e+00,
4.1600999999999999e+00, 1.8995000000000000e+00, 6.0472000000000004e-01,
3.0114000000000002e-01, 1.2515000000000001e-01, 1.0639000000000000e+07,
1.5934000000000000e+06, 3.6261000000000000e+05, 1.0270000000000000e+05,
3.3501000000000000e+04, 1.2093000000000000e+04, 4.7158999999999996e+03,
1.9555999999999999e+03, 8.5261000000000001e+02, 3.8767000000000002e+02,
1.8268000000000001e+02, 8.8245000000000005e+01, 3.9262999999999998e+01,
1.9234000000000002e+01, 9.4056999999999995e+00, 4.1600999999999999e+00,
1.8995000000000000e+00, 6.0472000000000004e-01, 3.0114000000000002e-01,
1.2515000000000001e-01, 1.0639000000000000e+07, 1.5934000000000000e+06,
3.6261000000000000e+05, 1.0270000000000000e+05, 3.3501000000000000e+04,
1.2093000000000000e+04, 4.7158999999999996e+03, 1.9555999999999999e+03,
8.5261000000000001e+02, 3.8767000000000002e+02, 1.8268000000000001e+02,
8.8245000000000005e+01, 3.9262999999999998e+01, 1.9234000000000002e+01,
9.4056999999999995e+00, 4.1600999999999999e+00, 1.8995000000000000e+00,
6.0472000000000004e-01, 3.0114000000000002e-01, 1.2515000000000001e-01,
1.0639000000000000e+07, 1.5934000000000000e+06, 3.6261000000000000e+05,
1.0270000000000000e+05, 3.3501000000000000e+04, 1.2093000000000000e+04,
4.7158999999999996e+03, 1.9555999999999999e+03, 8.5261000000000001e+02,
3.8767000000000002e+02, 1.8268000000000001e+02, 8.8245000000000005e+01,
3.9262999999999998e+01, 1.9234000000000002e+01, 9.4056999999999995e+00,
4.1600999999999999e+00, 1.8995000000000000e+00, 6.0472000000000004e-01,
3.0114000000000002e-01, 1.2515000000000001e-01, 6.0472000000000004e-01,
1.2515000000000001e-01, 4.5593000000000002e-02, 8.6765000000000000e+03,
2.0559000000000001e+03, 6.6623000000000002e+02, 2.5309999999999999e+02,
1.0612000000000000e+02, 4.7241999999999997e+01, 2.1824999999999999e+01,
9.9684000000000008e+00, 4.5171000000000001e+00, 1.9982000000000000e+00,
7.0987999999999996e-01, 2.8144999999999998e-01, 1.0204000000000001e-01,
8.6765000000000000e+03, 2.0559000000000001e+03, 6.6623000000000002e+02,
2.5309999999999999e+02, 1.0612000000000000e+02, 4.7241999999999997e+01,
2.1824999999999999e+01, 9.9684000000000008e+00, 4.5171000000000001e+00,
1.9982000000000000e+00, 7.0987999999999996e-01, 2.8144999999999998e-01,
1.0204000000000001e-01, 8.6765000000000000e+03, 2.0559000000000001e+03,
6.6623000000000002e+02, 2.5309999999999999e+02, 1.0612000000000000e+02,
4.7241999999999997e+01, 2.1824999999999999e+01, 9.9684000000000008e+00,
4.5171000000000001e+00, 1.9982000000000000e+00, 7.0987999999999996e-01,
2.8144999999999998e-01, 1.0204000000000001e-01, 7.0987999999999996e-01,
1.0204000000000001e-01, 3.5142000000000000e-02, 4.0382999999999998e+02,
1.2117000000000000e+02, 4.6344999999999999e+01, 1.9721000000000000e+01,
8.8623999999999992e+00, 3.9962000000000000e+00, 1.7636000000000001e+00,
7.0618999999999998e-01, 7.0618999999999998e-01, 2.6390000000000002e-01,
1.0470000000000000e-01, 5.5149999999999999e-01, 2.5800000000000001e-01};
double chbrclf_basis_coefficient[chbrclf_prim_num] =
{5.3100000000000000e-04, 4.1079999999999997e-03, 2.1087000000000002e-02,
8.1852999999999995e-02, 2.3481700000000000e-01, 4.3440099999999998e-01,
3.4612900000000002e-01, 3.9378000000000003e-02, -8.9829999999999997e-03,
2.3850000000000000e-03, -1.1300000000000000e-04, -8.7799999999999998e-04,
-4.5399999999999998e-03, -1.8133000000000000e-02, -5.5759999999999997e-02,
-1.2689500000000001e-01, -1.7035200000000000e-01, 1.4038200000000001e-01,
5.9868399999999999e-01, 3.9538899999999999e-01, 1.0000000000000000e+00,
1.0000000000000000e+00, 1.0000000000000000e+00, 1.4031000000000000e-02,
8.6865999999999999e-02, 2.9021599999999997e-01, 5.0100800000000001e-01,
3.4340599999999999e-01, 1.0000000000000000e+00, 1.0000000000000000e+00,
1.0000000000000000e+00, 1.0000000000000000e+00, 1.0000000000000000e+00,
1.0000000000000000e+00, 1.0000000000000000e+00, 1.0000000000000000e+00,
6.0679999999999996e-03, 4.5308000000000001e-02, 2.0282200000000000e-01,
5.0390299999999999e-01, 3.8342100000000001e-01, 1.0000000000000000e+00,
1.0000000000000000e+00, 1.0000000000000000e+00, 1.0000000000000000e+00,
1.0000000000000000e+00, 1.0000000000000000e+00, 1.0000000000000000e+00,
1.0000000000000000e+00, 5.0699999999999996e-04, 3.9230000000000003e-03,
2.0199999999999999e-02, 7.9009999999999997e-02, 2.3043900000000000e-01,
4.3287199999999998e-01, 3.4996400000000000e-01, 4.3233000000000001e-02,
-7.8919999999999997e-03, 2.3839999999999998e-03, -1.1700000000000000e-04,
-9.1200000000000005e-04, -4.7169999999999998e-03, -1.9085999999999999e-02,
-5.9655000000000000e-02, -1.4001000000000000e-01, -1.7678199999999999e-01,
1.7162500000000000e-01, 6.0504300000000000e-01, 3.6951200000000001e-01,
1.0000000000000000e+00, 1.0000000000000000e+00, 1.0000000000000000e+00,
1.6664999999999999e-02, 1.0447200000000000e-01, 3.1725999999999999e-01,
4.8734300000000003e-01, 3.3460400000000001e-01, 1.0000000000000000e+00,
1.0000000000000000e+00, 1.0000000000000000e+00, 1.0000000000000000e+00,
1.0000000000000000e+00, 1.0000000000000000e+00, 1.0000000000000000e+00,
1.0000000000000000e+00, 4.9296999999999999e-05, 3.8302900000000001e-04,
2.0085400000000001e-03, 8.3855800000000001e-03, 2.9470300000000001e-02,
8.7832499999999994e-02, 2.1147299999999999e-01, 3.6536400000000002e-01,
3.4088400000000002e-01, 1.0213300000000000e-01, 3.1167500000000002e-03,
1.0575100000000000e-03, -3.7800000000000003e-04, 1.5613600000000000e-04,
-5.1412600000000003e-05, -1.3830400000000001e-05, -1.0727900000000000e-04,
-5.6508299999999997e-04, -2.3613499999999999e-03, -8.4588600000000003e-03,
-2.5963799999999999e-02, -6.8636199999999994e-02, -1.4187400000000000e-01,
-1.9931900000000000e-01, -1.9566199999999999e-02, 4.9974099999999999e-01,
5.6373600000000001e-01, 7.9032500000000006e-02, -8.3509099999999996e-03,
2.3245599999999998e-03, 4.1854599999999997e-06, 3.2439500000000000e-05,
1.7110500000000001e-04, 7.1417599999999996e-04, 2.5670500000000000e-03,
7.8855200000000000e-03, 2.1086700000000000e-02, 4.4226399999999999e-02,
6.5167000000000003e-02, 6.0301199999999999e-03, -2.0649500000000001e-01,
-4.0587099999999998e-01, 7.5955800000000004e-02, 7.2566100000000000e-01,
3.9442300000000002e-01, 1.0000000000000000e+00, 1.0000000000000000e+00,
1.0000000000000000e+00, 2.4044800000000001e-03, 1.9214800000000001e-02,
8.8509699999999997e-02, 2.5602000000000003e-01, 4.3692700000000001e-01,
3.5033399999999998e-01, 5.8549499999999997e-02, -4.5842299999999999e-03,
2.2696999999999999e-03, -6.5214500000000003e-04, -5.1944499999999998e-03,
-2.4693799999999998e-02, -7.2816699999999998e-02, -1.3403000000000001e-01,
-9.4774200000000003e-02, 2.6228899999999999e-01, 5.6466700000000003e-01,
3.4125000000000000e-01, 1.0000000000000000e+00, 1.0000000000000000e+00,
1.0000000000000000e+00, 1.0000000000000000e+00, 1.0000000000000000e+00,
1.0000000000000000e+00, 1.0000000000000000e+00, 1.0000000000000000e+00,
5.9000000000000003e-06, 4.6100000000000002e-05, 2.4220000000000001e-04,
1.0226000000000000e-03, 3.7112999999999998e-03, 1.1978500000000000e-02,
3.4692700000000000e-02, 8.9123900000000006e-02, 1.9345570000000001e-01,
3.2090190000000002e-01, 3.2992329999999997e-01, 1.4941209999999999e-01,
1.4993800000000000e-02, -9.1650000000000000e-04, 4.3800000000000002e-04,
-2.3980000000000000e-04, 7.3600000000000000e-05, -3.6699999999999998e-05,
2.3900000000000002e-05, -5.5999999999999997e-06, -1.9000000000000000e-06,
-1.4500000000000000e-05, -7.6100000000000007e-05, -3.2100000000000000e-04,
-1.1708999999999999e-03, -3.7967999999999999e-03, -1.1230700000000000e-02,
-2.9927700000000002e-02, -7.1270600000000003e-02, -1.4031360000000001e-01,
-2.0307629999999999e-01, -9.6098500000000003e-02, 3.5580859999999997e-01,
5.9217920000000002e-01, 2.2159770000000001e-01, 1.3764800000000001e-02,
8.3949999999999997e-04, -4.5099999999999998e-05, -8.4999999999999999e-06,
-1.2400000000000000e-05, 6.9999999999999997e-07, 5.6999999999999996e-06,
3.0300000000000001e-05, 1.2750000000000001e-04, 4.6589999999999999e-04,
1.5096000000000000e-03, 4.4852000000000000e-03, 1.1983499999999999e-02,
2.8957100000000000e-02, 5.8156600000000003e-02, 8.8813299999999998e-02,
4.4524399999999999e-02, -2.0603869999999999e-01, -5.1270170000000004e-01,
-1.5093490000000001e-01, 6.7892030000000003e-01, 5.8176969999999995e-01,
4.6755499999999998e-02, -1.1182500000000000e-02, 2.4402000000000000e-03,
-1.9999999999999999e-07, -1.7999999999999999e-06, -9.3000000000000007e-06,
-3.9100000000000002e-05, -1.4280000000000000e-04, -4.6279999999999997e-04,
-1.3749999999999999e-03, -3.6784000000000001e-03, -8.8981000000000008e-03,
-1.7952900000000001e-02, -2.7573199999999999e-02, -1.4095300000000000e-02,
6.7256099999999999e-02, 1.7669280000000001e-01, 5.2886099999999998e-02,
-3.0759550000000002e-01, -4.7006579999999998e-01, 2.5587610000000000e-01,
6.9803409999999999e-01, 2.9672559999999998e-01, 1.0000000000000000e+00,
1.0000000000000000e+00, 1.0000000000000000e+00, 4.3570000000000002e-04,
3.7815000000000001e-03, 2.0478199999999998e-02, 7.9283400000000004e-02,
2.1784729999999999e-01, 3.8785849999999999e-01, 3.5943500000000000e-01,
1.1219949999999999e-01, 4.3873999999999996e-03, 1.7809000000000000e-03,
-4.5760000000000001e-04, 2.1220000000000001e-04, -7.3399999999999995e-05,
-1.7479999999999999e-04, -1.5263000000000000e-03, -8.3399000000000008e-03,
-3.3220300000000001e-02, -9.5418000000000003e-02, -1.8240260000000000e-01,
-1.5583079999999999e-01, 1.8678990000000001e-01, 5.4277330000000001e-01,
3.8733089999999998e-01, 4.5306899999999997e-02, -4.3784000000000002e-03,
1.8110999999999999e-03, 4.5099999999999998e-05, 3.9639999999999999e-04,
2.1554999999999999e-03, 8.6719999999999992e-03, 2.4868000000000001e-02,
4.8547199999999999e-02, 3.9615600000000001e-02, -6.0574900000000001e-02,
-1.8716990000000000e-01, -1.3777570000000000e-01, 2.9280210000000001e-01,
5.7608959999999998e-01, 3.0786170000000002e-01, 1.0000000000000000e+00,
1.0000000000000000e+00, 1.0000000000000000e+00, 1.4732000000000000e-03,
1.2672500000000000e-02, 5.8045100000000002e-02, 1.7051030000000000e-01,
3.1859579999999998e-01, 3.8450230000000002e-01, 2.7377370000000001e-01,
7.4396699999999996e-02, 1.0000000000000000e+00, 1.0000000000000000e+00,
1.0000000000000000e+00, 1.0000000000000000e+00, 1.0000000000000000e+00};
double chbrclf_basis_prim_factor[chbrclf_prim_num] =
{6.1616545431994848e+02, 1.4847738511079908e+02, 4.8888635917437597e+01,
1.8933972232608955e+01, 8.1089160941724145e+00, 3.7024003863155635e+00,
1.7525302846177560e+00, 6.6179013183966806e-01, 3.3419848027174592e-01,
1.5296336817449557e-01, 6.1616545431994848e+02, 1.4847738511079908e+02,
4.8888635917437597e+01, 1.8933972232608955e+01, 8.1089160941724145e+00,
3.7024003863155635e+00, 1.7525302846177560e+00, 6.6179013183966806e-01,
3.3419848027174592e-01, 1.5296336817449557e-01, 6.6179013183966806e-01,
1.5296336817449557e-01, 6.8493225861981921e-02, 5.5466699238441954e+01,
8.3998560685400019e+00, 1.7902622143452276e+00, 4.2905519588435126e-01,
1.0161854305479753e-01, 4.2905519588435126e-01, 1.0161854305479753e-01,
2.2111758010684022e-02, 1.9354014159719681e+00, 2.2164447815916102e-01,
2.9269105913429974e-02, 7.9628755341813429e-01, 7.6077763383300537e-02,
1.0006253235944540e+01, 2.4169531573445120e+00, 7.9610924849766440e-01,
3.0734305383061117e-01, 1.2929684417481876e-01, 3.0734305383061117e-01,
1.2929684417481876e-01, 4.5158041868216925e-02, 2.1842769845268308e+00,
4.3649547399719840e-01, 8.2165651391863506e-02, 1.8135965626177861e+00,
1.4243906834168285e-01, 1.1760777961352585e+03, 2.8332291650568584e+02,
9.3278452222064189e+01, 3.6112790320330610e+01, 1.5483603491420400e+01,
7.0961811262237955e+00, 3.3743135718917610e+00, 1.3123774561862465e+00,
6.4837584903810197e-01, 2.9185854115641796e-01, 1.1760777961352585e+03,
2.8332291650568584e+02, 9.3278452222064189e+01, 3.6112790320330610e+01,
1.5483603491420400e+01, 7.0961811262237955e+00, 3.3743135718917610e+00,
1.3123774561862465e+00, 6.4837584903810197e-01, 2.9185854115641796e-01,
1.3123774561862465e+00, 2.9185854115641796e-01, 1.1864804090515012e-01,
1.6098053319659394e+02, 2.5113539500925100e+01, 5.4641751683240054e+00,
1.2724697488890255e+00, 2.7383291850797253e-01, 1.2724697488890255e+00,
2.7383291850797253e-01, 5.4652635549581594e-02, 1.1967588544907814e+01,
1.2512674783228661e+00, 1.9091033786232964e-01, 6.3658177914201666e+00,
7.1181350527019893e-01, 1.2508497509090121e+04, 3.0120949486045815e+03,
9.9244828879919498e+02, 3.8536256746518035e+02, 1.6651589181438584e+02,
7.7653861740552273e+01, 3.8343569039456206e+01, 1.9768076572700657e+01,
1.0518202315565855e+01, 5.6561481770276556e+00, 2.8455658258813377e+00,
1.4986778401686554e+00, 7.0026807980299932e-01, 3.7931034358525295e-01,
1.8241061862759339e-01, 1.2508497509090121e+04, 3.0120949486045815e+03,
9.9244828879919498e+02, 3.8536256746518035e+02, 1.6651589181438584e+02,
7.7653861740552273e+01, 3.8343569039456206e+01, 1.9768076572700657e+01,
1.0518202315565855e+01, 5.6561481770276556e+00, 2.8455658258813377e+00,
1.4986778401686554e+00, 7.0026807980299932e-01, 3.7931034358525295e-01,
1.8241061862759339e-01, 1.2508497509090121e+04, 3.0120949486045815e+03,
9.9244828879919498e+02, 3.8536256746518035e+02, 1.6651589181438584e+02,
7.7653861740552273e+01, 3.8343569039456206e+01, 1.9768076572700657e+01,
1.0518202315565855e+01, 5.6561481770276556e+00, 2.8455658258813377e+00,
1.4986778401686554e+00, 7.0026807980299932e-01, 3.7931034358525295e-01,
1.8241061862759339e-01, 7.0026807980299932e-01, 1.8241061862759339e-01,
8.5428091252337218e-02, 4.7981915824835833e+03, 7.9090197643220097e+02,
1.8942417420993877e+02, 5.4394140688380837e+01, 1.6928298001679121e+01,
5.4455324755334713e+00, 1.4647169510384077e+00, 4.2779429930932966e-01,
1.1137474138247395e-01, 4.7981915824835833e+03, 7.9090197643220097e+02,
1.8942417420993877e+02, 5.4394140688380837e+01, 1.6928298001679121e+01,
5.4455324755334713e+00, 1.4647169510384077e+00, 4.2779429930932966e-01,
1.1137474138247395e-01, 1.4647169510384077e+00, 1.1137474138247395e-01,
2.7021385701525968e-02, 1.7806964960637739e+00, 2.5432363995130330e-01,
4.9487276238674341e-02, 6.7261264398159915e-01, 1.0710316041250582e-01,
1.3276564169936487e+05, 3.1963453883259335e+04, 1.0531492549479324e+04,
4.0887252186430137e+03, 1.7648322054568350e+03, 8.2188420053589937e+02,
4.0558653897685440e+02, 2.0958978573126603e+02, 1.1245348234327012e+02,
6.2266827352587455e+01, 3.5414274108483511e+01, 2.0520014948183928e+01,
1.1178864762092555e+01, 6.5457935075374944e+00, 3.8278369835025656e+00,
2.0760505305870112e+00, 1.1531599898261422e+00, 4.8873770086696849e-01,
2.8972530369835303e-01, 1.4996269365355971e-01, 1.3276564169936487e+05,
3.1963453883259335e+04, 1.0531492549479324e+04, 4.0887252186430137e+03,
1.7648322054568350e+03, 8.2188420053589937e+02, 4.0558653897685440e+02,
2.0958978573126603e+02, 1.1245348234327012e+02, 6.2266827352587455e+01,
3.5414274108483511e+01, 2.0520014948183928e+01, 1.1178864762092555e+01,
6.5457935075374944e+00, 3.8278369835025656e+00, 2.0760505305870112e+00,
1.1531599898261422e+00, 4.8873770086696849e-01, 2.8972530369835303e-01,
1.4996269365355971e-01, 1.3276564169936487e+05, 3.1963453883259335e+04,
1.0531492549479324e+04, 4.0887252186430137e+03, 1.7648322054568350e+03,
8.2188420053589937e+02, 4.0558653897685440e+02, 2.0958978573126603e+02,
1.1245348234327012e+02, 6.2266827352587455e+01, 3.5414274108483511e+01,
2.0520014948183928e+01, 1.1178864762092555e+01, 6.5457935075374944e+00,
3.8278369835025656e+00, 2.0760505305870112e+00, 1.1531599898261422e+00,
4.8873770086696849e-01, 2.8972530369835303e-01, 1.4996269365355971e-01,
1.3276564169936487e+05, 3.1963453883259335e+04, 1.0531492549479324e+04,
4.0887252186430137e+03, 1.7648322054568350e+03, 8.2188420053589937e+02,
4.0558653897685440e+02, 2.0958978573126603e+02, 1.1245348234327012e+02,
6.2266827352587455e+01, 3.5414274108483511e+01, 2.0520014948183928e+01,
1.1178864762092555e+01, 6.5457935075374944e+00, 3.8278369835025656e+00,
2.0760505305870112e+00, 1.1531599898261422e+00, 4.8873770086696849e-01,
2.8972530369835303e-01, 1.4996269365355971e-01, 4.8873770086696849e-01,
1.4996269365355971e-01, 7.0320786489653203e-02, 1.1936329579215313e+05,
1.9732975244933248e+04, 4.8247000542937221e+03, 1.4389816948051262e+03,
4.8549709936386239e+02, 1.7654297142185436e+02, 6.7240804881705529e+01,
2.5247705079657806e+01, 9.3867385006594475e+00, 3.3864040992879496e+00,
9.2879798315626561e-01, 2.9220769881703862e-01, 8.2205930646140513e-02,
1.1936329579215313e+05, 1.9732975244933248e+04, 4.8247000542937221e+03,
1.4389816948051262e+03, 4.8549709936386239e+02, 1.7654297142185436e+02,
6.7240804881705529e+01, 2.5247705079657806e+01, 9.3867385006594475e+00,
3.3864040992879496e+00, 9.2879798315626561e-01, 2.9220769881703862e-01,
8.2205930646140513e-02, 1.1936329579215313e+05, 1.9732975244933248e+04,
4.8247000542937221e+03, 1.4389816948051262e+03, 4.8549709936386239e+02,
1.7654297142185436e+02, 6.7240804881705529e+01, 2.5247705079657806e+01,
9.3867385006594475e+00, 3.3864040992879496e+00, 9.2879798315626561e-01,
2.9220769881703862e-01, 8.2205930646140513e-02, 9.2879798315626561e-01,
8.2205930646140513e-02, 2.1688183591227813e-02, 5.9876577632594533e+04,
7.2836806319891484e+03, 1.3549226646722386e+03, 3.0376315094739988e+02,
7.4924579607137730e+01, 1.8590543353806009e+01, 4.4423176930919421e+00,
8.9541051939952665e-01, 8.9541051939952665e-01, 1.5992942988584680e-01,
3.1718756222897104e-02, 3.8586186799894789e-01, 6.9839124768946298e-02};
#+end_src
** TODO Molecular orbitals
** Electron coordinates
Electron coordinates are stored in atomic units in normal format.

View File

@ -7,7 +7,7 @@ Name: @PACKAGE_NAME@
Description: Quantum Monte Carlo kernel library
URL: https://github.com/trex-coe/qmckl
Version: @PACKAGE_VERSION@
Cflags: -I${includedir} @PKG_CFLAGS@
Libs: -L${libdir} -lqmckl @PKG_LIBS@
Requires: @PKG_BLAS@
Cflags: -I${includedir}
Libs: -L${libdir} -lqmckl
Libs.private: @PKG_LIBS@

View File

@ -19,7 +19,7 @@ function extract_doc()
html=${DOCS}/html/$(basename ${org%.org}.html)
text=${DOCS}/text/$(basename ${org%.org}.txt)
./missing emacs --batch \
./tools/missing emacs --batch \
--load ${HTMLIZE} \
--load ${CONFIG_DOC} \
${org} \
@ -34,8 +34,9 @@ function extract_doc()
for i in $@
do
exported=${i%.org}.exported
exported=$(dirname $exported)/.$(basename $exported)
NOW=$(date +"%m%d%H%M.%S")
extract_doc ${i} &> $exported
extract_doc ${i} > $exported
# Make log file older than the exported files
touch -t ${NOW} $exported

View File

@ -33,8 +33,8 @@ def main():
for org in glob("org/*.org"):
i = org.split('/')[-1].rsplit(".",1)[0]
tangled = "org/"+i+".tangled"
exported = "org/"+i+".exported"
tangled = "org/."+i+".tangled"
exported = "org/."+i+".exported"
c_test_x = "tests/test_"+i
c_test_o = "tests/test_"+i+".$(OBJEXT)"
f_test_o = "tests/test_"+i+"_f.$(OBJEXT)"

View File

@ -2,7 +2,7 @@
#
# Installs the htmlize Emacs plugin
./missing git clone "https://github.com/hniksic/emacs-htmlize"
./tools/missing git clone "https://github.com/hniksic/emacs-htmlize"
mv emacs-htmlize/htmlize.el $1
rm -rf emacs-htmlize

View File

@ -20,17 +20,17 @@
** Table of function arguments
#+NAME: test
| qmckl_context | context | in | Global state |
| char | transa | in | Array ~A~ is ~'N'~: Normal, ~'T'~: Transposed |
| char | transb | in | Array ~B~ is ~'N'~: Normal, ~'T'~: Transposed |
| int64_t | m | in | Number of points in the first set |
| int64_t | n | in | Number of points in the second set |
| double | A[][lda] | in | Array containing the $m \times 3$ matrix $A$ |
| int64_t | lda | in | Leading dimension of array ~A~ |
| double | B[][ldb] | in | Array containing the $n \times 3$ matrix $B$ |
| int64_t | ldb | in | Leading dimension of array ~B~ |
| double | C[n][ldc] | out | Array containing the $m \times n$ matrix $C$ |
| int64_t | ldc | in | Leading dimension of array ~C~ |
| ~qmckl_context~ | ~context~ | in | Global state |
| ~char~ | ~transa~ | in | Array ~A~ is ~'N'~: Normal, ~'T'~: Transposed |
| ~char~ | ~transb~ | in | Array ~B~ is ~'N'~: Normal, ~'T'~: Transposed |
| ~int64_t~ | ~m~ | in | Number of points in the first set |
| ~int64_t~ | ~n~ | in | Number of points in the second set |
| ~double~ | ~A[][lda]~ | in | Array containing the $m \times 3$ matrix $A$ |
| ~int64_t~ | ~lda~ | in | Leading dimension of array ~A~ |
| ~double~ | ~B[][ldb]~ | in | Array containing the $n \times 3$ matrix $B$ |
| ~int64_t~ | ~ldb~ | in | Leading dimension of array ~B~ |
| ~double~ | ~C[n][ldc]~ | out | Array containing the $m \times n$ matrix $C$ |
| ~int64_t~ | ~ldc~ | in | Leading dimension of array ~C~ |
*** Fortran-C type conversions
@ -48,11 +48,6 @@ f_of_c_d = { '' : ''
}
#+END_SRC
#+RESULTS: f_of_c
#+begin_src f90 :tangle (eval f) :comments org :exports none
None
#+end_src
#+NAME:c_of_f
#+BEGIN_SRC python :var table=test :var rettyp="integer" :var fname=[] :results value :noweb yes :wrap "src f90 :tangle (eval f) :comments org :exports none"
ctypeid_d = { '' : ''
@ -66,11 +61,6 @@ ctypeid_d = { '' : ''
}
#+END_SRC
#+RESULTS: c_of_f
#+begin_src f90 :tangle (eval f) :comments org :exports none
None
#+end_src
*** Parse the table
#+NAME: parse_table
@ -78,7 +68,7 @@ ctypeid_d = { '' : ''
def parse_table(table):
result = []
for line in table:
for line in [ [x.replace('~','') for x in y] for y in table]:
d = { "c_type" : line[0],
"inout" : line[2].lower(),
"name" : line[1],
@ -106,10 +96,11 @@ def parse_table(table):
return result
#+END_SRC
*** Generates a C header
#+NAME: generate_c_header
#+BEGIN_SRC python :var table=[] :var rettyp=[] :var fname=[] :results drawer :noweb yes :wrap "src c :tangle (eval h_func) :comments org"
#+BEGIN_SRC python :var table=test :var rettyp=[] :var fname=[] :results drawer :noweb yes :wrap "src c :tangle (eval h_func) :comments org"
<<parse_table>>
results = []
@ -139,21 +130,6 @@ return template
#+END_SRC
#+RESULTS: generate_c_header
#+begin_src c :tangle (eval h_func) :comments org
[] [] (
const qmckl_context context,
const char transa,
const char transb,
const int64_t m,
const int64_t n,
const double* const A,
const int64_t lda,
const double* const B,
const int64_t ldb,
double* const C,
const int64_t ldc );
#+end_src
*** Generates a C interface to the Fortran function
@ -165,6 +141,9 @@ return template
d = parse_table(table)
args = ", ".join([ x["name"] for x in d ])
if len(args) > 100:
args = args.replace(",",""", &
""")
rettyp_c = ctypeid_d[rettyp.lower()]
@ -208,6 +187,23 @@ results='\n'.join(results)
return results
#+END_SRC
#+RESULTS: generate_c_interface
#+begin_src f90 :tangle (eval f) :comments org :exports none
integer(c_int32_t) function [] &
() &
bind(C) result(info)
use, intrinsic :: iso_c_binding
implicit none
integer(c_int32_t), external :: []_f
info = []_f &
()
end function []
#+end_src
*** Generates a Fortran interface to the C function
#+NAME: generate_f_interface
@ -261,27 +257,5 @@ return results
#+RESULTS: generate_f_interface
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
interface
integer(c_int32_t) function [] &
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc) &
bind(C)
use, intrinsic :: iso_c_binding
import
implicit none
integer (qmckl_context), intent(in) , value :: context
character , intent(in) , value :: transa
character , intent(in) , value :: transb
integer (c_int64_t) , intent(in) , value :: m
integer (c_int64_t) , intent(in) , value :: n
real (c_double ) , intent(in) :: A(lda,3)
integer (c_int64_t) , intent(in) , value :: lda
real (c_double ) , intent(in) :: B(ldb,3)
integer (c_int64_t) , intent(in) , value :: ldb
real (c_double ) , intent(out) :: C(ldc,n)
integer (c_int64_t) , intent(in) , value :: ldc
end function []
end interface
#+end_src

View File

@ -24,7 +24,7 @@ function tangle()
elif [[ ${org_file} -ot ${f_file} ]] ; then
return
fi
./missing \
./tools/missing \
emacs --batch ${org_file} \
--load=${PWD}/tools/config_tangle.el \
-f org-babel-tangle
@ -33,8 +33,9 @@ function tangle()
for i in $@
do
tangled=${i%.org}.tangled
tangled=$(dirname $tangled)/.$(basename $tangled)
NOW=$(date +"%m%d%H%M.%S")
tangle ${i} &> $tangled
tangle ${i} > $tangled
# Make log file older than the tangled files
touch -t ${NOW} $tangled

View File

@ -6,7 +6,7 @@
#+INFOJS_OPT: toc:t mouse:underline path:org-info.js
#+HTML_HEAD: <link rel="stylesheet" title="Standard" href="qmckl.css" type="text/css" />
#+STARTUP: align fold nodlcheck hidestars oddeven lognotestate
#+STARTUP: align fold nodlcheck hidestars oddeven lognotestate latexpreview
#+AUTHOR: TREX CoE
#+LANGUAGE: en