过于脆弱,
// 一旦有人为可读性加上该标志即退化为存储型 XSS。
var peaks = [{"t":10.6276,"i":7.5823,"hkl":"(1,-1,0,0)","d":8.32431},{"t":10.6276,"i":3.7912,"hkl":"(1,0,-1,0)","d":8.32431},{"t":21.3481,"i":3.9502,"hkl":"(2,-2,0,0)","d":4.16216},{"t":21.3481,"i":1.9751,"hkl":"(2,0,-2,0)","d":4.16215},{"t":25.6169,"i":20.2362,"hkl":"(0,0,0,2)","d":3.47743},{"t":27.8036,"i":14.9107,"hkl":"(1,0,-1,2)","d":3.20871},{"t":28.3666,"i":12.5248,"hkl":"(3,-2,-1,0)","d":3.14629},{"t":28.3666,"i":12.5246,"hkl":"(3,-1,-2,0)","d":3.14629},{"t":31.2014,"i":29.36,"hkl":"(2,-3,1,1)","d":2.86661},{"t":31.2014,"i":44.04,"hkl":"(3,-1,-2,1)","d":2.86661},{"t":31.2014,"i":14.68,"hkl":"(2,1,-3,1)","d":2.8666},{"t":31.7617,"i":100,"hkl":"(2,-1,-1,2)","d":2.8173},{"t":32.2617,"i":24.2614,"hkl":"(3,-3,0,0)","d":2.77477},{"t":32.2617,"i":24.2614,"hkl":"(0,3,-3,0)","d":2.77477},{"t":32.2617,"i":24.2615,"hkl":"(3,0,-3,0)","d":2.77477},{"t":33.5824,"i":5.499,"hkl":"(2,0,-2,2)","d":2.66861},{"t":41.1986,"i":5.5039,"hkl":"(4,-3,-1,1)","d":2.19117},{"t":41.1986,"i":2.7519,"hkl":"(1,-4,3,1)","d":2.19117},{"t":41.1986,"i":8.2558,"hkl":"(4,-1,-3,1)","d":2.19117},{"t":41.6409,"i":3.2438,"hkl":"(3,-3,0,2)","d":2.16891},{"t":41.6409,"i":1.6219,"hkl":"(3,0,-3,2)","d":2.16891},{"t":45.9039,"i":17.2903,"hkl":"(4,-2,-2,2)","d":1.97692},{"t":45.904,"i":8.6452,"hkl":"(2,2,-4,2)","d":1.97692},{"t":47.2571,"i":1.3457,"hkl":"(4,-3,-1,2)","d":1.92343},{"t":47.2571,"i":2.0186,"hkl":"(4,-1,-3,2)","d":1.92343},{"t":48.7945,"i":17.0225,"hkl":"(3,-1,-2,3)","d":1.86636},{"t":48.7945,"i":8.5113,"hkl":"(2,1,-3,3)","d":1.86636},{"t":49.4953,"i":2.7466,"hkl":"(3,-5,2,1)","d":1.84156},{"t":49.4953,"i":5.4932,"hkl":"(5,-3,-2,1)","d":1.84156},{"t":49.4953,"i":5.4932,"hkl":"(5,-2,-3,1)","d":1.84156},{"t":49.4953,"i":2.7466,"hkl":"(3,2,-5,1)","d":1.84156},{"t":50.2248,"i":1.4587,"hkl":"(5,-4,-1,0)","d":1.81651},{"t":50.2248,"i":1.4587,"hkl":"(5,-1,-4,0)","d":1.81651},{"t":51.1525,"i":4.2336,"hkl":"(4,-4,0,2)","d":1.78573},{"t":51.1525,"i":4.2336,"hkl":"(0,4,-4,2)","d":1.78573},{"t":51.1525,"i":4.2336,"hkl":"(4,0,-4,2)","d":1.78573},{"t":52.6401,"i":12.4688,"hkl":"(0,0,0,4)","d":1.73872},{"t":54.8451,"i":1.2199,"hkl":"(5,-3,-2,2)","d":1.67391},{"t":54.8451,"i":1.2198,"hkl":"(5,-2,-3,2)","d":1.67391},{"t":56.2313,"i":3.3822,"hkl":"(4,-3,-1,3)","d":1.63589},{"t":56.2313,"i":2.2549,"hkl":"(4,-1,-3,3)","d":1.63589},{"t":56.2313,"i":1.1274,"hkl":"(3,1,-4,3)","d":1.63589},{"t":57.2154,"i":1.6702,"hkl":"(4,-5,1,2)","d":1.61008},{"t":57.2154,"i":3.3404,"hkl":"(5,-4,-1,2)","d":1.61008},{"t":57.2154,"i":3.3404,"hkl":"(5,-1,-4,2)","d":1.61007},{"t":57.2154,"i":1.6702,"hkl":"(4,1,-5,2)","d":1.61007},{"t":58.6877,"i":1.3678,"hkl":"(4,-6,2,0)","d":1.57315},{"t":58.6877,"i":2.7356,"hkl":"(6,-4,-2,0)","d":1.57315},{"t":58.6877,"i":2.7356,"hkl":"(6,-2,-4,0)","d":1.57315},{"t":58.6877,"i":1.3678,"hkl":"(4,2,-6,0)","d":1.57315},{"t":59.184,"i":1.3247,"hkl":"(3,-6,3,1)","d":1.56113},{"t":59.184,"i":1.3247,"hkl":"(6,-3,-3,1)","d":1.56113},{"t":59.184,"i":1.3247,"hkl":"(3,3,-6,1)","d":1.56113},{"t":60.3217,"i":1.8079,"hkl":"(4,-6,2,1)","d":1.53438},{"t":60.3217,"i":3.6158,"hkl":"(6,-4,-2,1)","d":1.53438},{"t":60.3218,"i":1.8079,"hkl":"(6,-2,-4,1)","d":1.53438},{"t":60.3218,"i":3.6158,"hkl":"(4,2,-6,1)","d":1.53438},{"t":60.8731,"i":4.7934,"hkl":"(3,-1,-2,4)","d":1.5218},{"t":61.7794,"i":3.6564,"hkl":"(5,-5,0,2)","d":1.50164},{"t":61.7794,"i":3.6564,"hkl":"(0,5,-5,2)","d":1.50164},{"t":61.7794,"i":3.6564,"hkl":"(5,0,-5,2)","d":1.50164},{"t":62.0797,"i":1.6078,"hkl":"(6,-5,-1,0)","d":1.49509},{"t":62.0798,"i":1.6078,"hkl":"(6,-1,-5,0)","d":1.49509},{"t":63.0688,"i":2.6479,"hkl":"(3,-5,2,3)","d":1.47401},{"t":63.0688,"i":2.6479,"hkl":"(5,-2,-3,3)","d":1.47401},{"t":63.0688,"i":2.6479,"hkl":"(3,2,-5,3)","d":1.474},{"t":63.0997,"i":14.2879,"hkl":"(3,-3,0,4)","d":1.47336},{"t":63.0997,"i":7.1439,"hkl":"(3,0,-3,4)","d":1.47336},{"t":63.6618,"i":2.2242,"hkl":"(5,-6,1,1)","d":1.4617},{"t":63.6618,"i":2.2242,"hkl":"(6,-5,-1,1)","d":1.4617},{"t":63.6618,"i":2.2242,"hkl":"(1,-6,5,1)","d":1.4617},{"t":63.6618,"i":4.4484,"hkl":"(6,-1,-5,1)","d":1.4617},{"t":63.6618,"i":2.2242,"hkl":"(5,1,-6,1)","d":1.4617},{"t":72.1551,"i":1.5312,"hkl":"(7,-5,-2,1)","d":1.30913},{"t":72.1552,"i":1.5312,"hkl":"(5,2,-7,1)","d":1.30913},{"t":72.6301,"i":1.0681,"hkl":"(4,-6,2,3)","d":1.30173},{"t":72.6301,"i":2.1362,"hkl":"(6,-4,-2,3)","d":1.30173},{"t":72.6301,"i":1.0681,"hkl":"(6,-2,-4,3)","d":1.30173},{"t":72.6301,"i":2.1362,"hkl":"(4,2,-6,3)","d":1.30173},{"t":74.5126,"i":1.117,"hkl":"(4,-7,3,2)","d":1.27344},{"t":74.5126,"i":1.117,"hkl":"(4,3,-7,2)","d":1.27344},{"t":74.5985,"i":3.6735,"hkl":"(3,-2,-1,5)","d":1.27219},{"t":74.5985,"i":3.6734,"hkl":"(3,-1,-2,5)","d":1.27219},{"t":75.6953,"i":1.3517,"hkl":"(5,-6,1,3)","d":1.25646},{"t":75.6953,"i":2.7034,"hkl":"(6,-5,-1,3)","d":1.25646},{"t":75.6953,"i":4.0551,"hkl":"(6,-1,-5,3)","d":1.25646},{"t":75.7238,"i":1.2426,"hkl":"(5,-1,-4,4)","d":1.25606},{"t":76.5428,"i":1.4685,"hkl":"(7,-5,-2,2)","d":1.24465},{"t":76.5428,"i":1.4685,"hkl":"(5,2,-7,2)","d":1.24465},{"t":80.6386,"i":1.2598,"hkl":"(4,-1,-3,5)","d":1.19144},{"t":82.7313,"i":1.0534,"hkl":"(4,-6,2,4)","d":1.16654},{"t":82.7313,"i":2.1068,"hkl":"(6,-4,-2,4)","d":1.16654},{"t":82.7313,"i":1.0534,"hkl":"(6,-2,-4,4)","d":1.16654},{"t":82.7313,"i":2.1068,"hkl":"(4,2,-6,4)","d":1.16654},{"t":83.6933,"i":1.0496,"hkl":"(7,-5,-2,3)","d":1.15556},{"t":83.6933,"i":1.0496,"hkl":"(7,-2,-5,3)","d":1.15556},{"t":85.6952,"i":1.3314,"hkl":"(6,-5,-1,4)","d":1.13362},{"t":85.6952,"i":1.3314,"hkl":"(6,-1,-5,4)","d":1.13362},{"t":86.3372,"i":6.117,"hkl":"(2,-1,-1,6)","d":1.12683},{"t":86.4922,"i":4.2081,"hkl":"(5,-8,3,2)","d":1.12521},{"t":86.4922,"i":1.5791,"hkl":"(8,-5,-3,2)","d":1.12521},{"t":86.4922,"i":1.0498,"hkl":"(0,7,-7,2)","d":1.12521},{"t":86.4922,"i":1.5791,"hkl":"(8,-3,-5,2)","d":1.12521},{"t":86.4922,"i":2.629,"hkl":"(3,5,-8,2)","d":1.12521},{"t":86.4922,"i":1.5791,"hkl":"(5,3,-8,2)","d":1.12521},{"t":86.5751,"i":1.1308,"hkl":"(3,-5,2,5)","d":1.12435},{"t":86.5751,"i":1.1308,"hkl":"(5,-2,-3,5)","d":1.12435},{"t":86.5751,"i":1.1308,"hkl":"(3,2,-5,5)","d":1.12435}];
// 图例文案(中文站字面量;英文站模板传英文,见 en/page/detail.php)
var LBL_MATERIAL_PEAK = '材料衍射峰';
var initialRadiation = 'Cu Kα';
var canvas = document.getElementById('xrd-detail-canvas');
var note = document.getElementById('xrd-note');
var body = document.getElementById('xrd-peaks-body');
var cnt = document.getElementById('xrd-peaks-count');
var sel = document.getElementById('xrd-target');
var link = document.getElementById('xrd-direct-link');
var mpId = "mp-1105908";
function renderChart(ps, radiation) {
if (typeof XrdChart === 'undefined' || !canvas || !Array.isArray(ps)) return;
var m = 0;
ps.forEach(function (p) { if (p.t > m) m = p.t; });
var mt = Math.max(90, Math.ceil((m + 5) / 10) * 10);
XrdChart.render(canvas, { materialPeaks: ps, label: radiation, maxTheta: mt, materialPeakLabel: LBL_MATERIAL_PEAK });
}
function renderTable(ps) {
if (!body) return;
var rows = '';
ps.slice(0, 24).forEach(function (pk) {
var t = (pk.t != null) ? Number(pk.t).toFixed(2) : '';
var d = (pk.d != null) ? Number(pk.d).toFixed(4) : '';
var i = (pk.i != null) ? Number(pk.i).toFixed(1) : '';
var h = (pk.hkl != null) ? String(pk.hkl).replace(/[<>&]/g, '') : '';
rows += '
' + t + '
' + d + '
' + i + '
' + h + '
';
});
body.innerHTML = rows;
if (cnt) cnt.textContent = Math.min(ps.length, 24);
}
function updateLink(target) {
if (link) link.href = location.origin + '/api/v1/materials/' + encodeURIComponent(mpId) + '/xrd?format=raw&target=' + encodeURIComponent(target);
}
// 初始渲染(服务端已预取默认靶材的图谱)
renderChart(peaks, initialRadiation);
if (sel) updateLink(sel.value);
// 切换靶材:重新拉取该靶材的衍射图谱并刷新图表 / 表格 / 直接链接
if (sel) {
var xrdSeq = 0;
sel.addEventListener('change', function () {
var t = sel.value;
updateLink(t);
var my = ++xrdSeq;
// 先清空 loading 态,避免请求失败后按钮一直停在“切换中”
if (note) note.textContent = '正在加载 ' + t + ' 图谱…';
fetch('/api/v1/materials/' + encodeURIComponent(mpId) + '/xrd?target=' + encodeURIComponent(t))
.then(function (r) {
if (!r.ok) throw new Error('HTTP ' + r.status);
return r.json();
})
.then(function (res) {
// 竞态防护:快速切换靶材时,先发的请求可能后到,丢弃过期响应
if (my !== xrdSeq) return;
if (!res.success || !res.data || !Array.isArray(res.data.peaks) || !res.data.peaks.length) {
throw new Error(res.error || '该靶材暂无衍射数据');
}
var d = res.data;
if (note) note.textContent = '横轴为 2θ (°),纵轴为相对强度,' + d.radiation + ' , λ=' + d.wavelength + ' Å';
renderChart(d.peaks, d.radiation);
renderTable(d.peaks);
})
.catch(function (e) {
if (my !== xrdSeq) return;
// 恢复服务端预取的默认靶材视图,并明确提示失败原因
// (旧实现是空 catch,静默失败会让图表停留在上一个靶材的数据而用户毫不知情)
if (note) note.textContent = '切换靶材失败:' + (e && e.message ? e.message : '未知错误');
renderChart(peaks, initialRadiation);
renderTable(peaks);
});
});
}
})();
The crystal structure and related material properties of La5Sn3 were obtained from the Materials Project database (MP-ID: mp-1105908, database version v2026.04.13).
文献引用
Horton, M.K., Huck, P., Yang, R.X. et al. Accelerated data-driven materials science with the Materials Project. Nat. Mater. 24, 1522–1532 (2025).
https://doi.org/10.1038/s41563-025-02272-0
晶体结构 3D 渲染
加载 3D 结构...
样式: Ball & Stick|拖拽旋转 · 滚轮缩放 · 右键平移
原始 CIF 数据
# generated using pymatgen
data_La5Sn3
_symmetry_space_group_name_H-M 'P 1'
_cell_length_a 9.61208378
_cell_length_b 9.61208574
_cell_length_c 6.95486367
_cell_angle_alpha 90.00000000
_cell_angle_beta 90.00000000
_cell_angle_gamma 120.00002390
_symmetry_Int_Tables_number 1
_chemical_formula_structural La5Sn3
_chemical_formula_sum 'La10 Sn6'
_cell_volume 556.48611446
_cell_formula_units_Z 2
loop_
_symmetry_equiv_pos_site_id
_symmetry_equiv_pos_as_xyz
1 'x, y, z'
loop_
_atom_site_type_symbol
_atom_site_label
_atom_site_symmetry_multiplicity
_atom_site_fract_x
_atom_site_fract_y
_atom_site_fract_z
_atom_site_occupancy
La La0 1 0.66666700 0.33333300 -0.00000000 1.0
La La1 1 0.33333300 0.66666700 0.99999900 1.0
La La2 1 0.33333300 0.66666700 0.50000100 1.0
La La3 1 0.66666700 0.33333300 0.50000000 1.0
La La4 1 0.73789747 0.73804020 0.75000000 1.0
La La5 1 0.26195980 -0.00014173 0.75000000 1.0
La La6 1 0.00014173 0.26210153 0.75000000 1.0
La La7 1 0.26195980 0.26210253 0.25000000 1.0
La La8 1 0.73789747 -0.00014173 0.25000000 1.0
La La9 1 0.00014173 0.73804020 0.25000000 1.0
Sn Sn10 1 0.38353918 0.38348012 0.75000000 1.0
Sn Sn11 1 0.61651988 0.00005906 0.75000000 1.0
Sn Sn12 1 -0.00005906 0.61646082 0.75000000 1.0
Sn Sn13 1 0.61651988 0.61646082 0.25000000 1.0
Sn Sn14 1 0.38353918 0.00005906 0.25000000 1.0
Sn Sn15 1 -0.00005906 0.38348012 0.25000000 1.0