Commit ff270126 authored by peastman's avatar peastman Committed by GitHub
Browse files

Merge pull request #1652 from peastman/singular

Handle singular matrix in DIIS
parents 5f509089 ca4bbc18
......@@ -776,6 +776,15 @@ extern "C" __global__ void solveDIISMatrix(int iteration, const real* __restrict
for (int i = j+1; i < rank; i++)
b[i][j] /= b[j][j];
}
for (int i = 0; i < rank; i++)
if (b[i][i] == 0) {
// The matrix is singular.
for (int j = 0; j < rank-1; j++)
coefficients[j] = 0;
coefficients[rank-1] = 1;
return;
}
// Solve b*Y = X(piv)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment