Skip to content

Commit

Permalink
update: add test verified in nb
Browse files Browse the repository at this point in the history
  • Loading branch information
VsevolodX committed Sep 23, 2024
1 parent b7650e7 commit da3a7e0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/py/unit/test_tools_build_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
create_interfaces,
)
from mat3ra.made.tools.build.interface.builders import (
CommensurateLatticeInterfaceBuilder,
CommensurateLatticeInterfaceBuilderParameters,
NanoRibbonTwistedInterfaceBuilder,
NanoRibbonTwistedInterfaceConfiguration,
TwistedInterfaceConfiguration,
)
from mat3ra.utils import assertion as assertion_utils

Expand Down Expand Up @@ -63,3 +66,18 @@ def test_create_twisted_nanoribbon_interface():
expected_coordinate = [0.704207885, 0.522108183, 0.65]
assertion_utils.assert_deep_almost_equal(exected_cell_vectors, interface.basis.cell.vectors_as_array)
assertion_utils.assert_deep_almost_equal(expected_coordinate, interface.basis.coordinates.values[42])


def test_create_commensurate_supercell_twisted_interface():
film = Material(GRAPHENE)
substrate = Material(GRAPHENE)
config = TwistedInterfaceConfiguration(film=film, substrate=substrate, twist_angle=13, distance_z=3.0)
params = CommensurateLatticeInterfaceBuilderParameters(max_search=5, angle_tolerance=0.5, return_first_match=True)
builder = CommensurateLatticeInterfaceBuilder(build_parameters=params)
interfaces = builder.get_materials(config, post_process_parameters=config)
assert len(interfaces) == 1
interface = interfaces[0]
print(interface.basis.cell.vectors_as_array)
expected_cell_vectors = [[10.754672133, 0.0, 0.0], [5.377336066500001, 9.313819276550575, 0.0], [0.0, 0.0, 20.0]]

assertion_utils.assert_deep_almost_equal(expected_cell_vectors, interface.basis.cell.vectors_as_array)

0 comments on commit da3a7e0

Please sign in to comment.