Skip to content

Commit

Permalink
chore: rename steps -> layers
Browse files Browse the repository at this point in the history
  • Loading branch information
VsevolodX committed Jul 29, 2024
1 parent f488575 commit 2edc0ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
12 changes: 7 additions & 5 deletions src/py/mat3ra/made/tools/build/defect/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def _increase_lattice_size(

def _update_material_name(self, material: Material, configuration: _ConfigurationType) -> Material:
updated_material = super()._update_material_name(material, configuration)
new_name = f"{updated_material.name}, {configuration.steps_number}-step Terrace {configuration.cut_direction}"
new_name = f"{updated_material.name}, {configuration.number_of_added_layers}-step Terrace {configuration.cut_direction}"

Check failure on line 494 in src/py/mat3ra/made/tools/build/defect/builders.py

View workflow job for this annotation

GitHub Actions / run-py-linter (3.8.6)

Ruff (E501)

src/py/mat3ra/made/tools/build/defect/builders.py:494:121: E501 Line too long (128 > 120 characters)
updated_material.name = new_name
return updated_material

Expand All @@ -500,7 +500,7 @@ def create_terrace(
material: Material,
cut_direction: Optional[List[int]] = None,
pivot_coordinate: Optional[List[float]] = None,
steps_number: int = 1,
number_of_added_layers: int = 1,
use_cartesian_coordinates: bool = False,
rotate_to_match_pbc: bool = True,
) -> Material:
Expand All @@ -511,7 +511,7 @@ def create_terrace(
material: The material to add the terrace to.
cut_direction: The direction of the cut in lattice directions.
pivot_coordinate: The center position of the terrace.
steps_number: The number of steps to bunch.
number_of_added_layers: The number of added layers to the slab which will form the terrace
use_cartesian_coordinates: Whether to use Cartesian coordinates for the center position.
rotate_to_match_pbc: Whether to rotate the material to match the periodic boundary conditions.
Returns:
Expand All @@ -523,7 +523,9 @@ def create_terrace(
pivot_coordinate = [0.5, 0.5, 0.5]

new_material = material.clone()
material_with_additional_layers = self.create_material_with_additional_layers(new_material, steps_number)
material_with_additional_layers = self.create_material_with_additional_layers(
new_material, number_of_added_layers
)

normalized_direction_vector = self._calculate_cut_direction_vector(material, cut_direction)
condition = CoordinateConditionBuilder().plane(
Expand Down Expand Up @@ -553,7 +555,7 @@ def _generate(self, configuration: _ConfigurationType) -> List[_GeneratedItemTyp
material=configuration.crystal,
cut_direction=configuration.cut_direction,
pivot_coordinate=configuration.pivot_coordinate,
steps_number=configuration.steps_number,
number_of_added_layers=configuration.number_of_added_layers,
use_cartesian_coordinates=configuration.use_cartesian_coordinates,
)
]
6 changes: 3 additions & 3 deletions src/py/mat3ra/made/tools/build/defect/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,15 @@ class TerraceSlabDefectConfiguration(SlabDefectConfiguration):
that cuts the slab with added number of layers.
pivot_coordinate (List[float]): The pivot coordinate: the point in the unit cell
where the normal of the cut plane passes through.
steps_number (int): The number of steps to bunch (number of added layers).
number_of_added_layers (int): The number of added layers to the slab which will form the terrace.
use_cartesian_coordinates (bool): The flag to use cartesian coordinates for coordinates and vectors.
rotate_to_match_pbc (bool): The flag to rotate the slab with a terrace to match periodic boundary conditions.
"""

defect_type: SlabDefectTypeEnum = SlabDefectTypeEnum.TERRACE
cut_direction: List[int] = [1, 0, 0]
pivot_coordinate: List[float] = [0.5, 0.5, 0.5]
steps_number: int = 1 # number of steps to bunch
number_of_added_layers: int = 1
use_cartesian_coordinates: bool = False
rotate_to_match_pbc: bool = True

Expand All @@ -196,7 +196,7 @@ def _json(self):
"defect_type": self.defect_type.name,
"cut_direction": self.cut_direction,
"pivot_coordinate": self.pivot_coordinate,
"steps_number": self.steps_number,
"number_of_added_layers": self.number_of_added_layers,
"use_cartesian_coordinates": self.use_cartesian_coordinates,
"rotate_to_match_pbc": self.rotate_to_match_pbc,
}

0 comments on commit 2edc0ed

Please sign in to comment.