Skip to content

Commit a088f39

Browse files
committed
one final speed up and a bug fix in unitcell.ChooseSymmetric
1 parent 64d0ced commit a088f39

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

hexrd/core/material/unitcell.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,28 @@ def _calclength(u, mat):
3232

3333
@njit(cache=True, nogil=True)
3434
def _calcstar(v, sym, mat):
35-
# vsym = np.atleast_2d(v)
35+
3636
vsym = np.empty((sym.shape[0], v.shape[0]))
37+
nsym = sym.shape[0]
38+
3739
n = 0
3840
vsym[n,:] = v
3941
n = n + 1
42+
4043
# the first element is always the identity
4144
# so we can safely skip that
4245
for s in sym[1:,:,:]:
46+
4347
vp = np.dot(np.ascontiguousarray(s), v)
48+
4449
# check if this is new
4550
isnew = True
46-
for vec in vsym:
51+
for vec in vsym[0:n,:]:
4752
dist = np.sum((vp - vec)**2)
4853
if dist < 1e-4:
4954
isnew = False
5055
break
56+
5157
if isnew:
5258
vsym[n,:] = vp
5359
n = n + 1
@@ -987,7 +993,7 @@ def ChooseSymmetric(self, hkllist, InversionSymmetry=True):
987993
for i, g in enumerate(hkllist):
988994
if mask[i]:
989995

990-
geqv = self.CalcStar(g, 'r', applyLaue=laue)
996+
geqv = self.CalcStar(g, 'r', applyLaue=laue).astype(int)
991997

992998
for r in geqv[1:,]:
993999
rid = np.where(np.all(r == hkllist, axis=1))

0 commit comments

Comments
 (0)