Standalone Python Program Part II

Continuing, we will demonstrate how pyinstaller is used to build a project called _py_Haldane. Create a new folder, called “myproject2”. The source codes are in my github, folder _py_Haldane. Clone or download zip the repository, copy all the files in src into myproject2. The repository contains the manual for installation and usage, but we will explore a little differently here.

We will use PowerShell to build this standalone as well. Make sure you have installed pyinstaller, otherwise refer to part I. Now, we will (1) move into myproject2 folder and then (2) build the standalone program. In my case, input the lines into PowerShell.

cd Desktop/myproject2

Then, copy the folder Safekeep downloaded from github into myproject2/dist/main. There, run main.exe. In the File name field, insert Haldane_eigen1_3Sept, set the radio button to “eigen” mode and click Load button. Figure 1 will be shown, showing the eigenstate of Haldane model we modified. Easily done!


Figure 1. program _py_Haldane in action.

We explore the “time” mode. This program is actually just a viewer. The actual values are generated by python codes in my actual Final Year Project. Set the radio button to “time” and File name to “Haldane28Aug17_high_1_”, one of the data we have generated and saved in the Safekeep folder. Click Load, then click <<. You will see figure 2(A), marked by index = 0. Then click Next repeatedly to see the time evolution of the state. Figure 2(B) shows the state at index = 25. From the color, we can see the that initially, with some energy supply, the electron is initialized at bottom-left corner and let evolved. In this particular example, the intensity increases and creeps along the bottom edge.


Figure 2. _py_Haldane showing (A) a modified Haldane system initialized at bottom-left corner (B) a time-evolved state.

Physics explanation

2D Haldane model is the simplest topologically non-trivial system. A system like graphene is a 2D sheet of carbons linked in hexagonal structures. Electron can run from one carbon to another carbon. The eigenstate, i.e. the state that can stay as it is even after time has passed, can have many patterns. When the system is in its topologically non-trivial state, it can take the shape of the so-called edge state: electron is more likely found at the edges (or corners) of the 2D sheet, as in in figure 3. The figure is taken directly from here. The site also details some good information regarding this topic. The red dots show carbon atoms, while the black dots show the “intensity” of electron, i.e. the likelihood that an electron will be found at that site: the bigger the black dot, the more likely it is found there.

The interpretation of the absolute value of intensity is not clear; by normalizing the amplitude, we can again reinterpret it as the probability of finding the electron at some site relative to the others.


Figure 3. Edge state of the Haldane model.

Some extra stuffs

This project is a side project from my final year undergraduate study in NTU, Singapore. I have also been learning data science for awhile, and will update my progress slowly, here. Alright, actually I have to go back to the 4th ICT second part again. Signing off!