> >> m1 = mol1.OBMol
> >> m2 = mol2.OBMol
You'll want to count the number of atoms in each molecule before you do the
addition.
> >> m1 += m2
> >> #merging the two molecules
> >> m1.AddBond(1,2,1) ##
> >> how do I give the right indices here?
You just added a bond between atom 1 and atom 2. Most likely these are both in
mol1.
If you have benzene as m1 and methane as m2, then you have 6 atoms in m1 and 1
atom in m2, so you want to link atom 1 and atom 7.
> Moreover I would like to check whether the bond I have inserted is correct.
Probably you want to do this in a Jupyter notebook and depict the molecule.
Certainly, you can get properties from the bond (e.g., start and end atom
index) but those will be exactly what you specified.
Personally, if you're trying to grow a molecule, I do this all in SMILES and
generate 3D coordinates later.
'c1ccccc1' + 'C' = 'c1ccccc1C' # toluene
Now you don't always have the SMILES in the right atom order, but you can
always abuse SMILES syntax:
'c1%99c[C]cccc1' + '.C%99' # new bond created to the atom I want...
Hope that helps,
-Geoff
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss