Issue with electro-optic coefficient calculation

Hello,

ScAlN.abi (5.0 KB)

I’ve attached the input file I was using to try to calculate the piezoelectric and electro-optic coefficients for ScAlN. I used the structure.num_valence_electrons(pseudos=pseudos) function in abipy to get the number of valence electrons for setting the value of nband, and structure = Structure.from_mpid(“mp-1246075”) to get the structure of the molecule for the initial values of xred and rprim. The input file calculates through dataset 4 without issue. However, when I get to dataset 5, I get the following error:

— !ERROR
src_file: m_nonlinear.F90
src_line: 1549
mpi_rank: 0
message: |
In a non-linear response calculation, nband must be equal
to the number of valence bands.

Why would this error occur when nband is equal to the number of valence bands?

Thank you,

Joseph

Hi, I think your unit cell contains 96 electrons, but since you’re running it with occopt 1 (the default), you would have 96/2 = 48 bands (each band will be doubly occupied). Try it with nband 48.

I should have mentioned, you can check this by looking in the output file of your failed run, and examine the variable “occ”, which I suspect will show 48 2’s and 48 0’s, because I think you are running with 48 filled bands and 48 empty bands.

Thank you, this fixed it :slight_smile: