Ejemplo n.º 1
0
        public void Sodium_implicit()
        {
            IAtomContainer container = new AtomContainer();
            IAtom          atom      = new Atom("Na");

            container.Atoms.Add(atom);
            MDLValence.Apply(container);
            Assert.AreEqual(1, atom.Valency);
            Assert.AreEqual(1, atom.ImplicitHydrogenCount);
        }
Ejemplo n.º 2
0
        public void Carbon_neutral()
        {
            IAtomContainer container = new AtomContainer();
            IAtom          atom      = new Atom("C");

            container.Atoms.Add(atom);
            MDLValence.Apply(container);
            Assert.AreEqual(4, atom.Valency);
            Assert.AreEqual(4, atom.ImplicitHydrogenCount);
        }
Ejemplo n.º 3
0
        public void Tin_ii()
        {
            IAtomContainer container = new AtomContainer();
            IAtom          atom      = new Atom("Sn");

            atom.Valency = 2;
            container.Atoms.Add(atom);
            MDLValence.Apply(container);
            Assert.AreEqual(2, atom.Valency);
            Assert.AreEqual(2, atom.ImplicitHydrogenCount);
        }
Ejemplo n.º 4
0
        public void Carbon_anion()
        {
            IAtomContainer container = new AtomContainer();
            IAtom          atom      = new Atom("C");

            atom.FormalCharge = +1;
            container.Atoms.Add(atom);
            MDLValence.Apply(container);
            Assert.AreEqual(3, atom.Valency);
            Assert.AreEqual(3, atom.ImplicitHydrogenCount);
        }
Ejemplo n.º 5
0
        public void Tin_iv()
        {
            IAtomContainer container = new AtomContainer();
            IAtom          atom      = new Atom("Sn");

            atom.Valency = 4;
            IAtom hydrogen = new Atom("H");

            container.Atoms.Add(atom);
            container.Atoms.Add(hydrogen);
            container.AddBond(container.Atoms[0], container.Atoms[1], BondOrder.Single);
            MDLValence.Apply(container);
            Assert.AreEqual(4, atom.Valency);
            Assert.AreEqual(3, atom.ImplicitHydrogenCount); // 4 - explicit H
        }
Ejemplo n.º 6
0
        public void Bismuth()
        {
            IAtomContainer container = new AtomContainer();
            IAtom          bi1       = new Atom("Bi");
            IAtom          h2        = new Atom("H");

            bi1.FormalCharge = +2;
            container.Atoms.Add(bi1);
            container.Atoms.Add(h2);
            container.AddBond(container.Atoms[0], container.Atoms[1], BondOrder.Single);
            MDLValence.Apply(container);
            Assert.AreEqual(3, bi1.Valency);
            Assert.AreEqual(1, h2.Valency);
            Assert.AreEqual(2, bi1.ImplicitHydrogenCount);
            Assert.AreEqual(0, h2.ImplicitHydrogenCount);
        }
Ejemplo n.º 7
0
        public void Carbon_cation_DoubleBonded()
        {
            IAtomContainer container = new AtomContainer();
            IAtom          c1        = new Atom("C");
            IAtom          c2        = new Atom("C");

            c1.FormalCharge = -1;
            container.Atoms.Add(c1);
            container.Atoms.Add(c2);
            container.AddBond(container.Atoms[0], container.Atoms[1], BondOrder.Double);
            MDLValence.Apply(container);
            Assert.AreEqual(3, c1.Valency);
            Assert.AreEqual(1, c1.ImplicitHydrogenCount);
            Assert.AreEqual(4, c2.Valency);
            Assert.AreEqual(2, c2.ImplicitHydrogenCount);
        }