예제 #1
0
        public void TestGiveAngleFromMiddle_IAtom_IAtom_IAtom()
        {
            var filename = "NCDK.Data.MDL.testdoublebondconfig.mol";
            var ins      = ResourceLoader.GetAsStream(filename);
            var reader   = new MDLV2000Reader(ins);
            var chemFile = reader.Read(builder.NewChemFile());
            var mol      = chemFile[0][0].MoleculeSet[0];

            Assert.AreEqual(2.0943946986086157, BondTools.GiveAngleFromMiddle(mol.Atoms[0], mol.Atoms[2], mol.Atoms[3]), 0.2);
        }
예제 #2
0
        public void TestIsLeft_IAtom_IAtom_IAtom()
        {
            var filename = "NCDK.Data.MDL.testdoublebondconfig.mol";
            var ins      = ResourceLoader.GetAsStream(filename);
            var reader   = new MDLV2000Reader(ins);
            var chemFile = reader.Read(builder.NewChemFile());
            var mol      = chemFile[0][0].MoleculeSet[0];

            Assert.IsFalse(BondTools.IsLeft(mol.Atoms[1], mol.Atoms[0], mol.Atoms[2]));
        }
예제 #3
0
        public void TestBug2831420()
        {
            var filename = "NCDK.Data.MDL.bug2831420.mol";
            var ins      = ResourceLoader.GetAsStream(filename);
            var reader   = new MDLV2000Reader(ins);
            var chemFile = reader.Read(builder.NewChemFile());
            var mol      = chemFile[0][0].MoleculeSet[0];

            Assert.IsTrue(BondTools.IsStereo(mol, mol.Atoms[5]));
        }
예제 #4
0
        public void TestIsSquarePlanar_IAtomContainer_IAtom()
        {
            var filename = "NCDK.Data.MDL.squareplanar.mol";
            var ins      = ResourceLoader.GetAsStream(filename);
            var reader   = new MDLV2000Reader(ins);
            var chemFile = reader.Read(builder.NewChemFile());
            var mol      = chemFile[0][0].MoleculeSet[0];

            Assert.IsTrue(BondTools.IsSquarePlanar(mol, mol.Atoms[0]));
            Assert.IsFalse(BondTools.IsSquarePlanar(mol, mol.Atoms[1]));
        }
예제 #5
0
        public void TestMakeUpDownBonds_IAtomContainer()
        {
            var filename = "NCDK.Data.MDL.tetrahedral_2_lazy.mol";
            var ins      = ResourceLoader.GetAsStream(filename);
            var reader   = new MDLV2000Reader(ins);
            var chemFile = reader.Read(builder.NewChemFile());
            var mol      = chemFile[0][0].MoleculeSet[0];

            BondTools.MakeUpDownBonds(mol);
            Assert.AreEqual(BondStereo.Down, mol.Bonds[3].Stereo);
        }
예제 #6
0
        public void TestIsTrigonalBipyramidalOrOctahedral_IAtomContainer_IAtom()
        {
            var filename = "NCDK.Data.MDL.trigonal_bipyramidal.mol";
            var ins      = ResourceLoader.GetAsStream(filename);
            var reader   = new MDLV2000Reader(ins);
            var chemFile = reader.Read(builder.NewChemFile());
            var mol      = chemFile[0][0].MoleculeSet[0];

            Assert.AreEqual(BondTools.IsTrigonalBipyramidalOrOctahedral(mol, mol.Atoms[0]), 1);
            Assert.AreEqual(BondTools.IsTrigonalBipyramidalOrOctahedral(mol, mol.Atoms[1]), 0);
        }
예제 #7
0
        public void TestGiveAngleBothMethods_Point2d_Point2d_Point2d_bool()
        {
            var filename = "NCDK.Data.MDL.testdoublebondconfig.mol";
            var ins      = ResourceLoader.GetAsStream(filename);
            var reader   = new MDLV2000Reader(ins);
            var chemFile = reader.Read(builder.NewChemFile());
            var mol      = chemFile[0][0].MoleculeSet[0];

            Assert.AreEqual(2.0943946986086157, BondTools.GiveAngleBothMethods(mol.Atoms[0].Point2D.Value, mol
                                                                               .Atoms[2].Point2D.Value, mol.Atoms[3].Point2D.Value, true), 0.2);
            Assert.AreEqual(2.0943946986086157, BondTools.GiveAngleBothMethods(mol.Atoms[0].Point2D.Value, mol
                                                                               .Atoms[2].Point2D.Value, mol.Atoms[3].Point2D.Value, false), 0.2);
        }
예제 #8
0
        public void TestIsStereo_IAtomContainer_IAtom_forinvalid()
        {
            var filename = "NCDK.Data.MDL.trigonal_bipyramidal.mol";
            var ins      = ResourceLoader.GetAsStream(filename);
            var reader   = new MDLV2000Reader(ins);
            var chemFile = reader.Read(builder.NewChemFile());
            var mol      = chemFile[0][0].MoleculeSet[0];

            for (int i = 1; i < 6; i++)
            {
                mol.Atoms[i].Symbol = "C";
            }
            Assert.IsFalse(BondTools.IsStereo(mol, mol.Atoms[0]));
            Assert.IsFalse(BondTools.IsStereo(mol, mol.Atoms[1]));
        }
예제 #9
0
        public void TestCloseEnoughToBond_IAtom_IAtom_Double()
        {
            var filename = "NCDK.Data.XYZ.viagra.xyz";
            var ins      = ResourceLoader.GetAsStream(filename);
            var reader   = new XYZReader(ins);
            var atf      = AtomTypeFactory.GetInstance("NCDK.Config.Data.jmol_atomtypes.txt");
            var chemFile = reader.Read(builder.NewChemFile());
            var mol      = chemFile[0][0].MoleculeSet[0];

            foreach (var atom in mol.Atoms)
            {
                atf.Configure(atom);
            }
            Assert.IsTrue(BondTools.CloseEnoughToBond(mol.Atoms[0], mol.Atoms[1], 1));
            Assert.IsFalse(BondTools.CloseEnoughToBond(mol.Atoms[0], mol.Atoms[8], 1));
        }
예제 #10
0
        public void TestStereosAreOpposite_IAtomContainer_IAtom()
        {
            var filename = "NCDK.Data.MDL.squareplanar.mol";
            var ins      = ResourceLoader.GetAsStream(filename);
            var reader   = new MDLV2000Reader(ins);
            var chemFile = reader.Read(builder.NewChemFile());
            var mol      = chemFile[0][0].MoleculeSet[0];

            Assert.IsFalse(BondTools.StereosAreOpposite(mol, mol.Atoms[0]));
            filename = "NCDK.Data.MDL.tetrahedral_with_four_wedges.mol";
            ins      = ResourceLoader.GetAsStream(filename);
            reader   = new MDLV2000Reader(ins);
            chemFile = reader.Read(builder.NewChemFile());
            mol      = chemFile[0][0].MoleculeSet[0];
            Assert.IsTrue(BondTools.StereosAreOpposite(mol, mol.Atoms[0]));
        }
예제 #11
0
        public void TestIsValidDoubleBondConfiguration_IAtomContainer_IBond()
        {
            var filename = "NCDK.Data.MDL.testdoublebondconfig.mol";
            var ins      = ResourceLoader.GetAsStream(filename);
            var reader   = new MDLV2000Reader(ins);
            var chemFile = reader.Read(builder.NewChemFile());
            var mol      = chemFile[0][0].MoleculeSet[0];

            Assert.IsTrue(BondTools.IsValidDoubleBondConfiguration(mol, mol.Bonds[0]));
            Assert.IsFalse(BondTools.IsValidDoubleBondConfiguration(mol, mol.Bonds[1]));
            Assert.IsFalse(BondTools.IsValidDoubleBondConfiguration(mol, mol.Bonds[2]));
            Assert.IsFalse(BondTools.IsValidDoubleBondConfiguration(mol, mol.Bonds[3]));
            Assert.IsFalse(BondTools.IsValidDoubleBondConfiguration(mol, mol.Bonds[4]));
            Assert.IsFalse(BondTools.IsValidDoubleBondConfiguration(mol, mol.Bonds[5]));
            Assert.IsFalse(BondTools.IsValidDoubleBondConfiguration(mol, mol.Bonds[6]));
            Assert.IsFalse(BondTools.IsValidDoubleBondConfiguration(mol, mol.Bonds[7]));
        }
예제 #12
0
        public void TestIsTetrahedral_IAtomContainer_IAtom_bool()
        {
            var filename = "NCDK.Data.MDL.tetrahedral_1.mol";
            var ins      = ResourceLoader.GetAsStream(filename);
            var reader   = new MDLV2000Reader(ins);
            var chemFile = reader.Read(builder.NewChemFile());
            var mol      = chemFile[0][0].MoleculeSet[0];

            Assert.AreEqual(BondTools.IsTetrahedral(mol, mol.Atoms[0], true), 1);
            Assert.AreEqual(BondTools.IsTetrahedral(mol, mol.Atoms[1], true), 0);
            filename = "NCDK.Data.MDL.tetrahedral_1_lazy.mol";
            ins      = ResourceLoader.GetAsStream(filename);
            reader   = new MDLV2000Reader(ins);
            chemFile = reader.Read(builder.NewChemFile());
            mol      = chemFile[0][0].MoleculeSet[0];
            Assert.AreEqual(BondTools.IsTetrahedral(mol, mol.Atoms[0], true), 0);
            Assert.AreEqual(BondTools.IsTetrahedral(mol, mol.Atoms[0], false), 3);
        }