  The newly synthesized ultrathin carbon nanothreads have drawn great attention
from the carbon community. Here, based on first-principles calculations, we
investigate the electronic properties of carbon nanothreads under the influence
of two important factors: the Stone-Wales (SW) type defect and the lattice
strain. The SW defect is intrinsic to the polymer-I structure of the
nanothreads and is a building block for the general hybrid structures. We find
that the bandgap of the nanothreads can be tuned by the concentration of SW
defects in a wide range of $3.92 \sim 4.82$ eV, interpolating between the
bandgaps of $sp^{3}$-(3,0) structure and the polymer-I structure. Under strain,
the bandgaps of all the structures, including the hybrid ones, show a
nonmonotonic variation: the bandgap first increases with strain, then drops at
large strain above 10%. The gap size can be effectively tuned by strain in a
wide range ($>0.5$ eV). Interestingly, for $sp^{3}$-(3,0) structure, a switch
of band ordering occurs under strain at the valence band maximum, and for the
polymer-I structure, an indirect-to-direct-bandgap transition occurs at about
8% strain. The result also indicates that the presence of SW defects tends to
stabilize the bandgap size against strain. Our findings suggest the great
potential of structure- and strain-engineered carbon nanothreads in
optoelectronic and photoelectrochemical applications as well as stress sensors.
