In [2]:
# !/usr/bin/env python

# buckled layer model on rectangular lattice
# illustrates usage of function k_path

# Copyright under GNU General Public License 2010, 2012, 2016
# by Sinisa Coh and David Vanderbilt (see gpl-pythtb.txt)

from __future__ import print_function
from pythtb import * # import TB model class
import numpy as np
import pylab as plt
import spglib as spg
import seekpath as sp

lattice = np.array([
    [ 3.2871687359128612, 0.0000000000000000, 0.0000000000000000],
    [-1.6435843679564306, 2.8467716318265182, 0.0000000000000000],
    [ 0.0000000000000000, 0.0000000000000000, 5.3045771064003047]])

positions = np.array([
    [0.3333333333333357,  0.6666666666666643,  0.3787615522102606],
    [0.6666666666666643,  0.3333333333333357,  0.8787615522102604],
    [0.6666666666666643,  0.3333333333333357,  0.4996814330926362],
    [0.3333333333333357,  0.6666666666666643,  0.9996814330926364]])

numbers = [8, 8, 30, 30]

O0 = positions[0]
O1 = positions[1]
Zn0 = positions[2]
Zn1 = positions[3]



#    s    px   py   pz
orb=[O0,  O0,  O0,  O0,
     O1,  O1,  O1,  O1,
     Zn0, Zn0, Zn0, Zn0,
     Zn1, Zn1, Zn1, Zn1]


# only first two lattice vectors repeat, so k-space is 2D
my_model=tb_model(3,3,lattice,orb)

# set on-site energies

Esa = -19.046
Epa =   4.142
Eha = (Esa+3*Epa)/4

Esc =   1.666
Epc =  12.368
Ehc = (Esc+3*Epc)/4


Uss   = -6.043
Uxx   =  7.157
Uxy   = 10.578
Usapc =  4.703
Upasc =  8.634

print(0.25*(Usapc*3+Upasc))


Vdi = -1
Vin = 0.0


I = np.ones(16)
H = np.array([
#   Oxygen 0            Oxygen 1             Zinc 0               Zinc 1
    [Eha, 0.0, 0.0, 0.0,  0.0, 0.0, 0.0, 0.0,  Vin, 0.0, 0.0, 0.0,  Vdi, 0.0, 0.0, 0.0],
    [0.0, Eha, 0.0, 0.0,  0.0, 0.0, 0.0, 0.0,  0.0, Vdi, 0.0, 0.0,  0.0, Vin, 0.0, 0.0],
    [0.0, 0.0, Eha, 0.0,  0.0, 0.0, 0.0, 0.0,  0.0, 0.0, Vin, 0.0,  0.0, 0.0, Vin, 0.0],
    [0.0, 0.0, 0.0, Eha,  0.0, 0.0, 0.0, 0.0,  0.0, 0.0, 0.0, Vin,  0.0, 0.0, 0.0, Vin],
    
    [0.0, 0.0, 0.0, 0.0,  Eha, 0.0, 0.0, 0.0,  Vin, 0.0, 0.0, 0.0,  Vin, 0.0, 0.0, 0.0],
    [0.0, 0.0, 0.0, 0.0,  0.0, Eha, 0.0, 0.0,  0.0, Vin, 0.0, 0.0,  0.0, Vin, 0.0, 0.0],
    [0.0, 0.0, 0.0, 0.0,  0.0, 0.0, Eha, 0.0,  0.0, 0.0, Vin, 0.0,  0.0, 0.0, Vin, 0.0],
    [0.0, 0.0, 0.0, 0.0,  0.0, 0.0, 0.0, Eha,  0.0, 0.0, 0.0, Vin,  0.0, 0.0, 0.0, Vin],
    
    [0.0, 0.0, 0.0, 0.0,  0.0, 0.0, 0.0, 0.0,  Ehc, 0.0, 0.0, 0.0,  0.0, 0.0, 0.0, 0.0],
    [0.0, 0.0, 0.0, 0.0,  0.0, 0.0, 0.0, 0.0,  0.0, Ehc, 0.0, 0.0,  0.0, 0.0, 0.0, 0.0],
    [0.0, 0.0, 0.0, 0.0,  0.0, 0.0, 0.0, 0.0,  0.0, 0.0, Ehc, 0.0,  0.0, 0.0, 0.0, 0.0],
    [0.0, 0.0, 0.0, 0.0,  0.0, 0.0, 0.0, 0.0,  0.0, 0.0, 0.0, Ehc,  0.0, 0.0, 0.0, 0.0],
    
    [0.0, 0.0, 0.0, 0.0,  0.0, 0.0, 0.0, 0.0,  0.0, 0.0, 0.0, 0.0,  Ehc, 0.0, 0.0, 0.0],
    [0.0, 0.0, 0.0, 0.0,  0.0, 0.0, 0.0, 0.0,  0.0, 0.0, 0.0, 0.0,  0.0, Ehc, 0.0, 0.0],
    [0.0, 0.0, 0.0, 0.0,  0.0, 0.0, 0.0, 0.0,  0.0, 0.0, 0.0, 0.0,  0.0, 0.0, Ehc, 0.0],
    [0.0, 0.0, 0.0, 0.0,  0.0, 0.0, 0.0, 0.0,  0.0, 0.0, 0.0, 0.0,  0.0, 0.0, 0.0, Ehc]])


my_model.set_onsite(np.dot(H,I))

""" FROM O0 """
#O0[0,0,0] to Zn1[0,0,-1])
End_cell = [0, 0, -1]
init, final = 0*4,3*4
my_model.set_hop(Vdi,   init+1, final+1,  End_cell) #dir -> dir

my_model.set_hop(Vin, init+1, final+0,  End_cell) #dir -> indir
my_model.set_hop(Vin, init+1, final+2,  End_cell) #dir -> indir
my_model.set_hop(Vin, init+1, final+3,  End_cell) #dir -> indir

my_model.set_hop(Vin, init+0, final+1,  End_cell) #indir -> dir
my_model.set_hop(Vin, init+2, final+1,  End_cell) #indir -> dir
my_model.set_hop(Vin, init+3, final+1,  End_cell) #indir -> dir

#O0[0,0,0] to Zn1[0,1,-1])
End_cell = [0, 1, -1]
init, final = 0*4,3*4
my_model.set_hop(Vdi,   init+2, final+2,  End_cell) #dir -> dir

my_model.set_hop(Vin, init+2, final+0,  End_cell) #dir -> indir
my_model.set_hop(Vin, init+2, final+1,  End_cell) #dir -> indir
my_model.set_hop(Vin, init+2, final+3,  End_cell) #dir -> indir

my_model.set_hop(Vin, init+0, final+2,  End_cell) #indir -> dir
my_model.set_hop(Vin, init+1, final+2,  End_cell) #indir -> dir
my_model.set_hop(Vin, init+3, final+2,  End_cell) #indir -> dir

#O0[0,0,0] to Zn1[-1,0,-1])
End_cell = [-1, 0, -1]
init, final = 0*4,3*4
my_model.set_hop(Vdi,   init+3, final+3,  End_cell) #dir -> dir

my_model.set_hop(Vin, init+3, final+0,  End_cell) #dir -> indir
my_model.set_hop(Vin, init+3, final+1,  End_cell) #dir -> indir
my_model.set_hop(Vin, init+3, final+2,  End_cell) #dir -> indir

my_model.set_hop(Vin, init+0, final+3,  End_cell) #indir -> dir
my_model.set_hop(Vin, init+1, final+3,  End_cell) #indir -> dir
my_model.set_hop(Vin, init+2, final+3,  End_cell) #indir -> dir

#O0[0,0,0] to Zn0[0,0,0])
End_cell = [0, 0, 0]
init, final = 0*4,2*4
my_model.set_hop(Vdi,   init+0, final+0,  End_cell) #dir -> dir

my_model.set_hop(Vin, init+0, final+1,  End_cell) #dir -> indir
my_model.set_hop(Vin, init+0, final+2,  End_cell) #dir -> indir
my_model.set_hop(Vin, init+0, final+3,  End_cell) #dir -> indir

my_model.set_hop(Vin, init+1, final+0,  End_cell) #indir -> dir
my_model.set_hop(Vin, init+2, final+0,  End_cell) #indir -> dir
my_model.set_hop(Vin, init+3, final+0,  End_cell) #indir -> dir


""" FROM O1 """
#O1[0,0,0] to Zn0[0,0,0])
End_cell = [0, 0, 0]
init, final = 1*4,2*4
my_model.set_hop(Vdi,   init+1, final+1,  End_cell) #dir -> dir

my_model.set_hop(Vin, init+1, final+0,  End_cell) #dir -> indir
my_model.set_hop(Vin, init+1, final+2,  End_cell) #dir -> indir
my_model.set_hop(Vin, init+1, final+3,  End_cell) #dir -> indir

my_model.set_hop(Vin, init+0, final+1,  End_cell) #indir -> dir
my_model.set_hop(Vin, init+2, final+1,  End_cell) #indir -> dir
my_model.set_hop(Vin, init+3, final+1,  End_cell) #indir -> dir

#O1[0,0,0] to Zn0[0,-1,0])
End_cell = [0, -1, 0]
init, final = 1*4,2*4
my_model.set_hop(Vdi,   init+2, final+2,  End_cell) #dir -> dir

my_model.set_hop(Vin, init+2, final+0,  End_cell) #dir -> indir
my_model.set_hop(Vin, init+2, final+1,  End_cell) #dir -> indir
my_model.set_hop(Vin, init+2, final+3,  End_cell) #dir -> indir

my_model.set_hop(Vin, init+0, final+2,  End_cell) #indir -> dir
my_model.set_hop(Vin, init+1, final+2,  End_cell) #indir -> dir
my_model.set_hop(Vin, init+3, final+2,  End_cell) #indir -> dir

#O0[0,0,0] to Zn0[1,0,0])
End_cell = [1, 0, 0]
init, final = 1*4,2*4
my_model.set_hop(Vdi,   init+3, final+3,  End_cell) #dir -> dir

my_model.set_hop(Vin, init+3, final+0,  End_cell) #dir -> indir
my_model.set_hop(Vin, init+3, final+1,  End_cell) #dir -> indir
my_model.set_hop(Vin, init+3, final+2,  End_cell) #dir -> indir

my_model.set_hop(Vin, init+0, final+3,  End_cell) #indir -> dir
my_model.set_hop(Vin, init+1, final+3,  End_cell) #indir -> dir
my_model.set_hop(Vin, init+2, final+3,  End_cell) #indir -> dir

#O0[0,0,0] to Zn1[0,0,0])
End_cell = [0, 0, 0]
init, final = 1*4,3*4
my_model.set_hop(Vdi,   init+0, final+0,  End_cell) #dir -> dir

my_model.set_hop(Vin, init+0, final+1,  End_cell) #dir -> indir
my_model.set_hop(Vin, init+0, final+2,  End_cell) #dir -> indir
my_model.set_hop(Vin, init+0, final+3,  End_cell) #dir -> indir

my_model.set_hop(Vin, init+1, final+0,  End_cell) #indir -> dir
my_model.set_hop(Vin, init+2, final+0,  End_cell) #indir -> dir
my_model.set_hop(Vin, init+3, final+0,  End_cell) #indir -> dir



""" FROM Zn0 """
#Zn0[0,0,0] to O1[-1,0,0])
End_cell = [-1, 0, 0]
init, final = 2*4,1*4
my_model.set_hop(Vdi,   init+2, final+2,  End_cell) #dir -> dir

my_model.set_hop(Vin, init+2, final+0,  End_cell) #dir -> indir
my_model.set_hop(Vin, init+2, final+1,  End_cell) #dir -> indir
#my_model.set_hop(Vin, init+2, final+3,  End_cell) #dir -> indir

my_model.set_hop(Vin, init+0, final+2,  End_cell) #indir -> dir
my_model.set_hop(Vin, init+1, final+2,  End_cell) #indir -> dir
#my_model.set_hop(Vin, init+3, final+2,  End_cell) #indir -> dir

#Zn0[0,0,0] to O1[0,1,0])
End_cell = [0, 1, 0]
init, final = 2*4,1*4
my_model.set_hop(Vdi,   init+3, final+3,  End_cell) #dir -> dir

my_model.set_hop(Vin, init+3, final+0,  End_cell) #dir -> indir
my_model.set_hop(Vin, init+3, final+1,  End_cell) #dir -> indir
#my_model.set_hop(Vin, init+3, final+2,  End_cell) #dir -> indir

my_model.set_hop(Vin, init+0, final+3,  End_cell) #indir -> dir
my_model.set_hop(Vin, init+1, final+3,  End_cell) #indir -> dir
#my_model.set_hop(Vin, init+2, final+3,  End_cell) #indir -> dir


""" FROM Zn0 """
#Zn1[0,0,0] to O0[1,0,0]
End_cell = [1, 0, 0]
init, final = 3*4,0*4
my_model.set_hop(Vdi,   init+2, final+2,  End_cell) #dir -> dir

my_model.set_hop(Vin, init+2, final+0,  End_cell) #dir -> indir
my_model.set_hop(Vin, init+2, final+1,  End_cell) #dir -> indir
#my_model.set_hop(Vin, init+2, final+3,  End_cell) #dir -> indir

my_model.set_hop(Vin, init+0, final+2,  End_cell) #indir -> dir
my_model.set_hop(Vin, init+1, final+2,  End_cell) #indir -> dir
#my_model.set_hop(Vin, init+3, final+2,  End_cell) #indir -> dir

#Zn0[0,0,0] to O0[0,-1,0]
End_cell = [0, -1, 0]
init, final = 3*4,0*4
my_model.set_hop(Vdi,   init+3, final+3,  End_cell) #dir -> dir

my_model.set_hop(Vin, init+3, final+0,  End_cell) #dir -> indir
my_model.set_hop(Vin, init+3, final+1,  End_cell) #dir -> indir
#my_model.set_hop(Vin, init+3, final+2,  End_cell) #dir -> indir

my_model.set_hop(Vin, init+0, final+3,  End_cell) #indir -> dir
my_model.set_hop(Vin, init+1, final+3,  End_cell) #indir -> dir
#my_model.set_hop(Vin, init+2, final+3,  End_cell) #indir -> dir


spg.get_spacegroup((lattice,positions,numbers))


5.6857500000000005
Out[2]:
'P6_3mc (186)'

In [17]:
path = sp.get_explicit_k_path((lattice, positions, numbers), False, recipe="hpkot", threshold=1e-5,reference_distance=1)
expath = path['explicit_kpoints_abs'][0:int(len(path['explicit_kpoints_abs'])/2)+1]
label = path['explicit_kpoints_labels'][0:int(len(path['explicit_kpoints_abs'])/2)+1]

In [18]:
# ----------------------------------------
# specify k-space path
# ----------------------------------------

# specify a path in k-space by listing a set of nodes; the path
# will consist of straight line segments connecting these nodes
p = 0.5
#path=[[0.0,0.0,0.5],[0.5,0.0,0.5],[0.5,0,0.0],[0.0,0.0,0.0],[0,0,0.5],[2./3.,1./3.,0.5],[2./3.,1./3.,0.0],[0,0,0]]
# specify labels for these nodal points
#label=(r'$A $',      r'$L$',       r'$M$',       r'$\Gamma$', r'$A $', r'$H$',  r'$K$',r'$\Gamma $')

# call function k_path to construct the actual path
(k_vec,k_dist,k_node)=my_model.k_path(expath,1000)
# inputs:
#   path: see above
#   81: number of interpolated k-points to be plotted
# outputs:
#   k_vec: list of interpolated k-points
#   k_dist: horizontal axis position of each k-point in the list
#   k_node: horizontal axis position of each original node

# ----------------------------------------
# do bandstructure calculation
# ----------------------------------------
print('Calculating bandstructure...')
evals =my_model.solve_all(k_vec)

# ----------------------------------------
# plot band structure
# ----------------------------------------
print('Plotting bandstructure...')

# Initialize plot
fig, ax = plt.subplots(figsize=(15,5))
ax.set_title("Bandstructure for buckled rectangular layer")
ax.set_ylabel("Band energy")

# specify horizontal axis details
ax.set_xlim([0,k_node[-1]])
# put tickmarks and labels at node positions
ax.set_xticks(k_node)
ax.set_xticklabels(label)
# add vertical lines at node positions
for n in range(len(k_node)):
  ax.axvline(x=k_node[n],linewidth=0.5, color='k')

# Plot two bands
ax.plot(k_dist,evals[0])
ax.plot(k_dist,evals[1])
ax.plot(k_dist,evals[2])
ax.plot(k_dist,evals[3])
ax.plot(k_dist,evals[4])
ax.plot(k_dist,evals[5])
ax.plot(k_dist,evals[6])
ax.plot(k_dist,evals[7])

# save as PDF
fig.tight_layout()
fig.savefig("direct_band.png")
#plt.ylim(-14,3)
plt.show()
print('Done.\n')


/home/sindrerb/anaconda3/envs/hySpy2/lib/python3.6/site-packages/pythtb.py:1745: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  if kpts=='full':
/home/sindrerb/anaconda3/envs/hySpy2/lib/python3.6/site-packages/pythtb.py:1748: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  elif kpts=='fullc':
/home/sindrerb/anaconda3/envs/hySpy2/lib/python3.6/site-packages/pythtb.py:1751: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  elif kpts=='half':
----- k_path report begin ----------
real-space lattice vectors
 [[ 3.28717  0.       0.     ]
 [-1.64358  2.84677  0.     ]
 [ 0.       0.       5.30458]]
k-space metric tensor
 [[ 0.12339  0.0617   0.     ]
 [ 0.0617   0.12339  0.     ]
 [ 0.       0.       0.03554]]
internal coordinates of nodes
 [[ 0.       0.       0.     ]
 [ 0.95571  0.55178  0.     ]
 [ 0.63714  1.10356  0.     ]
 [ 0.       0.       0.     ]
 [ 0.       0.       0.59224]
 [ 0.95571  0.55178  0.59224]
 [ 0.63714  1.10356  0.59224]
 [ 0.       0.       0.59224]
 [ 0.95571  0.55178  0.59224]
 [ 0.95571  0.55178  0.     ]
 [ 0.63714  1.10356  0.59224]
 [ 0.63714  1.10356  0.     ]
 [ 0.       0.       0.     ]]
reciprocal-space lattice vectors
 [[ 0.30421  0.17564  0.     ]
 [ 0.       0.35128  0.     ]
 [ 0.       0.       0.18852]]
cartesian coordinates of nodes
 [[ 0.       0.       0.     ]
 [ 0.29074  0.36169  0.     ]
 [ 0.19383  0.49956  0.     ]
 [ 0.       0.       0.     ]
 [ 0.       0.       0.11165]
 [ 0.29074  0.36169  0.11165]
 [ 0.19383  0.49956  0.11165]
 [ 0.       0.       0.11165]
 [ 0.29074  0.36169  0.11165]
 [ 0.29074  0.36169  0.     ]
 [ 0.19383  0.49956  0.11165]
 [ 0.19383  0.49956  0.     ]
 [ 0.       0.       0.     ]]
list of segments:
  length = 0.46406  from  [ 0.  0.  0.]  to  [ 0.95571  0.55178  0.     ]
  length = 0.16853  from  [ 0.95571  0.55178  0.     ]  to  [ 0.63714  1.10356  0.     ]
  length = 0.53584  from  [ 0.63714  1.10356  0.     ]  to  [ 0.  0.  0.]
  length = 0.11165  from  [ 0.  0.  0.]  to  [ 0.       0.       0.59224]
  length = 0.46406  from  [ 0.       0.       0.59224]  to  [ 0.95571  0.55178  0.59224]
  length = 0.16853  from  [ 0.95571  0.55178  0.59224]  to  [ 0.63714  1.10356  0.59224]
  length = 0.53584  from  [ 0.63714  1.10356  0.59224]  to  [ 0.       0.       0.59224]
  length = 0.46406  from  [ 0.       0.       0.59224]  to  [ 0.95571  0.55178  0.59224]
  length = 0.11165  from  [ 0.95571  0.55178  0.59224]  to  [ 0.95571  0.55178  0.     ]
  length = 0.20215  from  [ 0.95571  0.55178  0.     ]  to  [ 0.63714  1.10356  0.59224]
  length = 0.11165  from  [ 0.63714  1.10356  0.59224]  to  [ 0.63714  1.10356  0.     ]
  length = 0.53584  from  [ 0.63714  1.10356  0.     ]  to  [ 0.  0.  0.]
node distance list: [ 0.       0.46406  0.63258  1.16843  1.28007  1.74413  1.91266  2.4485
  2.91256  3.0242   3.22636  3.33801  3.87385]
node index list:    [  0 120 163 301 330 450 493 631 751 780 832 861 999]
----- k_path report end ------------

Calculating bandstructure...
Plotting bandstructure...
Done.


In [19]:
res = 13
k_shape = (res,res,res)


"""
k_limits = (0.5,0.5,0.5)
k_vec=np.zeros((k_shape[0]*k_shape[1]*k_shape[2], 3))
for i,x in enumerate(np.linspace(-k_limits[0],k_limits[0],k_shape[0]+1)[:-1]):
    for j,y in enumerate(np.linspace(-k_limits[1],k_limits[1],k_shape[1]+1)[:-1]):
        for k,z in enumerate(np.linspace(-k_limits[2],k_limits[2],k_shape[2]+1)[:-1]):
            k_vec[i*k_shape[1]*k_shape[2]+j*k_shape[2]+k]=np.array([x, y, z])
"""
            
k_vec=my_model.k_uniform_mesh(k_shape)



print('---------------------------------------')
print('starting calculation')
print('---------------------------------------')
print('Calculating bands...')

# solve for eigenenergies of hamiltonian on
# the set of k-points from above
evals, evec=my_model.solve_all(k_vec,eig_vectors=True)

print("Done!")
#k_vec


---------------------------------------
starting calculation
---------------------------------------
Calculating bands...
Done!

In [16]:
eC = min(evals[1])
kC = k_vec[(evals[1])==min(evals[1])][0]

eV = max(evals[0])
kV = k_vec[(evals[0])==max(evals[0])][0]

print("C_min=",eC,"at",kC)
print("V_max=",eV,"at",kV)
print("E_dir=",min(evals[1]-evals[0]),"at",k_vec[(evals[1]-evals[0])==min(evals[1]-evals[0])][0])
print("E_indir=",eC-eV,"with q=",kC-kV)


C_min= -19.046 at [ 0.  0.  0.]
V_max= -19.046 at [ 0.  0.  0.]
E_dir= 0.0 at [ 0.  0.  0.]
E_indir= 0.0 with q= [ 0.  0.  0.]

In [5]:
np.save("k-vec", k_vec)
np.save("k-shape", k_shape)
np.save("E-band-0", evals[0])
np.save("E-band-1", evals[1])
np.save("W-band-0", evec[0])
np.save("W-band-1", evec[1])

In [6]:
E = np.append(evals[0],evals[1])

binX = (np.linspace(0,0.5,25))
binY = (np.linspace(0,0.5,25))
binE = (np.linspace(-1.5,1.5,40))

hist, bins = np.histogram(E,bins=(binE))

plt.step(bins[:-1],hist)
plt.savefig("DOS%i.png"%(res))
plt.show()



In [7]:
evec


Out[7]:
array([[[ -6.24982712e-01 +0.00000000e+00j,
           0.00000000e+00 +0.00000000e+00j,
          -1.11022302e-16 +0.00000000e+00j, ...,
           2.57513734e-18 +0.00000000e+00j,
           2.06270419e-17 +0.00000000e+00j,
           1.80120309e-01 +0.00000000e+00j],
        [ -6.24982712e-01 +0.00000000e+00j,
           0.00000000e+00 +6.53677726e-18j,
           0.00000000e+00 -5.24915664e-20j, ...,
           2.81870616e-18 -1.46451306e-18j,
           1.12561604e-18 +9.19668835e-19j,
           1.79791689e-01 -1.08753936e-02j],
        [ -6.24982712e-01 +0.00000000e+00j,
           0.00000000e+00 -2.79829702e-17j,
           0.00000000e+00 +2.24286775e-17j, ...,
           9.47999936e-19 +5.94760707e-18j,
          -4.63825194e-18 +8.07562233e-20j,
           1.78807029e-01 -2.17111041e-02j],
        ..., 
        [ -6.24982712e-01 +0.00000000e+00j,
           0.00000000e+00 -1.17142236e-17j,
           0.00000000e+00 +2.68418618e-18j, ...,
          -2.08381606e-18 +2.75771203e-18j,
           4.54598734e-19 -3.16279455e-18j,
          -6.10455478e-02 +1.69460222e-01j],
        [ -6.24982712e-01 +0.00000000e+00j,
          -5.55111512e-17 +5.01485212e-18j,
           1.11022302e-16 +2.74133485e-18j, ...,
          -2.36820505e-18 +7.96783959e-18j,
           3.68277507e-18 -1.03740748e-17j,
          -5.07024199e-02 +1.72836890e-01j],
        [ -6.24982712e-01 +0.00000000e+00j,
           0.00000000e+00 -7.27243560e-19j,
           0.00000000e+00 +7.81741985e-18j, ...,
          -1.11025160e-18 -1.47614301e-18j,
           1.23077436e-18 +5.65154906e-18j,
          -4.01742844e-02 +1.75582894e-01j]],

       [[ -7.07106781e-01 -0.00000000e+00j,
           1.84906850e-18 +0.00000000e+00j,
           2.22044605e-16 +0.00000000e+00j, ...,
           3.08383648e-20 +0.00000000e+00j,
          -4.66852439e-17 +0.00000000e+00j,
           4.33077470e-17 +0.00000000e+00j],
        [ -7.07106781e-01 -0.00000000e+00j,
           3.10804134e-17 -9.74682394e-18j,
           0.00000000e+00 -5.88798258e-18j, ...,
          -3.82801706e-18 +3.01617705e-18j,
          -4.53109136e-18 -2.06116358e-18j,
           2.06432690e-16 -1.12886191e-17j],
        [ -7.07106781e-01 -0.00000000e+00j,
          -1.35002409e-17 +4.58032029e-17j,
          -1.11022302e-16 -6.19088668e-19j, ...,
           5.18126111e-19 -1.30419587e-17j,
           1.52631938e-17 -1.14280641e-18j,
           3.84755830e-17 +1.45402453e-18j],
        ..., 
        [ -7.07106781e-01 -0.00000000e+00j,
           1.99714638e-17 +1.75096355e-17j,
           0.00000000e+00 -3.53666409e-18j, ...,
           4.17829759e-18 -3.56162767e-18j,
          -9.83762319e-19 +4.48509326e-18j,
          -2.00849254e-17 +6.17789213e-17j],
        [ -7.07106781e-01 -0.00000000e+00j,
           1.60707463e-16 -1.47881875e-17j,
          -1.11022302e-16 -2.62438263e-18j, ...,
           9.41042539e-18 -3.37056470e-17j,
          -9.80015001e-18 +2.35944875e-17j,
          -7.56242949e-19 +1.81989901e-17j],
        [ -7.07106781e-01 -0.00000000e+00j,
           1.80976634e-17 +9.50551516e-19j,
           1.11022302e-16 -2.81082135e-17j, ...,
           1.29950208e-18 +6.72121214e-18j,
          -4.21216210e-18 -1.44360608e-17j,
           2.34561991e-18 -6.63373629e-17j]],

       [[  8.75659089e-19 +0.00000000e+00j,
          -2.58264962e-01 +0.00000000e+00j,
           5.02335338e-01 +0.00000000e+00j, ...,
           1.94505210e-01 +0.00000000e+00j,
          -3.78320156e-01 +0.00000000e+00j,
          -3.55268207e-16 +0.00000000e+00j],
        [  1.51456040e-16 +0.00000000e+00j,
          -2.24469622e-01 +1.05203018e-03j,
           5.15519472e-01 +5.37916188e-02j, ...,
           1.68696905e-01 -1.09980388e-02j,
          -3.89987122e-01 -1.69958619e-02j,
           4.97404675e-16 +3.47004967e-20j],
        [ -8.22962628e-17 +0.00000000e+00j,
           1.20420505e-01 -3.09026892e-01j,
           4.38806047e-01 -1.28421641e-01j, ...,
          -6.19770502e-02 +2.41969914e-01j,
          -3.16407293e-01 +1.35846413e-01j,
          -5.02279838e-17 -3.18398727e-17j],
        ..., 
        [  8.69814240e-17 +0.00000000e+00j,
          -2.59118794e-01 +5.11758002e-02j,
           4.96086420e-01 -5.63767166e-02j, ...,
          -2.98781078e-02 +1.96661125e-01j,
           8.66777719e-02 -3.65892173e-01j,
          -1.11351822e-16 +3.49079066e-16j],
        [ -9.00203962e-17 +0.00000000e+00j,
          -5.38874353e-01 -4.08122290e-02j,
           1.22248616e-01 +1.09752685e-01j, ...,
          -1.43734021e-01 +3.80775753e-01j,
           1.05231340e-01 -6.50779523e-02j,
          -5.82807229e-17 -6.97659082e-17j],
        [  1.50027006e-17 +0.00000000e+00j,
           2.50953474e-01 -9.11690946e-02j,
          -1.79679364e-01 -4.64184725e-01j, ...,
          -2.47773153e-02 -1.99552051e-01j,
          -3.70963678e-01 +5.39391382e-02j,
          -1.62941166e-16 +2.09165681e-16j]],

       ..., 
       [[ -3.00114174e-17 +0.00000000e+00j,
           2.81785458e-01 +0.00000000e+00j,
           3.18677538e-01 +0.00000000e+00j, ...,
           3.74156098e-01 +0.00000000e+00j,
           4.23141580e-01 +0.00000000e+00j,
          -2.25961760e-17 +0.00000000e+00j],
        [ -4.08784626e-17 +0.00000000e+00j,
          -4.09329351e-01 +4.78612188e-02j,
          -1.05272091e-01 -5.91529370e-03j, ...,
          -5.38680818e-01 +9.62507010e-02j,
          -1.40000004e-01 +5.99728404e-04j,
          -1.28752777e-16 +2.39699141e-17j],
        [ -2.21160711e-18 +0.00000000e+00j,
          -2.38358382e-01 +2.94323856e-01j,
           1.10572040e-01 -1.59031415e-01j, ...,
          -2.67079528e-01 +4.26104303e-01j,
           1.20294773e-01 -2.27320036e-01j,
           6.72504603e-17 +8.24151769e-19j],
        ..., 
        [ -3.18184055e-17 +0.00000000e+00j,
           6.48616801e-02 -6.74607331e-02j,
           3.43252899e-01 -2.33190645e-01j, ...,
           5.50847435e-02 +1.11384826e-01j,
           1.36838247e-01 +5.33737733e-01j,
           1.24491645e-16 -3.09281114e-16j],
        [  2.26006291e-16 -0.00000000e+00j,
           4.12979461e-01 -2.55126643e-02j,
           8.90335473e-02 +4.27611268e-02j, ...,
          -1.21851823e-01 +5.35718351e-01j,
          -8.77602636e-02 +9.74561438e-02j,
          -2.32936555e-16 +7.87566369e-16j],
        [ -7.54981042e-17 +0.00000000e+00j,
          -2.07643773e-01 -5.98030816e-02j,
           3.55873386e-01 -8.72937867e-02j, ...,
           1.38901316e-01 -2.51053973e-01j,
           7.59540398e-03 +4.86479413e-01j,
           3.09122917e-17 -2.47824781e-16j]],

       [[  7.55059067e-17 -0.00000000e+00j,
           3.18677538e-01 +0.00000000e+00j,
          -2.81785458e-01 +0.00000000e+00j, ...,
           4.23141580e-01 +0.00000000e+00j,
          -3.74156098e-01 +0.00000000e+00j,
          -6.29327505e-17 +0.00000000e+00j],
        [ -2.83887492e-18 +0.00000000e+00j,
           1.05431647e-01 +1.17117608e-03j,
          -4.05188645e-01 -7.52554038e-02j, ...,
           1.39831137e-01 -6.90028987e-03j,
          -5.43063166e-01 -6.72578605e-02j,
          -8.10947871e-17 +4.39777139e-17j],
        [ -1.32026741e-16 +0.00000000e+00j,
          -1.93510382e-01 -8.42016639e-03j,
          -3.78569591e-01 +1.12389982e-02j, ...,
          -2.56418253e-01 +1.98723591e-02j,
          -4.97202741e-01 +7.54041453e-02j,
          -5.01049058e-16 +8.26027728e-17j],
        ..., 
        [ -1.03752996e-17 +0.00000000e+00j,
          -4.12910432e-01 +4.12965414e-02j,
           9.30325984e-02 +1.01451314e-02j, ...,
           1.34226763e-01 -5.34400458e-01j,
          -5.45394402e-02 +1.11652846e-01j,
           6.90909343e-17 -1.53404066e-16j],
        [  5.34084391e-18 +0.00000000e+00j,
           9.80859148e-02 +1.16034401e-02j,
          -3.35016520e-01 -2.42830933e-01j, ...,
          -5.14453150e-02 +1.20635581e-01j,
           4.34612011e-01 -3.36086922e-01j,
           6.87782573e-17 -7.64841758e-18j],
        [  1.15326777e-17 +0.00000000e+00j,
           3.47694745e-01 +1.15647900e-01j,
           2.11782754e-01 -4.29000030e-02j, ...,
          -2.52661254e-01 +4.15791053e-01j,
          -7.19273515e-03 +2.86827366e-01j,
          -1.58058078e-18 +1.06981288e-16j]],

       [[ -1.42118046e-01 +0.00000000e+00j,
           1.11022302e-16 +0.00000000e+00j,
          -2.22044605e-16 +0.00000000e+00j, ...,
           1.14571424e-16 +0.00000000e+00j,
          -2.18376198e-16 +0.00000000e+00j,
          -5.65151998e-01 +0.00000000e+00j],
        [ -1.42118046e-01 +0.00000000e+00j,
           1.11022302e-16 -2.35892790e-17j,
           1.11022302e-16 +2.89799916e-19j, ...,
           1.30942467e-16 -2.55388509e-17j,
           3.78913288e-17 +1.82348358e-18j,
          -5.64120909e-01 +3.41230285e-02j],
        [ -1.42118046e-01 +0.00000000e+00j,
           2.22044605e-16 +3.58285042e-18j,
           3.33066907e-16 -1.95752372e-17j, ...,
           2.04289116e-16 -1.83987710e-17j,
           3.80370829e-16 -5.58755292e-17j,
          -5.61031404e-01 +6.81215457e-02j],
        ..., 
        [ -1.42118046e-01 +0.00000000e+00j,
           0.00000000e+00 +1.55354591e-17j,
           0.00000000e+00 +5.58354817e-17j, ...,
          -2.04994228e-17 +8.85307983e-18j,
          -2.14618643e-17 -1.11300817e-16j,
           1.91538719e-01 -5.31704523e-01j],
        [ -1.42118046e-01 +0.00000000e+00j,
           8.88178420e-16 -5.72704675e-17j,
           2.22044605e-16 +5.58400886e-17j, ...,
          -1.84316397e-16 +7.95602480e-16j,
          -1.01250776e-16 +1.07864788e-16j,
           1.59085747e-01 -5.42299277e-01j],
        [ -1.42118046e-01 +0.00000000e+00j,
           1.11022302e-16 +4.75684471e-17j,
          -2.22044605e-16 +3.74875735e-17j, ...,
          -8.01867588e-17 +1.37731279e-16j,
          -4.49973926e-18 -1.90458291e-16j,
           1.26052288e-01 -5.50915240e-01j]]])

In [8]:
k_vec[:21,2]


Out[8]:
array([ 0.        ,  0.07692308,  0.15384615,  0.23076923,  0.30769231,
        0.38461538,  0.46153846,  0.53846154,  0.61538462,  0.69230769,
        0.76923077,  0.84615385,  0.92307692,  0.        ,  0.07692308,
        0.15384615,  0.23076923,  0.30769231,  0.38461538,  0.46153846,
        0.53846154])

In [9]:
valence = evals[0]
conduct = evals[1]
kBool = k_vec[:,0] == 0.5

print(min(conduct)-max(valence[kBool]))


---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-9-5fa651b9ca18> in <module>()
      3 kBool = k_vec[:,0] == 0.5
      4 
----> 5 print(min(conduct)-max(valence[kBool]))

ValueError: max() arg is an empty sequence

In [ ]:


In [ ]:


In [ ]: