Hi Philippe,

On 8/29/07, Philippe Vaglio <[EMAIL PROTECTED]> wrote:
> I am parsing a sdf file and calculating the molw using
> MFAnalyzer.getMass(). Everything is fine until I get
> to a molecule that contains a Deuterium with the D symbol.

I guess this now gets read as a PseudoAtom....

> The molw return is then 0.

which has mass 0. In principle deuterium is done via Isotope.getMassNumber().

> Also tried to use the WeightDescriptor but the molw is also 0.

Because of PseudoAtom...

> Here is the code I used
>
>                 MDLReader reader = new MDLReader();
>
>                 Molecule cdkMol = new Molecule();
>                 reader.read(cdkMol);

Add:

for (int i=0; i<cdkMol.getAtomCount(); i++) {
  if (cdkMol.atomAt(i) instanceof PseudoAtom) {
    PseudoAtom possiblyD = (PseudoAtom)cdkMol.atomAt(i);
    if ("D".equals(possiblyD.getLabel()) {
      IAtom deuterium = possiblyD.getBuilder().newAtom("H");
      deuterium.setMassNumber(2);
      AtomContainerManipulator.replaceAtomByAtom(cdkMol, possiblyD, deuterium);
    }
}

or something along those lines...

Egon

-- 
----
http://chem-bla-ics.blogspot.com/

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to