-
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 7282 1 #163
feature/SOF 7282 1 #163
Conversation
VsevolodX
commented
Sep 19, 2024
•
edited
Loading
edited
- feat: add commensurate supercells generation builder
return commensurate_lattice_pairs | ||
|
||
@staticmethod | ||
def __create_matrices(max_search: 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.
create_2d_supercell_matrices + docstring
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.
Can be util
return matrices | ||
|
||
@staticmethod | ||
def __solve_angle_from_rotation_matrix(matrix, zero_tolerance=1e-6, round_digits=3): |
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.
Can be util
intermediate_product = matrix2_inverse @ matrix1 | ||
product = matrix_a1a2_inverse @ intermediate_product @ matrix_a1a2 | ||
try: | ||
angle = self.__solve_angle_from_rotation_matrix(product) |
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.
We can return None and get back from loop here
@@ -1,6 +1,8 @@ | |||
from typing import Any, List, Optional | |||
|
|||
import numpy as np | |||
from mat3ra.made.tools.build.supercell import create_supercell |
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.
May be imported from ...
|
||
|
||
class CommensurateLatticeInterfaceBuilderParameters(BaseModel): | ||
max_search: int = 10 |
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.
max_repetition_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.
- Docstring
new_film, [0, 0, item.configuration.distance_z], use_cartesian_coordinates=True | ||
) | ||
try: | ||
interface = merge_materials([new_substrate, new_film]) |
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.
Why do we need this - lattices have to be commensurate already?
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.
The try case? lms
src/py/mat3ra/made/utils.py
Outdated
return matrices | ||
|
||
|
||
def get_angle_from_rotation_matrix( |
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_angle_from_rotation_matrix_2d
|
||
Attributes: | ||
configuration (TwistedInterfaceConfiguration): The configuration of the twisted interface. | ||
matrix1 (np.ndarray): The supercell matrix for the first lattice. |
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.
2d supercell matrix
# substrate = configuration.substrate | ||
max_search = self.build_parameters.max_repetition_int | ||
a = film.lattice.vector_arrays[0][:2] | ||
b = film.lattice.vector_arrays[1][:2] |
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.
We should have a getter for this film.lattice.a
, film.lattice.b
, film.lattice.c
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.
Ok. We're adding this across all the made during cleanup task.