I am trying to do the band structure calculation considering the Spin Orbit Coupling but getting the following error:

Computing kpt #:    92
 total cpu time spent up to now is     3908.6 secs

 Computing kpt #:    93
 total cpu time spent up to now is     3955.6 secs

 Computing kpt #:    94

     Error in routine cdiaghg (463):    
     S matrix not positive definite     

I have tried doing this calculation with both PAW and Ultrasoft fully relativistic pseudopotential and getting the same error in both the cases. Before it I have already done the scf calculation without any error with both the pseudopotential. I have tried increasing the plane wave cutoff too, but still getting the same error.

The link for the scf, nscf input out file is here.

I am wondering why this is happening. I have already checked for the overlap of atoms in xcrysden but I don't think that is the problem cause then scf calculation would not have been done successfully. Please suggest me how can I remove this errors as I am dealing with it for last three days.
Thank you!

  • 1
    $\begingroup$ Did you try with diago_david_ndim=2? $\endgroup$
    – 147875
    Commented Oct 9, 2021 at 11:42
  • 1
    $\begingroup$ @147875 Nope, I do not know about it. Will it resolve this issue? $\endgroup$
    – UJM
    Commented Oct 9, 2021 at 12:26
  • 1
    $\begingroup$ May be, you should tweak the parameters. Read these articles QE-Developer Emails, QE bug, Research Gate. If still problem persists, try changing the diagonalization = 'cg' $\endgroup$
    – 147875
    Commented Oct 9, 2021 at 12:37
  • 1
    $\begingroup$ @147875 Thank you for providing links. I have already read the thread from research gate link and also tried with diagonalization = 'cg' but it didn't work for me. Let me try with diago_david_ndim=2 and revert back. $\endgroup$
    – UJM
    Commented Oct 9, 2021 at 12:48
  • 1
    $\begingroup$ We have a QE chatroom in case you need to chat a lot more! $\endgroup$ Commented Oct 9, 2021 at 16:34

1 Answer 1


This error has been resolved now. Though I am not an expert but here are few thoughts. There may be several reasons for this error:

  • This error might appear due to numerical instability from overlapping atoms.
  • As mentioned by @Phil Hasnip, if the S-matrix eigenvalues are really small.
  • Some pseudopotential may not fit with calculation, USPP giving non-positive charge density, leading to a violation of positiveness of the S matrix appearing in the USPP formalism or maybe the presence of the ghost states (I am not aware of these states)

These steps may help in resolving the issue:

  • Changing the pseudopotential file, it may be corrupted.
  • Set the higher ecutwfc and ecutrho values.
  • Changing the parameter diago_david_ndim to 2(or maybe increase to 8). Currently, the default value is 4.
  • Run the calculation with the diagonalization = 'cg' instead of default value davidson. cg diagonalization is more robust.

In my case, changing the value of diago_david_ndim to '2' has resolved the issue for 'davidson' diagonalization.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .