Hi, what exactly does
rdkit.Chem.rdMolDescriptors._CalcMolWt( mol )
do? :
#!/usr/bin/python -u
import sys
import rdkit
import rdkit.Chem.rdMolDescriptors
PYBEL_PATH = "/share/linux/openbabel-2.3.2/lib"
sys.path.append( PYBEL_PATH )
import pybel
H = { "std" : 1.00794 }
C = { "std" : 12.0107 }
N = { "std" : 14.0067 }
O = { "std" : 15.9994 }
sdf = "CID_5950.sdf"
mol = rdkit.Chem.SupplierFromFilename( sdf ).next()
rdkit.Chem.AddHs( mol )
rdwt = rdkit.Chem.rdMolDescriptors._CalcMolWt( mol )
obmol = pybel.readfile( "sdf", sdf ).next()
obmol.addh()
obwt = obmol.molwt
mywt = 0.0
for a in obmol.atoms :
if a.OBAtom.IsHydrogen() : mywt += H["std"]
if a.OBAtom.IsCarbon() : mywt += C["std"]
if a.OBAtom.IsNitrogen() : mywt += N["std"]
if a.OBAtom.IsOxygen() : mywt += O["std"]
print
print "ALA", rdkit.Chem.rdMolDescriptors.CalcMolFormula( mol )
print "**********************"
print "me", mywt
print "ob", obwt
print "rd", rdwt
#########################
The output:
ALA C3H7NO2
**********************
me 89.09318
ob 89.09318
rd 89.094
(without pretty-printing it's
me 89.093180000000032
ob 89.093180000000032
rd 89.093999999999994)
What am I missing?
TIA
--
Dimitri Maziuk
Programmer/sysadmin
BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________ Rdkit-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

