Skip to content

Commit

Permalink
chore: try to explain shadowing
Browse files Browse the repository at this point in the history
  • Loading branch information
VsevolodX committed Sep 10, 2024
1 parent 51d878f commit a42aea8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/py/mat3ra/made/tools/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,11 @@ def is_height_within_limits(z: float, z_extremum: float, depth: float, surface:
return (z >= z_extremum - depth) if surface == SurfaceTypes.TOP else (z <= z_extremum + depth)


def shadowing_check(z: float, neighbors_indices: List[int], surface: SurfaceTypes, coordinates: np.ndarray) -> bool:
def is_shadowed_by_neighbors_from_surface(
z: float, neighbors_indices: List[int], surface: SurfaceTypes, coordinates: np.ndarray
) -> bool:
"""
Check if the atom is shadowed by its neighbors from the surface.
Check if any one of the neighboring atoms shadow the atom from the surface by being closer to the specified surface.
Args:
z (float): The z-coordinate of the atom.
Expand Down Expand Up @@ -406,7 +408,7 @@ def get_surface_atom_indices(
for idx, (x, y, z) in enumerate(coordinates):
if is_height_within_limits(z, z_extremum, depth, surface):
neighbors_indices = kd_tree.query_ball_point([x, y, z], r=shadowing_radius)
if shadowing_check(z, neighbors_indices, surface, coordinates):
if is_shadowed_by_neighbors_from_surface(z, neighbors_indices, surface, coordinates):
exposed_atoms_indices.append(ids[idx])

return exposed_atoms_indices
Expand Down

0 comments on commit a42aea8

Please sign in to comment.