/// <summary> /// Create a new CDK <see cref="IAtom"/> from the Beam Atom. If the element is /// unknown (i.e. '*') then an pseudo atom is created. /// </summary> /// <param name="atom">an Atom from the Beam Graph</param> /// <returns>the CDK atom to have it's properties set</returns> public IAtom NewCDKAtom(Beam.IAtom atom) { var element = atom.Element; var unknown = element == Beam.Element.Unknown; if (unknown) { var pseudoAtom = builder.NewPseudoAtom(element.Symbol); pseudoAtom.Symbol = element.Symbol; pseudoAtom.Label = atom.Label; return(pseudoAtom); } return(CreateAtom(element)); }
/// <summary> /// Create a new CDK <see cref="IAtom"/> from the Beam Atom. /// </summary> /// <param name="beamAtom">an Atom from the Beam ChemicalGraph</param> /// <param name="hCount">hydrogen count for the atom</param> /// <returns>the CDK atom to have it's properties set</returns> public IAtom ToCDKAtom(Beam.IAtom beamAtom, int hCount) { var cdkAtom = NewCDKAtom(beamAtom); cdkAtom.ImplicitHydrogenCount = hCount; cdkAtom.FormalCharge = beamAtom.Charge; if (beamAtom.Isotope >= 0) { cdkAtom.MassNumber = beamAtom.Isotope; } if (beamAtom.IsAromatic()) { cdkAtom.IsAromatic = true; } if (beamAtom.AtomClass > 0) { cdkAtom.SetProperty(CDKPropertyName.AtomAtomMapping, beamAtom.AtomClass); } return(cdkAtom); }