Hello there,

I am interested in finding all bond distances within a crystal structure. I tried to use MolecularDescriptors.atom_distance function, but apparently, it calculates bond that reach outside periodic boundary condition as well. I'm looking for some helps with the API, maybe there is a function that  I had overlooked.

Any helps would be greatly appreciated.

Thank you.

Hi,

if you want all the bond lengths within the unit cell, then you can do this by instantiating the crystal's molecule and measuring the the distances between the bonds' atoms.  For example,

from ccdc import io, descriptors

csd = io.EntryReader('csd')
crystal = csd.crystal('AABHTZ')
mol = crystal.molecule
for b in mol.bonds:
    print('%s-%s: %.2f' % (b.atoms[0], b.atoms[1], descriptors.MolecularDescriptors.atom_distance(b.atoms[0], b.atoms[1])))

Please let me know if I have misunderstood your problem.

Best wishes
Richard

 

Thank you for the help! I will try this code.

You must be signed in to post in this forum.