mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2025-04-30 12:24:49 +02:00
some conflicts later...
This commit is contained in:
commit
538a929632
18
.github/workflows/test-build.yml
vendored
18
.github/workflows/test-build.yml
vendored
@ -33,7 +33,7 @@ jobs:
|
||||
./autogen.sh
|
||||
mkdir _build
|
||||
cd _build
|
||||
../configure --enable-silent-rules --enable-python
|
||||
../configure --enable-python
|
||||
make -j 4
|
||||
sudo make install
|
||||
|
||||
@ -45,8 +45,8 @@ jobs:
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: test-report-ubuntu
|
||||
path: test-suite.log
|
||||
name: qmckl-standard
|
||||
path: _build/test-suite.log
|
||||
|
||||
- name: Dist test
|
||||
run: make distcheck
|
||||
@ -94,7 +94,7 @@ jobs:
|
||||
./autogen.sh
|
||||
mkdir _build_debug
|
||||
cd _build_debug
|
||||
../configure --enable-debug --enable-silent-rules
|
||||
../configure --enable-debug --disable-doc
|
||||
make -j2
|
||||
|
||||
- name: Run test
|
||||
@ -105,7 +105,7 @@ jobs:
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: test-report-ubuntu-debug
|
||||
name: qmckl-debug
|
||||
path: _build_debug/test-suite.log
|
||||
|
||||
hpc:
|
||||
@ -124,7 +124,7 @@ jobs:
|
||||
git clone https://github.com/TREX-CoE/trexio.git
|
||||
cd trexio
|
||||
./autogen.sh
|
||||
./configure --prefix=/usr
|
||||
./configure --prefix=/usr
|
||||
make -j 4
|
||||
sudo make install
|
||||
|
||||
@ -133,7 +133,7 @@ jobs:
|
||||
./autogen.sh
|
||||
mkdir _build_hpc
|
||||
cd _build_hpc
|
||||
../configure --enable-hpc
|
||||
../configure --enable-hpc --disable-doc
|
||||
make -j2
|
||||
|
||||
- name: Run test
|
||||
@ -144,7 +144,7 @@ jobs:
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: test-report-ubuntu-debug
|
||||
name: qmckl-hpc
|
||||
path: _build_hpc/test-suite.log
|
||||
|
||||
macos:
|
||||
@ -189,6 +189,6 @@ jobs:
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: test-report-macos-x86
|
||||
name: qmckl-macos-x86
|
||||
path: _build_hpc/test-suite.log
|
||||
|
||||
|
@ -48,6 +48,7 @@ qmckl_h = include/qmckl.h
|
||||
qmckl_f = include/qmckl_f.F90
|
||||
qmckl_fo = include/qmckl_f.o
|
||||
include_HEADERS = $(qmckl_h) $(qmckl_f)
|
||||
test_headers = include/chbrclf.h include/n2.h
|
||||
|
||||
QMCKL_TEST_DIR = $(abs_srcdir)/share/qmckl/test_data/
|
||||
|
||||
@ -76,7 +77,7 @@ ln_s_verbose_0 = @echo " LN_S $<";
|
||||
|
||||
# Include Guix manifest in the source code distribution tarball
|
||||
tools_qmckl_scm = tools/qmckl.scm
|
||||
EXTRA_DIST += $(tools_qmckl_scm)
|
||||
EXTRA_DIST += $(tools_qmckl_scm) $(test_headers)
|
||||
|
||||
# Documentation rules
|
||||
if HAVE_DOC
|
||||
|
13
configure.ac
13
configure.ac
@ -55,7 +55,7 @@ AC_ARG_WITH([ifort],
|
||||
|
||||
AS_IF([test "x$with_ifort" = "xyes"], [
|
||||
FC=ifort
|
||||
FCFLAGS="-march=native -ip -Ofast -ftz -finline -g -mkl=sequential" ])
|
||||
FCFLAGS="-march=native -ip -O3 -finline -g -mkl=sequential" ])
|
||||
|
||||
# Intel C compiler
|
||||
AC_ARG_WITH([icx],
|
||||
@ -66,7 +66,7 @@ AC_ARG_WITH([icx],
|
||||
|
||||
AS_IF([test "x$with_icx" = "xyes"], [
|
||||
CC=icx
|
||||
CFLAGS="-march=native -Ofast -finline -g -qmkl=sequential" ])
|
||||
CFLAGS="-march=native -O3 -finline -g -qmkl=sequential" ])
|
||||
|
||||
AS_IF([test "x$with_icx.$with_ifort" = "xyes.yes"], [
|
||||
ax_blas_ok="yes"
|
||||
@ -82,7 +82,7 @@ AC_ARG_WITH([icc],
|
||||
|
||||
AS_IF([test "x$with_icc" = "xyes"], [
|
||||
CC=icc
|
||||
CFLAGS="-march=native -ip -Ofast -ftz -finline -g -mkl=sequential" ])
|
||||
CFLAGS="-march=native -ip -O3 -finline -g -mkl=sequential" ])
|
||||
|
||||
AS_IF([test "x$with_icc.$with_ifort" = "xyes.yes"], [
|
||||
ax_blas_ok="yes"
|
||||
@ -359,6 +359,13 @@ AS_IF([test "x$ok" = "xyes"], [
|
||||
])
|
||||
|
||||
|
||||
AC_ARG_ENABLE(sanitizer, [AS_HELP_STRING([--enable-sanitizer],[enable sanitizer debug flags])], ok=$enableval, ok=no)
|
||||
if test "$ok" = "yes"; then
|
||||
CFLAGS="${CFLAGS} -fsanitize=address -fsanitize=undefined -fsanitize=leak -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=bounds -fsanitize=bounds-strict"
|
||||
FCFLAGS="${FCFLAGS} -fsanitize=address -fsanitize=undefined -fsanitize=leak -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=bounds -fsanitize=bounds-strict"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
##
|
||||
|
||||
|
12
include/n2.h
12
include/n2.h
@ -10,7 +10,7 @@ double n2_nucl_coord[3][n2_nucl_num] =
|
||||
#define n2_elec_up_num ((int64_t) 5)
|
||||
#define n2_elec_dn_num ((int64_t) 5)
|
||||
#define n2_elec_num ((int64_t) 10)
|
||||
#define n2_walk_num ((int64_t) 1)
|
||||
#define n2_walk_num ((int64_t) 2)
|
||||
|
||||
double n2_elec_coord[n2_walk_num][n2_elec_num][3] = { {
|
||||
{-0.250655104764153 , 0.503070975550133 , -0.166554344502303},
|
||||
@ -22,6 +22,16 @@ double n2_elec_coord[n2_walk_num][n2_elec_num][3] = { {
|
||||
{-0.232271834949124 , -1.059321673434182E-002 , -0.504862241464867},
|
||||
{ 1.09360863531826 , -2.036103063808752E-003 , -2.702796910818986E-002},
|
||||
{-0.108090166832043 , 0.189161729653261 , 2.15398313919894},
|
||||
{ 0.397978144318712 , -0.254277292595981 , 2.54553335476344}},{
|
||||
{-0.108090166832043 , 0.189161729653261 , 2.15398313919894},
|
||||
{ 1.09360863531826 , -2.036103063808752E-003 , -2.702796910818986E-002},
|
||||
{-0.232271834949124 , -1.059321673434182E-002 , -0.504862241464867},
|
||||
{-0.127732483187947 , -0.138975497694196 , -8.669850480215846E-002},
|
||||
{ 0.766647499681200 , -0.293515395797937 , 3.66454589201239 },
|
||||
{-4.901239896295210E-003 , -1.120440036458986E-002 , 1.99761909330422 },
|
||||
{ 1.61335569047166 , -0.615556732874863 , -1.43165470979934 },
|
||||
{-0.587812193472177 , -0.128751981129274 , 0.187773606533075},
|
||||
{-0.250655104764153 , 0.503070975550133 , -0.166554344502303},
|
||||
{ 0.397978144318712 , -0.254277292595981 , 2.54553335476344}}};
|
||||
|
||||
/* Jastrow related */
|
||||
|
@ -678,25 +678,32 @@ for (int64_t i=0 ; i<3*elec_num*walk_num ; ++i) {
|
||||
*** Get
|
||||
|
||||
#+begin_src c :comments org :tangle (eval h_func) :noweb yes
|
||||
qmckl_exit_code qmckl_get_electron_ee_distance(qmckl_context context, double* const distance);
|
||||
qmckl_exit_code
|
||||
qmckl_get_electron_ee_distance(qmckl_context context,
|
||||
double* const distance,
|
||||
const int64_t size_max);
|
||||
#+end_src
|
||||
|
||||
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
||||
interface
|
||||
integer(c_int32_t) function qmckl_get_electron_ee_distance(context, distance) &
|
||||
integer(c_int32_t) function qmckl_get_electron_ee_distance(context, distance, size_max) &
|
||||
bind(C)
|
||||
use, intrinsic :: iso_c_binding
|
||||
import
|
||||
implicit none
|
||||
integer (c_int64_t) , intent(in) , value :: context
|
||||
real (c_double ) , intent(out) :: distance(*)
|
||||
integer (c_int64_t) , intent(in) :: size_max
|
||||
end function
|
||||
end interface
|
||||
#+end_src
|
||||
|
||||
|
||||
#+begin_src c :comments org :tangle (eval c) :noweb yes :exports none
|
||||
qmckl_exit_code qmckl_get_electron_ee_distance(qmckl_context context, double* const distance)
|
||||
qmckl_exit_code
|
||||
qmckl_get_electron_ee_distance(qmckl_context context,
|
||||
double* const distance,
|
||||
const int64_t size_max)
|
||||
{
|
||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
return QMCKL_NULL_CONTEXT;
|
||||
@ -707,10 +714,23 @@ qmckl_exit_code qmckl_get_electron_ee_distance(qmckl_context context, double* co
|
||||
rc = qmckl_provide_ee_distance(context);
|
||||
if (rc != QMCKL_SUCCESS) return rc;
|
||||
|
||||
if (distance == NULL) {
|
||||
return qmckl_failwith( context,
|
||||
QMCKL_INVALID_ARG_2,
|
||||
"qmckl_get_electron_ee_distance",
|
||||
"distance is a null pointer");
|
||||
}
|
||||
|
||||
qmckl_context_struct* const ctx = (qmckl_context_struct*) context;
|
||||
assert (ctx != NULL);
|
||||
|
||||
size_t sze = ctx->electron.num * ctx->electron.num * ctx->electron.walker.num;
|
||||
const int64_t sze = ctx->electron.num * ctx->electron.num * ctx->electron.walker.num;
|
||||
if (size_max < sze) {
|
||||
return qmckl_failwith( context,
|
||||
QMCKL_INVALID_ARG_3,
|
||||
"qmckl_get_electron_ee_distance",
|
||||
"size_max < num*num*walk_num");
|
||||
}
|
||||
memcpy(distance, ctx->electron.ee_distance, sze * sizeof(double));
|
||||
|
||||
return QMCKL_SUCCESS;
|
||||
@ -901,7 +921,7 @@ assert(qmckl_electron_provided(context));
|
||||
|
||||
|
||||
double ee_distance[walk_num * elec_num * elec_num];
|
||||
rc = qmckl_get_electron_ee_distance(context, ee_distance);
|
||||
rc = qmckl_get_electron_ee_distance(context, ee_distance, walk_num * elec_num * elec_num);
|
||||
|
||||
// (e1,e2,w)
|
||||
// (0,0,0) == 0.
|
||||
@ -1133,24 +1153,31 @@ qmckl_check(context, rc);
|
||||
*** Get
|
||||
|
||||
#+begin_src c :comments org :tangle (eval h_func) :noweb yes
|
||||
qmckl_exit_code qmckl_get_electron_en_distance(qmckl_context context, double* distance);
|
||||
qmckl_exit_code
|
||||
qmckl_get_electron_en_distance(qmckl_context context,
|
||||
double* const distance,
|
||||
const int64_t size_max);
|
||||
#+end_src
|
||||
|
||||
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
||||
interface
|
||||
integer(c_int32_t) function qmckl_get_electron_en_distance(context, distance) &
|
||||
integer(c_int32_t) function qmckl_get_electron_en_distance(context, distance, size_max) &
|
||||
bind(C)
|
||||
use, intrinsic :: iso_c_binding
|
||||
import
|
||||
implicit none
|
||||
integer (c_int64_t) , intent(in) , value :: context
|
||||
real (c_double ) , intent(out) :: distance(*)
|
||||
integer (c_int64_t) , intent(in) :: size_max
|
||||
end function
|
||||
end interface
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :comments org :tangle (eval c) :noweb yes :exports none
|
||||
qmckl_exit_code qmckl_get_electron_en_distance(qmckl_context context, double* distance)
|
||||
qmckl_exit_code
|
||||
qmckl_get_electron_en_distance(qmckl_context context,
|
||||
double* const distance,
|
||||
const int64_t size_max)
|
||||
{
|
||||
|
||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
@ -1165,7 +1192,20 @@ qmckl_exit_code qmckl_get_electron_en_distance(qmckl_context context, double* di
|
||||
qmckl_context_struct* const ctx = (qmckl_context_struct*) context;
|
||||
assert (ctx != NULL);
|
||||
|
||||
if (distance == NULL) {
|
||||
return qmckl_failwith( context,
|
||||
QMCKL_INVALID_ARG_2,
|
||||
"qmckl_get_electron_en_distance",
|
||||
"distance is a null pointer");
|
||||
}
|
||||
|
||||
size_t sze = ctx->point.num * ctx->nucleus.num;
|
||||
if (size_max < sze) {
|
||||
return qmckl_failwith( context,
|
||||
QMCKL_INVALID_ARG_3,
|
||||
"qmckl_get_electron_en_distance",
|
||||
"size_max < num*nucl_num");
|
||||
}
|
||||
memcpy(distance, ctx->electron.en_distance, sze * sizeof(double));
|
||||
|
||||
return QMCKL_SUCCESS;
|
||||
@ -1385,7 +1425,7 @@ assert(qmckl_nucleus_provided(context));
|
||||
|
||||
double en_distance[walk_num][elec_num][nucl_num];
|
||||
|
||||
rc = qmckl_get_electron_en_distance(context, &(en_distance[0][0][0]));
|
||||
rc = qmckl_get_electron_en_distance(context, &(en_distance[0][0][0]), walk_num * elec_num * nucl_num);
|
||||
qmckl_check(context, rc);
|
||||
|
||||
// (e,n,w) in Fortran notation
|
||||
|
@ -339,7 +339,7 @@ qmckl_exit_code qmckl_finite_difference_deriv_n(
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
double* nucleus_coord = (double*) malloc(3 * nucl_num * sizeof(double));
|
||||
if (nucleus_coord == NULL) {
|
||||
return QMCKL_ALLOCATION_FAILED;
|
||||
@ -352,7 +352,7 @@ qmckl_exit_code qmckl_finite_difference_deriv_n(
|
||||
free(nucleus_coord);
|
||||
return QMCKL_ALLOCATION_FAILED;
|
||||
}
|
||||
|
||||
|
||||
double* function_values = (double*) malloc(walk_num*size * sizeof(double));
|
||||
if (function_values == NULL) {
|
||||
free(nucleus_coord);
|
||||
@ -370,17 +370,17 @@ qmckl_exit_code qmckl_finite_difference_deriv_n(
|
||||
for (int64_t a = 0; a < nucl_num; a++) {
|
||||
for (int64_t k = 0; k < 3; k++) {
|
||||
for (int64_t m = -4; m <= 4; m++) {
|
||||
|
||||
|
||||
// Apply finite difference displacement
|
||||
temp_coord[k+a*3] = nucleus_coord[k+3*a] + (double) m * delta_x;
|
||||
|
||||
// Update coordinates in the context
|
||||
rc = qmckl_set_nucleus_coord(context, 'N', temp_coord, 3*nucl_num);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
|
||||
rc = qmckl_context_touch(context);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
|
||||
// Call the provided function
|
||||
rc = get_function(context, function_values, size);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
@ -400,10 +400,10 @@ qmckl_exit_code qmckl_finite_difference_deriv_n(
|
||||
// Reset coordinates in the context
|
||||
rc = qmckl_set_nucleus_coord(context, 'N', temp_coord, 3*nucl_num);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
|
||||
rc = qmckl_context_touch(context);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
|
||||
// Normalize by the step size
|
||||
for (int64_t i = 0; i < size*3*nucl_num*walk_num ; i++) {
|
||||
derivative_output[i] /= delta_x;
|
||||
@ -414,7 +414,7 @@ qmckl_exit_code qmckl_finite_difference_deriv_n(
|
||||
free(function_values);
|
||||
return QMCKL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
#+end_src
|
||||
|
||||
* Force of en jastrow value
|
||||
@ -1039,7 +1039,7 @@ function qmckl_compute_forces_jastrow_en_g_doc( &
|
||||
invdenom = 1.0d0 / denom
|
||||
invdenom2 = invdenom*invdenom
|
||||
f = a_vector(1, type_nucl_vector(a)+1) * invdenom2
|
||||
|
||||
|
||||
do m = 1, 3
|
||||
dx(m) = en_distance_rescaled_gl(m,i,a,nw)
|
||||
end do
|
||||
@ -1455,7 +1455,7 @@ function qmckl_compute_forces_jastrow_en_l_doc( &
|
||||
invdenom = 1.0d0 / denom
|
||||
invdenom2 = invdenom*invdenom
|
||||
f = a_vector(1, type_nucl_vector(a)+1) * invdenom2
|
||||
|
||||
|
||||
do m = 1, 4
|
||||
dx(m) = en_distance_rescaled_gl(m,i,a,nw)
|
||||
end do
|
||||
@ -1611,7 +1611,7 @@ for (int nw = 0; nw < walk_num; nw++){
|
||||
for (int k = 0; k < 3; k++){
|
||||
//printf("finite_difference_force_en_l_sum[%i][%i][%i] %+3.10f \n", nw,a,k,finite_difference_force_en_l_sum[nw][a][k]);
|
||||
//printf("forces_jastrow_en_l [%i][%i][%i] %+3.10f\n", nw,a,k,forces_jastrow_en_l[nw][a][k]);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1721,7 +1721,7 @@ qmckl_exit_code qmckl_provide_forces_tmp_c(qmckl_context context)
|
||||
if (ctx->forces.forces_tmp_c == NULL) {
|
||||
|
||||
qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero;
|
||||
mem_info.size = 4 * ctx->electron.num * ctx->jastrow_champ.cord_num *
|
||||
mem_info.size = 4 * ctx->electron.num * ctx->jastrow_champ.cord_num *
|
||||
(ctx->jastrow_champ.cord_num+1) * ctx->nucleus.num * ctx->electron.walker.num * sizeof(double);
|
||||
double* forces_tmp_c = (double*) qmckl_malloc(context, mem_info);
|
||||
|
||||
@ -1734,7 +1734,7 @@ qmckl_exit_code qmckl_provide_forces_tmp_c(qmckl_context context)
|
||||
ctx->forces.forces_tmp_c = forces_tmp_c;
|
||||
}
|
||||
|
||||
|
||||
|
||||
rc = qmckl_compute_forces_tmp_c(context,
|
||||
ctx->electron.walker.num,
|
||||
ctx->electron.num,
|
||||
@ -1872,19 +1872,21 @@ for (int i = 0; i < 3 * nucl_num; i++) {
|
||||
for (int64_t a = 0; a < nucl_num; a++) {
|
||||
for (int64_t k = 0; k < 3; k++) {
|
||||
for (int64_t m = -4; m <= 4; m++) {
|
||||
|
||||
|
||||
// Apply finite difference displacement
|
||||
temp_coord[k+a*3] = nucleus_coord[k+3*a] + (double) m * delta_x;
|
||||
|
||||
// Update coordinates in the context
|
||||
rc = qmckl_set_nucleus_coord(context, 'N', temp_coord, 3*nucl_num);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
|
||||
rc = qmckl_context_touch(context);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
|
||||
// Call the provided function
|
||||
rc = qmckl_get_jastrow_champ_tmp_c(context,&output[0][0][0][0][0]);
|
||||
rc = qmckl_get_jastrow_champ_tmp_c(context,
|
||||
&output[0][0][0][0][0],
|
||||
4*nucl_num*walk_num*elec_num*(cord_num+1)*cord_num);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
// Accumulate derivative using finite-difference coefficients
|
||||
@ -1912,7 +1914,7 @@ assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
rc = qmckl_context_touch(context);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
|
||||
free(nucleus_coord);
|
||||
free(temp_coord);
|
||||
|
||||
@ -1926,7 +1928,7 @@ for (int nw = 0; nw < walk_num; nw++){
|
||||
//printf("nw=%i l=%i m=%i a=%i k=%i i=%i\n",nw,l,m,a,k,i);
|
||||
//printf("%.10f\t", finite_difference_force_tmp_c[nw][l][m][a][k][i]);
|
||||
//printf("%.10f\n", forces_tmp_c[nw][l][m][a][k][i]);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2047,7 +2049,7 @@ qmckl_exit_code qmckl_provide_forces_dtmp_c(qmckl_context context)
|
||||
if (ctx->forces.forces_dtmp_c == NULL) {
|
||||
|
||||
qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero;
|
||||
mem_info.size = 4* 4 * ctx->electron.num * ctx->jastrow_champ.cord_num *
|
||||
mem_info.size = 4* 4 * ctx->electron.num * ctx->jastrow_champ.cord_num *
|
||||
(ctx->jastrow_champ.cord_num+1) * ctx->nucleus.num * ctx->electron.walker.num * sizeof(double);
|
||||
double* forces_dtmp_c = (double*) qmckl_malloc(context, mem_info);
|
||||
|
||||
@ -2060,7 +2062,7 @@ qmckl_exit_code qmckl_provide_forces_dtmp_c(qmckl_context context)
|
||||
ctx->forces.forces_dtmp_c = forces_dtmp_c;
|
||||
}
|
||||
|
||||
|
||||
|
||||
rc = qmckl_compute_forces_dtmp_c(context,
|
||||
ctx->electron.walker.num,
|
||||
ctx->electron.num,
|
||||
@ -2139,7 +2141,7 @@ integer(qmckl_exit_code) function qmckl_compute_forces_dtmp_c( &
|
||||
end do
|
||||
end do
|
||||
end do
|
||||
|
||||
|
||||
if (.true.) then
|
||||
do nw = 1, walk_num
|
||||
do l = 0, cord_num-1
|
||||
@ -2220,19 +2222,21 @@ for (int i = 0; i < 3 * nucl_num; i++) {
|
||||
for (int64_t a = 0; a < nucl_num; a++) {
|
||||
for (int64_t k = 0; k < 3; k++) {
|
||||
for (int64_t m = -4; m <= 4; m++) {
|
||||
|
||||
|
||||
// Apply finite difference displacement
|
||||
temp_coord[k+a*3] = nucleus_coord[k+3*a] + (double) m * delta_x;
|
||||
|
||||
// Update coordinates in the context
|
||||
rc = qmckl_set_nucleus_coord(context, 'N', temp_coord, 3*nucl_num);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
|
||||
rc = qmckl_context_touch(context);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
|
||||
// Call the provided function
|
||||
rc = qmckl_get_jastrow_champ_dtmp_c(context,&doutput[0][0][0][0][0][0]);
|
||||
rc = qmckl_get_jastrow_champ_dtmp_c(context,
|
||||
&doutput[0][0][0][0][0][0],
|
||||
4*4*nucl_num*walk_num*elec_num*(cord_num+1)*cord_num);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
// Accumulate derivative using finite-difference coefficients
|
||||
@ -2262,7 +2266,7 @@ assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
rc = qmckl_context_touch(context);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
|
||||
free(nucleus_coord);
|
||||
free(temp_coord);
|
||||
|
||||
@ -2279,7 +2283,7 @@ for (int nw = 0; nw < walk_num; nw++){
|
||||
//printf("%.10f\n", forces_dtmp_c[nw][l][m][k][a][kk][i]);
|
||||
//assert(fabs(finite_difference_force_dtmp_c[nw][l][m][k][a][kk][i] - forces_dtmp_c[nw][l][m][k][a][kk][i]) < 1.e-8);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2444,7 +2448,7 @@ qmckl_exit_code qmckl_provide_forces_jastrow_een(qmckl_context context)
|
||||
ctx->forces.forces_jastrow_een = forces_jastrow_een;
|
||||
}
|
||||
|
||||
|
||||
|
||||
rc = qmckl_compute_forces_jastrow_een(context,
|
||||
ctx->electron.walker.num,
|
||||
ctx->electron.num,
|
||||
@ -2458,7 +2462,7 @@ qmckl_exit_code qmckl_provide_forces_jastrow_een(qmckl_context context)
|
||||
ctx->jastrow_champ.tmp_c,
|
||||
ctx->forces.forces_tmp_c,
|
||||
ctx->forces.forces_jastrow_een);
|
||||
|
||||
|
||||
if (rc != QMCKL_SUCCESS) {
|
||||
return rc;
|
||||
}
|
||||
@ -2537,7 +2541,7 @@ integer(qmckl_exit_code) function qmckl_compute_forces_jastrow_een( &
|
||||
if(cn == 0.d0) cycle
|
||||
do j = 1, elec_num
|
||||
do ii = 1, 3
|
||||
accu = een_rescaled_n(j,a,m,nw) * forces_tmp_c(j,ii,a,m+l,k,nw)
|
||||
accu = een_rescaled_n(j,a,m,nw) * forces_tmp_c(j,ii,a,m+l,k,nw)
|
||||
accu = accu - een_rescaled_n_gl(j,ii,a,m,nw) * tmp_c(j,a,m+l,k,nw)
|
||||
|
||||
forces_jastrow_een(ii, a, nw) = forces_jastrow_een(ii, a, nw) + accu * cn
|
||||
@ -2769,7 +2773,7 @@ integer(qmckl_exit_code) function qmckl_compute_forces_een_rescaled_n_gl( &
|
||||
real (c_double ) , intent(in) :: rescale_factor_en(type_nucl_num)
|
||||
real (c_double ) , intent(in) :: en_distance(nucl_num,elec_num,walk_num)
|
||||
real (c_double ) , intent(in) :: een_rescaled_n(elec_num,nucl_num,0:cord_num,walk_num)
|
||||
real (c_double ) , intent(in) :: een_rescaled_n_gl(elec_num,4,nucl_num,0:cord_num,walk_num)
|
||||
real (c_double ) , intent(in) :: een_rescaled_n_gl(elec_num,4,nucl_num,0:cord_num,walk_num)
|
||||
real (c_double ) , intent(out) :: forces_een_n(elec_num,4,nucl_num,3,0:cord_num,walk_num)
|
||||
|
||||
double precision :: x, ria_inv, kappa_l
|
||||
@ -2905,17 +2909,17 @@ for (int i = 0; i < 3 * nucl_num; i++) {
|
||||
for (int64_t a = 0; a < nucl_num; a++) {
|
||||
for (int64_t k = 0; k < 3; k++) {
|
||||
for (int64_t m = -4; m <= 4; m++) {
|
||||
|
||||
|
||||
// Apply finite difference displacement
|
||||
temp_coord[k+a*3] = nucleus_coord[k+3*a] + (double) m * delta_x;
|
||||
|
||||
// Update coordinates in the context
|
||||
rc = qmckl_set_nucleus_coord(context, 'N', temp_coord, 3*nucl_num);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
|
||||
rc = qmckl_context_touch(context);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
|
||||
// Call the provided function
|
||||
rc = qmckl_get_jastrow_champ_een_rescaled_n_gl(context,&ddoutput[0][0][0][0][0], 4*elec_num*nucl_num*(cord_num+1)*walk_num);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
@ -2931,7 +2935,7 @@ for (int64_t a = 0; a < nucl_num; a++) {
|
||||
finite_difference_force_een_n[nw][l][k][a][j][i] += coef[m + 4] * ddoutput[nw][l][a][j][i]/delta_x;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2946,7 +2950,7 @@ assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
rc = qmckl_context_touch(context);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
|
||||
free(nucleus_coord);
|
||||
free(temp_coord);
|
||||
|
||||
@ -2962,7 +2966,7 @@ for (int nw = 0; nw < walk_num; nw++){
|
||||
//printf("%.10f\n", forces_een_n[nw][l][k][a][kk][i]);
|
||||
//assert(fabs(finite_difference_force_een_n[nw][l][k][a][kk][i] - forces_een_n[nw][l][k][a][kk][i]) < 1.e-6);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3957,7 +3961,7 @@ printf("OK\n");
|
||||
|
||||
* Force of AO value
|
||||
|
||||
Here we compute the forces of the AO value.
|
||||
Here we compute the forces of the AO value.
|
||||
|
||||
|
||||
** Get
|
||||
@ -4005,7 +4009,7 @@ qmckl_get_forces_ao_value(qmckl_context context,
|
||||
#+begin_src c :comments org :tangle (eval h_private_func) :noweb yes :exports none
|
||||
qmckl_exit_code qmckl_provide_forces_ao_value(qmckl_context context);
|
||||
#+end_src
|
||||
|
||||
|
||||
#+begin_src c :comments org :tangle (eval c) :noweb yes :exports none
|
||||
qmckl_exit_code qmckl_provide_forces_ao_value(qmckl_context context)
|
||||
{
|
||||
@ -4238,17 +4242,17 @@ for (int i = 0; i < 3 * nucl_num; i++) {
|
||||
for (int64_t a = 0; a < nucl_num; a++) {
|
||||
for (int64_t k = 0; k < 3; k++) {
|
||||
for (int64_t m = -4; m <= 4; m++) {
|
||||
|
||||
|
||||
// Apply finite difference displacement
|
||||
temp_coord[k+a*3] = nucleus_coord[k+3*a] + (double) m * delta_x;
|
||||
|
||||
// Update coordinates in the context
|
||||
rc = qmckl_set_nucleus_coord(context, 'N', temp_coord, 3*nucl_num);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
|
||||
rc = qmckl_context_touch(context);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
|
||||
// Call the provided function
|
||||
rc = qmckl_get_ao_basis_ao_value(context,&ao_output[0][0], point_num*ao_num);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
@ -4273,7 +4277,7 @@ assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
rc = qmckl_context_touch(context);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
|
||||
free(nucleus_coord);
|
||||
free(temp_coord);
|
||||
|
||||
@ -4523,7 +4527,7 @@ rc = qmckl_get_forces_mo_value(context, &forces_mo_value[0][0][0][0], 3*nucl_num
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
double finite_difference_force_mo_value[3][nucl_num][point_num][mo_num];
|
||||
printf("Mo num %i %i\n", mo_num, ao_num);
|
||||
printf("Mo num %ld %ld\n", mo_num, ao_num);
|
||||
|
||||
nucleus_coord = (double*) malloc(3 * nucl_num * sizeof(double));
|
||||
if (nucleus_coord == NULL) {
|
||||
@ -4549,17 +4553,17 @@ for (int i = 0; i < 3 * nucl_num; i++) {
|
||||
for (int64_t a = 0; a < nucl_num; a++) {
|
||||
for (int64_t k = 0; k < 3; k++) {
|
||||
for (int64_t m = -4; m <= 4; m++) {
|
||||
|
||||
|
||||
// Apply finite difference displacement
|
||||
temp_coord[k+a*3] = nucleus_coord[k+3*a] + (double) m * delta_x;
|
||||
|
||||
// Update coordinates in the context
|
||||
rc = qmckl_set_nucleus_coord(context, 'N', temp_coord, 3*nucl_num);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
|
||||
rc = qmckl_context_touch(context);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
|
||||
// Call the provided function
|
||||
rc = qmckl_get_mo_basis_mo_value(context,&mo_output[0][0], point_num*mo_num);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
@ -4584,7 +4588,7 @@ assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
rc = qmckl_context_touch(context);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
|
||||
free(nucleus_coord);
|
||||
free(temp_coord);
|
||||
|
||||
@ -4606,7 +4610,7 @@ for (int j = 0; j < mo_num; j++){
|
||||
printf("OK\n");
|
||||
|
||||
#+end_src
|
||||
|
||||
|
||||
|
||||
* End of files :noexport:
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -2,9 +2,6 @@
|
||||
|
||||
# -*- org-image-actual-width: 300 -*-
|
||||
|
||||
To modify the data of the tests, don't modify only this file. You will
|
||||
need to modify the files that are in the =include/= directory.
|
||||
|
||||
* CHBrClF
|
||||
|
||||
This test is the all-electron Hartree-Fock wave function of CHClBr,
|
||||
@ -970,15 +967,14 @@ double chbrclf_basis_prim_factor[chbrclf_prim_num] =
|
||||
#+end_src
|
||||
|
||||
** Molecular orbitals
|
||||
|
||||
The file is too large to be included in org-mode.
|
||||
|
||||
#+begin_src c
|
||||
#define chbrclf_mo_num ((int64_t) 224)
|
||||
double chbrclf_mo_coef[chbrclf_mo_num*chbrclf_ao_num] =
|
||||
{
|
||||
... see include/chbrclf.h
|
||||
... see tests/chbrclf.h
|
||||
}
|
||||
#+end_src
|
||||
|
||||
|
||||
** Electron coordinates
|
||||
|
||||
@ -1156,7 +1152,7 @@ N2
|
||||
|
||||
Nuclear coordinates are stored in atomic units in transposed format.
|
||||
|
||||
#+begin_src c
|
||||
#+begin_src c
|
||||
#define n2_nucl_num ((int64_t) 2)
|
||||
|
||||
double n2_charge[n2_nucl_num] = { 5., 5.};
|
||||
@ -1172,13 +1168,23 @@ double n2_nucl_coord[3][n2_nucl_num] =
|
||||
|
||||
Electron coordinates are stored in atomic units in normal format.
|
||||
|
||||
#+begin_src c
|
||||
#+begin_src c
|
||||
#define n2_elec_up_num ((int64_t) 5)
|
||||
#define n2_elec_dn_num ((int64_t) 5)
|
||||
#define n2_elec_num ((int64_t) 10)
|
||||
#define n2_walk_num ((int64_t) 1)
|
||||
#define n2_walk_num ((int64_t) 2)
|
||||
|
||||
double n2_elec_coord[n2_walk_num][n2_elec_num][3] = { {
|
||||
{-0.250655104764153 , 0.503070975550133 , -0.166554344502303},
|
||||
{-0.587812193472177 , -0.128751981129274 , 0.187773606533075},
|
||||
{ 1.61335569047166 , -0.615556732874863 , -1.43165470979934 },
|
||||
{-4.901239896295210E-003 , -1.120440036458986E-002 , 1.99761909330422 },
|
||||
{ 0.766647499681200 , -0.293515395797937 , 3.66454589201239 },
|
||||
{-0.127732483187947 , -0.138975497694196 , -8.669850480215846E-002},
|
||||
{-0.232271834949124 , -1.059321673434182E-002 , -0.504862241464867},
|
||||
{ 1.09360863531826 , -2.036103063808752E-003 , -2.702796910818986E-002},
|
||||
{-0.108090166832043 , 0.189161729653261 , 2.15398313919894},
|
||||
{ 0.397978144318712 , -0.254277292595981 , 2.54553335476344}},{
|
||||
{-0.250655104764153 , 0.503070975550133 , -0.166554344502303},
|
||||
{-0.587812193472177 , -0.128751981129274 , 0.187773606533075},
|
||||
{ 1.61335569047166 , -0.615556732874863 , -1.43165470979934 },
|
||||
@ -1197,7 +1203,7 @@ double n2_elec_coord[n2_walk_num][n2_elec_num][3] = { {
|
||||
This test is mainly for the Jastrow factor and was supplied by
|
||||
Ramon Panades Baruetta.
|
||||
|
||||
#+begin_src c
|
||||
#+begin_src c
|
||||
/* Jastrow related */
|
||||
|
||||
#define n2_type_nucl_num ((int64_t) 1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user