1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-07-23 03:07:46 +02:00

Reorganising ORG file.

This commit is contained in:
Francois Coppens 2023-02-13 15:08:37 +01:00
parent 6ad4aabdfa
commit c0d4f766b1

View File

@ -465,7 +465,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context,
} }
#+end_src #+end_src
** Fortran interface ** Fortran interfaces (exposed in qmckl_f.F90)
:PROPERTIES: :PROPERTIES:
:Name: qmckl_sherman_morrison_naive :Name: qmckl_sherman_morrison_naive
:CRetType: qmckl_exit_code :CRetType: qmckl_exit_code
@ -550,64 +550,64 @@ interface
end interface end interface
#+end_src #+end_src
** Test ** Tests
The tests for the kernels are executed on datasets that are extracted from a run of The tests for the kernels are executed on datasets that are extracted from a run of
QMC=Chem on Benzene (21 spin-up/21 spin down electrons) using 329 unique alpha determinants. QMC=Chem on Benzene (21 spin-up/21 spin down electrons) using 329 unique alpha determinants.
The tests are run such that the kernels reject the computed inverse whenever the computed The tests are run such that the kernels reject the computed inverse whenever the computed
intermediate determinants or denominators are smaller than 1e-3. This is the default value in intermediate determinants or denominators are smaller than 1e-3. This is the default value in
QMC=Chem. The tests will return QMCKL_SUCCESS whenever all the elements of the final matrix QMC=Chem. The tests will return QMCKL_SUCCESS whenever all the elements of the final matrix
$R=S.S^-1 - 1$ are smaller than the given tolerance value of 1e-3, and will return $R=S.S^-1 - 1$ are smaller than the given tolerance value of 1e-3, and will return
QMCKL_FAILURE if the values are larger than this tolerance value. QMCKL_FAILURE if the values are larger than this tolerance value.
#+begin_src c :tangle (eval c_test) #+begin_src c :tangle (eval c_test)
const uint64_t Dim = 21; const uint64_t Dim = 21;
const uint64_t LDS = (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH; const uint64_t LDS = (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH;
const double breakdown = 1e-3; const double breakdown = 1e-3;
const double tolerance = 1e-3; const double tolerance = 1e-3;
double res[441]; double res[441];
#include "sm_test.h" #include "sm_test.h"
assert(Updates1 != NULL); assert(Updates1 != NULL);
assert(Updates_index1 != NULL); assert(Updates_index1 != NULL);
assert(Slater_inv1 != NULL); assert(Slater_inv1 != NULL);
// original determinant of Slater1 (before applying updates) // original determinant of Slater1 (before applying updates)
double det = 3.407025646103221e-10; double det = 3.407025646103221e-10;
rc = qmckl_sherman_morrison_naive(context, rc = qmckl_sherman_morrison_naive(context,
LDS, LDS,
Dim, Dim,
N_updates1, N_updates1,
Updates1, Updates1,
Updates_index1, Updates_index1,
breakdown, breakdown,
Slater_inv1, Slater_inv1,
&det); &det);
// Check that the determinant is updated properly // Check that the determinant is updated properly
assert(fabs(det + 4.120398385068217e-10) < 1e-15); assert(fabs(det + 4.120398385068217e-10) < 1e-15);
for (unsigned int i = 0; i < Dim; i++) { for (unsigned int i = 0; i < Dim; i++) {
for (unsigned int j = 0; j < Dim; j++) { for (unsigned int j = 0; j < Dim; j++) {
res[i * Dim + j] = 0; res[i * Dim + j] = 0;
for (unsigned int k = 0; k < Dim; k++) { for (unsigned int k = 0; k < Dim; k++) {
res[i * Dim + j] += Slater1[i * Dim + k] * Slater_inv1[k * LDS + j]; res[i * Dim + j] += Slater1[i * Dim + k] * Slater_inv1[k * LDS + j];
}
}
} }
rc = QMCKL_SUCCESS; }
for (unsigned int i = 0; i < Dim; i++) { }
for (unsigned int j = 0; j < Dim; j++) { rc = QMCKL_SUCCESS;
if (i == j && fabs(res[i * Dim + j] - 1) > tolerance) { for (unsigned int i = 0; i < Dim; i++) {
rc = QMCKL_FAILURE; for (unsigned int j = 0; j < Dim; j++) {
} if (i == j && fabs(res[i * Dim + j] - 1) > tolerance) {
if (i != j && fabs(res[i * Dim + j]) > tolerance) { rc = QMCKL_FAILURE;
rc = QMCKL_FAILURE;
}
}
} }
assert(rc == QMCKL_SUCCESS); if (i != j && fabs(res[i * Dim + j]) > tolerance) {
#+end_src rc = QMCKL_FAILURE;
}
}
}
assert(rc == QMCKL_SUCCESS);
#+end_src
* End of files * End of files