Effect of spatial folding of molecules on two-photon absorption and nonlinear refraction in foldamers