aestimosolver / aestimo

Aestimo 1D Schrödinger-Poisson Solver
https://aestimosolver.github.io
GNU General Public License v3.0
52 stars 23 forks source link

"numpy.linalg.linalg.LinAlgError: Singular matrix" error #14

Closed sblisesivdin closed 4 years ago

sblisesivdin commented 4 years ago

For example, when I try to run sample_qw_barrierdope_ingan_2 it gives an error:

Predictor–corrector method is activated Convergence of the Gummel cycles Va_t[ 0 ]=0.00 /mnt/c/Users/sblisesivdin/Documents/GitHub/aestimo/func_lib.py:114: RuntimeWarning: invalid value encountered in log phip = V + np.log(p) Traceback (most recent call last): File "aestimo_eh.py", line 4624, in run_aestimo(inputfile) File "aestimo_eh.py", line 4587, in run_aestimo result_dd = Poisson_Schrodinger_DD_test_2(result, model) File "aestimo_eh.py", line 3968, in Poisson_Schrodinger_DD_test_2 ni, fi_e, fi_h, xin, odata, toll, maxit, verbose, model, Vt File "/mnt/c/Users/sblisesivdin/Documents/GitHub/aestimo/DDNnewtonmap.py", line 154, in DDNnewtonmap dutmp= np.linalg.solve(LHS, RHS)#, rcond=None)[0] File "/usr/lib/python3/dist-packages/numpy/linalg/linalg.py", line 375, in solve r = gufunc(a, b, signature=signature, extobj=extobj) File "/usr/lib/python3/dist-packages/numpy/linalg/linalg.py", line 90, in _raise_linalgerror_singular raise LinAlgError("Singular matrix") numpy.linalg.linalg.LinAlgError: Singular matrix

h-hebal commented 4 years ago

The error was rectified by reordering the structure from n-p to p-n , removing the warning from func_lib.py file and gradually inserting piezoelectric charge to poisson equation in the Newton DD solver (with good grid size avoid gradually inserting piezoelectric charge).