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

Search of (A-B)-(A-B)-(...) rings in ring_statistics #86

Closed
yunai2384 opened this issue Aug 15, 2021 · 5 comments
Closed

Search of (A-B)-(A-B)-(...) rings in ring_statistics #86

yunai2384 opened this issue Aug 15, 2021 · 5 comments

Comments

@yunai2384
Copy link

Hello,
I was searching for rings in compound AB2, and the only type of rings i need is (A-B)-(A-B)-(...). I modified functions step_colser(), step_away() and find_shortest_distances() with type[j] != type[j], but it say "Distance map and graph do not match". How can i do with it ?
Best regard,
yunai

@jameskermode
Copy link
Member

Perhaps generating all rings and then filtering based on type afterwards would be a simpler approach?

@yunai2384
Copy link
Author

Perhaps generating all rings and then filtering based on type afterwards would be a simpler approach?

Thanks for reply, i think the shortest path of A-A-A... rings and A-B-A-B... rings should be different, and a little modification of the shortest path algorithm forA-B-A-B rings should be better?

@jameskermode
Copy link
Member

Thinking about this a little more, I think you could actually do it with no modifications to the shortest path algorithm, just by passing a custom cutoff dictionary to neighbour_list. If you leave out A-A and B-B from the dictionary they will never considered to be neighbours.

@pastewka
Copy link
Collaborator

You can also explicitly remove A-A and B-B- neighbors from the neighbor list. Try the following (untested):

import _matscipy
from matscipy.neighbours import neighbour_list

i, j, r = neighbour_list('ijD', a, cutoff)
n = a.numbers
mask = a[i] != a[j]  # True for differing elements
i = i[mask]
j = j[mask]
r = r[mask]
d = _matscipy.distances_on_graph(i, j)
ring =_matscipy.find_sp_rings(i, j, r, d, maxlength)

@yunai2384
Copy link
Author

Thanks a lot, i checked the rings in my 816 atoms in AB2, and the rings i get are all A-B-A-B, it helps me a lot.
Best regards and keep healthy!

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

No branches or pull requests

3 participants