Skip to content

Commit

Permalink
chore: docstrings where absent
Browse files Browse the repository at this point in the history
  • Loading branch information
VsevolodX committed Sep 25, 2024
1 parent ac44282 commit 65c2837
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/py/mat3ra/made/tools/build/grain_boundary/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class SurfaceGrainBoundaryConfiguration(TwistedInterfaceConfiguration):
Args:
gap (float): The gap between the two phases.
xy_supercell_matrix (List[List[int]]): The supercell matrix to apply for both phases.
"""

gap: float = 0.0
Expand All @@ -35,13 +36,13 @@ def _json(self):

class SurfaceGrainBoundaryBuilderParameters(CommensurateLatticeTwistedInterfaceBuilderParameters):
"""
Parameters for creating a surface grain boundary.
Parameters for creating a grain boundary between two surface phases.
Args:
distance_tolerance (float): The distance tolerance to remove atoms that are too close, in angstroms.
"""

distance_tolerance: float = 0.1
distance_tolerance: float = 1.0


class SurfaceGrainBoundaryBuilder(CommensurateLatticeTwistedInterfaceBuilder):
Expand Down
19 changes: 15 additions & 4 deletions src/py/mat3ra/made/tools/build/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def merge_materials(
distance_tolerance (float): Distance tolerance to replace close coordinates with the last one, in angstroms.
merge_dangerously (bool): If True, the lattices are merged "as is" with no sanity checks.
Returns:
Material: The merged material.
"""
merged_material = materials[0]
for material in materials[1:]:
Expand All @@ -102,12 +102,23 @@ def merge_materials(


def merge_two_materials_laterally(
phase_1_material_initial: Material, phase_2_material_initial: Material, gap: float, distance_tolerance: float = 1.0
phase_1_material: Material, phase_2_material: Material, gap: float, distance_tolerance: float = 1.0
) -> Material:
phase_1_material_doubled = create_supercell(phase_1_material_initial, scaling_factor=[2, 1, 1])
"""
Merge two materials laterally with translation along x axis with a gap between them.
Args:
phase_1_material (Material): The first material.
phase_2_material (Material): The second material.
gap (float): The gap between the two materials, in angstroms.
distance_tolerance (float): The distance tolerance to remove atoms that are too close, in angstroms.
Returns:
Material: The merged material.
"""
phase_1_material_doubled = create_supercell(phase_1_material, scaling_factor=[2, 1, 1])
phase_1_material = filter_by_box(phase_1_material_doubled, [0, 0, 0], [0.5, 1, 1])

phase_2_material_doubled = create_supercell(phase_2_material_initial, scaling_factor=[2, 1, 1])
phase_2_material_doubled = create_supercell(phase_2_material, scaling_factor=[2, 1, 1])
phase_2_material = filter_by_box(phase_2_material_doubled, [0.5, 0, 0], [1, 1, 1])

new_lattice_vectors_1 = phase_1_material.lattice.vector_arrays
Expand Down

0 comments on commit 65c2837

Please sign in to comment.