Home
Qijing Zheng
Cancel

Matplotlib: Plot within a hexagon

Problem Suppose we have a periodic function $f(x,y)$ defined within a hexagonal unit cell, how can we plot the function on the Wigner-Seitz cell? Codes #!/usr/bin/env python # -*- coding: utf-8 ...

Fourier Transform of Radial Functions

Description of the problem Suppose we have a function which can be expressed in terms of spherical harmonics [\begin{equation} \label{eq:radial_fun} f(r, \theta, \phi) = \sum_{l=0...

Numerov Algorithm

Numerov’s method Numerov’s method1 (also called Cowell’s method) is a numerical method to solve ordinary differential equations of second order in which the first-order term does not appear. It is...

Plotly: Spherical Harmonics

Introduction In mathematics and physical science, spherical harmonics are special functions defined on the surface of a sphere. The spherical harmonics form a complete set of orthogonal functions...

Plotly: Tight-binding Model for Graphene

Honeycomb lattice of graphene The unit cell of graphene’s lattice consists of two different types of sites, which we will refer to as $A$ and $B$ sites (see Figure 1). ...

Plotly: 1D Diatomic Chain Dispersion

1D Diatomic Chain Dispersion Consider a 1D chain with two atoms in the unit cell 1D diatomic chain. two sublattices. Genera...

Transforming Between Supercell and Primitive Cell

Primitive Cell to Supercell Suppose the transformation matrix between the primitive cell ($\mathbf{A}$) and the supercell ($\mathbf{a}$) is $M$, i.e. \[ \mathbf{A} = M\cdot \mathbf{a} \] For ...

VASP: Stacking-dependent Potential Energy Surface of Bilayer MoS2

Introduction A few days ago, I met a problem so that I needed to calculate the stacking-dependent energy of bilayer MoS2. As is shown in the figure below, by shifting one of the two layers relati...

TikZ: Visible Light Spectrum

Visible light spectrum In this post, I will try to use TikZ to plot schematics of visible light spectrum. First, we must find out the proper function that represents the varying wavelength of the ...

TikZ: Schematics of e-ph Matrix in Wannier Representation

Schematics of e-ph Matrix in Wannier Representation I was reading this article on electron-phonon interaction using Wannier functions when I noticed that Fig. 2 therein looks very simple and tha...