In one specific case that I'm able to identify, I'm losing precision on the geometry vectors when copying a molecule in pybel. I've attached a small sample of source and a single molecule file that reliably reproduces the results for me on Windows with OpenBabel 2.3.1 and Python 2.7.2. Also, confirmed on Rocks Linux with OpenBabel 2.3.2 and Python 2.6.6.
The output on my machine from the sample code is as follows: Original : 0.0602900000, -2.2281500000, 0.0378600000 Molecule_copy : 0.0603000000, -2.2281000000, 0.0379000000 OBMol_copy : 0.0602900000, -2.2281500000, 0.0378600000 A few notes: 1) Yes, the precision in my print format string is ridiculous :) I just wanted to make sure I wasn't arbitrarily clipping precision when displaying the output. 2) The sample code only outputs the first atom (Rh) as it was all that was necessary to show the problem on my machine. 3) Since this works fine when passing OBMol into the constructor, it looks like it has to be caused by the Molecule._exchange call which in turn calls Molecule.write(format='mol') 4) Calling Molecule.write(format='mol') directly also shows a loss of precision on the geometry in the output. The .write() call goes into openbabel.OBConversion and from there into swig code which I'm not very familiar with so I didn't try to follow it deeper into the C++ library. 5) It seems like the precision being lost is far greater than I would expected from the inherent precision problems of double and it feels more like it's just rounding to four digits of precision. It seems especially suspect since using OBMol is accurate. I will work around this by always using new_copy = pybel.Molecule(my_mol.OBMol), but it is an odd behavior. Is anyone else able to confirm? Is it unexpected behavior to pass pybel.Molecule instead of OBMol or is the _cinfony check in the constructor specifically meant for that case? Thanks, Greg Fortune
test1.xyz
Description: Protein Databank data
test1.py
Description: Binary data
------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss