Skip to content

Commit

Permalink
BUG: Fixed bug to ensure correct behaviour of alpha period finder whe…
Browse files Browse the repository at this point in the history
…n surface reconstruction

moves atoms outward
  • Loading branch information
Fraser-Birks committed Sep 26, 2023
1 parent c5ba684 commit a4eae34
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions scripts/fracture_mechanics/parallel_NCFlex.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ def main(K_range,alpha_range):
ypos = pos[:,1] - sy/2

#find the closest y atoms by finding which atoms lie within 1e-2 of the min
closest_y_mask = np.abs(ypos)<(np.min(np.abs(ypos))+(1e-2))
closest_y_mask = np.abs(ypos)<(np.min(np.abs(ypos[xmask]))+(1e-2))

#filter out all atoms with x less than 0
xmask = xpos>0
Expand All @@ -692,11 +692,8 @@ def main(K_range,alpha_range):
closest_x = xpos[closest_y_mask&xmask]

#sort these atoms and find the largest x gap
print('closest_x', closest_x)
sorted_x = np.sort(closest_x)
print('sorted_x', sorted_x)
diffs = np.diff(sorted_x)
print('diffs',diffs)
alpha_period = np.sum(np.unique(np.round(np.diff(sorted_x),decimals=4)))
print('alpha_period',alpha_period)
# setup the crack
Expand Down

0 comments on commit a4eae34

Please sign in to comment.