Navigation

HEAS Data Platform · Materials Science Database

XRD Diffraction Matching Guide

Phase identification · Target selection · Matching principles · API endpoints

Overview

XRD (X-ray diffraction) phase identification is a core technique in materials characterization. Based on pymatgen, this platform pre-computes diffraction peaks from the CIF crystal structures of the full material collection, building an XRD library that spans the HEA / TRA / ELA datasets. You only need to paste a list of experimentally measured diffraction peak 2θ (°) values, and the system returns the closest crystal structures by peak-position and intensity similarity, assisting rapid phase identification.

  • Input: a 2θ list (optionally with intensities, 2θ:intensity), separated by commas / spaces / newlines.
  • Output: candidate materials (MP-ID, dataset, F1, recall, matched peaks and hkl), with the full diffraction pattern available on expand.
  • Multi-target: common targets such as Cu / Mo / Co / Cr / Ag are supported; diffraction peak positions shift with wavelength.

Target Selection

Different targets have different wavelengths, so the absolute positions of the diffraction peaks change accordingly; the choice should account for the sample's absorption coefficient, ferromagnetism and resolution requirements.

Target Wavelength (Å) Advantages Caveats
Cu Kα 1.5406 Highly versatile with a moderate wavelength, suitable for most samples (organic and inorganic materials). May show strong absorption for samples with high absorption coefficients (e.g. iron-containing materials).
Mo Kα 0.7093 Strong penetration, suitable for high-absorption materials (metals, iron-containing compounds). Short wavelength and lower sensitivity; may not suit low-absorption samples.
Co Kα 1.7903 Suitable for ferromagnetic samples (iron, steel, etc.), reducing fluorescence interference. Long wavelength; may not be applicable to organic materials.
Cr Kα 2.2897 Applicable to special ferromagnetic materials and some metallic materials. Wavelength too long; lower resolution for some samples.
Ag Kα 0.5608 Suitable for very-high-absorption materials (heavy-metal compounds). Wavelength too short; sensitivity may be insufficient.
Low-absorption samples
e.g. organic compounds and light-element materials: choose the Cu target (moderate wavelength, high sensitivity).
High-absorption samples
e.g. iron and metallic compounds: choose the Mo or Ag target (strong penetration).
Ferromagnetic samples
e.g. iron and nickel alloys: choose the Co target (reduces iron fluorescence interference).
High-resolution needs
For complex crystal structures, prefer short-wavelength targets (Mo, Ag).

Matching Principles

The search adopts a “three-strongest-peaks-first” strategy: each material's three strongest peaks (by intensity, peak 1 ≥ peak 2 ≥ peak 3) are pre-stored in the database. The three highest-intensity peaks of your experimental pattern serve as the search keys, recalling candidates first from the main library's three-strongest index, then matching the remaining peaks against each candidate's full pattern, ranked by F1 and recall.

  • Three strongest peaks: it is recommended to provide the three strongest peaks (the 3 highest-intensity ones) directly; at least 3 peaks are required to search.
  • Strong hits: the number of query key peaks matched among the candidate material's three strongest peaks (0–3), the primary ranking criterion.
  • Recall: the fraction of your experimental peaks that are explained; higher is more reliable.
  • F1: the harmonic mean of precision and recall, balancing hits and conciseness.
  • Peak tolerance: default 0.7°, controlling the allowed deviation in peak-position matching.
  • hkl notation: 4-index Miller-Bravais for hexagonal/trigonal systems, 3-index otherwise.
  • Ranking prioritizes “strong hits → F1 → recall”.

API Endpoints

GET /api/v1/xrd

XRD diffraction matching is served through one unified endpoint that switches between three modes automatically based on the parameters passed: matching mode (pass peaks to search for similar materials by experimental peaks), pattern mode (pass mp_id to return that material's full diffraction pattern), and browse mode (pass neither, to return the default list of the first N records). Parameter priority is peaks > mp_id > browse. Matching and browse results are deduplicated by mp_id across datasets: when the same material has records in multiple datasets (HEA / TRA / ELA) only the highest-priority one is kept (HEA → TRA → ELA). The pattern of a single material is also available at GET /api/v1/materials/{id}/xrd (applies to MP materials; Alexandria entries return 404), documented under API Endpoints. Rate limits and error responses follow the platform-wide policy; see the API Endpoints documentation for details.

Query Parameters

Parameter Type Default Description
peaksstring-Diffraction peak list, separated by commas / spaces / newlines, e.g. 21.2,44.5,64.8 or 21.2:80,44.5:50 (2θ:intensity); passing it enters matching mode, requiring at least 3 and at most 100 peaks
mp_idstring-Material ID (e.g. mp-16496); passing it returns that material's full diffraction pattern (pattern mode)
tolerancefloat0.7Peak tolerance (°), controlling the allowed deviation in peak-position matching (0.1–3)
limitint50 / 10Default 50 in matching mode (1–200); default 10 in browse mode (1–100, i.e. records per page)
pageint1Browse-mode page number (starting from 1), used with limit for paging; ignored in matching / pattern mode
targetstringCuKaTarget (radiation): CuKa / MoKa / CoKa / CrKa / AgKa; diffraction peak positions shift with wavelength
formatstringjsonResponse format: json (default, full JSON envelope) or raw (plain-text xy, including hkl and the # generated using pymatgen comment)

Matching Mode: match materials by diffraction peaks

Request example
curl "https://heas.labs.gt.ac.cn/api/v1/xrd?peaks=21.2,44.5,64.8:80&tolerance=0.7&limit=50&target=CuKa"
Response example
{
  "success": true,
  "data": {
    "query": {
      "peaks": [{"t":21.2,"i":1},{"t":44.5,"i":1},{"t":64.8,"i":80}],
      "tolerance": 0.7,
      "target": "CuKa"
    },
    "count": 2,
    "results": [
      {
        "mp_id": "mp-1007853",
        "type": "TRA",
        "formula": "Fe3Ni",
        "score": 0.6667,
        "strong_hits": 2,
        "recall": 0.6667,
        "matched": 2,
        "query_peaks": 3,
        "matched_peaks": [
          {"query_t":44.5,"match_t":44.9374,"match_hkl":"(2,1,1)","delta":0.4374},
          {"query_t":64.8,"match_t":65.433,"match_hkl":"(2,2,0)","delta":0.633}
        ],
        "three_strong": [44.9374, 82.8981, 65.433]
      },
      {
        "mp_id": "mp-1008275",
        "type": "TRA",
        "formula": "Cr3Ni",
        "score": 0.6667,
        "strong_hits": 2,
        "recall": 0.6667,
        "matched": 2,
        "query_peaks": 3,
        "matched_peaks": [
          {"query_t":44.5,"match_t":44.4898,"match_hkl":"(2,1,1)","delta":0.0102},
          {"query_t":64.8,"match_t":64.7385,"match_hkl":"(2,2,0)","delta":0.0615}
        ],
        "three_strong": [44.4898, 81.9449, 64.7385]
      }
    ]
  }
}

Matching results[] fields

Field Type Description
mp_idstringMaterial ID
typestringDataset: HEA / TRA / ELA
formulastringChemical formula (looked up in the unified index)
scorefloatF1 composite score (harmonic mean of precision and recall)
strong_hitsintNumber of strong hits (0–3), the primary ranking criterion
recallfloatRecall: fraction of query peaks explained
matched / query_peaksintMatched peak count / total query peak count
matched_peaksarray[{query_t, match_t, match_hkl, delta}], the nearest-neighbor match for each experimental peak
three_strongarrayMaterial's three strongest peak 2θ positions (ordered by intensity, strong to weak)

Pattern Mode: fetch a material's diffraction pattern

Request example
curl "https://heas.labs.gt.ac.cn/api/v1/xrd?mp_id=mp-16496&target=CuKa"
Response example
{
  "success": true,
  "data": {
    "mp_id": "mp-16496",
    "formula": "Al(CuRe)2",
    "type": "HEA",
    "n_peaks": 31,
    "radiation": "CuKa",
    "wavelength": 1.5406,
    "peaks": [
      {"t":21.2551,"i":15.8874,"hkl":"(1,1,0)","d":4.18015},
      {"t":22.731,"i":15.6974,"hkl":"(0,0,1)","d":3.91197},
      {"t":41.2128,"i":100,"hkl":"(2,1,1)","d":2.19045}
    ],
    "three_strong": [41.2128, 48.7095, 33.9076],
    "three_strong_by_target": {
      "AgKa": [14.7115, 17.2557, 16.4866],
      "CoKa": [48.2403, 39.5811, 57.2178],
      "CrKa": [63.061, 51.3524, 75.5783],
      "CuKa": [41.2128, 48.7095, 33.9076],
      "MoKa": [18.6732, 21.9165, 20.9354]
    },
    "n_peaks_by_target": {"AgKa": 82, "CoKa": 24, "CrKa": 13, "CuKa": 31, "MoKa": 79}
  }
}

The peaks array is abridged in this example; the real response returns every peak of the selected target (see n_peaks). Each peak carries t (2θ, °), i (intensity), hkl (Miller indices) and d (d-spacing, Å). three_strong_by_target and n_peaks_by_target cover every precomputed target.

Response example (format=raw)
# XRD pattern
mp_id: mp-2866
formula: Yb(FeSi)2
type: HEA
radiation: CuKa
wavelength: 1.5406 A
# generated using pymatgen
2theta(deg)	intensity(%)	hkl
19.0585	2.8853	(1,1,-1)
24.6635	64.9002	(1,0,0)
37.8013	100.0000	(1,1,0)
46.3769	41.3450	(1,-1,1)
80.7603	7.0365	(2,2,0)

Browse Mode: default diffraction pattern list

Without peaks / mp_id, the database preview list is returned (catalog information only, without full patterns). Paging is supported via page + limit; the response carries total / page / total_pages for client-side pagination. The same material may exist in multiple datasets (HEA / TRA / ELA); the browse list is deduplicated across datasets by HEA → TRA → ELA priority, keeping only the highest-priority entry (e.g. if an mp_id has records in both HEA and TRA, only the HEA version is returned), avoiding duplicate listings.

Request example
curl "https://heas.labs.gt.ac.cn/api/v1/xrd?limit=10&page=2&target=CuKa"
Response example
{
  "success": true,
  "data": {
    "query": {"mode":"browse","target":"CuKa","page":1,"per_page":2},
    "count": 2,
    "total": 170157,
    "page": 1,
    "total_pages": 85079,
    "results": [
      {
        "mp_id": "mp-1",
        "type": "TRA",
        "element": "Cs",
        "n_peaks": 36,
        "three_strong": [20.0696, 35.1319, 28.5317],
        "formula": "Cs"
      },
      {
        "mp_id": "mp-10",
        "type": "TRA",
        "element": "As",
        "n_peaks": 13,
        "three_strong": [33.1341, 47.5624, 47.5624],
        "formula": "As"
      }
    ]
  }
}

FAQ

Why do different targets give different results?
Diffraction peak positions are determined by the wavelength: the 2θ peak positions of the same material differ under different targets, so matching must use the target library consistent with your experiment.
Can a small number of main peaks be matched?
Yes. Hitting the main peaks (the first few strongest peaks) can yield high recall; the system preferentially returns the materials that explain the most experimental peaks.
Why are there 4 numbers in the hkl?
Hexagonal / trigonal systems use the 4-index Miller-Bravais notation (h,k,i,l), while the other systems use the 3-index notation (h,k,l); both are standard representations.
How does browse mode page?
Browse mode (without peaks / mp_id) supports paging via limit (records per page, 1–100) and page (page number, starting from 1); the response contains total / page / total_pages for client-side pagination, and the web preview also provides Previous / Next navigation.
Why does the same material appear only once?
The data spans multiple datasets (HEA / TRA / ELA), so the same material could appear repeatedly. The browse list is deduplicated across datasets by HEA → TRA → ELA priority, keeping only the highest-priority entry; the detail endpoint locates records precisely by mp_id + dataset and is unaffected by deduplication.
Contents