Skip to main content

The PyPhotonics python code is a post-processing code written entirely in python which takes as input the output files of the VASP and phonopy codes for a defect system, and calculates the Huang-Rhys factor and the PL lineshapes for that system.

Project description

pyphotonics

PyPhotonics is a post-processing python code that calculates photonic properties of materials. Based on the outcome of DFT, constrained DFT and vibrational calculations using DFT performed using VASP for a defect system, PyPhotonics uses the results in the output files and calculates the Huang-Rhys factor of the defect and the photoluminescence line-shape. Soon, the code will calculate the carrier capture coefficient and carrier lifetimes for defects, which are essential quantities for assessing the photovoltaic efficiency of materials.

If you wish to use PyPhotonics, please cite our paper:

Installation

You can install PyPhotonics using the pip command: pip install pyphotonics. The following python packages are required:

  • scipy
  • numpy
  • pandas
  • matplotlib
  • oganesson

Directory structure

The pyphotonics module is composed of the following files:

/pyphotonics
    /__init__.py
    /constants.py: A list of physical constants.
    /photoluminescence.py: Contains the Photoluminescence class, which drives the photonics calculations.

How to use

PL line-shape and the Huang-Rhys factor

To calculate the PL line-shape and the Huang-Rhys of a crystal structure using pyphotonics, a number of DFT calculations should be performed with VASP first:

  • The ground state structure of the crystal should be optimized. Let's call the output file CONTCAR_GS.
  • The excited state structure of the crystal should be optimized. Let's call the output file CONTCAR_ES. For a tutorial on how to setup such calculation, see this tutorial
  • The phonon modes of the ground state system should be calculated with VASP, and the bands.yaml file should be produced using the phonopy code.

Once all of the above is done, you can calculate the HR factor and PL line-shape as follows (the complete example is in the test/ directory):

from pyphotonics.photoluminescence import Photoluminescence
p = Photoluminescence("CONTCAR_GS", "CONTCAR_ES", 189, method="phonopy", resolution=1000)

You can also run pyphotonics from the command line by typing the following in the directory test/photoluminscence/:

pyphotonics -cgs CONTCAR_GS -ces CONTCAR_ES -m 189 -M phonopy -r 1000

Setting up the INCAR for CDFT

VASP allows you to excite a crystal structure by constraining the occupations of the electronic bands. Let's say you want to excite a spin-up (spin component 1) or spin-down (spin component 2) electron from the ground state to the excited state. To do this, run the following command:

pyphotonics-incar <path to your OUTCAR file>

pyphotonics will write to the terminal the values of the two INCAR tags, FERWE and FERDO, which you can then copy-paste into your INCAR file to perform the excited state optimisation.

There is a sample OUTCAR file in the directory test/ferwe_ferdo which you can test with. Go to the directory and type: pyphotonics-incar.

What are the FERWE and FERDO?

These are INCAR tags that specify the electronic occupation. Here is how you can construct those tags for any structure:

  • Find out how many bands do you have. You can obtain that by search for NBANDS in the OUTCAR file
  • Find out how many k points do you have. You can look that up in the OUTCAR by searching for the section that starts with the string spin component 1 in the OUTCAR. Let's call that number N_K.
  • Find out how many electrons are occupying spin components 1 and 2 by searching the last such section in the OUTCAR that starts with spin component 1. Let's say there are O_UP electrons that occupy the spin up, O_DN electrons that occupy the spin down.
  • Next, calculate how many states are empty in both spins: empty states in the spin up = U_UP where U_UP = NBANDS - O_UP. Same applies for U_DN.

Finally, add the FERWE (spin up, or spin component 1) and FERDO (spin down, or spin component 2) as follows:

  • FERWE = [O_UP-1]*1.0 1*0.0 1*1.0 [U_UP-1]*0.0 <repeated N_K times>
  • FERDO = [O_DN]*1.0 [U_DN]*0.0 <repeated N_K times>

Note the <repeated N_K times> above. It means: repeat [O_UP-1]*1.0 1*0.0 1*1.0 [U_UP-1]*0.0 for N_K times.

Let's have an example. Let's say we have 8 kpoints in both spins, 216 bands, where the spin up electrons occupy 144 bands and the spin down occupy 142 bands. Then, here are the two tags:

  • FERWE = 143*1.0 1*0.0 1*1.0 71*0.0 143*1.0 1*0.0 1*1.0 71*0.0 143*1.0 1*0.0 1*1.0 71*0.0 143*1.0 1*0.0 1*1.0 71*0.0 143*1.0 1*0.0 1*1.0 71*0.0 143*1.0 1*0.0 1*1.0 71*0.0 143*1.0 1*0.0 1*1.0 71*0.0 143*1.0 1*0.0 1*1.0 71*0.0
  • FERDO = 142*1.0 74*0.0 142*1.0 74*0.0 142*1.0 74*0.0 142*1.0 74*0.0 142*1.0 74*0.0 142*1.0 74*0.0 142*1.0 74*0.0 142*1.0 74*0.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyphotonics-0.2.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyphotonics-0.2.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file pyphotonics-0.2.0.tar.gz.

File metadata

  • Download URL: pyphotonics-0.2.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for pyphotonics-0.2.0.tar.gz
Algorithm Hash digest
SHA256 138aba55691e7d400992bed9f246e5a898a8e221b54b0428c405b0ecd3dacf27
MD5 b8fdd27634eba1600b990c15899282b7
BLAKE2b-256 09f10d7f03926260b07561cdca15b6e2c719d372764f247891153fdd911d5e25

See more details on using hashes here.

File details

Details for the file pyphotonics-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pyphotonics-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for pyphotonics-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8505b1630f2c22449cbbf0b8005dff5855514df3ae3f1e8b93b58c91c29fc9c5
MD5 8c4f725ddf2d67b8010bfb55ba3ce1c5
BLAKE2b-256 78c6bbebc7019181aa743e1cb5cf23b66b0849e007e237ff7a8cac43e013fe8b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page