How boyuanliuoptics/dos-calculation works
Purpose and Entry Points
This repository computes photonic-crystal density of states (DOS) from sampled band structures. It provides two MATLAB workflows: Generalized Gilat–Raubenheimer (GGR), which uses frequencies plus group velocities, and tetrahedron (Tr), which uses sampled frequencies and k-space positions. Primary entry points are DOS_GGR.m, DOS_Tr.m, and the MPB preprocessing launcher dompb.sh.
Band-Data Generation and Normalization
The optional upstream simulation path runs MIT Photonic-Bands (MPB) against the example structure definition in 3Dexample.ctl. dompb.sh is the integration boundary: it invokes MPB and converts its output into text files accepted by the MATLAB DOS programs. MPB is external infrastructure; the repository is not itself a band solver.
Relevant paths:
• dompb.sh
• 3Dexample.ctl
GGR DOS Pipeline
DOS_GGR.m is the higher-accuracy DOS path. It consumes a flat, line-aligned frequency stream and corresponding 3-component group velocities. Each frequency/velocity row pair represents the same k-point and band; therefore input ordering is a critical data-integrity boundary. The algorithm evaluates DOS from local linearized band behavior, requiring both data sources.
Relevant path:
• DOS_GGR.m
Tetrahedron DOS Pipeline
DOS_Tr.m computes DOS from gridded k-point positions and per-point band frequencies, without velocities. Its input couples the first three columns (reciprocal-space coordinates) with following band-frequency columns. This is the alternative when velocity data is unavailable, with lower relative accuracy than GGR.
Relevant path:
• DOS_Tr.m
Input and Output Contract
The MATLAB stages expect working-directory data files generated by dompb.sh or reshaped from another band-computing package: frequency_GGR.txt plus velocity_GGR.txt for GGR, and frequency_Tr.txt for tetrahedra. band.txt is optional plotting-oriented band-path data. Both solvers produce DOS data and a corresponding plot; file naming and current-directory placement form the main operational boundary.
Relevant paths:
• DOS_GGR.m
• DOS_Tr.m
• dompb.sh
Python Exploration Path
A separate Python area appears to provide notebook-oriented experimentation and reusable material/integration utilities, rather than replacing the documented MATLAB production flow. Its likely entry point is the example notebook; consult its local README for its specific execution model.
Relevant paths:
• python/3Dexample.ipynb
• python/integrators.py
• python/material.py
• python/README.md
Runtime Boundaries
The main workflow requires Linux shell execution for dompb.sh, MPB for band and velocity generation, and MATLAB for DOS calculation and plotting. External solvers may substitute for MPB only if they emit data matching the repository’s ordering and coordinate conventions.
Main entry points: dompb.sh MPB launcher · 3Dexample.ipynb 3D example notebook · DOS_GGR.m GGR DOS · DOS_Tr.m Tetrahedron DOS
Components 15
MPB preprocessing
Optional upstream band-data generation.
- 3D example structure
3Dexample.ctl - MPB launcher · Runs MPB and normalizes output text files.
dompb.sh - MIT Photonic Bands · External band and velocity generator.
MATLAB DOS workflows
Production DOS calculation paths.
- GGR frequencies · Flat frequency stream aligned with velocity rows.
- GGR velocities · Three-component velocities aligned to frequency rows.
- GGR DOS · Higher-accuracy local-linearized DOS calculation.
DOS_GGR.m - Tetrahedron frequencies · k-space coordinates followed by band frequencies.
- Tetrahedron DOS · DOS calculation without group velocities.
DOS_Tr.m - DOS data and plot · Each MATLAB solver writes DOS results and a plot.
Python exploration
Notebook-oriented experimental utilities.
- 3D example notebook
python/3Dexample.ipynb - Integration utilities
python/integrators.py - Material utilities
python/material.py - Python README · Documents the Python execution model.
python/README.md
Other components
- Band-path data · Optional plotting-oriented band data.
- Alternative band solver · Must preserve required ordering and coordinate conventions.
Connections 17
- 3D example structure → MPB launcher: input structure
- MPB launcher → MIT Photonic Bands: invokes
- MIT Photonic Bands → MPB launcher: band output
- MPB launcher → GGR frequencies: writes
- MPB launcher → GGR velocities: writes
- MPB launcher → Tetrahedron frequencies: writes
- GGR frequencies → GGR DOS: aligned rows
- GGR velocities → GGR DOS: aligned rows
- Tetrahedron frequencies → Tetrahedron DOS: coordinates + bands
- GGR DOS → DOS data and plot: writes
- Tetrahedron DOS → DOS data and plot: writes
- Alternative band solver → GGR frequencies: compatible export
- Alternative band solver → GGR velocities: compatible export
- Alternative band solver → Tetrahedron frequencies: compatible export
- 3D example notebook → Integration utilities: uses
- 3D example notebook → Material utilities: uses
- Python README → 3D example notebook: guides