-
Notifications
You must be signed in to change notification settings - Fork 3
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
Feature/SOF-7456 adjustments for Twisted Interface Builder #171
Conversation
return commensurate_lattice_pairs | ||
|
||
def __determine_max_int(self, a: List[float], b: List[float], target_angle: float) -> int: |
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.
__get_initial_guess_for_max_int
) | ||
commensurate_lattice_pairs: List[CommensurateLatticePair] = [] | ||
while not commensurate_lattice_pairs and max_int < 42: |
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.
42 is a magic number. Should be configurable as an optional builder parameter instead.
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.
Well, we only want to limit infinite loop. This will stop for up to angle of ~0.8 degrees
if theta_rad == 0: | ||
max_int = 1 | ||
if film.lattice.type == "HEX": | ||
from .enums import angle_to_lmpq_hex |
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.
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.
?
There's a tabulation for supercell vectors, they themselves do not help construct both matrices in our method, but we can use those values to generate the matrices with max_int value.
|
||
|
||
# Tabulation from https://github.com/qtm-iisc/Twister/blob/474156a2a59f2b9d59350b32de56864a9496f848/examples/Homobilayer_hex/hex.table | ||
angle_to_lmpq_hex = [ |
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.
Let's call is something understandable
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.
Add explanation of what's in rows
|
||
Args: | ||
configuration (TwistedInterfaceConfiguration): The configuration for the twisted interface. | ||
a (List[float]): The a lattice vector. | ||
b (List[float]): The b lattice vector. | ||
max_search (int): The maximum search range. | ||
target_angle (float): The target angle, in degrees. | ||
max_int (int): The maximum integer for the transformation matrices. |
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.
maybe max_supercell_matrix_element_int
?
theta_rad = np.radians(target_angle) | ||
|
||
# Factor in both the lattice length and twist angle, ensuring a minimum of 1 for very small angles | ||
if theta_rad == 0: |
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.
Should be with tolerance for zero
|
||
|
||
# Tabulation from https://github.com/qtm-iisc/Twister/blob/474156a2a59f2b9d59350b32de56864a9496f848/examples/Homobilayer_hex/hex.table | ||
angle_to_supercell_matrix_values_for_hex = [ |
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.
Explain in comment what is given in the rows
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.
let's have [
{
"angle": ...,
"xy_supercell": [[0, 1], [-1, 1]]
}
...
]
int: The maximum integer for the transformation matrices. | ||
""" | ||
if film.lattice.type == "HEX": | ||
tabulated_matrix_match_for_given_angle = min( |
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.
xy_supercell_matrix_for_closest_angle
No description provided.