  We report on the investigation of the atomic and electronic structures of a
clean Si(331)-(12$\times$1) surface using a first-principles approach with both
plane wave and strictly localized basis sets. Starting from the surface
structure proposed by Zhachuk and Teys [Phys. Rev. B 95, 041412(R) (2017)], we
develop significant improvements to the atomic model and localized basis set
which are critical for the correct description of the observed bias dependence
of scanning tunneling microscopy (STM) images. The size mismatch between the Si
pentamers from the surface model and those seen by STM is explained within the
context of the Tersoff-Hamann model. The energy barriers that separate
different Si(331) buckled configurations were estimated, showing that the
surface structure is prone to dynamic buckling at room temperature. It is found
that empty electronic states on Si(331) are essentially localized on the
pentamers with interstitials and under-coordinated Si sp$^2$-like atoms between
them, while filled electronic states are localized on under-coordinated Si
sp$^3$-like atoms and dimers on trenches. The calculated electronic density of
states exhibits two broad peaks in the fundamental bandgap of Si: one near the
valence band top and the other near the conduction band bottom. The resulting
surface bandgap of 0.58 eV is in an excellent agreement with spectroscopy
studies.
