Performing SCF calculations for crystal structures using Quantum Espresso sometimes gives me this error.

     Error in routine electrons (1):
     charge is wrong: smearing is needed

     stopping ...

I was able to resolve this by setting the value of the parameter nspin to 2 and specifying the tot_magnetization value obtained from the Materials Project database. If the crystal is metallic, it works if I set the occupation to smearing instead of fixed. In general, for crystals that are entirely unknown/synthetic and not present in any database, is there a way to determine if they have a spin, total magnetization, net charge and whether they are metallic or not? Will using software like USPEX (or any other tools) help in this regard? Just to clarify, I know the structure and composition of the unknown crystals. It is only the properties mentioned above which are not known.


An example of an input file that gives the above charge is wrong error when I perform SCF calculation. It's the Li₃(NiO₂)₄ crystal (mp-755972). The crystal is metallic in this case, but in general, I am not sure if there is a way to determine the metallicity, charge, and total magnetization

   calculation      = 'scf'
   verbosity        = 'high'
   nstep            = 1
   tstress          = .false.
   tprnfor          = .false.
   outdir           = 'out'
   prefix           = 'myprefix'
   pseudo_dir       = 'SSSP'
   ntyp             = 3
   nbnd             = 256
   ecutwfc          = 30
   ecutrho          = 240
   occupations      = 'fixed'
   degauss          = 0.001
   smearing         = 'gaussian'
   nspin            = 1
   nat              = 15
   ibrav            = 0
   electron_maxstep = 1000
   mixing_mode      = 'plain'
   mixing_beta      = 0.7
   diagonalization  = 'david'

Li 6.94 li_pbe_v1.4.uspp.F.UPF
Ni 58.6934 ni_pbe_v1.4.uspp.F.UPF
O 15.999 O.pbe-n-kjpaw_psl.0.1.UPF

K_POINTS automatic
3 3 3  0 0 0

5.61196941000000 0.00000000000000 0.00000000000000
-2.80568521479842 5.09575857245564 0.00000000000000
0.00017151044003 -3.27389010244342 4.79031051982104

Li -1.4027568522 0.9109342350 2.3951552599 
Li 0.0000857552 -1.6369450512 2.3951552599 
Li 2.8060704602 -1.6369450512 2.3951552599 
Ni 0.0001687046 -3.2738817328 4.7903057295 
Ni 2.8061534096 -3.2738817328 4.7903057295 
Ni 4.2091268020 2.5478690947 0.0000000000 
Ni 1.4031477097 2.5478760123 0.0000047903 
O -1.4025356006 2.5206534950 3.7297501417 
O 4.2089913062 -0.6987850249 1.0605603782 
O 4.2089946010 -2.3279785879 3.8047616141 
O -1.4025332834 4.1498470579 0.9855489057 
O -0.0249960414 -0.0151120810 3.7377787021 
O -0.0250827853 1.8368680471 1.0524503824 
O 2.8315328789 -0.0149995771 3.7378601374 
O 2.8314517468 1.8369838249 1.0525270274 
  • $\begingroup$ Could you please add the full input file you used as a code block? Also, you can use smearing for unknown materials. It is needed for metallic materials but does no/very little harm if you use it in a small amount for insulators. $\endgroup$ Commented Aug 31, 2023 at 5:14
  • $\begingroup$ I edited my question to include the input file. The issue with using smearing is that I cannot get the highest occupied and lowest unoccupied energies in the output file to compute the band gap. Is there a way to determine that with smearing option? $\endgroup$ Commented Aug 31, 2023 at 21:43
  • $\begingroup$ If it indeed has some metallic character, there will be no band gap, right? In case your material turns out to be an insulator and you used smearing, you can still find the band gap manually from the output file. A possibily easier way is to run a pw.x calculation with calculation='bands' and a bands.x calculation after completing the scf calculation to check the band gap visually. You can also extract the exact band gap by inspecting the energy values at the corresponding k-points. $\endgroup$ Commented Aug 31, 2023 at 23:36
  • $\begingroup$ And the error you received is because occupations='fixed' only works for insulators with a band gap. Otherwise, you should use occupations='smearing' in this case. $\endgroup$ Commented Aug 31, 2023 at 23:51
  • 1
    $\begingroup$ It should always be safe to treat the system as metallic. If it transpires that the system has a band-gap, all that will happen is that the occupancies will be calculated as 1 or 0 instead of being assumed to be 1 or 0. $\endgroup$ Commented Sep 2, 2023 at 1:22

1 Answer 1


To determine if any material has "spin, total magnetization, net charge or if they are metallic", some steps can be done in order to check if they are/or not.

  1. First it should be safe to perform calculations with nspin = 2. It can also be checked if the orbitals carry unpaired electrons, these types of materials usually tend to have magnetic properties during the calculations. Fermi level after the calculations will show if the material has partially occupied state or not.
  2. Smearing parameter 'degauss' can be taken with smaller value in any case, specially during initial calculations. Eg degauss = 0.05. This is done when you are taking nspin = 2. Otherwise this value can be determined by testing it like cut off convergence.
  3. A system which doesn't have impurities, occupation = 'smearing' is taken.
  4. Material with semi conducting nature usually does not require smearing, fixed would work just fine. A good sampling of occupied fermi surface is needed in metals hence smearing is required. The general rule goes like this degauss = 0 then kpoints = infinity in dertermining its value.
    Note - Smearing can be applied to any kind of material, but general sense is that where it would be useful. It is applied to metals (check this page - http://theossrv1.epfl.ch/Main/ElectronicTemperature)
    To improve convergence it is applied to insulators/semi conductors. Basically to give a tolerance factor in energies and as a spread of energies for electrons to occupy instead of confined to finite energy.
  5. The options are
    'gaussian', 'gauss' : ordinary Gaussian spreading (Default)
    'methfessel-paxton', 'm-p', 'mp' :Methfessel-Paxton first-order spreading
    'marzari-vanderbilt', 'cold', 'm-v', 'mv' :Marzari-Vanderbilt-DeVita-Payne cold smearing
    'fermi-dirac', 'f-d', 'fd' :smearing with Fermi-Dirac function
  6. Tot_magnetization - A system with spin is relaxed with nspin = 2. Tot_magnetization is total unbalance in spin up and spin down electrons. Calculations will give a value when it is used for each element. But, magnetization calculations should be done once to check if the material is magnetic or not. Generally it is seen that paired electrons are not magnetic materials, but still with certain elements, like Cu, Fe, magnetic characteristics are seen.
  • $\begingroup$ This seems like a very low-effort answer, are you able to polish it a bit? $\endgroup$ Commented Jan 13 at 5:01
  • $\begingroup$ @NikeDattani I see that the explanation is not in many words, but these details solved this question for me before. Let me then study more for how to write long explanation answer. Thanks for your comment. $\endgroup$ Commented Jan 16 at 5:35
  • $\begingroup$ Even what you have written can be explained more professionally. There's very few answers on this site that have a net score of 0, which means that I'm not the only one thinking this way. $\endgroup$ Commented Jan 16 at 15:46
  • $\begingroup$ @NikeDattani I have edited my answer. I tried my best to answer to the best of my knowledge. I would like to say that I don't know what 'net score 0' means here on the site. But I am trying to be more active here, where I can contribute and learn. $\endgroup$ Commented Jan 21 at 10:21
  • $\begingroup$ Thank you, the update is an improvement! +1. $\endgroup$ Commented Jan 21 at 23:55

You must log in to answer this question.

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