Skip to content

Commit

Permalink
Merge pull request #126 from Exabyte-io/feature/SOF-7352
Browse files Browse the repository at this point in the history
Feature/SOF-7352 update: add separation to terminations and interface creation
  • Loading branch information
VsevolodX authored May 9, 2024
2 parents bf53506 + bfed4b8 commit 728745c
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions src/py/mat3ra/made/tools/build/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ...material import Material
from .interface import InterfaceDataHolder
from .interface import InterfaceDataHolder, CoherentInterfaceBuilder, TerminationType
from .interface import InterfaceSettings as Settings
from .interface import interface_init_zsl_builder, interface_patch_with_mean_abs_strain
from ..convert import decorator_convert_material_args_kwargs_to_structure
Expand All @@ -8,12 +8,14 @@

@decorator_convert_material_args_kwargs_to_structure
def create_interfaces(
substrate: Material,
layer: Material,
settings: Settings,
substrate: Material = None,
layer: Material = None,
settings: Settings = None,
sort_by_strain_and_size: bool = True,
remove_duplicates: bool = True,
is_logging_enabled: bool = True,
interface_builder: CoherentInterfaceBuilder = None,
termination: TerminationType = None,
) -> InterfaceDataHolder:
"""
Create all interfaces between the substrate and layer structures using ZSL algorithm provided by pymatgen.
Expand All @@ -28,15 +30,15 @@ def create_interfaces(
Returns:
InterfaceDataHolder.
"""
substrate = translate_to_bottom(substrate, settings["USE_CONVENTIONAL_CELL"])
layer = translate_to_bottom(layer, settings["USE_CONVENTIONAL_CELL"])

if is_logging_enabled:
print("Creating interfaces...")

builder = interface_init_zsl_builder(substrate, layer, settings)
builder = interface_builder or init_interface_builder(substrate, layer, settings)
interfaces_data = InterfaceDataHolder()

if termination is not None:
builder.terminations = [termination]

for termination in builder.terminations:
all_interfaces_for_termination = builder.get_interfaces(
termination,
Expand Down Expand Up @@ -64,3 +66,14 @@ def create_interfaces(
print(f"Found {len(interfaces_data.get_interfaces_for_termination(0))} {unique_str} interfaces.")

return interfaces_data


@decorator_convert_material_args_kwargs_to_structure
def init_interface_builder(
substrate: Material,
layer: Material,
settings: Settings,
) -> CoherentInterfaceBuilder:
substrate = translate_to_bottom(substrate, settings["USE_CONVENTIONAL_CELL"])
layer = translate_to_bottom(layer, settings["USE_CONVENTIONAL_CELL"])
return interface_init_zsl_builder(substrate, layer, settings)

0 comments on commit 728745c

Please sign in to comment.