-
Notifications
You must be signed in to change notification settings - Fork 918
Allow for setting termination_ftol for film and substrate slabs separately #4498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 10 commits
ac73279
7d2e9bc
d7b33b5
6551acb
ddd28d6
11527a4
5f6ff7e
2aa44af
4ecad8f
d079dca
85e868e
cbde8e7
34dad5e
86b42ab
4e175a8
17c4d27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ def __init__( | |
film_miller: tuple[int, int, int], | ||
substrate_miller: tuple[int, int, int], | ||
zslgen: ZSLGenerator | None = None, | ||
termination_ftol: float = 0.25, | ||
termination_ftol: float | tuple[float, float] = 0.25, | ||
label_index: bool = False, # necessary to add index to termination | ||
filter_out_sym_slabs: bool = True, | ||
): | ||
|
@@ -43,7 +43,7 @@ def __init__( | |
film_miller (tuple[int, int, int]): miller index for the film layer | ||
substrate_miller (tuple[int, int, int]): miller index for the substrate layer | ||
zslgen (ZSLGenerator | None): BiDirectionalZSL if you want custom lattice matching tolerances for coherency. | ||
termination_ftol (float): tolerance to distinguish different terminating atomic planes. | ||
termination_ftol (float): tolerances (film, substrate) to distinguish different terminating atomic planes. | ||
label_index (bool): If True add an extra index at the beginning of the termination label. | ||
filter_out_sym_slabs (bool): If True filter out identical slabs with different terminations. | ||
This might need to be set as False to find more non-identical terminations because slab | ||
|
@@ -133,24 +133,29 @@ def _find_terminations(self): | |
reorient_lattice=False, # This is necessary to not screw up the lattice | ||
) | ||
|
||
film_slabs = film_sg.get_slabs(ftol=self.termination_ftol, filter_out_sym_slabs=self.filter_out_sym_slabs) | ||
sub_slabs = sub_sg.get_slabs(ftol=self.termination_ftol, filter_out_sym_slabs=self.filter_out_sym_slabs) | ||
if type(self.termination_ftol) is not tuple: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should use |
||
self.termination_ftol = (self.termination_ftol, self.termination_ftol) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess it's more readable to unpack within if isinstance(termination_ftol, tuple):
self.film_termination_ftol, self.substrate_termination_ftol = termination_ftol
else:
self.film_termination_ftol = self.substrate_termination_ftol = termination_ftol There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Daniel, many thanks for these helpful suggestions. I have commited these changes. |
||
|
||
film_slabs = film_sg.get_slabs(ftol=self.termination_ftol[0], filter_out_sym_slabs=self.filter_out_sym_slabs) | ||
sub_slabs = sub_sg.get_slabs(ftol=self.termination_ftol[1], filter_out_sym_slabs=self.filter_out_sym_slabs) | ||
film_shifts = [slab.shift for slab in film_slabs] | ||
|
||
if self.label_index: | ||
film_terminations = [ | ||
label_termination(slab, self.termination_ftol, t_idx) for t_idx, slab in enumerate(film_slabs, start=1) | ||
label_termination(slab, self.termination_ftol[0], t_idx) | ||
for t_idx, slab in enumerate(film_slabs, start=1) | ||
] | ||
else: | ||
film_terminations = [label_termination(slab, self.termination_ftol) for slab in film_slabs] | ||
film_terminations = [label_termination(slab, self.termination_ftol[0]) for slab in film_slabs] | ||
|
||
sub_shifts = [slab.shift for slab in sub_slabs] | ||
if self.label_index: | ||
sub_terminations = [ | ||
label_termination(slab, self.termination_ftol, t_idx) for t_idx, slab in enumerate(sub_slabs, start=1) | ||
label_termination(slab, self.termination_ftol[1], t_idx) | ||
for t_idx, slab in enumerate(sub_slabs, start=1) | ||
] | ||
else: | ||
sub_terminations = [label_termination(slab, self.termination_ftol) for slab in sub_slabs] | ||
sub_terminations = [label_termination(slab, self.termination_ftol[1]) for slab in sub_slabs] | ||
|
||
self._terminations = { | ||
(film_label, sub_label): (film_shift, sub_shift) | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not very familiar with the use case of
CoherentInterfaceBuilder
but I assume it's reasonable to allow more fine-grained control over the film and substrate. In this case I guess: either you allowtermination_ftol
to befloat | tuple[float, float]
but you should update the docstring accordingly (currently it's stillfloat
), or you could deprecate this arg with two args likefilm/substrate_termination_tol
.