From 8640002ff179ab4b0c25a8b8f529b9f435ec270c Mon Sep 17 00:00:00 2001
From: Abdullah Alperen <alperena@msu.edu>
Date: Mon, 31 Dec 2018 23:21:52 -0500
Subject: [PATCH] PuReMD: fix the allocation size of one of the arrays needed
 for SAI computation

---
 PuReMD/src/linear_solvers.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/PuReMD/src/linear_solvers.c b/PuReMD/src/linear_solvers.c
index 39d2d427..d1ad369b 100644
--- a/PuReMD/src/linear_solvers.c
+++ b/PuReMD/src/linear_solvers.c
@@ -1235,7 +1235,12 @@ real sparse_approx_inverse( reax_system *system, simulation_data *data,
 
     X = smalloc( sizeof(int) * (system->bigN + 1),
             "sparse_approx_inverse::X", MPI_COMM_WORLD );
-    q = smalloc( sizeof(int) * system->N * 2,
+    //size of q should be equal to the maximum possible cardinalty 
+    //of the set formed by neighbors of neighbors of an atom
+    //i.e, maximum number of rows of dense matrix
+    //for water systems, this number is 34000
+    //for silica systems, it is 12000
+    q = smalloc( sizeof(int) * 50000,
             "sparse_approx_inverse::q", MPI_COMM_WORLD );
 
     for ( i = 0; i <= system->bigN; ++i )
-- 
GitLab