I should point out that the --gen3D workaround doesn't work in all cases. See the attached 2D SDF for an example - converting it to 3D results in 'nan' coordinates.

What is the official stance on this? On the one hand Babel can't be expected to fix files that other software has screwed up. On the other hand, is there really such a thing as "incorrect" bond lengths in a 2D SDF?



Quoting cadeddu <cade...@unistra.fr> on Mon, 06 Aug 2012 16:25:11 +0200:

To conclude:
this small workaround works  - but great care must be taken into
checking the structures:
--------------------------------------------------
import pybel, openbabel
mol=pybel.readfile("cdx", "benzene_acs.cdx").next()
factor=1.39/1.89  # this is the error of the bond length: real
value/wrong one
for each in mol.atoms:
  x=each.coords[0]*factor
  y=each.coords[1]*factor
  z=each.coords[2]*factor
  each.OBAtom.SetVector(x,y,z)
mol.addh()
output = pybel.Outputfile("mol2", "benzene_acs.mol2","overwrite=True")
output.write(mol)
output.close()
--------------------------------------------------

hope this will help
thank you guys for this wonderful software and those lovely python
libraries! :)
andrea



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss






_____________________________________________________
Dr. Douglas R. Houston
Lecturer
Room 3.23
Institute of Structural and Molecular Biology
Michael Swann Building
King's Buildings
University of Edinburgh
Edinburgh, EH9 3JR, UK
Tel. 0131 650 7358


--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

Attachment: 2Dtonan.sdf
Description: Binary data

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to