You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These analysis functions contain some postprocessing code to associate positions of adsorbate molecules on a surface slab with high-symmetry locations on the surface slab.
3
+
4
+
Base definitions for fcc metal surface facets are included, but there are options to expand this further.
5
+
6
+
**This code only works for 2D positions in X and Y, so the surface needs to lie in the XY plane.**
7
+
8
+
"""
9
+
module HighSymmetrySites
10
+
11
+
12
+
using NQCDynamics: AbstractSimulation, PeriodicCell, get_positions
Classifies a given 2D position according to its proximity to high-symmetry surface sites.
86
+
87
+
# Arguments
88
+
- `position`: A 2-element (or longer, only first 2D used) vector representing the coordinates to classify.
89
+
- `categories`: A dictionary mapping site names (as Symbols) to lists of site coordinates.
90
+
- `cell::PeriodicCell`: The surface unit cell used to calculate distances and perform coordinate transformations.
91
+
- `fractional::Bool = false`: Whether to use fractional coordinates to determine distances to sites. If `true`, `position` is mapped directly to the sites; if `false`, converts to fractional using `cell`.
92
+
- `snap_to_site::Float64 = 0.03`: The distance tolerance (in the same units as position/cell) for snapping to a given site category.
93
+
94
+
# Returns
95
+
- The key of the closest site category (from `categories`) if within `snap_to_site` of any defined site. If not within this range or outside the cell, returns `:other`.
96
+
97
+
# Notes
98
+
- Positions are always truncated to 2D before classification.
99
+
- If the position is not inside the periodic cell, returns `:other`.
100
+
- Site assignment is based on the minimum Euclidean distance to any site in each category.
101
+
"""
102
+
functionpositions_to_category(
103
+
position,
104
+
categories,
105
+
cell::PeriodicCell;
106
+
fractional::Bool=false,
107
+
snap_to_site::Float64=0.03,
108
+
)
109
+
position =first(position,2) # Ensure we only ever carry X and Y
0 commit comments