How to get the hkl or hkil indices from calculated xrd pattern

Dear Materials Project Crew,

I tried to calculate the XRD for ZnO (see code below). It works. Nevertheless, I would like to plot a similar diagram as given by you within the Material Project site. However, since I am a beginner using pymatgen, I could not find out how to extract from my structure and the calculated patterns the indices using pymatgen. Especially the hkil indices that are important for hexagonal lattices. It would be nice if you could give me a suggestion. Thank you very much for the time and support!

Yours Sincerely


from mp_api.client import MPRester
from pymatgen.analysis.diffraction.xrd import XRDCalculator
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

with MPRester(api_key=‘’) as mpr:
structure = mpr.get_structure_by_material_id(‘mp-2133’)

sga = SpacegroupAnalyzer(structure)
conventional_structure = sga.get_conventional_standard_structure()

calculator = XRDCalculator(wavelength=‘CuKa’)
pattern = calculator.get_pattern(conventional_structure)

I found the solutions. Using pattern.hkls works. Sorry for the disturbance