Skip to main content

DefectPL

A high-performance computational toolkit for calculating and visualizing the photoluminescence (PL) spectra, electron-phonon coupling characteristics, and optical lineshapes of quantum defect centers in insulators and semiconductors.

PyPI Version Conda Recipe Anaconda Version Downloads License: MIT

⚠️ Development Status: This package is under active development. Features, APIs, and documentation are subject to rapid updates.


📌 Overview & Key Features

DefectPL implements photoluminescence calculation framework based on standard generating function methodologies (New J. Phys. 16 073026 (2014)) to evaluate electronic-vibrational coupling profiles of point defects in solids from first-principles data. It bridges ab initio electronic structure outputs with experimentally observable optical lineshapes, specifically supporting high Huang-Rhys (HR) factor regimes.

The core engine provides automated pipelines to compute, serialize, and visualize:

  • Macroscopic Optical Lineshapes: Full photoluminescence (PL) spectra sidebands accounting for multi-phonon convolutions.
  • Coupling Parameters: Quantified total and mode-resolved partial Huang-Rhys factors ($S_k$), alongside temperature-dependent Debye-Waller factors ($I_{\text{ZPL}}/I_{\text{tot}}$).
  • Phonon Localization Metrics: Spatial confinement analytics via Inverse Participation Ratios (IPR) and structural localization index mappings.
  • Spectral Density Mapping: Multi-mode Electron-Phonon Spectral Density functions, $S(\omega)$.
  • Isotope Engineering: Analytical evaluation of localized isotope substitution impacts on vibrational mode coupling pathways.

📚 Documentation & Reference

For comprehensive API references, mathematical formulations, and step-by-step tutorials, visit the official documentation portal: 👉 https://Shibu778.github.io/defectpl/

Citation

If you utilize DefectPL in your peer-reviewed scientific workflows, please cite the following original research works:

📄 Carbon with Stone-Wales Defect as Quantum Emitter in h-BN, Phys. Rev. B 111, 104109 (2025). DOI: 10.1103/PhysRevB.111.104109

📄 High-throughput Computational Search for Group-IV-related Quantum Defects as Spin-photon Interfaces in 4H-SiC, Phys. Rev. B 112, 184112 (2025). DOI: 10.1103/PhysRevB.112.184112


🚀 Installation

DefectPL can be seamlessly integrated via your preferred package manager ecosystem.

Standard Installation via PyPI

pip install defectpl

Stable Pre-compiled Binaries via Conda-Forge

conda install conda-forge::defectpl

Editable Source Build (For Developers)

git clone [https://github.com/Shibu778/defectpl.git](https://github.com/Shibu778/defectpl.git)
cd defectpl
pip install -e .

🧑‍💻 Architectural Tracks & Examples

DefectPL natively exposes two core calculation modalities: Displacement Mode (evaluating structural coordinate shift vectors) and Force Mode (evaluating vertical electronic excitation forces). All core engine classes inherit from Monty’s MSONable, ensuring atomic state serialization into lightweight JSON formats.

1. Displacement Mode (Structure Coordinates Tracking)

Ideal when relaxed atomic geometries for both the ground state (GS) and excited state (ES) are completely resolved alongside Phonopy supercell calculations.

from pathlib import Path
from pymatgen.core import Structure
from monty.serialization import dumpfn

from defectpl.phonon import read_band_yaml
from defectpl.vasp_wrapper import calc_dR
from defectpl.defectpl import Photoluminescence

# 1. Parse ground/excited state geometry and Phonopy coordinates
struct_gs = Structure.from_file("CONTCAR_GS")
struct_es = Structure.from_file("CONTCAR_ES")
frequencies, eigenvectors, masses = read_band_yaml("band.yaml")

# 2. Extract periodic-boundary-condition safe displacement matrices
dR = calc_dR(struct_gs, struct_es)

# 3. Initialize core execution engine
pl_engine = Photoluminescence(
    frequencies=frequencies,
    eigenvectors=eigenvectors,
    masses=masses,
    dR=dR,          # Pass dR matrix for Displacement mode
    dF=None,
    EZPL=1.95,
    gamma=2.0
)

# 4. Generate publication-quality graphics & serialize configuration states
pl_engine.generate_plots(out_dir="./plots", fig_format="png")
dumpfn(pl_engine, "properties.json", indent=4)

2. Force Mode (Force Difference Matrix Tracking)

Ideal for high-throughput pipelines, utilizing the force landscape acting on the ground-state structure under a vertical electronic excitation constraint.

from defectpl.vasp_wrapper import prepare_dF_files
from defectpl.defectpl import Photoluminescence
from defectpl.phonon import read_band_yaml

# 1. Parse standard Phonopy baseline calculations
frequencies, eigenvectors, masses = read_band_yaml("band.yaml")

# 2. Extract force difference vectors (dF = F_excited - F_ground) from VASP output streams
dF = prepare_dF_files("OUTCAR_GS", "OUTCAR_ES")

# 3. Execute solver via Force Matrix track
pl_engine = Photoluminescence(
    frequencies=frequencies,
    eigenvectors=eigenvectors,
    masses=masses,
    dR=None,
    dF=dF,          # Pass dF matrix for Force mode
    EZPL=1.95,
    gamma=2.0
)
pl_engine.generate_plots(out_dir="./plots", fig_format="png")

🤝 Contributing & Bug Reporting

We welcome community contributions, optimization proposals, and workflow suggestions! If you uncover numerical bugs or wish to request feature additions, please systematically log them through our official GitHub Issues portal or submit a structured Pull Request.


👤 Maintainers & Acknowledgements

Project Lead Maintainers: * Shibu Meher * Manoj Dey

Special Acknowledgements

The development of this software was supported and inspired by several foundational open-source packages within the materials physics community:

  • PyPhotonics
  • nonrad
  • sumo
  • phonopy

Metadata

Release files for defectpl 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for defectpl 0.3.0
File Size Uploaded Provenance
defectpl-0.3.0.tar.gz 112.0 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for defectpl 0.3.0
File Interpreter ABI Platform
defectpl-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 231.9 kB

Release files / defectpl-0.3.0.tar.gz

Download URL defectpl-0.3.0.tar.gz
Size 112.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cf7f6d0f0a3fb8429e87b18902ec887f240ac5d19801a88fc8e59c2b10c1d6bb
BLAKE2b-256 checksum
How to use checksums
19abced812a0a733eca867a1de429438866894ae3a65efe64bd9ab737b1048d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 16, 2026.

Transparency log

Release files / defectpl-0.3.0-py3-none-any.whl

Download URL defectpl-0.3.0-py3-none-any.whl
Size 119.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bdd52ae5f807a8a73ec2814daaaa63f742f8e4de61a8682e23bccbb160d44846
BLAKE2b-256 checksum
How to use checksums
4423f99406dc99ca9e970b7431993a72d8b9ac34b95ea2fb563d7d879f45370f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 16, 2026.

Transparency log

Security for defectpl 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for defectpl-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page