diff --git a/Makefile b/Makefile index 2312bec..b47b608 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ ## Compilers ARCH = -CXX = clang++ +CXX = clang++-7 FC = flang-7 H5CXX = h5c++ diff --git a/datasets/datasets.small.dat b/datasets/dataset.small.dat similarity index 100% rename from datasets/datasets.small.dat rename to datasets/dataset.small.dat diff --git a/datasets/datasets.small.hdf5 b/datasets/dataset.small.hdf5 similarity index 100% rename from datasets/datasets.small.hdf5 rename to datasets/dataset.small.hdf5 diff --git a/src/SM_MaponiA3.cpp b/src/SM_MaponiA3.cpp index 786da30..0d55188 100644 --- a/src/SM_MaponiA3.cpp +++ b/src/SM_MaponiA3.cpp @@ -103,8 +103,7 @@ void MaponiA3(double *Slater_inv, unsigned int Dim, cout << endl; #endif if (fabs(beta) < 1e-6) { - cout << "Break-down occured. Exiting..." << endl; - exit(1); + cerr << "Break-down occured." << endl; } // Compute intermediate update to Slater_inv diff --git a/src/SM_Standard.cpp b/src/SM_Standard.cpp index 6a7a9d8..7d8d3fb 100644 --- a/src/SM_Standard.cpp +++ b/src/SM_Standard.cpp @@ -113,7 +113,7 @@ void SM2(double *Slater_inv, unsigned int Dim, unsigned int N_updates, void SM3(double *Slater_inv, unsigned int Dim, unsigned int N_updates, double *Updates, unsigned int *Updates_index) { - std::cerr << "Called SM2 with updates " << N_updates << std::endl; + std::cerr << "Called SM3 with updates " << N_updates << std::endl; double C[Dim]; double D[Dim]; diff --git a/tests/test_internal_h5.cpp b/tests/test_internal_h5.cpp index 4fb2e42..a819749 100644 --- a/tests/test_internal_h5.cpp +++ b/tests/test_internal_h5.cpp @@ -10,8 +10,18 @@ using namespace H5; // #define DEBUG -const H5std_string FILE_NAME( "datasets.hdf5" ); +const H5std_string FILE_NAME( "dataset.hdf5" ); +double residual_max(double * A, unsigned int Dim) { + double max= 0.0; + for (unsigned int i = 0; i < Dim; i++) { + for (unsigned int j = 0; j < Dim; j++) { + double delta = (A[i * Dim + j] - (i == j)); + if (delta > max) max = delta; + } + } + return max; +} double residual2(double * A, unsigned int Dim) { double res = 0.0; @@ -51,7 +61,7 @@ int test_cycle(H5File file, int cycle, std::string version) { double * slater_inverse = new double[dim*dim]; read_double(file, group + "/slater_inverse", slater_inverse); - slater_inverse = transpose(slater_inverse, dim); + //slater_inverse = transpose(slater_inverse, dim); unsigned int * col_update_index = new unsigned int[nupdates]; read_int(file, group + "/col_update_index", col_update_index); @@ -91,7 +101,6 @@ int test_cycle(H5File file, int cycle, std::string version) { exit(1); } - #ifdef DEBUG showMatrix(slater_matrix, dim, "NEW Slater"); #endif @@ -104,8 +113,9 @@ int test_cycle(H5File file, int cycle, std::string version) { matMul(slater_matrix, slater_inverse, res, dim); bool ok = is_identity(res, dim, 1e-3); + double res_max = residual_max(res, dim); double res2 = residual2(res, dim); - std::cout << "Residual = " << version << " " << cycle << " " << res2 << std::endl; + std::cout << "Residual = " << version << " " << cycle << " " << res_max << " " << res2 << std::endl; #ifdef DEBUG showMatrix(res, dim, "Result"); diff --git a/tools/convert-to-h5.py b/tools/convert-to-h5.py index e3dcaf9..c98aea6 100644 --- a/tools/convert-to-h5.py +++ b/tools/convert-to-h5.py @@ -6,8 +6,8 @@ def rl(rf): return " ".join(rf.readline().split()) -with h5py.File('datasets.hdf5', 'w') as f: - with open('datasets.dat', 'r') as rf: +with h5py.File('dataset.hdf5', 'w') as f: + with open('dataset.dat', 'r') as rf: while(1): line = rl(rf) if not line or not line.startswith('#START_PACKET'): @@ -23,7 +23,7 @@ with h5py.File('datasets.hdf5', 'w') as f: for i in range(slater_matrix_dim*slater_matrix_dim): res = parse('({i:d},{j:d}) {sla:e} {inv:e}', rl(rf)) slater_matrix[res['i']-1, res['j']-1] = res['sla'] - slater_inverse[res['i']-1, res['j']-1] = res['inv'] + slater_inverse[res['j']-1, res['i']-1] = res['inv'] # Read updates col_update_index = np.zeros(nupdates, dtype='i')