UNPKG

bands-visualiser

Version:
122 lines (105 loc) 3.1 kB
import { BandsVisualiser } from "./bandvisualiser.js"; import test_bands from "../exampleData/test_bands.json"; import test_dos from "../exampleData/test_dos.json"; import test_dos1 from "../exampleData/test_dos1.json"; import MoBands from "../exampleData/MoBands.json"; import { splitBandsData, getBandByIndex, downsampleProjections, } from "../main.js"; const plotContainerSimple = document.getElementById("bandstructuresimple"); const plotContainerFermi = document.getElementById("bandstructureFermi"); const plotContainerSpins = document.getElementById("bandstructureSpins"); const plotContainerCustom = document.getElementById("bandstructureCustom"); const plotContainerCustom2 = document.getElementById("bandstructureCustom2"); const plotContainerDos = document.getElementById("DOS"); const plotContainerBSDOS = document.getElementById("BSDOS"); // super simple example BandsVisualiser(bandstructuresimple, { bandsDataArray: [test_bands], }); // adding a fermi level BandsVisualiser(bandstructureFermi, { bandsDataArray: [test_bands], fermiLevels: [18.25], settings: { yaxis: { range: [8.0, 28.0] } }, }); // Splitting bandsData into up and down spins const a = splitBandsData(test_bands.bandsData, 2); const spinDown = { bandsData: a[0], traceFormat: { name: "Spin Down", line: { color: "blue", width: 1.25 }, }, }; const spinUp = { bandsData: a[1], traceFormat: { name: "Spin Up", line: { color: "red", width: 1.25 }, }, }; // //EXAMPLE BANDS (w/ split spins) BandsVisualiser(bandstructureSpins, { bandsDataArray: [spinDown, spinUp], fermiLevels: [21], settings: { yaxis: { range: [8.0, 28.0] } }, }); // SPIN BANDS WITH Index band const customBand = getBandByIndex(spinDown.bandsData, 19); const customBandObj = { bandsData: customBand, traceFormat: { name: "Custom Band", line: { color: "purple", width: 3, dash: "dot" }, }, }; // //EXAMPLE BANDS (w/ split spins) BandsVisualiser(bandstructureCustom2, { bandsDataArray: [spinDown, spinUp, customBandObj], fermiLevels: [21], settings: { yaxis: { range: [8.0, 28.0] } }, }); // SPIN BANDS WITH Custom Trace BandsVisualiser(bandstructureCustom, { bandsDataArray: [spinDown, spinUp], fermiLevels: [21], settings: { yaxis: { range: [8.0, 28.0] } }, customTraces: [ { x: [1, 2, 3, 4, 5, 6, 7, 8, 12], y: [10, 15, 10, 20, 10, 25, 10, 25, 15, 10], mode: "lines", name: "Custom Trace", line: { color: "rgba(0,0,0,0.4)", width: 6 }, }, ], }); // // EXAMPLE DOS HERE BandsVisualiser(DOS, { dosDataArray: [test_dos], fermiLevels: [18.25], }); // // EXAMPLE COMBINED HERE BandsVisualiser(BSDOS, { bandsDataArray: [test_bands], dosDataArray: [test_dos, test_dos1], fermiLevels: [18.25], }); // EXAMPLE DOS HERE BandsVisualiser(DOS, { dosDataArray: [test_dos] }); // EXAMPLE COMBINED HERE BandsVisualiser(PROJ, { bandsDataArray: [MoBands], fermiLevels: [21], settings: { xaxis: { title: { text: "Energy (eV)" }, }, yaxis: { title: { text: "Density of States" }, }, }, });