Skip to content
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

Fix neighbour calc #207

Merged
merged 3 commits into from
Nov 15, 2023
Merged

Fix neighbour calc #207

merged 3 commits into from
Nov 15, 2023

Conversation

Tetracarbonylnickel
Copy link
Contributor

Addresses the problem that the shrink wrapped cell was too tight. Fix by adding a little layer if the shrink wrapped cell is created.

Comment on lines 122 to 123
cell.flat[:: cell.shape[1] + 1] += 1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this line do?

Copy link
Contributor Author

@Tetracarbonylnickel Tetracarbonylnickel Nov 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as cell[np.diag_indices_from(cell)] += 1 idk why I used that.

cell[idx, idx] = 1.0

cell.flat[:: cell.shape[1] + 1] += 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be replaced by something clearer

extend diagonal elements of cell
@@ -119,7 +119,7 @@ def get_shrink_wrapped_cell(positions):
if cell[idx, idx] < 10e-1:
cell[idx, idx] = 1.0

cell.flat[:: cell.shape[1] + 1] += 1
cell[np.diag_indices_from(cell)] += 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so the purpose of this line is to increase the cell by 1 Angstrom in all directions.
is this necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. If the cell is too tight some atoms will be counted as being in a adjacent cell and the neighbour list will be wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think 0.1 A would also be sufficient but I did not tested it.

@Tetracarbonylnickel Tetracarbonylnickel merged commit 5bcfb50 into dev Nov 15, 2023
@Tetracarbonylnickel Tetracarbonylnickel deleted the fix-neighbour-calc branch November 15, 2023 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants