The Finite Elements Method convergence survival guide

Ok, people, let’s face it. Many of us had no idea about the maths behind Finite Elements Method (FEM) simulations when we initially started using them. And most of us have felt that horrible feeling when we repeatedly saw the message ‘No convergence’ instead of a nice output. What is horrible about it is that, unless you or your group develops the software, you probably have no idea where to start looking for fixing the problem.

I heard from a lot of people in my field (electronics) that they have felt discouraged with FEM and did not even want to touch it. But I’m here to tell you that there is hope! I decided to write this guide after almost 10 years of using this type of software (on and off), first for nanoelectonics and then for semiconducting quantum technologies. It might be that the issue is actually more important in the latter, because of the differences in magnitude (or the scale of things) between classical and quantum effects (yes, not everything is quantum in quantum TCAD). But this is a user’s and not developer’s guide, so I will also keep it math-and code-free.

Continue reading

Matrix elements of the momentum operator in Quantum Espresso

Last week I was trying to find what the format of the filp file is for Quantum Espresso that produced by bands.x with the appropriate variable set, and which contains the matrix elements of the momentum operator between valence and conduction bands.

As I couldn’t find any documentation on is format, or any .gnu files to plot it, I thought it would be faster for me to go through the code, and indeed it was quite easy to figure out what was being printed, so I thought I would post this here too.

I will also upload a python notebook that converts them into .csv file, as soon as I double check that it is working properly. Continue reading

Nearest neighbour hoppings in TBModels for kwant

TBModels is a python module that belongs to the Z2Pack toolkit, and can be used to constructuct Tight Binding models to be used with Kwant software for transport calculations using the Landauer-Buttinker formula.

When deriving Hamiltonian matrices from first principles with Wannier90 for kwant, TBmodels will restore all the hoppings between adjacent unit cells. This can be proven very time-consuming both when preparing and solving systems with lots of atoms. Often, only nearest neighbor (nn) interactions are needed, especially if next-nearest neighbor (nnn) etc. decay considerably that can be safely ignored.

For example, in my system, WFs 4 and 2 are neighbors. When looking at the Wannier_hr.dat file, I see the following:

0 0 0 4 2 -1.287933 0.000000


0 1 0 4 2 0.056218 0.000000


0 2 0 4 2 0.004991 -0.000000


0 3 0 4 2 0.008744 -0.000000


0 4 0 4 2 -0.004063 -0.000000

The first three numbers signify the unit cell, which is [0,0,0] in the home, [0,1,0] one hop in the y direction, [0,2,0] two hops in the y direction etc. The next numbers are the WFs (namely 4 and 2) and the last term is the hopping term. In my system, there is no repetition in the z direction, and so only x and y are important. z stays 0.

Continue reading