MCPcopy Create free account
hub / github.com/NanoComp/meep / first_brillouin_zone

Method first_brillouin_zone

python/solver.py:1118–1158  ·  view source on GitHub ↗

Function to convert a k-point k into an equivalent point in the first Brillouin zone (not necessarily the irreducible Brillouin zone)

(self, k)

Source from the content-addressed store, hash-verified

1116 return ks
1117
1118 def first_brillouin_zone(self, k):
1119 """
1120 Function to convert a k-point k into an equivalent point in the
1121 first Brillouin zone (not necessarily the irreducible Brillouin zone)
1122 """
1123
1124 def n(k):
1125 return mp.reciprocal_to_cartesian(k, self.geometry_lattice).norm()
1126
1127 def try_plus(k, v):
1128 return try_plus(k + v, v) if n(k + v) < n(k) else k
1129
1130 def _try(k, v):
1131 return try_plus(try_plus(k, v), mp.Vector3() - v)
1132
1133 try_list = [
1134 mp.Vector3(1, 0, 0),
1135 mp.Vector3(0, 1, 0),
1136 mp.Vector3(0, 0, 1),
1137 mp.Vector3(0, 1, 1),
1138 mp.Vector3(1, 0, 1),
1139 mp.Vector3(1, 1, 0),
1140 mp.Vector3(0, 1, -1),
1141 mp.Vector3(1, 0, -1),
1142 mp.Vector3(1, -1, 0),
1143 mp.Vector3(1, 1, 1),
1144 mp.Vector3(-1, 1, 1),
1145 mp.Vector3(1, -1, 1),
1146 mp.Vector3(1, 1, -1),
1147 ]
1148
1149 def try_all(k):
1150 return functools.reduce(_try, try_list, k)
1151
1152 def try_all_and_repeat(k):
1153 knew = try_all(k)
1154 return try_all_and_repeat(knew) if n(knew) < n(k) else k
1155
1156 k0 = k - mp.Vector3(*[round(x) for x in k])
1157
1158 return try_all_and_repeat(k0) if n(k0) < n(k) else try_all_and_repeat(k)
1159
1160 def get_dominant_planewave(self, band):
1161 return self.mode_solver.get_dominant_planewave(band)

Callers 1

Calls

no outgoing calls

Tested by 1