6
$\begingroup$

I am an IT guy with little knowledge of Chemistry, so please bear with me...

For context: I am working with a system that has a lot of structures, their .mol files and some metadata (like mol weights) in a database. Due to an error, some of the metadata was lost and needs to be recalculated. Since there are a lot of structures, I need to automate this.

Originally, the mol weights were calculated using the Freeware version of ACD ChemSketch. Since I did not find a way to call ChemSketch and have it return the mol weight or otherwise automate ChemSketch itself, I looked at RDKit for Python as an alternative.

In my tests, I noticed that ChemSketch and RDKit produced slightly different results when calculating the mol weights. I used m = Chem.MolFromMolFile('amisalin.mol') to load the file and then MolWt(m) respectively ExactMolWt(m).

Example mol file amisalin.mol:


  -ACD/LAB-

 18 17  0  0  0  0  0  0  0  0  0 V2000
   18.3905   -6.6892    0.0000 C   0  0  0  0  0
   19.4429   -6.0748    0.0000 C   0  0  0  0  0
   18.3905   -8.0661    0.0000 C   0  0  0  0  0
   17.2059   -5.9960    0.0000 C   0  0  0  0  0
   20.5930   -6.7427    0.0000 N   0  0  0  0  0
   19.4429   -4.2757    0.0000 O   0  0  0  0  0
   17.2059   -8.7560    0.0000 C   0  0  0  0  0
   16.0211   -6.6892    0.0000 C   0  0  0  0  0
   21.7398   -6.0748    0.0000 C   0  0  0  0  0
   16.0211   -8.0661    0.0000 C   0  0  0  0  0
   22.5401   -6.5380    0.0000 C   0  0  0  0  0
   14.8742   -8.7309    0.0000 N   0  0  0  0  0
   23.6965   -5.8762    0.0000 N   0  0  0  0  0
   24.8434   -6.5380    0.0000 C   0  0  0  0  0
   23.6965   -4.0709    0.0000 C   0  0  0  0  0
   25.9934   -5.8762    0.0000 C   0  0  0  0  0
   24.8434   -3.4124    0.0000 C   0  0  0  0  0
   21.0845  -12.6663    0.0000 Cl  0  0  0  0  0
  1  2  1  0  2  0  0
  1  3  2  0  1  0  0
  1  4  1  0  1  0  0
  2  5  1  0  2  0  0
  2  6  2  0  2  0  0
  3  7  1  0  1  0  0
  4  8  2  0  1  0  0
  5  9  1  0  2  0  0
  7 10  2  0  1  0  0
  9 11  1  0  2  0  0
 10 12  1  0  2  0  0
 11 13  1  0  2  0  0
 13 14  1  0  2  0  0
 13 15  1  0  2  0  0
 14 16  1  0  2  0  0
 15 17  1  0  2  0  0
  8 10  1  0  1  0  0
M  END

Results:

Average molar weight Exact molar weight
Chemsketch 271.78628 271.14514
RDKit 271.7919999999999 271.145140004

As you can see, the results are slightly different. Since the input data is identical, I assume this is due to some internal differences when calculating the weights, possibly due to rounding (?).

My question now is: Is the difference negligible? Does anyone know where it comes from? Is one of the results "correct" / more accurate than the other?

$\endgroup$
5
  • $\begingroup$ What is the intended use of the .mol files? Often, it they are used as a descriptor of the structure, how the atoms are bound together and having an idea about the molecular mass is a nicety, but not a must have. For example, if the .mol files «anyway» are rewritten later into an other format to perform subsequent (e.g., quantum chemical) computations. $\endgroup$
    – Buttonwood
    May 4, 2021 at 17:28
  • 1
    $\begingroup$ And re automation of GUI programs with no programmatic API; I occasionally use PyAutoGui in Python. It works better if the program already uses short-cuts (e.g., Ctrl + C) than if you have to define the clicks of the «simulated mouse» by the pixel coordinates of your screen (this is then is less portable ...). A demo (starts around 11:00 mn:ss) by the developer is here; basic-enough to be part of his book «Automate the boring stuff» in chapter 20. $\endgroup$
    – Buttonwood
    May 4, 2021 at 17:37
  • $\begingroup$ Thank you for your very helpful comments and answer. I had also considered using pyautogui but went another way since I'd ideally like my solution to run "headless". However, thanks to your help, I'm now equipped to discuss this with the users. If the discrepancy shouldn't be acceptable to them, as an alternative, I also found that the most recent version of openbabel yields almost exactly the same results for average mol weight as ChemSketch. $\endgroup$
    – buddemat
    May 5, 2021 at 10:45
  • $\begingroup$ For the use, the installation of OpenBabel should follow reading the current documentation (readthedocs.io with its many examples; openbabel.org still often points to the elder version 2.3. Overall, the installation of OpenBabel requires much less disk space than the sum of (miniconda Python + RDKit) and already may suffice here. About its interfaces for being called from a program, see e.g., (here). $\endgroup$
    – Buttonwood
    May 5, 2021 at 11:41
  • 1
    $\begingroup$ Yes, I noticed and was surprised by that too. I built the most recent OpenBabel version from source and successfully integrated it with Python using pip/conda. $\endgroup$
    – buddemat
    May 5, 2021 at 11:47

1 Answer 1

11
$\begingroup$

In first place, you must clarify with the users of the database the purpose of the entries about molecular weight because average molecular weight and exact molecular weight differ in their meaning and subsequent use. It may be that the documentation of the database provides this information. Later, once this target is set, use either one of the program to compute the entries for all compounds of this database to ensure consistency in the data. RDKit's current release 2021_03_1 is just some weeks old and probably the easier route to cover eventually all entries in your database.

  • Molecules consist of atoms (like oxygen, nitrogen, etc). For some of them, say nitrogen, despite they are all nitrogen, there might be more than one form and these differ slightly in their mass per individual atom (isotopes).

  • The mass of these isotopes is published. Equally, biannually, there are updated public records about the probability that an atom of e.g., nitrogen either is $\ce{^{14}N}$ (about 99.6%) or $\ce{^{15}N}$ (about 0.4%).

  • These probabilities are equally valid for molecules, if you have 1000 molecules each containing one atom of nitrogen, than 4 of them should contain the heavier isotope $\ce{^{15}N}$. Similar there are such probabilities about other atoms, like carbon, oxygen, etc., which are all independent of each other. Among carbon atoms, for example, 98.9% are $\ce{^{12}C}$, and 1.1% are $\ce{^{13}C}$, respectively. (Except in radiochemistry / nuclear chemistry.)

  • Exact molecular weight is used, e.g. in databases eventually used for e.g., mass spectroscopy. An analysis of your sample will recognize these different probabilities and may yield different, separate signals about the molecules with $\ce{^{14}N}$ from the ones about $\ce{^{15}N}$. Thus exact molecular weight is about molecules of one isotopic composition.

    Say our sample were $\ce{(CN)2}$ of two carbon atoms and two nitrogen atoms per molecule, than there would be four mass signals for all combinations of the two isotopes of carbon and nitrogen possible. Their intensity correlate with these probabilities. Exact molecular weight is a monoisotopic mass, typically to consider only the mass of the molecules consisting with the most frequently observed isotopes per element, i.e., only about $\ce{^{12}C}$ and $\ce{^{14}N}$. Depending on the intended analysis, it may be worth to retain six (or even more) decimals.

  • Average molecular weight now accounts not only for the molecules consisting of the most frequently seen isotopes per element, but for any combination of the elements with each other. These weights are are averaged by the probability that these combinations occur, e.g that there is a molecule $\ce{(^{13}C^{14}N)2}$ consisting only of the heavier carbon isotope and the lighter nitrogen isotope among all $\ce{(CN)2}$ molecules of your sample. Average molecular weights are typically used in to set up a reaction in the lab, to know how many grams of compound A shall react with how many grams of compound B. Depending on the scale of the reaction and the needs of your clients, to retain two decimals of this value may suffice.

The pace these IUPAC publishes the data about these isotopes is independent from the one the programs are updated by the developers, and later by the users. This contributes why an old program still may include outdated values.

$\endgroup$
1
  • 1
    $\begingroup$ The sort of answer that you wish you could upvote twice. Solid facts, clearly explained, appropriate level of detail! $\endgroup$
    – matt_black
    May 5, 2021 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.