Hello everyone,

I have two molecules (benzene and methane) in two separate xyz files.
I would like to create a methylbenzene molecule out of these and relax it with 
a UFF.
I am new to pybel (and babel in general). I would like to:

  *   open the two files
  *   remove one hydrogen from the benzene and one from the methane
  *   create a bond among the two carbons
  *   perform UFF relaxation.

So far I have tried several things, mostly trying to follow this discussion 
(which is a bit outdated actually): 
http://forums.openbabel.org/OBGenericData-and-OBPairData-td4651441.html#a4651899
I could not get much out of it for the moment:

  *   I could read the files with readfile(), but why do I get an iterator?
  *   Is OBBuilder() what I am looking for? How to use it properly?
  *   Should I rather use OBPairData() ?
  *   I know I can use -d to remove (all) hydrogens in babel. How do I do it 
for specific atoms in pybel?

Below you can find the little code I could write at the moment. I am attaching 
the two xyz files.
Any help would be greatly appreciated.
Thank you.
Marco

import pybel as pb
mol1 = [ m for m in pb.readfile('xyz', 'benzene.xyz')][0]
mol2 = [ m for m in pb.readfile('xyz', 'methane.xyz')][0]

mol1 + mol2 # This gives a TypeError: unsupported operand type(s) for +: 
'Molecule' and 'Molecule'

m1 = mol1.OBMol
m2 = mol2.OBMol
m3 = m1 + m2  # This gives a TypeError: unsupported operand type(s) for +: 
'OBMol' and 'OBMol'



==
Marco Di Gennaro, Ph.D.
Toyota Motor Europe



This e-mail may contain confidential information. If you are not an addressee 
or otherwise authorised to receive this message, you should not use, copy, 
disclose or take any action based on this e-mail. If you have received this 
e-mail in error, please inform the sender promptly and delete this message and 
any attachments immediately.

Attachment: methane.xyz
Description: methane.xyz

Attachment: benzene.xyz
Description: benzene.xyz

_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to