Environmental effects on molecular response in materials for non-linear optics