Skip to content

Commit

Permalink
update: add gap between phases
Browse files Browse the repository at this point in the history
  • Loading branch information
VsevolodX committed Sep 25, 2024
1 parent 9723057 commit 348e56e
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 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 @@ -7,8 +7,7 @@
from mat3ra.made.tools.build.interface.builders import CommensurateLatticeTwistedInterfaceBuilder
from mat3ra.made.tools.build.supercell import create_supercell
from mat3ra.made.tools.build.utils import merge_materials
from mat3ra.made.tools.modify import filter_by_box

from mat3ra.made.tools.modify import filter_by_box, add_vacuum_sides, translate_by_vector

from mat3ra.made.tools.build.interface.configuration import TwistedInterfaceConfiguration

Expand Down Expand Up @@ -44,6 +43,26 @@ def _post_process(self, items: List[Material], post_process_parameters=None) ->
phase_2_material_doubled = create_supercell(phase_2_material_initial, 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
new_lattice_vectors_1[0][0] += item.configuration.gap

new_lattice_vectors_2 = phase_2_material.lattice.vector_arrays
new_lattice_vectors_2[0][0] += item.configuration.gap
phase_1_material.set_new_lattice_vectors(
lattice_vector1=new_lattice_vectors_1[0],
lattice_vector2=new_lattice_vectors_1[1],
lattice_vector3=new_lattice_vectors_1[2],
)
phase_2_material.set_new_lattice_vectors(
lattice_vector1=new_lattice_vectors_2[0],
lattice_vector2=new_lattice_vectors_2[1],
lattice_vector3=new_lattice_vectors_2[2],
)

phase_2_material = translate_by_vector(
phase_2_material, [item.configuration.gap / 2, 0, 0], use_cartesian_coordinates=True
)

interface = merge_materials([phase_1_material, phase_2_material])
grain_boundaries.append(interface)

Expand Down

0 comments on commit 348e56e

Please sign in to comment.