From 4e7c4de0e85576ba40369c7b34aed447d42878c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Coppens?= Date: Fri, 12 Mar 2021 16:18:03 +0100 Subject: [PATCH] tests/test_internal_h5 and test_external_h5 updated to use replacement updates instead of additive updates. --- tests/QMCChem_dataset_test.f90 | 2 +- tests/test_external_h5.cpp | 10 +++++++--- tests/test_internal_h5.cpp | 11 +++++++---- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/tests/QMCChem_dataset_test.f90 b/tests/QMCChem_dataset_test.f90 index e7b507d..a3811db 100644 --- a/tests/QMCChem_dataset_test.f90 +++ b/tests/QMCChem_dataset_test.f90 @@ -77,5 +77,5 @@ program QMCChem_dataset_test close(4000) close(5000) - deallocate(S, S_inv, S_inv_t, Updates, Updates_index) + deallocate(S, S_inv, S_inv_t, Updates, U, Updates_index) end program diff --git a/tests/test_external_h5.cpp b/tests/test_external_h5.cpp index f775510..44c4a5d 100644 --- a/tests/test_external_h5.cpp +++ b/tests/test_external_h5.cpp @@ -47,6 +47,9 @@ int test_cycle(H5File file, int cycle) { double * updates = new double[nupdates*dim]; read_double(file, group + "/updates", updates); + double * u = new double[nupdates*dim]; + + /* Test */ #ifdef DEBUG showMatrix(slater_matrix, dim, "OLD Slater"); @@ -59,12 +62,13 @@ int test_cycle(H5File file, int cycle) { for (j = 0; j < nupdates; j++) { for (i = 0; i < dim; i++) { col = col_update_index[j]; - slater_matrix[i*dim + (col - 1)] += updates[i + j*dim]; + u[i + j*dim] = updates[i + j*dim] - slater_matrix[i*dim + (col - 1)]; + slater_matrix[i*dim + (col - 1)] = updates[i + j*dim]; } } //MaponiA3(slater_inverse, dim, nupdates, updates, col_update_index); - SM(slater_inverse, dim, nupdates, updates, col_update_index); + SM(slater_inverse, dim, nupdates, u, col_update_index); #ifdef DEBUG showMatrix(slater_matrix, dim, "NEW Slater"); @@ -82,7 +86,7 @@ int test_cycle(H5File file, int cycle) { showMatrix(res, dim, "Result"); #endif - delete [] res, updates, col_update_index, + delete [] res, updates, u, col_update_index, slater_matrix, slater_inverse; return ok; diff --git a/tests/test_internal_h5.cpp b/tests/test_internal_h5.cpp index 1ed3075..5d55804 100644 --- a/tests/test_internal_h5.cpp +++ b/tests/test_internal_h5.cpp @@ -8,7 +8,7 @@ #include "Helpers.hpp" using namespace H5; -//#define DEBUG +// #define DEBUG const H5std_string FILE_NAME( "datasets.hdf5" ); @@ -47,6 +47,8 @@ int test_cycle(H5File file, int cycle) { double * updates = new double[nupdates*dim]; read_double(file, group + "/updates", updates); + double * u = new double[nupdates*dim]; + /* Test */ #ifdef DEBUG showMatrix(slater_matrix, dim, "OLD Slater"); @@ -59,11 +61,12 @@ int test_cycle(H5File file, int cycle) { for (j = 0; j < nupdates; j++) { for (i = 0; i < dim; i++) { col = col_update_index[j]; - slater_matrix[i*dim + (col - 1)] += updates[i + j*dim]; + u[i + j*dim] = updates[i + j*dim] - slater_matrix[i*dim + (col - 1)]; + slater_matrix[i*dim + (col - 1)] = updates[i + j*dim]; } } - MaponiA3(slater_inverse, dim, nupdates, updates, col_update_index); + MaponiA3(slater_inverse, dim, nupdates, u, col_update_index); //SM(slater_inverse, dim, nupdates, updates, col_update_index); #ifdef DEBUG @@ -82,7 +85,7 @@ int test_cycle(H5File file, int cycle) { showMatrix(res, dim, "Result"); #endif - delete [] res, updates, col_update_index, + delete [] res, updates, u, col_update_index, slater_matrix, slater_inverse; return ok;