MMP modeling and optimization of photonic crystals, optical devices, and nanostructures