Hello,

I am trying to study particular atoms in a molecule. I am giving an input
babel sdf (attached to this post) of one molecule into the python script
posted below and am trying to look at indices and atomic masses of the
atoms I am interested in. I have noticed that, after calling mol.make3D(),
properties of the particular atoms I am studying, such as atomic mass and
index number, become messed up. Does anyone know why this is the case? I
have posted an example output from running this script with the given sdf
below. Thanks!

*Script:*

import pybel
from sys import argv

mols = [x for x in pybel.readfile('sdf', 'interesting_atom.sdf')]

for mol in mols:
    interesting_atoms = []
    interesting_atom_indices = list(set(mol.data['PRIMARY_SOM'].split()))
    for index in interesting_atom_indices:
        interesting_atoms.append(mol.OBMol.GetAtomById(int(index)))
    print map(lambda x: x.GetIndex(), interesting_atoms)
    print map(lambda x: x.GetAtomicMass(), interesting_atoms)
    mol.make3D()
    mol.localopt()
    print map(lambda x: x.GetIndex(), interesting_atoms)
    print map(lambda x: x.GetAtomicMass(), interesting_atoms)

Output:

[1, 15, 29] -- initial indices of interesting atoms
[12.0107, 12.0107, 1.00794] -- atomic masses of these interesting atoms
==============================
*** Open Babel Warning  in CorrectStereoAtoms
  Could not correct 3 stereocenter(s) in this molecule (RXNREGNO#97673
MTB12598)
  with Atom Ids as follows: 11 17 19
[0, 4133926103, 0] -- new indices
[114.818, 0.0, 1.00794] -- new atomic masses

Attachment: interesting_molecule.sdf
Description: Binary data

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to