Skip to content

Commit

Permalink
fix: get more of the island by selecting deeper
Browse files Browse the repository at this point in the history
  • Loading branch information
VsevolodX committed Aug 24, 2024
1 parent 1db1ccd commit 3968a14
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/py/mat3ra/made/tools/build/defect/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@ class IslandSlabDefectBuilder(SlabDefectBuilder):
_ConfigurationType: type(IslandSlabDefectConfiguration) = IslandSlabDefectConfiguration # type: ignore
_GeneratedItemType: Material = Material

@staticmethod
def _default_condition(coordinate: List[float]):
return True

def create_island(
self,
material: Material,
Expand All @@ -410,27 +414,23 @@ def create_island(
Returns:
The material with the island added.
"""

new_material = material.clone()
original_max_z = get_atomic_coordinates_extremum(new_material, use_cartesian_coordinates=False)
material_with_additional_layers = self.create_material_with_additional_layers(new_material, thickness)
added_layers_max_z = get_atomic_coordinates_extremum(material_with_additional_layers)

if condition is None:
condition = self._default_condition

def condition(coordinate: List[float]):
return True

thickness_nudge_value = (added_layers_max_z - original_max_z) / thickness
atoms_within_island = filter_by_condition_on_coordinates(
material=material_with_additional_layers,
condition=condition,
use_cartesian_coordinates=use_cartesian_coordinates,
)

# Filter atoms in the added layers
island_material = filter_by_box(
material=atoms_within_island,
min_coordinate=[0, 0, original_max_z],
min_coordinate=[0, 0, original_max_z - thickness_nudge_value],
max_coordinate=[1, 1, added_layers_max_z],
)

Expand Down

0 comments on commit 3968a14

Please sign in to comment.