HBond Coordination

This module enables the calculation of hydrogen bond donor and acceptor coordination likelihoods. These are based on statistical models for each hydrogen bonding functional group built from observations of crystal structures in the CSD.

Firstly, we shall import the relevant module:

>>> from ccdc.descriptors import CrystalDescriptors

Then we can create a calculator:

>>> calculator = CrystalDescriptors.HBondCoordination()

The ccdc.descriptors.CrystalDescriptors.HBondCoordination takes an optional ‘settings’ argument, in order to configure the geometric and other parameters of the hydrogen bonds sought. See the documentation for graph sets in the main documentation.

The calculator requires crystals for analysis. We can load them from the CSD or from other crystallographic files:

>>> from ccdc.io import EntryReader
>>> csd = EntryReader('csd')
>>> crystal = csd.crystal('VAYXOI')

We can now calculate predicted hbond coordination scores:

>>> predictions = calculator.predict(crystal)

The return value is an instance of ccdc.descriptors.CrystalDescriptors.HBondCoordination.Predictions. It currently supports an interface allowing one to determine whether a valid prediction was made, to extract predictions for hydrogen bonds observed in the crystal, for scores for a particular hydrogen bonding atom and a method for generating CSV formatted information suitable for a spreadsheet.

>>> print(predictions.is_valid)
True

Let us now look at the predictions for the hydrogen bonds observed in the crystal:

>>> observed = predictions.observed
>>> print(len(observed))
6

Each observation is of a potentially hydrogen bonding atom, hence there are six entries in the returned tuple. Each element of the returned tuple is an instance of collections.namedtuple containing a label, a coordination count and a probability of that count being observed.

>>> print(observed[0])
Observation(label='N2 of sec_amine_pl (d)', coordination_count=1, probability=0.863535)

This corresponds with the observed hydrogen bonds of the crystal system:

>>> print(crystal.hbonds())
(HBond(Atom(O1)-Atom(H4)-Atom(N2)),)

Indeed all the observations have high probabilites: for this structure the hydrogen bond coordination enviroments are well satisfied, indicating that these are stable interactions.

>>> print([round(obs.probability, 3) for obs in observed])
[0.864, 0.83, 0.443, 0.708, 0.944, 0.93]

Other structures may have less satisfied coordination environments, for example, ‘ABACOX’. This may indicate that a more stable polymorph may exist.

>>> abacox = csd.crystal('ABACOX')
>>> predictions = calculator.predict(abacox)
>>> observed = predictions.observed
>>> print([round(obs.probability, 3) for obs in observed])
[0.435, 0.437, 0.486, 0.085]

Here we can see that one probability is very low. We can investigate further:

>>> print(observed[-1].label)
O3 of sulfonate (a)
>>> O3_coordination, O3_predictions = predictions.predictions_for_label('O3')
>>> print('Coordination: %d Probability: %.3f' % (O3_coordination, O3_predictions[O3_coordination]))
Coordination: 0 Probability: 0.085

Showing that the prediction for the observed lack of coordination is indeed low. The probabilities are in O3_predictions, and we can extract the most probable of these by:

>>> print(max((v, k) for k, v in O3_predictions.items()))
(0.49697, 1)