Skip to content
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

Merged
merged 13 commits into from
Nov 6, 2024

Conversation

VsevolodX
Copy link
Member

No description provided.

return commensurate_lattice_pairs

def __determine_max_int(self, a: List[float], b: List[float], target_angle: float) -> int:
Copy link
Member

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:
Copy link
Member

@timurbazhirov timurbazhirov Nov 5, 2024

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.

Copy link
Member Author

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

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 = [
Copy link
Member

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

Copy link
Member

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.
Copy link
Member

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:
Copy link
Member

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 = [
Copy link
Member

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

Copy link
Member

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(
Copy link
Member

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

@VsevolodX VsevolodX merged commit 2987cdd into main Nov 6, 2024
9 checks passed
@VsevolodX VsevolodX deleted the feature/SOF-7456 branch November 6, 2024 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants