# Extract coordination sphere from crystal structure

Some tools allow for a relatively inexpensive analysis of crystal field effects in metal complexes, starting from the coordination sphere. Additionally, there are multiple sources of crystal structures that, to a certain level, can be accessed following automated computational procedures. An example of the latter would be the Cambridge Structural Database (CSD) of the Cambridge Crystallographic Data Centre (CCDC).

My question is: Given a large series of crystal structures in any given standard form (e.g. xyz, pdb, cif...), is there a tool to automatically extract the coordination sphere of a certain metal ion with minimal user intevention?

• what does the acronym ccdc stand for in one of your question tags? May 3 '20 at 2:02

Yes, there is! Pymatgen is ideally suited for this task. Specifically, I highly recommend the local environment module. Given a CIF, you can calculate the coordination environment around a given atom index using the following Python code. Here, the CrystalNN algorithm is used, but you can find many other approaches here that you should consider. Simply swap out the nn_object line.

import pymatgen as pm
from pymatgen.analysis.local_env import CrystalNN
p = '/path/to/cif' #path to CIF file
site_idx = 0 #index of atom to get coordination environment
structure = pm.Structure.from_file(p) #read in CIF as Pymatgen Structure
nn_object = CrystalNN() #initialize class
neighbors = nn_object.get_nn_info(structure,site_idx) #get NN info


An example output for neighbors would look something like the following, which is a list containing all the coordinating atoms and their distances, the nearest image, and the site index. Other methods, such as VoronoiNN, will provide additional information.

[{'site': PeriodicSite: O (3.2910, 2.0794, 0.9655) [0.4692, 0.2958, 0.2602], 'image': (0, 0, 0), 'weight': 1, 'site_index': 25}, {'site': PeriodicSite: C (4.9976, 0.0907, 2.7314) [0.7612, 0.0129, 0.5053], 'image': (0, 0, 0), 'weight': 1, 'site_index': 35}]


Of course, there are simpler approaches that are just based off a fixed cutoff distance (in Pymatgen, that could be done with pymatgen.core.structure.get_neighbors() or in the Atomic Simulation Environment with the ase.neighborlist tool).

• Thanks for joining us Andrew! I upvoted. Great answer! If you can please ask 3-5 of your own questions, we would appreciate it. This is a "limited Private Beta" with a life of 4-10 more days, and we can be shut down anywhere between 5-11 days if we do not get enough activity in the first few days. Apr 30 '20 at 18:43

I don't think there is a predefined tool right away or at least I'm not aware of that, but this problem seems a pretty easy task to do with TCL in VMD (Visual Molecular Dynamics) software. Basically you want to find the ligands that are attached to metal atom in your molecule. As you know all the molecular formats such as xyz or pdb, lists the atoms, and then list the connectivity of atoms for forming the bonds. It's just a search task in your connectivity matrix (list of bonds) to find rows that contain the id of metal atom. Let's say you have this connectivity matrix for three atoms of M (metal atom), A, B:

M - A
A - B
B - M


So your search should identify the M - A and B - M by checking that if one of the two members in each row is equal to M or not. I hope it helps you to find such tool or at least develop your own to do this job for you.

• I edited the question for clarity. Is this tool programmable, so that after some initial work it can be launched and so some work on analyzing let's say 1000 structures on its own? Apr 30 '20 at 16:26
• Yes VMD (Visual Molecular Dynamics) is programmable and you could write scripts for it even going through millions of atoms by using TCL language. See here: ks.uiuc.edu/Training/Tutorials/vmd/tutorial-html/node4.html Apr 30 '20 at 16:27