Skip to content

Commit

Permalink
fix lattice bug
Browse files Browse the repository at this point in the history
  • Loading branch information
qzhu committed Jan 15, 2022
1 parent 9908cc2 commit 99c593c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
9 changes: 5 additions & 4 deletions pyxtal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1506,9 +1506,10 @@ def _get_alternative(self, wyc_sets, index, ref_cell=None):
if pos1 is not None:
new_struc.atom_sites[i] = atom_site(wp, pos1, site.specie)
else:
print(pos)
print(wp)
raise RuntimeError("Cannot find the right pos")
return None
#print(pos)
#print(wp)
#raise RuntimeError("Cannot find the right pos")

new_struc.source = "Alt. Wyckoff Set [{:d}]: {:s}".format(index, xyz_string)
new_struc.wyc_set_id = index
Expand Down Expand Up @@ -2035,7 +2036,7 @@ def get_transition_by_path(self, ref_struc, path, d_tol, d_tol2=0.5, N_images=2)
for label in site:
try:
index = string.ascii_lowercase.index(label[-1])
except ValueError: #8A
except ValueError: #'8A'
index = 26
_site.extend(relation[index])
_sites0.append(_site)
Expand Down
11 changes: 7 additions & 4 deletions pyxtal/lattice.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,13 @@ def search_transformation(self, lat_ref, d_tol=1.0, f_tol=0.1):

for j, tran2 in enumerate(trans2):
tmp = np.dot(tran2, lat0.matrix)
cell2 = Lattice.from_matrix(tmp, l_type=self.ltype).matrix
diff = np.abs(cell1-cell2).flatten()
id = np.argmax(diff)
d_tol1, f_tol1 = diff[id], diff[id]/abs(cell1.flatten()[id])
try:
cell2 = Lattice.from_matrix(tmp, l_type=self.ltype).matrix
diff = np.abs(cell1-cell2).flatten()
id = np.argmax(diff)
d_tol1, f_tol1 = diff[id], diff[id]/abs(cell1.flatten()[id])
except:
d_tol1, f_tol1 = 10, 1.0
tols[j, :] = [d_tol1, f_tol1]
#print([d_tol1, f_tol1])
#print(tols)
Expand Down

0 comments on commit 99c593c

Please sign in to comment.