Hi,

I'm having a few problems in creating molecules from scratch in Python (see 
attached code)
My code creates a molecule by creating atoms from coordinates, elements and 
bonds.
The main issue is that I get different atom types than I would get by parsing a simple PDB created with same coordinates and elements (but no bonds).

Is there any other step to do other than BeginModify()/EndModify() to be applied to the molecule to achieve the same results I would get by reading a file?

Thanks!

S


--
 Stefano Forli, PhD

 Staff Scientist
 Molecular Graphics Laboratory
 Dept. of Integrative Structural
  and Computational Biology, MB-112F
 The Scripps Research Institute
 10550  North Torrey Pines Road
 La Jolla,  CA 92037-1000,  USA.

    tel: +1 (858)784-2055
    fax: +1 (858)784-2860
    email: fo...@scripps.edu
    http://www.scripps.edu/~forli/
obmol = ob.OBMol()
obmol.BeginModify()
for chain in chainList:
    cId = chain.getChid()
    for res in chain
        obres = obmol.NewResidue()
        obres.SetName(res.name )
        obres.SetNum( res.num )
        obres.SetChain(cId)
        for atom in res.atoms:
            obatom = obmol.NewAtom()
            obatom.SetAtomicNum( atom.atomicNum )
            obres.AddAtom(obatom)
            obatom.SetResidue(obres)
            obres.SetAtomID(obatom, atom.name )
            coords =  atom.coords
            vec = ob.vector3()
            vec.SetX(coords[0])
            vec.SetY(coords[1])
            vec.SetZ(coords[2])
            obatom.SetVector(vec)

for i,j in bonds[1]:
    bondOrder = bondOrderList['%d,%d'%(i,j)]
    obmol.AddBond(i, j, bondOrder)
obmol.SetTitle(title)
obmol.EndModify(True)
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to