{
  "capsules": [
    {
      "blake3_hex": "0e48a0df41b7245570738b1ddeaa39a709dae18de947b54c489c762597bddcfc",
      "builtin": true,
      "created_at": 1796040000,
      "creator_name": "commons-chem",
      "ecosystem": "chemistry",
      "ed25519_pubkey_hex": "fcfa833e7541ffbda4235fa7b41340c52fb1fe76ee7cad14fe0244361d838367",
      "ed25519_sig_hex": "6228de5565b5cd016945bf6b3549239cbbe3661ea8affd009d4ca347dd4c2e949700b324c6ed5ab9fb890982b5d7bcdc4821e86651c84ce375e85c69daf0da09",
      "handle": "commons-chem",
      "html_source": "<!doctype html><html><head><meta charset=\"utf-8\"><style>\nbody{margin:0;padding:16px;background:#0a0c10;color:#eceef3;font:14px/1.5 system-ui,sans-serif}\n.ctl{display:flex;gap:12px;flex-wrap:wrap;margin-bottom:10px}\nselect,input{background:#131720;color:#eceef3;border:1px solid #252c3a;border-radius:6px;padding:5px 8px}\nsvg{width:100%;height:185px;background:#131720;border:1px solid #252c3a;border-radius:10px}\n</style></head><body>\n<div class=\"ctl\">\n  <label style=\"font-size:12px;color:#8e97a8\">Lattice a (Å): <input id=\"a\" type=\"number\" step=\"0.05\" min=\"2.5\" max=\"9.0\" value=\"4.05\" oninput=\"go()\"></label>\n  <label style=\"font-size:12px;color:#8e97a8\">Centering: <select id=\"lat\" onchange=\"go()\"><option value=\"fcc\">FCC (e.g. Al, Cu, Au)</option><option value=\"bcc\">BCC (e.g. Fe, W)</option><option value=\"sc\">Simple Cubic (e.g. Po)</option></select></label>\n</div>\n<svg id=\"xrd\" viewBox=\"0 0 760 185\"></svg>\n<div id=\"peaks\" style=\"margin-top:8px;font-family:monospace;font-size:12px;color:#46e0c0\"></div>\n<script>\nfunction allowed(lat,h,k,l){\n  if(lat==='bcc') return ((h+k+l)%2)===0;\n  if(lat==='fcc') return (h%2===k%2)&&(k%2===l%2);\n  return true;\n}\nfunction go(){\n  const a=Math.max(2.2,Number(document.getElementById('a').value)||4.05);\n  const lat=document.getElementById('lat').value, lam=1.5406;\n  const seen=new Map();\n  for(let h=0;h<=4;h++)for(let k=0;k<=h;k++)for(let l=0;l<=k;l++){\n    const q=h*h+k*k+l*l; if(q===0||!allowed(lat,h,k,l))continue;\n    if(!seen.has(q)) seen.set(q,`${h}${k}${l}`);\n  }\n  const pks=[];\n  for(const [q,hkl] of [...seen.entries()].sort((x,y)=>x[0]-y[0])){\n    const d=a/Math.sqrt(q), s=lam/(2*d);\n    if(s<0.98){ const twoTheta=(2*Math.asin(s)*180/Math.PI); pks.push({hkl,d,twoTheta}); }\n  }\n  let svg=`<line x1=\"30\" y1=\"158\" x2=\"740\" y2=\"158\" stroke=\"#252c3a\"/>`;\n  pks.forEach((p,i)=>{\n    const x=30+((p.twoTheta-10)/130)*700;\n    const h=Math.max(36,130-i*14);\n    svg+=`<line x1=\"${x.toFixed(1)}\" y1=\"158\" x2=\"${x.toFixed(1)}\" y2=\"${(158-h).toFixed(1)}\" stroke=\"#d4af61\" stroke-width=\"3\"/>`;\n    svg+=`<text x=\"${x.toFixed(1)}\" y=\"${(152-h).toFixed(1)}\" fill=\"#eceef3\" font-size=\"11\" text-anchor=\"middle\">(${p.hkl})</text>`;\n  });\n  document.getElementById('xrd').innerHTML=svg;\n  document.getElementById('peaks').textContent=pks.map(p=>`(${p.hkl}) 2θ=${p.twoTheta.toFixed(2)}° d=${p.d.toFixed(3)}Å`).join(' · ');\n}\ngo();\n</script></body></html>",
      "slug": "crystal-bravais-bragg-diffraction",
      "spdx_license": "CC-BY-4.0",
      "summary": "Compute Miller-index (hkl) d-spacings and 2θ Bragg diffraction peaks for Simple Cubic, BCC, and FCC crystals.",
      "title": "Bragg Powder XRD & Cubic Lattice Spacing Simulator (Cu Kα = 1.5406 Å)",
      "verified_passkey": true
    }
  ],
  "capsules_count": 1,
  "channel_url": "/u/commons-chem",
  "disclosures": [],
  "feeds": [],
  "handle": "commons-chem",
  "identity": null,
  "schema": "commons-scholar.creator-channel.v1"
}