Nonlinear optical properties of materials are important as tools in basicresearch and optical technology. Recently there has been a tremendousupsurge of interest in optical nonlinear effects, especially in crystals with curvedbandstructure geometry. Such materials are candidates for applications basedon the conversion of light to dc current. In this talk I describe our discovery thata family of Weyl semimetals has by far the largest second-order susceptibility ofany previously known crystal. In puzzling over this result, we uncovered asurprising theorem relating the strength of optical nonlinearity to a quantuminvariant property of the bandstructure that unites nonlinear optics with thecelebrated “modern theory of polarization.” This quantum invariant provides anew strategy for algorithmic computational searches for nonlinear materialswith optimal response functions.