tests/test_internal_h5 and test_external_h5 updated to use replacement updates instead of additive updates.

This commit is contained in:
François Coppens 2021-03-12 16:18:03 +01:00
parent 6012b9decf
commit 4e7c4de0e8
3 changed files with 15 additions and 8 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;