On Sat, Jun 1, 2013 at 6:46 AM, Yingfeng Wang <[email protected]> wrote:

> Dear Greg,
>
> Thanks.
>
> As for
> In [19]: frags = Chem.GetMolFrags(nm,asMols=True)
> In [20]: [AllChem.CalcMolFormula(x) for x in frags]
> Out[20]: ['C4H5N3O', 'C6H6']
>
> Is it possible to directly get 'C6H5+' instead of 'C6H6'?
>

You can't get C6H5+, because there's not really any way for the code to
know here to assign charges if you just call break bonds, but as of this
morning (I just committed it) you can tell the RDKit not to sanitize the
fragments:

In [10]: frags = Chem.GetMolFrags(nm,asMols=True,sanitizeFrags=False)

In [11]: [AllChem.CalcMolFormula(x) for x in frags]
Out[11]: ['C4H4N3O', 'C6H5']

In [10]: frags = Chem.GetMolFrags(nm,asMols=True,sanitizeFrags=False)

In [11]: [AllChem.CalcMolFormula(x) for x in frags]
Out[11]: ['C4H4N3O', 'C6H5']



>
> As for the difference between ExactMolWt() and MolWt(). The confusion is
> from the following case:
>
> >>>[Chem.MolToSmiles(x) for x in frags]
> ['Cc1nncc(O)n1', 'c1ccccc1']
>
> >>> Descriptors.MolWt(Chem.MolFromSmiles('Cc1nncc(O)n1'))
> 111.10399999999998
> >>> Descriptors.MolWt(Chem.MolFromSmiles('c1ccccc1'))
> 78.11399999999999
> >>> [Descriptors.ExactMolWt(x) for x in frags]
> [111.04326178, 78.046950192]
>
> By far, every thing is perfect.
>
> But if I use
>
> >>>[Descriptors.MolWt(x) for x in frags]
> [5.04, 6.048]
>
> It looks I can get correct mass by MolWt() if I transfer mol to Smiles
> format, and transfer Smiles format back to mol. However, if I directly
> apply MolWt() on the original mol, I got weird results.
>

I can reproduce this and it looks like a bug. I'll get it fixed.

-greg
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to