I have the following list of list, in which the inner list has 2 items in string format.
neighbor_list = [['Mo0',
'[PeriodicSite: S (1.5952, -0.9210, 37.6032) [0.3333, -0.3333, 0.9458], PeriodicSite: S (0.0000, 1.8419, 37.6032) [0.3333, 0.6667, 0.9458], PeriodicSite: S (3.1903, 1.8419, 37.6032) [1.3333, 0.6667, 0.9458], PeriodicSite: S (1.5952, -0.9210, 34.4734) [0.3333, -0.3333, 0.8671], PeriodicSite: S (0.0000, 1.8419, 34.4734) [0.3333, 0.6667, 0.8671], PeriodicSite: S (3.1903, 1.8419, 34.4734) [1.3333, 0.6667, 0.8671]]'],
['Mo1',
'[PeriodicSite: S (1.5952, -0.9210, 12.7242) [0.3333, -0.3333, 0.3200], PeriodicSite: S (0.0000, 1.8419, 12.7242) [0.3333, 0.6667, 0.3200], PeriodicSite: S (3.1903, 1.8419, 12.7242) [1.3333, 0.6667, 0.3200], PeriodicSite: S (1.5952, -0.9210, 9.5944) [0.3333, -0.3333, 0.2413], PeriodicSite: S (0.0000, 1.8419, 9.5944) [0.3333, 0.6667, 0.2413], PeriodicSite: S (3.1903, 1.8419, 9.5944) [1.3333, 0.6667, 0.2413]]'],
['Mo2',
'[PeriodicSite: S (-1.5952, 0.9210, 30.1636) [-0.3333, 0.3333, 0.7587], PeriodicSite: S (1.5952, 0.9210, 30.1636) [0.6667, 0.3333, 0.7587], PeriodicSite: S (0.0000, 3.6839, 30.1636) [0.6667, 1.3333, 0.7587], PeriodicSite: S (-1.5952, 0.9210, 27.0339) [-0.3333, 0.3333, 0.6800], PeriodicSite: S (1.5952, 0.9210, 27.0339) [0.6667, 0.3333, 0.6800], PeriodicSite: S (0.0000, 3.6839, 27.0339) [0.6667, 1.3333, 0.6800]]'],
['Mo3',
'[PeriodicSite: S (-1.5952, 0.9210, 5.2846) [-0.3333, 0.3333, 0.1329], PeriodicSite: S (1.5952, 0.9210, 5.2846) [0.6667, 0.3333, 0.1329], PeriodicSite: S (0.0000, 3.6839, 5.2846) [0.6667, 1.3333, 0.1329], PeriodicSite: S (-1.5952, 0.9210, 2.1548) [-0.3333, 0.3333, 0.0542], PeriodicSite: S (1.5952, 0.9210, 2.1548) [0.6667, 0.3333, 0.0542], PeriodicSite: S (0.0000, 3.6839, 2.1548) [0.6667, 1.3333, 0.0542]]']]
The first item in the inner list (say Mo0) is the center and all the S in second item are the surroundings. First I want to print the list of center atom addeded to the surroundings e.g. Mo0S6, Mo1S6, M02S6 and so on. Then I want to find if there are any common S between Mo0, Mo1, Mo2, Mo3 by using their coordinates, e.g. the coordinates for S in neighbor of Mo0 are :
S (1.5952, -0.9210, 37.6032)
S (1.5952, -0.9210, 12.7242)
and so on.
I can get the center and surroundings by doing
for i in range(len(neighbor_list)):
center = neighbor_list[i][0]
surroundings = neighbor_list[i][1]
How can I sum the number of surroundings for each center atom and find the intersection between surroundings?
The final goal is to get the matrix in the following format
Mo0S6 Mo1S6 Mo2S6 Mo3S6
Mo0S6 0.0 0.0 0.0 0.0
Mo1S6 0.0 0.0 0.0 0.0
Mo2S6 0.0 0.0 0.0 0.0
Mo3S6 0.0 0.0 0.0 0.0
All elements in the dataframe are 0 because there are no common S in this list.
Could anyone please help me on this. Thanks in advance.