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. 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’ benzene.xyz <http://forums.openbabel.org/file/t375731/benzene.xyz> methane.xyz <http://forums.openbabel.org/file/t375731/methane.xyz> Any help would be greatly appreciated. Thank you. Marco ----- ------------------------------------- Marco Di Gennaro Researcher, Toyota Motor Europe ------------------------------------- -- Sent from: http://forums.openbabel.org/General-discussion-f3090658.html _______________________________________________ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss