From: Noel O'B. <no...@ca...> - 2006-05-25 09:08:40
|
Given a set of atom coordinates and corresponding atomic numbers, is the following function sufficient to create an OBMol suitable for writing to a file as a PDB, for example? def createopenbabel(atomcoords,atomnos): """Create an open babel molecule.""" obmol = ob.OBMol() for coords,atomno in zip(atomcoords,atomnos): obatom = ob.OBAtom() obatom.SetAtomicNum(atomno) obatom.SetVector(*coords) obmol.AddAtom(obatom) obmol.ConnectTheDots() obmol.PerceiveBondOrders() return obmol (I see that I've neglected to include the molecular charge, but apart from that, how does it look? Do I have to handle aromaticity in some way?) Regards, Noel |