-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from Imperial-CMTH/chern_number
Chern number
- Loading branch information
Showing
3 changed files
with
379 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from koala.lattice import Lattice | ||
import numpy as np | ||
import scipy.linalg as la | ||
|
||
def crosshair_marker(lattice: Lattice, projector: np.ndarray, crosshair_position: np.ndarray): | ||
"""Generate the crosshair marker for a lattice and Hamiltonian | ||
:param lattice: the lattice on which the Hamiltonian is placed | ||
:type lattice: Lattice | ||
:param projector: A projectro onto a set of occupied states | ||
:type projector: np.ndarray | ||
:param crosshair_position: the position of the crosshair in the bulk | ||
:type crosshair_position: np.ndarray | ||
:return: an array giving the marker value at every point in the system | ||
:rtype: np.ndarray | ||
""" | ||
|
||
|
||
positions = lattice.vertices.positions | ||
theta_x_vec = np.diag(1*(positions[:,0] < crosshair_position[0])) | ||
theta_y_vec = np.diag(1*(positions[:,1] < crosshair_position[1])) | ||
|
||
crosshair_marker = 4*np.pi*np.diag(projector@theta_x_vec@projector@theta_y_vec@projector).imag | ||
|
||
return crosshair_marker | ||
|
||
|
||
def chern_marker(lattice: Lattice, projector: np.ndarray): | ||
"""generate the Chern marker for the system | ||
:param lattice: the lattice | ||
:type lattice: Lattice | ||
:param projector: a projector onto a set of occupied states | ||
:type projector: np.ndarray | ||
:return: the Chern marker value for each point in the system | ||
:rtype: np.ndarray | ||
""" | ||
|
||
positions = lattice.vertices.positions | ||
X = np.diag(positions[:,0]) | ||
Y = np.diag(positions[:,1]) | ||
|
||
chern_marker = 4*np.pi*np.diag(projector@X@projector@Y@projector).imag | ||
|
||
return chern_marker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from koala.pointsets import generate_random | ||
from koala.voronization import generate_lattice | ||
from koala.graph_color import color_lattice | ||
from koala.hamiltonian import generate_majorana_hamiltonian | ||
from numpy import linalg as la | ||
import numpy as np | ||
import matplotlib | ||
from koala import chern_number as cn | ||
|
||
def test_chern_and_crosshair(): | ||
# define the lattice system | ||
number_of_plaquettes = 50 | ||
points = generate_random(number_of_plaquettes) | ||
lattice = generate_lattice(points) | ||
|
||
# color the lattice | ||
coloring = color_lattice(lattice) | ||
|
||
# parameters | ||
ujk = np.full(lattice.n_edges, 1) | ||
J = np.array([1,1,1]) | ||
|
||
# solve system | ||
H_maj = generate_majorana_hamiltonian(lattice, coloring, ujk, J) | ||
eigs, vecs = la.eigh (H_maj) | ||
lowest_diag = np.array([1]*(lattice.n_vertices//2) + [0]*(lattice.n_vertices//2) ) | ||
P = vecs @ np.diag(lowest_diag) @ vecs.conj().T | ||
|
||
# find crosshair / chern number | ||
crosshair_position = np.array([0.5,0.5]) | ||
crosshair_marker = cn.crosshair_marker(lattice, P, crosshair_position) | ||
chern_marker = cn.chern_marker(lattice, P) |
Large diffs are not rendered by default.
Oops, something went wrong.