Example #1
0
        public void Mr3()
        {
            var c0 = new AtomNode("C");
            var c1 = new AtomNode("C");
            var c2 = new AtomNode("C");
            var n  = new AtomNode("N");

            var mole = new Molecule(c0);

            mole.AddBondToLast(BondOrder.Single, c1);
            mole.AddBondToLast(BondOrder.Single, c2);
            mole.AddBondToLast(BondOrder.Triple, n);

            var mass = float.Parse(mole.GetMolecularMass());

            Assert.AreEqual(55, mass);
        }
Example #2
0
        public void Formula3()
        {
            var c0 = new AtomNode("C");
            var c1 = new AtomNode("C");
            var c2 = new AtomNode("C");
            var n  = new AtomNode("N");

            var mole = new Molecule(c0);

            mole.AddBondToLast(BondOrder.Single, c1);
            mole.AddBondToLast(BondOrder.Single, c2);
            mole.AddBondToLast(BondOrder.Triple, n);

            var formula = mole.GetMolecularFormula();

            Assert.AreEqual("C3H5N", formula);
        }
Example #3
0
        public void Smiles3()
        {
            var c0 = new AtomNode("C");
            var c1 = new AtomNode("C");
            var c2 = new AtomNode("C");
            var n  = new AtomNode("N");

            var mole = new Molecule(c0);

            mole.AddBondToLast(BondOrder.Single, c1);
            mole.AddBondToLast(BondOrder.Single, c2);
            mole.AddBondToLast(BondOrder.Triple, n);

            var smiles = mole.ToSMILES();

            Assert.AreEqual("CCC#N", smiles);
        }
Example #4
0
        public void Mr2()
        {
            var c0 = new AtomNode("C");
            var c1 = new AtomNode("C");
            var c2 = new AtomNode("C");
            var c3 = new AtomNode("C");
            var o  = new AtomNode("O");

            var mole = new Molecule(c0);

            mole.AddBondToLast(BondOrder.Single, c1);
            mole.AddBond(BondOrder.Single, c1, c2);
            mole.AddBond(BondOrder.Single, c2, c3);
            mole.AddBondToLast(BondOrder.Double, o);

            var mass = float.Parse(mole.GetMolecularMass());

            Assert.AreEqual(72, mass);
        }
Example #5
0
        public void Formula2()
        {
            var c0 = new AtomNode("C");
            var c1 = new AtomNode("C");
            var c2 = new AtomNode("C");
            var c3 = new AtomNode("C");
            var o  = new AtomNode("O");

            var mole = new Molecule(c0);

            mole.AddBondToLast(BondOrder.Single, c1);
            mole.AddBond(BondOrder.Single, c1, c2);
            mole.AddBond(BondOrder.Single, c2, c3);
            mole.AddBondToLast(BondOrder.Double, o);

            var formula = mole.GetMolecularFormula();

            Assert.AreEqual("C4H8O", formula);
        }
Example #6
0
        public void Smiles2()
        {
            var c0 = new AtomNode("C");
            var c1 = new AtomNode("C");
            var c2 = new AtomNode("C");
            var c3 = new AtomNode("C");
            var o  = new AtomNode("O");

            var mole = new Molecule(c0);

            mole.AddBondToLast(BondOrder.Single, c1);
            mole.AddBond(BondOrder.Single, c1, c2);
            mole.AddBond(BondOrder.Single, c2, c3);
            mole.AddBondToLast(BondOrder.Double, o);

            var smiles = mole.ToSMILES();

            Assert.AreEqual("CCCC=O", smiles);
        }
Example #7
0
        public void Mr5()
        {
            var c0 = new AtomNode("C");
            var p  = new AtomNode("P");
            var h  = new AtomNode("H");
            var n  = new AtomNode("N");
            var o  = new AtomNode("O");
            var cl = new AtomNode("Cl");
            var o2 = new AtomNode("O");

            var mole = new Molecule(c0);

            mole.AddBondToLast(BondOrder.Single, p);
            mole.AddBondToLast(BondOrder.Single, cl);
            mole.AddBond(BondOrder.Single, c0, h);
            mole.AddBond(BondOrder.Single, p, n);
            mole.AddBondToLast(BondOrder.Double, o);
            mole.AddBond(BondOrder.Single, n, o2);

            var mass = float.Parse(mole.GetMolecularMass());

            Assert.AreEqual(128.5, mass);
        }
Example #8
0
        public void Formula5()
        {
            var c0 = new AtomNode("C");
            var p  = new AtomNode("P");
            var h  = new AtomNode("H");
            var n  = new AtomNode("N");
            var o  = new AtomNode("O");
            var cl = new AtomNode("Cl");
            var o2 = new AtomNode("O");

            var mole = new Molecule(c0);

            mole.AddBondToLast(BondOrder.Single, p);
            mole.AddBondToLast(BondOrder.Single, cl);
            mole.AddBond(BondOrder.Single, c0, h);
            mole.AddBond(BondOrder.Single, p, n);
            mole.AddBondToLast(BondOrder.Double, o);
            mole.AddBond(BondOrder.Single, n, o2);

            var formula = mole.GetMolecularFormula();

            Assert.AreEqual("CH4PClNO2", formula);
        }
Example #9
0
        public void Smiles5()
        {
            var c0 = new AtomNode("C");
            var p  = new AtomNode("P");
            var h  = new AtomNode("H");
            var n  = new AtomNode("N");
            var o  = new AtomNode("O");
            var cl = new AtomNode("Cl");
            var o2 = new AtomNode("O");

            var mole = new Molecule(c0);

            mole.AddBondToLast(BondOrder.Single, p);
            mole.AddBondToLast(BondOrder.Single, cl);
            mole.AddBond(BondOrder.Single, c0, h);
            mole.AddBond(BondOrder.Single, p, n);
            mole.AddBondToLast(BondOrder.Double, o);
            mole.AddBond(BondOrder.Single, n, o2);

            var smiles = mole.ToSMILES();

            Assert.AreEqual("CP(Cl)(N(=O)(O))", smiles);
        }
Example #10
0
        public void Mr1()
        {
            var c0 = new AtomNode("C");
            var c1 = new AtomNode("C");
            var c2 = new AtomNode("C");
            var c3 = new AtomNode("C");
            var c4 = new AtomNode("C");
            var c5 = new AtomNode("C");
            var h  = new AtomNode("H");

            var mole = new Molecule(c0);

            mole.AddBondToLast(BondOrder.Single, c1);
            mole.AddBond(BondOrder.Single, c1, c2);
            mole.AddBond(BondOrder.Single, c2, c3);
            mole.AddBondToLast(BondOrder.Single, c4);
            mole.AddBondToLast(BondOrder.Single, c5);
            mole.AddBondToLast(BondOrder.Single, c0);
            mole.AddBondToLast(BondOrder.Single, h);

            var mass = float.Parse(mole.GetMolecularMass());

            Assert.AreEqual(84, mass);
        }
Example #11
0
        public void Formula1()
        {
            var c0 = new AtomNode("C");
            var c1 = new AtomNode("C");
            var c2 = new AtomNode("C");
            var c3 = new AtomNode("C");
            var c4 = new AtomNode("C");
            var c5 = new AtomNode("C");
            var h  = new AtomNode("H");

            var mole = new Molecule(c0);

            mole.AddBondToLast(BondOrder.Single, c1);
            mole.AddBond(BondOrder.Single, c1, c2);
            mole.AddBond(BondOrder.Single, c2, c3);
            mole.AddBondToLast(BondOrder.Single, c4);
            mole.AddBondToLast(BondOrder.Single, c5);
            mole.AddBondToLast(BondOrder.Single, c0);
            mole.AddBondToLast(BondOrder.Single, h);

            var formula = mole.GetMolecularFormula();

            Assert.AreEqual("C6H12", formula);
        }
Example #12
0
        public void Smiles1()
        {
            var c0 = new AtomNode("C");
            var c1 = new AtomNode("C");
            var c2 = new AtomNode("C");
            var c3 = new AtomNode("C");
            var c4 = new AtomNode("C");
            var c5 = new AtomNode("C");
            var h  = new AtomNode("H");

            var mole = new Molecule(c0);

            mole.AddBondToLast(BondOrder.Single, c1);
            mole.AddBond(BondOrder.Single, c1, c2);
            mole.AddBond(BondOrder.Single, c2, c3);
            mole.AddBondToLast(BondOrder.Single, c4);
            mole.AddBondToLast(BondOrder.Single, c5);
            mole.AddBondToLast(BondOrder.Single, c0);
            mole.AddBondToLast(BondOrder.Single, h);

            var smiles = mole.ToSMILES();

            Assert.AreEqual("C1CCCCC1", smiles);
        }
Example #13
0
        public void Mr4()
        {
            var c0 = new AtomNode("C");

            var mole = new Molecule(c0);

            for (int i = 0; i < 99; i++)
            {
                var c = new AtomNode("C");
                mole.AddBondToLast(BondOrder.Single, c);
            }

            var mass = float.Parse(mole.GetMolecularMass());

            Assert.AreEqual(1402, mass);
        }
Example #14
0
        public void Formula4()
        {
            var c0 = new AtomNode("C");

            var mole = new Molecule(c0);

            for (int i = 0; i < 99; i++)
            {
                var c = new AtomNode("C");
                mole.AddBondToLast(BondOrder.Single, c);
            }

            var formula = mole.GetMolecularFormula();

            Assert.AreEqual("C100H202", formula);
        }
Example #15
0
        public void Smiles4()
        {
            var c0 = new AtomNode("C");

            var mole = new Molecule(c0);

            var s = "C";

            for (int i = 0; i < 20; i++)
            {
                var c = new AtomNode("C");
                mole.AddBondToLast(BondOrder.Single, c);
                s += "C";
            }

            var smiles = mole.ToSMILES();

            Assert.AreEqual(s, smiles);
        }