Probing microporous materials with second-harmonic generation