The 2 × 2 × 2 supercells with 32 atoms are generated, and 1 B is replaced by 1 Al or 1 Ga atom for x=0.0625 composition, whereas 2 B atoms are randomly substituted by 2 Al or 2 Ga for x=0.125 composition. PBE-D3 method is employed to account for the van der Waals interaction. We also consider doping in 3 × 3 × 2 supercells, and results are shown in Supplementary Information. With In doping, no band gap is observed, hence we have not studied In-doped h-BN further as typically ferroelectric/piezoelectric materials have a non-zero band gap.