Example #1
0
        public void TestOxygen1()
        {
            IAtomContainer mol    = builder.NewAtomContainer();
            IAtom          carbon = builder.NewAtom("C");
            IAtom          o1     = builder.NewAtom("O");
            IAtom          o2     = builder.NewAtom("O");

            carbon.ImplicitHydrogenCount = 1;
            o1.ImplicitHydrogenCount     = 1;
            o2.ImplicitHydrogenCount     = 0;

            IBond bond1 = builder.NewBond(carbon, o1, BondOrder.Single);
            IBond bond2 = builder.NewBond(carbon, o2, BondOrder.Double);

            mol.Atoms.Add(carbon);
            mol.Atoms.Add(o1);
            mol.Atoms.Add(o2);
            mol.Bonds.Add(bond1);
            mol.Bonds.Add(bond2);

            StructGenMatcher matcher = new StructGenMatcher();

            // look at the sp2 O first
            IAtomType matched = matcher.FindMatchingAtomType(mol, mol.Atoms[2]);

            AssertAtomType(testedAtomTypes, "O2", matched);

            matched = matcher.FindMatchingAtomType(mol, mol.Atoms[0]);
            AssertAtomType(testedAtomTypes, "C4", matched);

            matched = matcher.FindMatchingAtomType(mol, mol.Atoms[1]);
            AssertAtomType(testedAtomTypes, "O2", matched);
        }
Example #2
0
        public void TestReadAtomTypes_CDK()
        {
            string data = "<atomTypeList xmlns=\"http://www.xml-cml.org/schema/cml2/core\"                              \n"
                          + "  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"                                    \n"
                          + "  xsi:schemaLocation=\"http://www.xml-cml.org/schema/cml2/core ../../io/cml/data/cmlAll.xsd\"\n"
                          + "  id=\"mol2\" title=\"MOL2 AtomTypes\">                                                      \n"
                          + "                                                                                             \n"
                          + "  <atomType id=\"C.sp\">\n" + "    <atom elementType=\"C\" formalCharge=\"0\">\n"
                          + "      <scalar dataType=\"xsd:integer\" dictRef=\"cdk:formalNeighbourCount\">2</scalar>\n"
                          + "      <scalar dataType=\"xsd:integer\" dictRef=\"cdk:lonePairCount\">0</scalar>\n"
                          + "      <scalar dataType=\"xsd:integer\" dictRef=\"cdk:piBondCount\">2</scalar>\n" + "    </atom>\n"
                          + "    <scalar dataType=\"xsd:string\" dictRef=\"cdk:hybridization\">sp1</scalar>\n"
                          + "  </atomType>                                                                                "
                          + "</atomTypeList>";

            AtomTypeReader reader = new AtomTypeReader(new StringReader(data));

            Assert.IsNotNull(reader);
            var types = reader.ReadAtomTypes().ToReadOnlyList();

            Assert.IsNotNull(types);
            Assert.AreEqual(1, types.Count);

            object obj = types[0];

            Assert.IsNotNull(obj);
            Assert.IsTrue(obj is IAtomType);
            IAtomType atomType = (IAtomType)obj;

            Assert.AreEqual(0, atomType.FormalCharge.Value);
            Assert.AreEqual(Hybridization.SP1, atomType.Hybridization);
            Assert.AreEqual(0, atomType.GetProperty <int?>(CDKPropertyName.LonePairCount));
            Assert.AreEqual(2, atomType.GetProperty <int?>(CDKPropertyName.PiBondCount));
        }
Example #3
0
        public void TestMatchAgainstItself()
        {
            var    m_element1 = new Mock <IAtomType>(); IAtomType element1 = m_element1.Object;
            string result = AtomTypeDiff.Diff(element1, element1);

            AssertZeroLength(result);
        }
Example #4
0
        public void TestArsenic()
        {
            IAtomContainer mol   = builder.NewAtomContainer();
            IAtom          atom1 = builder.NewAtom("As");

            atom1.ImplicitHydrogenCount = 0;
            mol.Atoms.Add(atom1);
            for (int i = 0; i < 3; i++)
            {
                IAtom atom = builder.NewAtom("Cl");
                mol.Atoms.Add(atom);
                IBond bond = builder.NewBond(atom, atom1,
                                             BondOrder.Single);
                mol.Bonds.Add(bond);
            }

            StructGenMatcher matcher = new StructGenMatcher();
            IAtomType        matched = matcher.FindMatchingAtomType(mol, mol.Atoms[0]);

            AssertAtomType(testedAtomTypes, "As3", matched);

            for (int i = 1; i < mol.Atoms.Count; i++)
            {
                IAtom atom = mol.Atoms[i];
                matched = matcher.FindMatchingAtomType(mol, atom);
                AssertAtomType(testedAtomTypes, "atom " + i + " failed to match", "Cl1", matched);
            }
        }
        /// <summary> Tries to saturate a bond by increasing its bond orders by 1.0.
        ///
        /// </summary>
        /// <returns> true if the bond could be increased
        /// </returns>
        public virtual bool saturateByIncreasingBondOrder(IBond bond, IAtomContainer atomContainer, double increment)
        {
            IAtom[] atoms   = bond.getAtoms();
            IAtom   atom    = atoms[0];
            IAtom   partner = atoms[1];

            //logger.debug("  saturating bond: ", atom.Symbol, "-", partner.Symbol);
            IAtomType[] atomTypes1 = getAtomTypeFactory(bond.Builder).getAtomTypes(atom.Symbol);
            IAtomType[] atomTypes2 = getAtomTypeFactory(bond.Builder).getAtomTypes(partner.Symbol);
            for (int atCounter1 = 0; atCounter1 < atomTypes1.Length; atCounter1++)
            {
                IAtomType aType1 = atomTypes1[atCounter1];
                //logger.debug("  condidering atom type: ", aType1);
                if (couldMatchAtomType(atomContainer, atom, aType1))
                {
                    //logger.debug("  trying atom type: ", aType1);
                    for (int atCounter2 = 0; atCounter2 < atomTypes2.Length; atCounter2++)
                    {
                        IAtomType aType2 = atomTypes2[atCounter2];
                        //logger.debug("  condidering partner type: ", aType1);
                        if (couldMatchAtomType(atomContainer, partner, atomTypes2[atCounter2]))
                        {
                            //logger.debug("    with atom type: ", aType2);
                            if (bond.Order < aType2.MaxBondOrder && bond.Order < aType1.MaxBondOrder)
                            {
                                bond.Order = bond.Order + increment;
                                //logger.debug("Bond order now ", bond.Order);
                                return(true);
                            }
                        }
                    }
                }
            }
            return(false);
        }
 public void Ctor()
 {
     {
         #region 1
         IAtomContainer methane = new AtomContainer();
         IAtom          carbon  = new Atom("C");
         methane.Atoms.Add(carbon);
         CDKAtomTypeMatcher matcher = CDKAtomTypeMatcher.GetInstance();
         foreach (var atom in methane.Atoms)
         {
             IAtomType type = matcher.FindMatchingAtomType(methane, atom);
             AtomTypeManipulator.Configure(atom, type);
         }
         var adder = CDK.HydrogenAdder;
         adder.AddImplicitHydrogens(methane);
         #endregion
     }
     {
         #region 2
         IAtomContainer ethane  = new AtomContainer();
         IAtom          carbon1 = new Atom("C");
         IAtom          carbon2 = new Atom("C");
         ethane.Atoms.Add(carbon1);
         ethane.Atoms.Add(carbon2);
         CDKAtomTypeMatcher matcher = CDKAtomTypeMatcher.GetInstance();
         IAtomType          type    = matcher.FindMatchingAtomType(ethane, carbon1);
         AtomTypeManipulator.Configure(carbon1, type);
         var adder = CDK.HydrogenAdder;
         adder.AddImplicitHydrogens(ethane, carbon1);
         #endregion
     }
 }
        public void TestM22()
        {
            IAtomContainer expected1 = builder.NewAtomContainer();

            expected1.Atoms.Add(builder.NewAtom("O"));
            expected1.Atoms[0].FormalCharge = 1;
            expected1.Atoms.Add(builder.NewAtom("C"));
            expected1.AddBond(expected1.Atoms[0], expected1.Atoms[1], BondOrder.Double);
            expected1.Atoms.Add(builder.NewAtom("C"));
            expected1.AddBond(expected1.Atoms[1], expected1.Atoms[2], BondOrder.Single);
            expected1.Atoms.Add(builder.NewAtom("H"));
            expected1.Atoms.Add(builder.NewAtom("H"));
            expected1.Atoms.Add(builder.NewAtom("H"));
            expected1.Atoms.Add(builder.NewAtom("H"));
            expected1.Atoms.Add(builder.NewAtom("Na"));
            expected1.AddBond(expected1.Atoms[1], expected1.Atoms[3], BondOrder.Single);
            expected1.AddBond(expected1.Atoms[2], expected1.Atoms[4], BondOrder.Single);
            expected1.AddBond(expected1.Atoms[2], expected1.Atoms[5], BondOrder.Single);
            expected1.AddBond(expected1.Atoms[2], expected1.Atoms[6], BondOrder.Single);
            expected1.AddBond(expected1.Atoms[0], expected1.Atoms[7], BondOrder.Single);

            string[] expectedTypes = { "O.plus.sp2", "C.sp2", "C.sp3", "H", "H", "H", "H", "Na" };
            Assert.AreEqual(expectedTypes.Length, expected1.Atoms.Count);
            for (int i = 0; i < expectedTypes.Length; i++)
            {
                IAtom     nextAtom      = expected1.Atoms[i];
                IAtomType perceivedType = matcher.FindMatchingAtomType(expected1, nextAtom);
                Assert.IsNotNull(perceivedType, "Missing atom type for: " + nextAtom + " " + i + " expected: " + expectedTypes[i]);
                Assert.AreEqual(expectedTypes[i], perceivedType.AtomTypeName, "Incorrect atom type perceived for: " + nextAtom);
            }
        }
        public void TestM25()
        {
            //CreateFromSmiles("C[O*]")
            IAtomContainer expected1 = builder.NewAtomContainer();

            expected1.Atoms.Add(builder.NewAtom("C"));
            expected1.Atoms.Add(builder.NewAtom("O"));
            expected1.SingleElectrons.Add(builder.NewSingleElectron(expected1.Atoms[1]));
            expected1.AddBond(expected1.Atoms[0], expected1.Atoms[1], BondOrder.Single);
            expected1.Atoms.Add(builder.NewAtom("H"));
            expected1.Atoms.Add(builder.NewAtom("H"));
            expected1.Atoms.Add(builder.NewAtom("H"));
            expected1.AddBond(expected1.Atoms[0], expected1.Atoms[2], BondOrder.Single);
            expected1.AddBond(expected1.Atoms[0], expected1.Atoms[3], BondOrder.Single);
            expected1.AddBond(expected1.Atoms[0], expected1.Atoms[4], BondOrder.Single);
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(expected1);

            string[] expectedTypes = { "C.sp3", "O.sp3.radical", "H", "H", "H" };
            Assert.AreEqual(expectedTypes.Length, expected1.Atoms.Count);
            for (int i = 0; i < expectedTypes.Length; i++)
            {
                IAtom     nextAtom      = expected1.Atoms[i];
                IAtomType perceivedType = matcher.FindMatchingAtomType(expected1, nextAtom);
                Assert.IsNotNull(perceivedType, "Missing atom type for: " + nextAtom + " " + i + " expected: " + expectedTypes[i]);
                Assert.AreEqual(expectedTypes[i], perceivedType.AtomTypeName, "Incorrect atom type perceived for: " + nextAtom);
            }
        }
        public void TestM19()
        {
            //CreateFromSmiles("C=[N*+]")
            IAtomContainer expected1 = builder.NewAtomContainer();

            expected1.Atoms.Add(builder.NewAtom("C"));
            expected1.Atoms.Add(builder.NewAtom("N"));
            expected1.Atoms[1].FormalCharge = 1;
            expected1.SingleElectrons.Add(builder.NewSingleElectron(expected1.Atoms[1]));
            expected1.AddBond(expected1.Atoms[0], expected1.Atoms[1], BondOrder.Double);
            expected1.Atoms.Add(builder.NewAtom("H"));
            expected1.Atoms.Add(builder.NewAtom("H"));
            expected1.Atoms.Add(builder.NewAtom("H"));
            expected1.AddBond(expected1.Atoms[0], expected1.Atoms[2], BondOrder.Single);
            expected1.AddBond(expected1.Atoms[0], expected1.Atoms[3], BondOrder.Single);
            expected1.AddBond(expected1.Atoms[1], expected1.Atoms[4], BondOrder.Single);

            string[] expectedTypes = { "C.sp2", "N.plus.sp2.radical", "H", "H", "H" };
            Assert.AreEqual(expectedTypes.Length, expected1.Atoms.Count);
            for (int i = 0; i < expectedTypes.Length; i++)
            {
                IAtom     nextAtom      = expected1.Atoms[i];
                IAtomType perceivedType = matcher.FindMatchingAtomType(expected1, nextAtom);
                Assert.IsNotNull(perceivedType, "Missing atom type for: " + nextAtom + " " + i + " expected: " + expectedTypes[i]);
                Assert.AreEqual(expectedTypes[i], perceivedType.AtomTypeName, "Incorrect atom type perceived for: " + nextAtom);
            }
        }
        public void TestM0()
        {
            //COMPOUND
            //[C*]=C-C
            IAtomContainer molecule = builder.NewAtomContainer();

            molecule.Atoms.Add(builder.NewAtom("C"));
            molecule.SingleElectrons.Add(new SingleElectron(molecule.Atoms[0]));
            molecule.Atoms.Add(builder.NewAtom("C"));
            molecule.AddBond(molecule.Atoms[0], molecule.Atoms[1], BondOrder.Double);
            molecule.Atoms.Add(builder.NewAtom("C"));
            molecule.AddBond(molecule.Atoms[1], molecule.Atoms[2], BondOrder.Single);
            molecule.Atoms.Add(builder.NewAtom("H"));
            molecule.AddBond(molecule.Atoms[0], molecule.Atoms[3], BondOrder.Single);
            molecule.Atoms.Add(builder.NewAtom("H"));
            molecule.AddBond(molecule.Atoms[1], molecule.Atoms[4], BondOrder.Single);
            molecule.Atoms.Add(builder.NewAtom("H"));
            molecule.AddBond(molecule.Atoms[2], molecule.Atoms[5], BondOrder.Single);
            molecule.Atoms.Add(builder.NewAtom("H"));
            molecule.AddBond(molecule.Atoms[2], molecule.Atoms[6], BondOrder.Single);
            molecule.Atoms.Add(builder.NewAtom("H"));
            molecule.AddBond(molecule.Atoms[2], molecule.Atoms[7], BondOrder.Single);

            string[] expectedTypes = { "C.radical.sp2", "C.sp2", "C.sp3", "H", "H", "H", "H", "H" };
            Assert.AreEqual(expectedTypes.Length, molecule.Atoms.Count);
            for (int i = 0; i < expectedTypes.Length; i++)
            {
                IAtom     nextAtom      = molecule.Atoms[i];
                IAtomType perceivedType = matcher.FindMatchingAtomType(molecule, nextAtom);
                Assert.IsNotNull(perceivedType, "Missing atom type for: " + nextAtom + " " + i + " expected: " + expectedTypes[i]);
                Assert.AreEqual(expectedTypes[i], perceivedType.AtomTypeName, "Incorrect atom type perceived for: " + nextAtom);
            }
        }
Example #11
0
        /// <summary>
        /// Compare two <see cref="IChemObject"/> classes and return the difference as an <see cref="IDifference"/>.
        /// </summary>
        /// <param name="first">the first of the two classes to compare</param>
        /// <param name="second">the second of the two classes to compare</param>
        /// <returns>an <see cref="IDifference"/> representation of the difference between the first and second <see cref="IChemObject"/>.</returns>
        public static IDifference Difference(IChemObject first, IChemObject second)
        {
            if (!(first is IAtomType && second is IAtomType))
            {
                return(null);
            }
            IAtomType            firstElem  = (IAtomType)first;
            IAtomType            secondElem = (IAtomType)second;
            ChemObjectDifference totalDiff  = new ChemObjectDifference("AtomTypeDiff");

            totalDiff.AddChild(StringDifference.Construct("N", firstElem.AtomTypeName, secondElem.AtomTypeName));
            totalDiff.AddChild(BondOrderDifference.Construct("MBO", firstElem.MaxBondOrder,
                                                             secondElem.MaxBondOrder));
            totalDiff
            .AddChild(DoubleDifference.Construct("BOS", firstElem.BondOrderSum, secondElem.BondOrderSum));
            totalDiff
            .AddChild(IntegerDifference.Construct("FC", firstElem.FormalCharge, secondElem.FormalCharge));
            totalDiff.AddChild(AtomTypeHybridizationDifference.Construct("H", firstElem.Hybridization,
                                                                         secondElem.Hybridization));
            totalDiff.AddChild(IntegerDifference.Construct("NC", firstElem.FormalNeighbourCount,
                                                           secondElem.FormalNeighbourCount));
            totalDiff.AddChild(DoubleDifference.Construct("CR", firstElem.CovalentRadius,
                                                          secondElem.CovalentRadius));
            totalDiff.AddChild(IntegerDifference.Construct("V", firstElem.Valency, secondElem.Valency));
            totalDiff.AddChild(IsotopeDiff.Difference(first, second));
            if (totalDiff.ChildCount() > 0)
            {
                return(totalDiff);
            }
            else
            {
                return(null);
            }
        }
Example #12
0
        /// <summary> Calculates the number of hydrogens that can be added to the given atom to fullfil
        /// the atom's valency. It will return 0 for PseudoAtoms, and for atoms for which it
        /// does not have an entry in the configuration file.
        /// </summary>
        public virtual int calculateNumberOfImplicitHydrogens(IAtom atom, double bondOrderSum, double maxBondOrder, int neighbourCount)
        {
            int missingHydrogen = 0;

            if (atom is IPseudoAtom)
            {
                //logger.debug("don't figure it out... it simply does not lack H's");
                return(0);
            }

            //logger.debug("Calculating number of missing hydrogen atoms");
            // get default atom
            IAtomType[] atomTypes = getAtomTypeFactory(atom.Builder).getAtomTypes(atom.Symbol);
            if (atomTypes.Length == 0)
            {
                //logger.warn("Element not found in configuration file: ", atom);
                return(0);
            }

            //logger.debug("Found atomtypes: ", atomTypes.Length);
            for (int f = 0; f < atomTypes.Length; f++)
            {
                IAtomType type = atomTypes[f];
                if (couldMatchAtomType(atom, bondOrderSum, maxBondOrder, type))
                {
                    //logger.debug("This type matches: ", type);
                    //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                    missingHydrogen = (int)(type.BondOrderSum - bondOrderSum);
                    break;
                }
            }

            //logger.debug("missing hydrogens: ", missingHydrogen);
            return(missingHydrogen);
        }
        /// <summary> Determines if the atom can be of type AtomType.</summary>
        public virtual bool couldMatchAtomType(IAtomContainer container, IAtom atom, IAtomType type)
        {
            double bondOrderSum = container.getBondOrderSum(atom);
            double maxBondOrder = container.getMaximumBondOrder(atom);

            return(couldMatchAtomType(atom, bondOrderSum, maxBondOrder, type));
        }
        /// <summary> Method that assign properties to an atom given a particular atomType.
        /// 
        /// </summary>
        /// <param name="atom"> Atom to configure
        /// </param>
        /// <param name="atomType">   AtomType
        /// </param>
        public static void configure(IAtom atom, IAtomType atomType)
        {
            atom.AtomTypeName = atomType.AtomTypeName;
            atom.MaxBondOrder = atomType.MaxBondOrder;
            atom.BondOrderSum = atomType.BondOrderSum;
            atom.VanderwaalsRadius = atomType.VanderwaalsRadius;
            atom.CovalentRadius = atomType.CovalentRadius;
            atom.Valency = atomType.Valency;
            atom.setFormalCharge(atomType.getFormalCharge());
            atom.Hybridization = atomType.Hybridization;
            atom.FormalNeighbourCount = atomType.FormalNeighbourCount;
            atom.setFlag(CDKConstants.IS_HYDROGENBOND_ACCEPTOR, atomType.getFlag(CDKConstants.IS_HYDROGENBOND_ACCEPTOR));
            atom.setFlag(CDKConstants.IS_HYDROGENBOND_DONOR, atomType.getFlag(CDKConstants.IS_HYDROGENBOND_DONOR));
            System.Object constant = atomType.getProperty(CDKConstants.CHEMICAL_GROUP_CONSTANT);
            if (constant != null)
            {
                atom.setProperty(CDKConstants.CHEMICAL_GROUP_CONSTANT, constant);
            }
            atom.setFlag(CDKConstants.ISAROMATIC, atomType.getFlag(CDKConstants.ISAROMATIC));

            System.Object color = atomType.getProperty("org.openscience.cdk.renderer.color");
            if (color != null)
            {
                atom.setProperty("org.openscience.cdk.renderer.color", color);
            }
            if (atomType.AtomicNumber != 0)
            {
                atom.AtomicNumber = atomType.AtomicNumber;
            }
            if (atomType.getExactMass() > 0.0)
            {
                atom.setExactMass(atomType.getExactMass());
            }
        }
Example #15
0
        public void TestFlourine()
        {
            IAtomContainer mol   = builder.NewAtomContainer();
            IAtom          atom1 = builder.NewAtom("C");

            atom1.ImplicitHydrogenCount = 0;
            mol.Atoms.Add(atom1);
            for (int i = 0; i < 4; i++)
            {
                IAtom floruineAtom = builder.NewAtom("F");
                mol.Atoms.Add(floruineAtom);
                IBond bond = builder.NewBond(floruineAtom, atom1);
                mol.Bonds.Add(bond);
            }

            StructGenMatcher matcher = new StructGenMatcher();
            IAtomType        matched = matcher.FindMatchingAtomType(mol, mol.Atoms[0]);

            AssertAtomType(testedAtomTypes, "C4", matched);

            for (int i = 1; i < mol.Atoms.Count; i++)
            {
                IAtom atom = mol.Atoms[i];
                matched = matcher.FindMatchingAtomType(mol, atom);
                AssertAtomType(testedAtomTypes, "atom " + i + " failed to match", "F1", matched);
            }
        }
Example #16
0
        /// <summary>
        /// Determines if the atom can be of type <see cref="IAtomType"/>. That is, it sees if this
        /// <see cref="IAtomType"/> only differs in bond orders, or implicit hydrogen count.
        /// </summary>
        private static bool CouldMatchAtomType(IAtomContainer container, IAtom atom, IAtomType type)
        {
            var bondOrderSum = container.GetBondOrderSum(atom);
            var maxBondOrder = container.GetMaximumBondOrder(atom);

            return(CouldMatchAtomType(atom, bondOrderSum, maxBondOrder, type));
        }
Example #17
0
        private void AddTestedAtomType(IDictionary <string, int> testedAtomTypes, string expectedID)
        {
            if (testedAtomTypes == null)
            {
                testedAtomTypes = new Dictionary <string, int>();
            }

            try
            {
                IAtomType type = GetFactory().GetAtomType(expectedID);
                Assert.IsNotNull(type, "Attempt to test atom type which is not defined in the " + AtomTypeListName
                                 + ": " + expectedID);
            }
            catch (NoSuchAtomTypeException exception)
            {
                Assert.IsNotNull("Attempt to test atom type which is not defined in the " + AtomTypeListName
                                 + ": " + exception.Message);
            }
            if (testedAtomTypes.ContainsKey(expectedID))
            {
                // increase the count, so that redundancy can be calculated
                testedAtomTypes[expectedID] = 1 + testedAtomTypes[expectedID];
            }
            else
            {
                testedAtomTypes[expectedID] = 1;
            }
        }
Example #18
0
        private void DeserializeAtomTypeFields(INode rdfObject, IAtomType element)
        {
            DeserializeIsotopeFields(rdfObject, element);
            var hybrid = g.GetTriplesWithSubjectPredicate(rdfObject, P_HASHYBRIDIZATION).FirstOrDefault();

            if (hybrid != null)
            {
                var rdfHybrid = hybrid.Object.ToString();
                if (RESOURCE_TO_HYBRID.ContainsKey(rdfHybrid))
                {
                    element.Hybridization = RESOURCE_TO_HYBRID[rdfHybrid];
                }
            }
            var name = g.GetTriplesWithSubjectPredicate(rdfObject, P_HASATOMTYPENAME).FirstOrDefault();

            if (name != null)
            {
                element.AtomTypeName = name.Object.ToString();
            }
            var order = g.GetTriplesWithSubjectPredicate(rdfObject, P_HASMAXBONDORDER).FirstOrDefault();

            if (order != null)
            {
                var maxOrder = order.Object;
                element.MaxBondOrder = Resource2Order(maxOrder);
            }
            var formalCharge = g.GetTriplesWithSubjectPredicate(rdfObject, P_HASFORMALCHARGE).FirstOrDefault();

            if (formalCharge != null)
            {
                element.FormalCharge = int.Parse(formalCharge.Object.ToString(), NumberFormatInfo.InvariantInfo);
            }
        }
Example #19
0
        /// <summary>
        /// get the electrostatic potential of the neighbours of a atom.
        /// </summary>
        /// <param name="ac">The IAtomContainer to study</param>
        /// <param name="atom1">The position of the IAtom to study</param>
        /// <param name="ds"></param>
        /// <returns>The sum of electrostatic potential of the neighbours</returns>
        private double GetElectrostaticPotentialN(IAtomContainer ac, int atom1, double[] ds)
        {
            //        double CoulombForceConstant = 1/(4*Math.PI*8.81/*Math.Pow(10, -12)*/);
            double CoulombForceConstant = 0.048;
            double sum = 0.0;

            try
            {
                var atoms = ac.GetConnectedAtoms(ac.Atoms[atom1]);
                foreach (var atom in atoms)
                {
                    double    covalentradius = 0;
                    string    symbol         = atom.Symbol;
                    IAtomType type           = factory.GetAtomType(symbol);
                    covalentradius = type.CovalentRadius.Value;

                    double charge = ds[StepSize * atom1 + atom1 + 5];
                    Debug.WriteLine($"sum_({sum}) = CFC({CoulombForceConstant})*Charge({charge}/ret({covalentradius}");
                    sum += CoulombForceConstant * charge / (covalentradius * covalentradius);
                }
            }
            catch (CDKException e)
            {
                Debug.WriteLine(e);
            }

            return(sum);
        }
Example #20
0
        /// <summary> Method that assign properties to an atom given a particular atomType.
        ///
        /// </summary>
        /// <param name="atom"> Atom to configure
        /// </param>
        /// <param name="atomType">   AtomType
        /// </param>
        public static void configure(IAtom atom, IAtomType atomType)
        {
            atom.AtomTypeName      = atomType.AtomTypeName;
            atom.MaxBondOrder      = atomType.MaxBondOrder;
            atom.BondOrderSum      = atomType.BondOrderSum;
            atom.VanderwaalsRadius = atomType.VanderwaalsRadius;
            atom.CovalentRadius    = atomType.CovalentRadius;
            atom.Valency           = atomType.Valency;
            atom.setFormalCharge(atomType.getFormalCharge());
            atom.Hybridization        = atomType.Hybridization;
            atom.FormalNeighbourCount = atomType.FormalNeighbourCount;
            atom.setFlag(CDKConstants.IS_HYDROGENBOND_ACCEPTOR, atomType.getFlag(CDKConstants.IS_HYDROGENBOND_ACCEPTOR));
            atom.setFlag(CDKConstants.IS_HYDROGENBOND_DONOR, atomType.getFlag(CDKConstants.IS_HYDROGENBOND_DONOR));
            System.Object constant = atomType.getProperty(CDKConstants.CHEMICAL_GROUP_CONSTANT);
            if (constant != null)
            {
                atom.setProperty(CDKConstants.CHEMICAL_GROUP_CONSTANT, constant);
            }
            atom.setFlag(CDKConstants.ISAROMATIC, atomType.getFlag(CDKConstants.ISAROMATIC));

            System.Object color = atomType.getProperty("org.openscience.cdk.renderer.color");
            if (color != null)
            {
                atom.setProperty("org.openscience.cdk.renderer.color", color);
            }
            if (atomType.AtomicNumber != 0)
            {
                atom.AtomicNumber = atomType.AtomicNumber;
            }
            if (atomType.getExactMass() > 0.0)
            {
                atom.setExactMass(atomType.getExactMass());
            }
        }
Example #21
0
        public TokenStream Atom(IAtomType atomType)
        {
            if (_error)
            {
                return(this);
            }
            int localC = C;

            C = 0;
            int currentNumber = _queueNumber++;

            if (CreatedAtom == null)
            {
                atomType.Is(this);
            }
            else
            {
                var outerAtom = CreatedAtom;
                CreatedAtom  = atomType.Create();
                _lastElement = atomType.Get(this);
                CreatedAtom  = outerAtom;
                DiscardData(currentNumber);
            }
            C = localC;
            return(this);
        }
Example #22
0
        public void TestReadAtomTypes_CDK()
        {
            OWLAtomTypeReader reader = new OWLAtomTypeReader(new StringReader(OWL_CONTENT));

            Assert.IsNotNull(reader);
            var types = reader.ReadAtomTypes();

            Assert.IsNotNull(types);
            Assert.AreEqual(1, types.Count);

            object obj = types[0];

            Assert.IsNotNull(obj);
            Assert.IsTrue(obj is IAtomType);
            IAtomType atomType = (IAtomType)obj;

            Assert.AreEqual("C", atomType.Symbol);
            Assert.AreEqual("C.sp3.0", atomType.AtomTypeName);
            Assert.AreEqual(0, atomType.FormalCharge.Value);
            Assert.AreEqual(Hybridization.SP3, atomType.Hybridization);
            Assert.AreEqual(4, atomType.FormalNeighbourCount.Value);
            Assert.AreEqual(0, atomType.GetProperty <int>(CDKPropertyName.LonePairCount));
            Assert.AreEqual(0, atomType.GetProperty <int>(CDKPropertyName.PiBondCount));
            Assert.AreEqual(0, atomType.GetProperty <int>(CDKPropertyName.SingleElectronCount));
        }
        public void TestSetForceFieldConfigurator_String()
        {
            string forceFieldName = "mmff94";

            forceFieldConfigurator.SetForceFieldConfigurator(forceFieldName);
            var mmff94AtomTypes = forceFieldConfigurator.AtomTypes;

            Assert.IsNotNull(mmff94AtomTypes);
            IAtomType atomtype0 = mmff94AtomTypes[0];

            Assert.AreEqual("C", atomtype0.AtomTypeName);
            IAtomType atomtype1 = mmff94AtomTypes[1];

            Assert.AreEqual("Csp2", atomtype1.AtomTypeName);

            forceFieldName = "mm2";
            forceFieldConfigurator.SetForceFieldConfigurator(forceFieldName);
            var mm2AtomTypes = forceFieldConfigurator.AtomTypes;

            Assert.IsNotNull(mm2AtomTypes);
            IAtomType atomtype2 = mm2AtomTypes[2];

            Assert.AreEqual("C=", atomtype2.AtomTypeName);
            IAtomType atomtype3 = mm2AtomTypes[3];

            Assert.AreEqual("Csp", atomtype3.AtomTypeName);
        }
Example #24
0
        public void TestNewAtomType_String_String()
        {
            IChemObjectBuilder builder = RootObject.Builder;
            IAtomType          type    = builder.NewAtomType("C", "C.sp2");

            Assert.IsNotNull(type);
        }
Example #25
0
        public void TestNewAtomType_IElement()
        {
            IChemObjectBuilder builder = RootObject.Builder;
            IAtomType          type    = builder.NewAtomType(ChemicalElement.C);

            Assert.IsNotNull(type);
        }
Example #26
0
        /// <summary>
        /// Method that assign properties to an atom given a particular atomType.
        /// An <see cref="ArgumentException"/> is thrown if the given <see cref="IAtomType"/>
        /// is null. <b>This method overwrites non-null values.</b>
        /// </summary>
        /// <param name="atom">Atom to configure</param>
        /// <param name="atomType">AtomType. Must not be null.</param>
        public static void Configure(IAtom atom, IAtomType atomType)
        {
            if (atomType == null)
            {
                throw new ArgumentNullException(nameof(atomType));
            }

            if (string.Equals("X", atomType.AtomTypeName, StringComparison.Ordinal))
            {
                atom.AtomTypeName = "X";
                return;
            }

            // we set the atom type name, but nothing else
            atom.AtomTypeName = atomType.AtomTypeName;

            // configuring atom type information is not really valid
            // for pseudo atoms - first because they basically have no
            // type information and second because they may have information
            // associated with them from another context, which should not be
            // overwritten. So we only do the stuff below if we have a non pseudoatom
            //
            // a side effect of this is that it is probably not valid to get the atom
            // type of a pseudo atom. I think this is OK, since you can always check
            // whether an atom is a pseudo atom without looking at its atom type
            if (!(atom is IPseudoAtom))
            {
                atom.Symbol                 = atomType.Symbol;
                atom.MaxBondOrder           = atomType.MaxBondOrder;
                atom.BondOrderSum           = atomType.BondOrderSum;
                atom.CovalentRadius         = atomType.CovalentRadius;
                atom.Valency                = atomType.Valency;
                atom.FormalCharge           = atomType.FormalCharge;
                atom.Hybridization          = atomType.Hybridization;
                atom.FormalNeighbourCount   = atomType.FormalNeighbourCount;
                atom.IsHydrogenBondAcceptor = atomType.IsHydrogenBondAcceptor;
                atom.IsHydrogenBondDonor    = atomType.IsHydrogenBondDonor;
                var constant = atomType.GetProperty <int?>(CDKPropertyName.ChemicalGroupConstant);
                if (constant != null)
                {
                    atom.SetProperty(CDKPropertyName.ChemicalGroupConstant, constant);
                }
                if (atomType.IsAromatic)
                {
                    atom.IsAromatic = atomType.IsAromatic;
                }

                object color = atomType.GetProperty <object>(CDKPropertyName.Color);
                if (color != null)
                {
                    atom.SetProperty(CDKPropertyName.Color, color);
                }
                atom.AtomicNumber = atomType.AtomicNumber;
                if (atomType.ExactMass != null)
                {
                    atom.ExactMass = atomType.ExactMass;
                }
            }
        }
Example #27
0
        public void AssertAtomType(IDictionary <string, int> testedAtomTypes, string error, string expectedID,
                                   IAtomType foundAtomType)
        {
            AddTestedAtomType(testedAtomTypes, expectedID);

            Assert.IsNotNull(foundAtomType, "No atom type was recognized, but expected: " + expectedID);
            Assert.AreEqual(expectedID, foundAtomType.AtomTypeName, error);
        }
Example #28
0
        // the Molecule tests

        private static ValidationReport ValidateBondOrderSum(IAtom atom, IAtomContainer molecule)
        {
            var report       = new ValidationReport();
            var checkBondSum = new ValidationTest(atom, "The atom's total bond order is too high.");

            try
            {
                var structgenATF = CDK.CdkAtomTypeFactory;
                int bos          = (int)molecule.GetBondOrderSum(atom);
                var atomTypes    = structgenATF.GetAtomTypes(atom.Symbol).ToReadOnlyList();
                if (atomTypes.Count == 0)
                {
                    checkBondSum.Details = $"Cannot validate bond order sum for atom not in valency atom type list: {atom.Symbol}";
                    report.Warnings.Add(checkBondSum);
                }
                else
                {
                    IAtomType failedOn = null;
                    bool      foundMatchingAtomType = false;
                    foreach (var type in atomTypes)
                    {
                        if (atom.FormalCharge == type.FormalCharge)
                        {
                            foundMatchingAtomType = true;
                            if (bos == type.BondOrderSum)
                            {
                                // skip this atom type
                            }
                            else
                            {
                                failedOn = type;
                            }
                        }
                    }
                    if (foundMatchingAtomType)
                    {
                        report.OKs.Add(checkBondSum);
                    }
                    else
                    {
                        if (failedOn != null)
                        {
                            checkBondSum.Details = $"Bond order exceeds the one allowed for atom {atom.Symbol} for which the total bond order is {failedOn.BondOrderSum}";
                        }
                        else
                        {
                        }
                        report.Errors.Add(checkBondSum);
                    }
                }
            }
            catch (Exception exception)
            {
                Trace.TraceError($"Error while performing atom bos validation: {exception.Message}");
                Debug.WriteLine(exception);
            }
            return(report);
        }
Example #29
0
        public virtual void TestGetAtomTypeFromPDB()
        {
            AtomTypeFactory factory  = AtomTypeFactory.GetInstance("NCDK.Config.Data.pdb_atomtypes.xml");
            IAtomType       atomType = factory.GetAtomType("ALA.CA");

            Assert.IsNotNull(atomType);
            Assert.AreEqual("C", atomType.Symbol);
            Assert.AreEqual("ALA.CA", atomType.AtomTypeName);
        }
Example #30
0
        public virtual void TestGetAtomTypeFromJmol()
        {
            AtomTypeFactory factory  = AtomTypeFactory.GetInstance("NCDK.Config.Data.jmol_atomtypes.txt");
            IAtomType       atomType = factory.GetAtomType("H");

            Assert.IsNotNull(atomType);
            Assert.AreEqual("H", atomType.Symbol);
            Assert.AreEqual("H", atomType.AtomTypeName);
        }
Example #31
0
        /// <summary> Calculate the number of missing hydrogens by substracting the number of
        /// bonds for the atom from the expected number of bonds. Charges are included
        /// in the calculation. The number of expected bonds is defined by the AtomType
        /// generated with the AtomTypeFactory.
        ///
        /// </summary>
        /// <param name="atom">     Description of the Parameter
        /// </param>
        /// <param name="throwExceptionForUnknowAtom"> Should an exception be thrown if an unknown atomtype is found or 0 returned ?
        /// </param>
        /// <returns>           Description of the Return Value
        /// </returns>
        /// <seealso cref="AtomTypeFactory">
        /// </seealso>
        public virtual int calculateNumberOfImplicitHydrogens(IAtom atom, double bondOrderSum, IBond[] connectedBonds, bool throwExceptionForUnknowAtom)
        {
            int missingHydrogen = 0;

            if (atom is IPseudoAtom)
            {
                // don't figure it out... it simply does not lack H's
            }
            else if (atom.AtomicNumber == 1 || atom.Symbol.Equals("H"))
            {
                //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                missingHydrogen = (int)(1 - bondOrderSum - atom.getFormalCharge());
            }
            else
            {
                //logger.info("Calculating number of missing hydrogen atoms");
                // get default atom
                IAtomType[] atomTypes = getAtomTypeFactory(atom.Builder).getAtomTypes(atom.Symbol);
                if (atomTypes.Length == 0 && throwExceptionForUnknowAtom)
                {
                    return(0);
                }
                //logger.debug("Found atomtypes: " + atomTypes.Length);
                if (atomTypes.Length > 0)
                {
                    IAtomType defaultAtom = atomTypes[0];
                    //logger.debug("DefAtom: ", defaultAtom);
                    //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                    missingHydrogen = (int)(defaultAtom.BondOrderSum - bondOrderSum + atom.getFormalCharge());
                    if (atom.getFlag(CDKConstants.ISAROMATIC))
                    {
                        bool subtractOne = true;
                        for (int i = 0; i < connectedBonds.Length; i++)
                        {
                            if (connectedBonds[i].Order == 2 || connectedBonds[i].Order == CDKConstants.BONDORDER_AROMATIC)
                            {
                                subtractOne = false;
                            }
                        }
                        if (subtractOne)
                        {
                            missingHydrogen--;
                        }
                    }
                    //logger.debug("Atom: ", atom.Symbol);
                    //logger.debug("  max bond order: " + defaultAtom.BondOrderSum);
                    //logger.debug("  bond order sum: " + bondOrderSum);
                    //logger.debug("  charge        : " + atom.getFormalCharge());
                }
                else
                {
                    //logger.warn("Could not find atom type for ", atom.Symbol);
                }
            }
            return(missingHydrogen);
        }
        public override void startElement(System.String uri, System.String local, System.String raw, SaxAttributesSupport atts)
        {
            currentChars = "";
            //logger.debug("START Element: ", raw);
            //logger.debug("  uri: ", uri);
            //logger.debug("  local: ", local);
            //logger.debug("  raw: ", raw);

            if ("atomType".Equals(local))
            {
                atomType = builder.newAtomType("R");
                for (int i = 0; i < atts.GetLength(); i++)
                {
                    if ("id".Equals(atts.GetFullName(i)))
                    {
                        atomType.AtomTypeName = atts.GetValue(i);
                    }
                }
            }
            else if ("atom".Equals(local))
            {
                for (int i = 0; i < atts.GetLength(); i++)
                {
                    if ("elementType".Equals(atts.GetFullName(i)))
                    {
                        atomType.Symbol = atts.GetValue(i);
                    }
                    else if ("formalCharge".Equals(atts.GetFullName(i)))
                    {
                        try
                        {
                            atomType.setFormalCharge(System.Int32.Parse(atts.GetValue(i)));
                        }
                        catch (System.FormatException exception)
                        {
                            //logger.error("Value of <atom> @", atts.GetFullName(i), " is not an integer: ", atts.GetValue(i));
                            //logger.debug(exception);
                        }
                    }
                }
            }
            else if ("scalar".Equals(local))
            {
                for (int i = 0; i < atts.GetLength(); i++)
                {
                    if ("dictRef".Equals(atts.GetFullName(i)))
                    {
                        if ("cdk:maxBondOrder".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_MAXBONDORDER;
                        }
                        else if ("cdk:bondOrderSum".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_BONDORDERSUM;
                        }
                        else if ("cdk:hybridization".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_HYBRIDIZATION;
                        }
                        else if ("cdk:formalNeighbourCount".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_FORMALNEIGHBOURCOUNT;
                        }
                        else if ("cdk:valency".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_VALENCY;
                        }
                        else if ("cdk:formalCharge".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_FORMALCHARGE;
                        }
                        else if ("cdk:DA".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_DA;
                        }
                        else if ("cdk:sphericalMatcher".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_SPHERICALMATCHER;
                        }
                        else if ("cdk:ringSize".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_RINGSIZE;
                        }
                        else if ("cdk:ringConstant".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_CHEMICALGROUPCONSTANT;
                        }
                        else if ("cdk:aromaticAtom".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_ISAROMATIC;
                        }
                        else if ("emboss:vdwrad".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_VANDERWAALSRADIUS;
                        }
                    }
                }
            }
        }
		/// <summary> Determines if the atom can be of type AtomType.</summary>
		public virtual bool couldMatchAtomType(IAtomContainer atomContainer, IAtom atom, IAtomType atomType)
		{
			//logger.debug("   ... matching atom ", atom.Symbol, " vs ", atomType);
			if (atomContainer.getBondOrderSum(atom) + atom.getHydrogenCount() < atomType.BondOrderSum)
			{
				//logger.debug("    Match!");
				return true;
			}
			//logger.debug("    No Match");
			return false;
		}
        // SAX Parser methods

        /* public void doctypeDecl(String name, String publicId, String systemId) {
        //logger.info("DocType root element: " + name);
        //logger.info("DocType root PUBLIC: " + publicId);
        //logger.info("DocType root SYSTEM: " + systemId);
        } */

        public override void startDocument()
        {
            atomTypes = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
            scalarType = SCALAR_UNSET;
            atomType = null;
        }
 /// <summary> Get an array of all atomTypes known to the AtomTypeFactory for the given
 /// element symbol and atomtype class.
 /// 
 /// </summary>
 /// <param name="symbol"> An element symbol to search for
 /// </param>
 /// <returns>         An array of atomtypes that matches the given element symbol
 /// and atomtype class
 /// </returns>
 public virtual IAtomType[] getAtomTypes(System.String symbol)
 {
     //logger.debug("Request for atomtype for symbol ", symbol);
     System.Collections.ArrayList atomList = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
     IAtomType atomType = null;
     for (int f = 0; f < this.atomTypes.Count; f++)
     {
         atomType = (IAtomType)this.atomTypes[f];
         // //logger.debug("  does symbol match for: ", atomType);
         if (atomType.Symbol.Equals(symbol))
         {
             // //logger.debug("Atom type found for symbol: ", atomType);
             IAtomType clone;
             try
             {
                 clone = (IAtomType)atomType.Clone();
                 atomList.Add(clone);
             }
             //UPGRADE_NOTE: Exception 'java.lang.CloneNotSupportedException' was converted to 'System.Exception' which has different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1100'"
             catch (System.Exception e)
             {
                 //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                 //logger.error("Could not clone IAtomType: ", e.Message);
                 //logger.debug(e);
             }
         }
     }
     IAtomType[] atomTypes = new IAtomType[atomList.Count];
     atomList.CopyTo(atomTypes);
     //if (atomTypes.Length > 0)
         //logger.debug("Atomtype for symbol ", symbol, " has this number of types: " + atomTypes.Length);
     //else
         //logger.debug("No atomtype for symbol ", symbol);
     return atomTypes;
 }
Example #36
0
		/// <summary> Determines if the atom can be of type AtomType.</summary>
		public virtual bool couldMatchAtomType(IAtom atom, double bondOrderSum, double maxBondOrder, IAtomType type)
		{
			//logger.debug("   ... matching atom ", atom.Symbol, " vs ", type);
			int hcount = atom.getHydrogenCount();
			int charge = atom.getFormalCharge();
			if (charge == type.getFormalCharge())
			{
				if (bondOrderSum + hcount <= type.BondOrderSum && maxBondOrder <= type.MaxBondOrder)
				{
					//logger.debug("    We have a match!");
					return true;
				}
			}
			//logger.debug("    No Match");
			return false;
		}
		/// <summary> Determines if the atom can be of type AtomType. That is, it sees if this
		/// AtomType only differs in bond orders, or implicit hydrogen count.
		/// </summary>
		public virtual bool couldMatchAtomType(IAtom atom, double bondOrderSum, double maxBondOrder, IAtomType type)
		{
			//logger.debug("couldMatchAtomType:   ... matching atom ", atom, " vs ", type);
			int hcount = atom.getHydrogenCount();
			int charge = atom.getFormalCharge();
			if (charge == type.getFormalCharge())
			{
				//logger.debug("couldMatchAtomType:     formal charge matches...");
				if (atom.Hybridization == type.Hybridization)
				{
					//logger.debug("couldMatchAtomType:     hybridization is OK...");
					if (bondOrderSum + hcount <= type.BondOrderSum)
					{
						//logger.debug("couldMatchAtomType:     bond order sum is OK...");
						if (maxBondOrder <= type.MaxBondOrder)
						{
							//logger.debug("couldMatchAtomType:     max bond order is OK... We have a match!");
							return true;
						}
					}
					else
					{
						//logger.debug("couldMatchAtomType:      no match", "" + (bondOrderSum + hcount), " > ", "" + type.BondOrderSum);
					}
				}
			}
			else
			{
				//logger.debug("couldMatchAtomType:     formal charge does NOT match...");
			}
			//logger.debug("couldMatchAtomType:    No Match");
			return false;
		}
		/// <summary> Determines if the atom can be of type AtomType.</summary>
		public virtual bool couldMatchAtomType(IAtomContainer container, IAtom atom, IAtomType type)
		{
			double bondOrderSum = container.getBondOrderSum(atom);
			double maxBondOrder = container.getMaximumBondOrder(atom);
			return couldMatchAtomType(atom, bondOrderSum, maxBondOrder, type);
		}