-
Notifications
You must be signed in to change notification settings - Fork 448
Fix non-periodic cell construction in get_neighborhood
#1395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,16 +24,15 @@ def get_neighborhood( | |
| pbc_y = pbc[1] | ||
| pbc_z = pbc[2] | ||
| identity = np.identity(3, dtype=float) | ||
| max_positions = np.max(np.absolute(positions)) + 1 | ||
| # Extend cell in non-periodic directions | ||
| # For models with more than 5 layers, the multiplicative constant needs to be increased. | ||
| # temp_cell = np.copy(cell) | ||
| max_positions = np.max(positions, axis=0) - np.min(positions, axis=0) | ||
| padding = 1 # 1 angstrom padding | ||
|
Comment on lines
+27
to
+28
|
||
|
|
||
|
Comment on lines
+28
to
+29
|
||
| if not pbc_x: | ||
| cell[0, :] = max_positions * 5 * cutoff * identity[0, :] | ||
| cell[0, :] = (max_positions[0] + cutoff + padding) * identity[0, :] | ||
| if not pbc_y: | ||
| cell[1, :] = max_positions * 5 * cutoff * identity[1, :] | ||
| cell[1, :] = (max_positions[1] + cutoff + padding) * identity[1, :] | ||
| if not pbc_z: | ||
| cell[2, :] = max_positions * 5 * cutoff * identity[2, :] | ||
| cell[2, :] = (max_positions[2] + cutoff + padding) * identity[2, :] | ||
|
Comment on lines
+27
to
+35
|
||
|
|
||
| sender, receiver, unit_shifts = neighbour_list( | ||
| quantities="ijS", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
paddingis a hard-coded magic number and is currently anintwhile the rest of the computation is floating-point. Consider using1.0and/or factoring this into a named constant (or parameter) so it’s easier to tune/document and consistent with the cell’s float dtype.