Structural phase transition of the ion crystals embedded in an optical lattice