# Calculating molarity, weight concentration from absorbance value for plasmonic nanoparticles in solution

It is common to measure the peak absorbance of the plasmonic nanoparticles in solution and then get the following: Molarity (moles/liter) Number of particles per ml Weight concentration (ug/ml) I wrote a small python function to extract these parameters. The following inputs are needed for the function d_nm : diameter of the particle in nanoparticle od Read More …

# Creating Energy Band Diagrams for Solar cells and LED

Energy band diagrams are used to visulize the electron and hole transport in Solar cells and LED. I want to quickly draw them and came up with a python module. You can download the module at my github repository. Here’s an example on how to use this code. from Band_diagram import metal, semiconductor, plot # Read More …

# Tab autocompletetion with python interpreter in bash terminal

I want to tab autocomplete commands in my python interpreter within bash terminal. This is very useful when I import a module and just want to browse through the methods and autocomplete. Found two ways to do it. Thanks to stack overflow posts. Method 1 (as mentioned here): This is easy. Install pyreadline (pip install Read More …

# Did I turn off the stove…ESP8266

My wife and I leave the house after a good meal and after like 20 minutes in the car, I ask my wife…did we turn off the stove? My wife answers…you were the last one to cook. What to do now? Go back home and check it. Now, that sucks. To solve this common problem, Read More …

# Coupled Dipole Approximation in Python

Coupled dipole approximation (CDA) method is a numerical method to calculate the optical properties (scattering and absorption) of interacting dipoles. This method is used in discrete dipole approximation method (like in DDSCAT software), where a big particle (also known as target) is broken into lot of interacting dipoles arranged in cubic lattice. CDA can also Read More …

# Fitting Complex Metal Dielectric Functions with Differential Evolution Method

The real and imaginary part of dielectric permittivity of the metals is important to simulate the optical properties of metal films and nanoparticles. Permittivity data is obtained experimentally by ellipsometry and is fitted with analytical models. The most common model for fitting experimental data is with Drude-Lorentz model shown below. $$\epsilon(\omega)=1-\frac{f_1\omega_p^2}{(\omega^2+i\Gamma_1\omega)}+\sum_{j=2}^{n}\frac{f_j\omega_p^2}{(\omega_{o,j}^2-\omega^2-i\Gamma_j\omega)}$$ The first term is Read More …

# Dealing with plotting negative, zero and positive values in log scale

Sometimes you have to show positive, zero and negative number in log scale. However you cannot take log of negative numbers and zero. But one could approximate it with a log transform modulus as stated here. In Python with numpy: from numpy import sign, abs, log10 import matplotlib.pyplot as plt # Data varies in several Read More …

# Python code for generating plasmonic metal dielectric functions

I keep needing a python code to generate the dielectric functions of plasmonic materials such as Au, Ag, Pd, and Pt. I wanted the dielectric functions called by other python codes such as TMM. So I wrote a python version of LD.m LD.m is a matlab file written by Bora Ung that produces dielectric functions Read More …

# DDSCAT on amazon EC2

Amazon provides high performance computing capabilities through their EC2 service. You can find more information here They provide a 750 hr free instance with their a free-tier program. If you want more resources, you can pay for it. See the pricing, pricing seem very reasonable. I wanted to see how easy it was to install Read More …

# Plasmonic Materials in MEEP > 1.2

Here is how I was implementing plasmonic materials in meep1.1 scheme code. Unlike Meep 1. 1, Meep >= 1. 2 changed the way materials are defined. Here I will describe how to change the material definition code from meep1.1 to meep 1.2 . Please note that one can still use the material definition written from Read More …