chemcoord.Cartesian.get_bonds

Cartesian.get_bonds(self_bonding_allowed=False, offset=3, modified_properties=None, use_lookup=False, set_lookup=True, atomic_radius_data=None)

Return a dictionary representing the bonds.

Warning

This function is not sideeffect free, since it assigns the output to a variable self._metadata['bond_dict'] if set_lookup is True (which is the default). This is necessary for performance reasons.

.get_bonds() will use or not use a lookup depending on use_lookup. Greatly increases performance if True, but could introduce bugs in certain situations.

Just imagine a situation where the Cartesian is changed manually. If you apply lateron a method e.g. get_zmat() that makes use of get_bonds() the dictionary of the bonds may not represent the actual situation anymore.

You have two possibilities to cope with this problem. Either you just re-execute get_bonds on your specific instance, or you change the internally_use_lookup option in the settings. Please note that the internal use of the lookup variable greatly improves performance.

Parameters:
  • modified_properties (dic) –

    If you want to change the van der Vaals radius of one or more specific atoms, pass a dictionary that looks like:

    modified_properties = {index1: 1.5}
    

    For global changes use the constants module.

  • offset (float) –
  • use_lookup (bool) –
  • set_lookup (bool) –
  • self_bonding_allowed (bool) –
  • atomic_radius_data (str) – Defines which column of constants.elements is used. The default is atomic_radius_cc and can be changed with settings['defaults']['atomic_radius_data']. Compare with add_data().
Returns:

Dictionary mapping from an atom index to the set of indices of atoms bonded to.

Return type:

dict