mirror of
https://github.com/TREX-CoE/Sherman-Morrison.git
synced 2024-08-25 14:41:45 +02:00
Merge pull request #20 from fmgjcoppens/tmp
- Moved transposing of Slater_inv to HDF5 conversion tool and removed…
This commit is contained in:
commit
3a99393e8f
2
Makefile
2
Makefile
@ -1,6 +1,6 @@
|
||||
## Compilers
|
||||
ARCH =
|
||||
CXX = clang++
|
||||
CXX = clang++-7
|
||||
FC = flang-7
|
||||
H5CXX = h5c++
|
||||
|
||||
|
@ -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
|
||||
|
@ -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];
|
||||
|
||||
|
@ -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");
|
||||
|
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user