From 74f58e197d222c66259349a044672f4763905309 Mon Sep 17 00:00:00 2001 From: VsevolodX <79542055+VsevolodX@users.noreply.github.com> Date: Fri, 4 Oct 2024 11:22:12 -0700 Subject: [PATCH] update: various cleaups --- .../made/tools/build/defect/builders.py | 1 - tests/py/unit/fixtures.py | 66 +------------------ tests/py/unit/test_tools_build_defect.py | 2 +- .../unit/test_tools_build_grain_boundary.py | 2 +- tests/py/unit/test_tools_build_slab.py | 1 - 5 files changed, 4 insertions(+), 68 deletions(-) diff --git a/src/py/mat3ra/made/tools/build/defect/builders.py b/src/py/mat3ra/made/tools/build/defect/builders.py index 2646883f..66f6bc35 100644 --- a/src/py/mat3ra/made/tools/build/defect/builders.py +++ b/src/py/mat3ra/made/tools/build/defect/builders.py @@ -175,7 +175,6 @@ def create_adatom( def _calculate_coordinate_from_position_and_distance( self, material: Material, position_on_surface: List[float], distance_z: float ) -> List[float]: - # max_z = get_atomic_coordinates_extremum(material, use_cartesian_coordinates=False) max_z_id = get_local_extremum_atom_index( material, position_on_surface, "max", vicinity=3.0, use_cartesian_coordinates=False ) diff --git a/tests/py/unit/fixtures.py b/tests/py/unit/fixtures.py index 07cdd71a..34883958 100644 --- a/tests/py/unit/fixtures.py +++ b/tests/py/unit/fixtures.py @@ -170,7 +170,7 @@ "bulk": SI_CONVENTIONAL_CELL, "miller_indices": (0, 0, 1), "thickness": 1, - "vacuum": 1, + "vacuum": 5.0, "xy_supercell_matrix": [[1, 0], [0, 1]], "use_conventional_cell": True, "use_orthogonal_z": True, @@ -211,69 +211,7 @@ "_id": "", "metadata": { "boundaryConditions": {"type": "pbc", "offset": 0}, - "build": { - "termination": "Si_P6/mmm_1", - "configuration": { - "type": "SlabConfiguration", - "bulk": { - "name": "Si8", - "basis": { - "elements": [ - {"id": 0, "value": "Si"}, - {"id": 1, "value": "Si"}, - {"id": 2, "value": "Si"}, - {"id": 3, "value": "Si"}, - {"id": 4, "value": "Si"}, - {"id": 5, "value": "Si"}, - {"id": 6, "value": "Si"}, - {"id": 7, "value": "Si"}, - ], - "coordinates": [ - {"id": 0, "value": [0.5, 0.0, 0.0]}, - {"id": 1, "value": [0.25, 0.25, 0.75]}, - {"id": 2, "value": [0.5, 0.5, 0.5]}, - {"id": 3, "value": [0.25, 0.75, 0.25]}, - {"id": 4, "value": [0.0, 0.0, 0.5]}, - {"id": 5, "value": [0.75, 0.25, 0.25]}, - {"id": 6, "value": [0.0, 0.5, 0.0]}, - {"id": 7, "value": [0.75, 0.75, 0.75]}, - ], - "units": "crystal", - "cell": [[5.468763846, 0.0, 0.0], [-0.0, 5.468763846, 0.0], [0.0, 0.0, 5.468763846]], - "constraints": [], - "labels": [], - }, - "lattice": { - "a": 5.468763846, - "b": 5.468763846, - "c": 5.468763846, - "alpha": 90.0, - "beta": 90.0, - "gamma": 90.0, - "units": {"length": "angstrom", "angle": "degree"}, - "type": "TRI", - "vectors": { - "a": [5.468763846, 0.0, 0.0], - "b": [-0.0, 5.468763846, 0.0], - "c": [0.0, 0.0, 5.468763846], - "alat": 1, - "units": "angstrom", - }, - }, - "isNonPeriodic": False, - "_id": "", - "metadata": {"boundaryConditions": {"type": "pbc", "offset": 0}}, - "isUpdated": True, - }, - "miller_indices": (0, 0, 1), - "thickness": 1, - "vacuum": 5.0, - "xy_supercell_matrix": [[1, 0], [0, 1]], - "use_conventional_cell": True, - "use_orthogonal_z": True, - "make_primitive": True, - }, - }, + "build": {"configuration": SI_SLAB_CONFIGURATION, "termination": "Si_P6/mmm_1"}, }, "isUpdated": True, } diff --git a/tests/py/unit/test_tools_build_defect.py b/tests/py/unit/test_tools_build_defect.py index 03df8e9b..036cc127 100644 --- a/tests/py/unit/test_tools_build_defect.py +++ b/tests/py/unit/test_tools_build_defect.py @@ -107,7 +107,7 @@ def test_create_crystal_site_adatom(): assert defect.basis.elements.values[-1] == "Si" assertion_utils.assert_deep_almost_equal( - # TO pass on GHA + # Adjusted expected value to pass tests on GHA due to slab generation differences between GHA and local [0.083333333, 0.458333333, 0.561569594], defect.basis.coordinates.values[-1], ) diff --git a/tests/py/unit/test_tools_build_grain_boundary.py b/tests/py/unit/test_tools_build_grain_boundary.py index be3dbc1a..86ad9476 100644 --- a/tests/py/unit/test_tools_build_grain_boundary.py +++ b/tests/py/unit/test_tools_build_grain_boundary.py @@ -57,7 +57,7 @@ def test_slab_grain_boundary_builder(): [0.0, 3.867, 0.0], [0.0, 0.0, 8.734], ] - # To pass on GHA + # Adjusted expected value to pass tests on GHA due to slab generation differences between GHA and local expected_coordinate_15 = [0.777190818, 0.0, 0.110688115] assert len(gb.basis.elements.values) == 32 diff --git a/tests/py/unit/test_tools_build_slab.py b/tests/py/unit/test_tools_build_slab.py index 2c85bf40..5d1f2b82 100644 --- a/tests/py/unit/test_tools_build_slab.py +++ b/tests/py/unit/test_tools_build_slab.py @@ -19,5 +19,4 @@ def test_build_slab(): ) termination = get_terminations(slab_config)[0] slab = create_slab(slab_config, termination) - print(slab.to_json()) assertion_utils.assert_deep_almost_equal(SI_SLAB, slab.to_json())