I am a student of cheminformatics, and I am trying to solve a problem in predicting whether atom can be an acceptor/donor of hydrogen bonds, using Python programming language and RDKit library.

My molecules are described as graphs, where each atom is a node and each bond is an arc. Each node (atom) contains a vector of size 1 x 14, where 14 are features that I associate with that atom. Based on these features I then go on to predict whether that group will be an acceptor/donor/both of H bonds. Let's look at an example, suppose we have a C=O group, and consider the features of oxygen:

  • If the feature associated with the atomic number is equal to 8;
  • If the feature associated with the number of hydrogen bonds is equal to 0;
  • If the feature associated with hybridization is equal to 3 (SP2);

We can understand that that oxygen is part of a carbonyl group and then it is a hydrogen bond acceptor, and up to this point I have no special problems.


The problem arises when I need to take into account the chemical surroundings to make this prediction. As in the case of a nitro group (NO2) or the NH group in alpha to carbonyl (which is no longer an acceptor). With my technique (at the bottom I also leave the code for those who are curious) it is difficult to consider this chemical surroundings as well.

Does anyone have experience with problems like this? I had thought of also making the prediction on the basis of the partial charge of the atom, but I cannot find references in the literature, such as a threshold of the charge through which one goes from acceptor to donor.


Here I leave you an example of the code used, where the rules were defined only for the carbonyl and alcohol groups.

def h_acc(arr):
  # arr is my features vector, is a Python list
  if arr[0] == 8 and arr[9] != 0 and arr[7] == 4: # arr[0] etc. are respectively the columns associated with atomic number, number of bound Hs and hybridization
    arr.append(1) # we add feature 1 to the bottom of our vector, because OH is an acceptor

  if arr[0] == 8 and arr[9] == 0 and arr[7] == 3:
    arr.append(1) # we add feature 1 to the bottom of our vector, because C=O is an acceptor

    arr.append(0) # we add feature 0 to the bottom of our vector, in all other cases that are not acceptors

  return arr


Later rules were also included for other chemical groups, and a very similar function was written to predict whether that group will be a donor.

  • $\begingroup$ Can you include the list of features that you are looking at? I have not worked in Chemoinformatics, but I would guess if you included the availability of lone pairs, it would probably be helpful. $\endgroup$ Commented May 20, 2023 at 16:13
  • 2
    $\begingroup$ Please have a look at the expected behaviour regarding greetings such as good morning , thanks, sorry on the expected behaviour of MMSE here. I have edited the question to remove them since the expected behaviour is to not include them in questions. $\endgroup$ Commented May 20, 2023 at 17:16
  • 1
    $\begingroup$ @HemanthHaridas Sure, forgive me for the late reply. The feature in order are: atomic number; atomic mass; Van der Waals atomic radius; atom degree; atom degree including Hs; valence; formal charge; hybridization; aromaticity; total number of Hs; radical electrons; is in ring; atom is chiral center; chirality. If I wanted to, I could try to add others as well if it is necessary $\endgroup$ Commented May 21, 2023 at 7:12
  • $\begingroup$ Can you join this chat room? I have few questions $\endgroup$ Commented May 21, 2023 at 7:51
  • 2
    $\begingroup$ One problem is that there is no clear boundary between very weak H-bond acceptors and non H-bond acceptors. Suppose you accept that the nitrogen in an amide is not a H-bond acceptor, while that in an amine is. Then change the carbonyl group in the amide to successively less electron-withdrawing groups. When does the nitrogen atom turn into a H-bond acceptor? AFAIK there is no consensus in the literature, so you have to draw the line by yourself. Once the line is drawn, the program implementation is trivial. $\endgroup$
    – wzkchem5
    Commented May 21, 2023 at 8:13