mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2025-01-03 18:16:28 +01:00
Correct tests and put C(2,2) in distance probes
Since we don't need to place probs on all matrices, a simple solution seems to monitor one element of the matrix. A solution could be to compute a matrix norm / residual but this would make the tests more complex.
This commit is contained in:
parent
cbf1bd8de8
commit
ce24885979
@ -65,10 +65,6 @@ gradients and Laplacian of the atomic basis functions.
|
||||
int main() {
|
||||
qmckl_context context;
|
||||
context = qmckl_context_create();
|
||||
|
||||
#ifdef VFC_CI
|
||||
vfc_probes probes = vfc_init_probes();
|
||||
#endif
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval c)
|
||||
@ -1742,11 +1738,8 @@ end function qmckl_ao_gaussian_vgl
|
||||
|
||||
# Test
|
||||
#+begin_src f90 :tangle (eval f_test)
|
||||
#ifdef VFC_CI
|
||||
integer(c_int32_t) function test_qmckl_ao_gaussian_vgl(context, probes) bind(C)
|
||||
#else
|
||||
integer(c_int32_t) function test_qmckl_ao_gaussian_vgl(context) bind(C)
|
||||
#endif
|
||||
|
||||
use qmckl
|
||||
use qmckl_probes_f
|
||||
|
||||
@ -1755,11 +1748,6 @@ integer(c_int32_t) function test_qmckl_ao_gaussian_vgl(context) bind(C)
|
||||
integer(c_int64_t), intent(in), value :: context
|
||||
logical(C_BOOL) :: vfc_err
|
||||
|
||||
#ifdef VFC_CI
|
||||
type(vfc_probes) :: probes
|
||||
integer(C_INT) :: vfc_err
|
||||
#endif
|
||||
|
||||
integer*8 :: n, ldv, j, i
|
||||
double precision :: X(3), R(3), Y(3), r2
|
||||
double precision, allocatable :: VGL(:,:), A(:)
|
||||
@ -1788,7 +1776,6 @@ integer(c_int32_t) function test_qmckl_ao_gaussian_vgl(context) bind(C)
|
||||
DBLE(test_qmckl_ao_gaussian_vgl))
|
||||
|
||||
if (test_qmckl_ao_gaussian_vgl /= 0) return
|
||||
#endif
|
||||
|
||||
test_qmckl_ao_gaussian_vgl = -1
|
||||
|
||||
@ -1828,13 +1815,8 @@ end function test_qmckl_ao_gaussian_vgl
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval c_test) :exports none
|
||||
#ifdef VFC_CI
|
||||
int test_qmckl_ao_gaussian_vgl(qmckl_context context, vfc_probes * probes);
|
||||
assert(0 == test_qmckl_ao_gaussian_vgl(context, &probes));
|
||||
#else
|
||||
int test_qmckl_ao_gaussian_vgl(qmckl_context context);
|
||||
assert(0 == test_qmckl_ao_gaussian_vgl(context));
|
||||
#endif
|
||||
#+end_src
|
||||
|
||||
** TODO General functions for Slater basis functions
|
||||
@ -2821,9 +2803,6 @@ end function qmckl_ao_power_f
|
||||
*** Test
|
||||
|
||||
#+begin_src f90 :tangle (eval f_test)
|
||||
#ifdef VFC_CI
|
||||
integer(c_int32_t) function test_qmckl_ao_power(context, probes) bind(C)
|
||||
#else
|
||||
integer(c_int32_t) function test_qmckl_ao_power(context) bind(C)
|
||||
|
||||
use qmckl
|
||||
@ -2833,7 +2812,6 @@ integer(c_int32_t) function test_qmckl_ao_power(context) bind(C)
|
||||
|
||||
logical(C_BOOL) :: vfc_err
|
||||
|
||||
|
||||
integer(qmckl_context), intent(in), value :: context
|
||||
|
||||
integer*8 :: n, LDP
|
||||
@ -2860,7 +2838,6 @@ integer(c_int32_t) function test_qmckl_ao_power(context) bind(C)
|
||||
DBLE(test_qmckl_ao_power))
|
||||
|
||||
if (test_qmckl_ao_power /= QMCKL_SUCCESS) return
|
||||
#endif
|
||||
|
||||
test_qmckl_ao_power = QMCKL_FAILURE
|
||||
|
||||
@ -2880,13 +2857,8 @@ end function test_qmckl_ao_power
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval c_test) :exports none
|
||||
#ifdef VFC_CI
|
||||
int test_qmckl_ao_power(qmckl_context context, vfc_probes * probes);
|
||||
assert(0 == test_qmckl_ao_power(context, &probes));
|
||||
#else
|
||||
int test_qmckl_ao_power(qmckl_context context);
|
||||
assert(0 == test_qmckl_ao_power(context));
|
||||
#endif
|
||||
#+end_src
|
||||
|
||||
** General functions for Value, Gradient and Laplacian of a polynomial
|
||||
@ -3168,11 +3140,7 @@ end function qmckl_ao_polynomial_vgl_f
|
||||
*** Test
|
||||
|
||||
#+begin_src f90 :tangle (eval f_test)
|
||||
#ifdef VFC_CI
|
||||
integer(c_int32_t) function test_qmckl_ao_polynomial_vgl(context, probes) bind(C)
|
||||
#else
|
||||
integer(c_int32_t) function test_qmckl_ao_polynomial_vgl(context) bind(C)
|
||||
#endif
|
||||
use qmckl
|
||||
use qmckl_probes_f
|
||||
|
||||
@ -3181,11 +3149,6 @@ integer(c_int32_t) function test_qmckl_ao_polynomial_vgl(context) bind(C)
|
||||
integer(c_int64_t), intent(in), value :: context
|
||||
logical(C_BOOL) :: vfc_err
|
||||
|
||||
#ifdef VFC_CI
|
||||
type(vfc_probes) :: probes
|
||||
integer(C_INT) :: vfc_err
|
||||
#endif
|
||||
|
||||
integer :: lmax, d, i
|
||||
integer, allocatable :: L(:,:)
|
||||
integer*8 :: n, ldl, ldv, j
|
||||
@ -3216,7 +3179,6 @@ integer(c_int32_t) function test_qmckl_ao_polynomial_vgl(context) bind(C)
|
||||
|
||||
if (test_qmckl_ao_polynomial_vgl /= QMCKL_SUCCESS) return
|
||||
if (n /= d) return
|
||||
#endif
|
||||
|
||||
#ifdef VFC_CI
|
||||
do j=1,n
|
||||
@ -3278,13 +3240,8 @@ end function test_qmckl_ao_polynomial_vgl
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval c_test)
|
||||
#ifdef VFC_CI
|
||||
int test_qmckl_ao_polynomial_vgl(qmckl_context context, vfc_probes * probes);
|
||||
assert(0 == test_qmckl_ao_polynomial_vgl(context, &probes));
|
||||
#else
|
||||
int test_qmckl_ao_polynomial_vgl(qmckl_context context);
|
||||
assert(0 == test_qmckl_ao_polynomial_vgl(context));
|
||||
#endif
|
||||
#+end_src
|
||||
|
||||
* Combining radial and polynomial parts
|
||||
@ -3801,10 +3758,6 @@ assert( fabs(ao_vgl[1][0][26][224] - ( -3.843864637762753e-09)) < 1.e-14 );
|
||||
rc = qmckl_context_destroy(context);
|
||||
assert (rc == QMCKL_SUCCESS);
|
||||
|
||||
#ifdef VFC_CI
|
||||
vfc_dump_probes(&probes);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
#+end_src
|
||||
|
@ -16,16 +16,10 @@ Functions for the computation of distances between particles.
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#ifdef VFC_CI
|
||||
#include <vfc_probes.h>
|
||||
#endif
|
||||
int main() {
|
||||
qmckl_context context;
|
||||
context = qmckl_context_create();
|
||||
|
||||
#ifdef VFC_CI
|
||||
vfc_probes probes = vfc_init_probes();
|
||||
#endif
|
||||
|
||||
#+end_src
|
||||
|
||||
@ -302,12 +296,6 @@ integer(qmckl_exit_code) function test_qmckl_distance_sq(context) bind(C)
|
||||
integer(qmckl_context), intent(in), value :: context
|
||||
logical(C_BOOL) :: vfc_err
|
||||
|
||||
|
||||
#ifdef VFC_CI
|
||||
type(vfc_probes) :: probes
|
||||
integer(C_INT) :: vfc_err
|
||||
#endif
|
||||
|
||||
double precision, allocatable :: A(:,:), B(:,:), C(:,:)
|
||||
integer*8 :: m, n, LDA, LDB, LDC
|
||||
double precision :: x
|
||||
@ -319,8 +307,6 @@ integer(qmckl_exit_code) function test_qmckl_distance_sq(context) bind(C)
|
||||
LDB = n
|
||||
LDC = 5
|
||||
|
||||
print *, "Entering test 1"
|
||||
|
||||
allocate( A(LDA,m), B(LDB,n), C(LDC,n) )
|
||||
|
||||
do j=1,m
|
||||
@ -337,25 +323,22 @@ integer(qmckl_exit_code) function test_qmckl_distance_sq(context) bind(C)
|
||||
test_qmckl_distance_sq = &
|
||||
qmckl_distance_sq(context, 'X', 't', m, n, A, LDA, B, LDB, C, LDC)
|
||||
|
||||
vfc_err = qmckl_probe("distance", "distance_sq_Xt", DBLE(test_qmckl_distance_sq))
|
||||
vfc_err = qmckl_probe("distance", "distance_sq_Xt", DBLE(C(2,2)))
|
||||
|
||||
if (test_qmckl_distance_sq == 0) return
|
||||
#endif
|
||||
|
||||
test_qmckl_distance_sq = &
|
||||
qmckl_distance_sq(context, 't', 'X', m, n, A, LDA, B, LDB, C, LDC)
|
||||
|
||||
|
||||
vfc_err = qmckl_probe("distance", "distance_sq_tX", DBLE(test_qmckl_distance_sq))
|
||||
vfc_err = qmckl_probe("distance", "distance_sq_tX", DBLE(C(2,2)))
|
||||
|
||||
if (test_qmckl_distance_sq == 0) return
|
||||
#endif
|
||||
|
||||
|
||||
test_qmckl_distance_sq = &
|
||||
qmckl_distance_sq(context, 'T', 't', m, n, A, LDA, B, LDB, C, LDC)
|
||||
|
||||
vfc_err = qmckl_probe("distance", "distance_sq_Tt", DBLE(test_qmckl_distance_sq))
|
||||
vfc_err = qmckl_probe("distance", "distance_sq_Tt", DBLE(C(2,2)))
|
||||
|
||||
if (test_qmckl_distance_sq == 0) return
|
||||
|
||||
@ -376,7 +359,7 @@ integer(qmckl_exit_code) function test_qmckl_distance_sq(context) bind(C)
|
||||
test_qmckl_distance_sq = &
|
||||
qmckl_distance_sq(context, 'n', 'T', m, n, A, LDA, B, LDB, C, LDC)
|
||||
|
||||
vfc_err = qmckl_probe("distance", "distance_sq_nT", DBLE(test_qmckl_distance_sq))
|
||||
vfc_err = qmckl_probe("distance", "distance_sq_nT", DBLE(C(2,2)))
|
||||
|
||||
if (test_qmckl_distance_sq == 0) return
|
||||
|
||||
@ -397,7 +380,7 @@ integer(qmckl_exit_code) function test_qmckl_distance_sq(context) bind(C)
|
||||
test_qmckl_distance_sq = &
|
||||
qmckl_distance_sq(context, 'T', 'n', m, n, A, LDA, B, LDB, C, LDC)
|
||||
|
||||
vfc_err = qmckl_probe("distance", "distance_sq_Tn", DBLE(test_qmckl_distance_sq))
|
||||
vfc_err = qmckl_probe("distance", "distance_sq_Tn", DBLE(C(2,2)))
|
||||
|
||||
if (test_qmckl_distance_sq == 0) return
|
||||
|
||||
@ -418,7 +401,7 @@ integer(qmckl_exit_code) function test_qmckl_distance_sq(context) bind(C)
|
||||
test_qmckl_distance_sq = &
|
||||
qmckl_distance_sq(context, 'n', 'N', m, n, A, LDA, B, LDB, C, LDC)
|
||||
|
||||
vfc_err = qmckl_probe("distance", "distance_sq_nN", DBLE(test_qmckl_distance_sq))
|
||||
vfc_err = qmckl_probe("distance", "distance_sq_nN", DBLE(C(2,2)))
|
||||
|
||||
if (test_qmckl_distance_sq == 0) return
|
||||
|
||||
@ -777,23 +760,21 @@ integer(qmckl_exit_code) function test_qmckl_dist(context) bind(C)
|
||||
test_qmckl_dist = &
|
||||
qmckl_distance(context, 'X', 't', m, n, A, LDA, B, LDB, C, LDC)
|
||||
|
||||
vfc_err = qmckl_probe("distance", "distance_Xt", DBLE(test_qmckl_dist))
|
||||
vfc_err = qmckl_probe("distance", "distance_Xt", DBLE(C(2,2)))
|
||||
|
||||
if (test_qmckl_dist == 0) return
|
||||
#endif
|
||||
|
||||
test_qmckl_dist = &
|
||||
qmckl_distance(context, 't', 'X', m, n, A, LDA, B, LDB, C, LDC)
|
||||
|
||||
vfc_err = qmckl_probe("distance", "distance_tX", DBLE(test_qmckl_dist))
|
||||
vfc_err = qmckl_probe("distance", "distance_tX", DBLE(C(2,2)))
|
||||
|
||||
if (test_qmckl_dist == 0) return
|
||||
#endif
|
||||
|
||||
test_qmckl_dist = &
|
||||
qmckl_distance(context, 'T', 't', m, n, A, LDA, B, LDB, C, LDC)
|
||||
|
||||
vfc_err = qmckl_probe("distance", "distance_Tt", DBLE(test_qmckl_dist))
|
||||
vfc_err = qmckl_probe("distance", "distance_Tt", DBLE(C(2,2)))
|
||||
|
||||
if (test_qmckl_dist == 0) return
|
||||
|
||||
@ -814,7 +795,7 @@ integer(qmckl_exit_code) function test_qmckl_dist(context) bind(C)
|
||||
test_qmckl_dist = &
|
||||
qmckl_distance(context, 'n', 'T', m, n, A, LDA, B, LDB, C, LDC)
|
||||
|
||||
vfc_err = qmckl_probe("distance", "distance_nT", DBLE(test_qmckl_dist))
|
||||
vfc_err = qmckl_probe("distance", "distance_nT", DBLE(C(2,2)))
|
||||
|
||||
if (test_qmckl_dist == 0) return
|
||||
|
||||
@ -835,7 +816,7 @@ integer(qmckl_exit_code) function test_qmckl_dist(context) bind(C)
|
||||
test_qmckl_dist = &
|
||||
qmckl_distance(context, 'T', 'n', m, n, A, LDA, B, LDB, C, LDC)
|
||||
|
||||
vfc_err = qmckl_probe("distance", "distance_Tn", DBLE(test_qmckl_dist))
|
||||
vfc_err = qmckl_probe("distance", "distance_Tn", DBLE(C(2,2)))
|
||||
|
||||
if (test_qmckl_dist == 0) return
|
||||
|
||||
@ -856,7 +837,7 @@ integer(qmckl_exit_code) function test_qmckl_dist(context) bind(C)
|
||||
test_qmckl_dist = &
|
||||
qmckl_distance(context, 'n', 'N', m, n, A, LDA, B, LDB, C, LDC)
|
||||
|
||||
vfc_err = qmckl_probe("distance", "distance_nN", DBLE(test_qmckl_dist))
|
||||
vfc_err = qmckl_probe("distance", "distance_nN", DBLE(C(2,2)))
|
||||
|
||||
if (test_qmckl_dist == 0) return
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user