Closed yunai2384 closed 3 years ago
Perhaps generating all rings and then filtering based on type afterwards would be a simpler approach?
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?
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.
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)
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!
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