From 1515fff03fdfbb2281f44a0d9e3a81ab6506e25e Mon Sep 17 00:00:00 2001 From: VsevolodX <79542055+VsevolodX@users.noreply.github.com> Date: Wed, 4 Sep 2024 20:07:06 -0700 Subject: [PATCH] chore: run lint fix --- src/py/mat3ra/made/tools/analyze.py | 5 ++++- src/py/mat3ra/made/tools/build/interface/builders.py | 7 +++---- src/py/mat3ra/made/tools/modify.py | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/py/mat3ra/made/tools/analyze.py b/src/py/mat3ra/made/tools/analyze.py index 592e41cd..293c6c7f 100644 --- a/src/py/mat3ra/made/tools/analyze.py +++ b/src/py/mat3ra/made/tools/analyze.py @@ -524,7 +524,7 @@ def get_optimal_displacements( return displacements_with_min_norm -def calculate_moire_periodicity(lattice_a: float, lattice_b: float, twist_angle: float) -> tuple[float, float]: +def calculate_moire_periodicity(lattice_a: float, lattice_b: float, twist_angle: float) -> Tuple[float, float]: """ Calculate the periodicity of the Moiré pattern considering X and Y independently. @@ -532,6 +532,9 @@ def calculate_moire_periodicity(lattice_a: float, lattice_b: float, twist_angle: lattice_a (float): Lattice constant of the first material. lattice_b (float): Lattice constant of the second material. twist_angle (float): Twist angle between the two materials. + + Returns: + Tuple[float, float]: Periodicity of the Moiré pattern in X and Y directions in Angstroms. """ theta = np.deg2rad(twist_angle) diff --git a/src/py/mat3ra/made/tools/build/interface/builders.py b/src/py/mat3ra/made/tools/build/interface/builders.py index 78356ed1..17467368 100644 --- a/src/py/mat3ra/made/tools/build/interface/builders.py +++ b/src/py/mat3ra/made/tools/build/interface/builders.py @@ -1,4 +1,4 @@ -from typing import Any, List, Optional, Tuple +from typing import Any, List, Optional import numpy as np from mat3ra.made.tools.build.supercell import create_supercell @@ -7,7 +7,6 @@ translate_to_z_level, rotate_material, translate_by_vector, - filter_by_box, filter_by_triangle_projection, ) from pydantic import BaseModel, Field @@ -270,8 +269,8 @@ def _update_material_name(self, material: Material, configuration: TwistedInterf substrate_formula = get_chemical_formula(configuration.substrate_configuration.bulk) film_miller = "".join(map(str, configuration.film_configuration.miller_indices)) substrate_miller = "".join(map(str, configuration.substrate_configuration.miller_indices)) - - new_name = f"{film_formula}({film_miller})-{substrate_formula}({substrate_miller}), Twist {configuration.twist_angle:.2f}°" + twist_str = f"Twist {configuration.twist_angle:.2f} degrees" + new_name = f"{film_formula}({film_miller})-{substrate_formula}({substrate_miller}), {twist_str}" if "mean_abs_strain" in material.metadata: strain = material.metadata["mean_abs_strain"] new_name += f", Strain {strain*100:.3f}%" diff --git a/src/py/mat3ra/made/tools/modify.py b/src/py/mat3ra/made/tools/modify.py index a16032df..4efe94f1 100644 --- a/src/py/mat3ra/made/tools/modify.py +++ b/src/py/mat3ra/made/tools/modify.py @@ -452,6 +452,7 @@ def rotate_material(material: Material, axis: List[int], angle: float, wrap: boo material (Material): The material to rotate. axis (List[int]): The axis to rotate around, expressed as [x, y, z]. angle (float): The angle of rotation in degrees. + wrap (bool): Whether to wrap the material to the unit cell. Returns: Atoms: The rotated material. """