Exemplo n.º 1
0
        public void TestGetBondLengthValue_String_String()
        {
            var parser   = CDK.SmilesParser;
            var smiles   = "CCCCCC";
            var molecule = parser.ParseSmiles(smiles);

            Assert.IsNotNull(molecule);
            ForceFieldConfigurator ffc = new ForceFieldConfigurator();

            ffc.SetForceFieldConfigurator("mmff94");
            AtomPlacer3D atomPlacer3d = new AtomPlacer3D(ffc.GetParameterSet());

            ffc.AssignAtomTyps(molecule);

            string id1       = molecule.Atoms[1].AtomTypeName;
            string id2       = molecule.Atoms[2].AtomTypeName;
            string mmff94id1 = "C";
            string mmff94id2 = "C";

            Assert.AreNotSame(mmff94id1, id1);
            Assert.AreNotSame(mmff94id2, id2);

            double bondlength = atomPlacer3d.GetBondLengthValue(id1, id2);

            Assert.AreEqual(1.508, bondlength, 0.001);
        }
        public void TestRemoveAromaticityFlagsFromHoseCode_String()
        {
            string hosecode1     = "***HO*SE*CODE***";
            string cleanHoseCode = ForceFieldConfigurator.RemoveAromaticityFlagsFromHoseCode(hosecode1);

            Assert.AreEqual("HOSECODE", cleanHoseCode);
            string hosecode2 = "HOSECODE";

            cleanHoseCode = ForceFieldConfigurator.RemoveAromaticityFlagsFromHoseCode(hosecode2);
            Assert.AreEqual("HOSECODE", cleanHoseCode);
        }
        public void TestConfigureMMFF94BasedAtom_IAtom_String_boolean_propanamide()
        {
            string pasmi  = "NC(=O)CC";
            var    parser = CDK.SmilesParser;
            var    pa     = parser.ParseSmiles(pasmi);
            ForceFieldConfigurator ffc = new ForceFieldConfigurator();

            ffc.SetForceFieldConfigurator("mmff94");
            IAtom amideN = pa.Atoms[0];

            ffc.ConfigureMMFF94BasedAtom(amideN, new HOSECodeGenerator().GetHOSECode(pa, amideN, 3), false);
            Assert.AreEqual("NC=O", amideN.AtomTypeName);
        }
        public void TestConfigureMMFF94BasedAtom_IAtom_String_boolean_urea()
        {
            string usmi   = "NC(N)=O";
            var    parser = CDK.SmilesParser;
            var    urea   = parser.ParseSmiles(usmi);
            ForceFieldConfigurator ffc = new ForceFieldConfigurator();

            ffc.SetForceFieldConfigurator("mmff94");
            IAtom amideN = urea.Atoms[0];

            ffc.ConfigureMMFF94BasedAtom(amideN, new HOSECodeGenerator().GetHOSECode(urea, amideN, 3), false);
            //        Console.Error.WriteLine(amideN.AtomTypeName);
            Assert.AreEqual("NC=O", amideN.AtomTypeName);
        }
Exemplo n.º 5
0
        public void InvalidChain()
        {
            string input = "CCCCCC(CCCC)CCCC";
            var    sp    = CDK.SmilesParser;
            var    m     = sp.ParseSmiles(input);

            ForceFieldConfigurator ffc = new ForceFieldConfigurator();

            ffc.SetForceFieldConfigurator("mmff92");
            ffc.AssignAtomTyps(m);

            AtomPlacer3D ap3d = new AtomPlacer3D(ffc.GetParameterSet());

            ap3d.PlaceAliphaticHeavyChain(m, m);
        }
        [TestMethod(), Ignore()] // Old atom typing method - see new Mmff class
        public void TestConfigureMMFF94BasedAtom_IAtom_String_boolean_hydroxyurea()
        {
            string husmi  = "NC(=O)NO";
            var    parser = CDK.SmilesParser;
            var    hu     = parser.ParseSmiles(husmi);
            ForceFieldConfigurator ffc = new ForceFieldConfigurator();

            ffc.SetForceFieldConfigurator("mmff94");
            IAtom N1 = hu.Atoms[0];
            IAtom N2 = hu.Atoms[3];

            ffc.ConfigureAtom(N1, new HOSECodeGenerator().GetHOSECode(hu, N1, 3), false);
            ffc.ConfigureAtom(N2, new HOSECodeGenerator().GetHOSECode(hu, N2, 3), false);
            Assert.AreEqual("NC=O", N1.AtomTypeName);
            Assert.AreEqual("N2OX", N2.AtomTypeName);
        }
Exemplo n.º 7
0
        public void TestMapTemplates_IAtomContainer_Double()
        {
            var ac   = TestMoleculeFactory.MakeBicycloRings();
            var th3d = TemplateHandler3D.Instance;
            var ffc  = new ForceFieldConfigurator();

            ffc.SetForceFieldConfigurator("mm2");
            var ringSetMolecule         = ffc.AssignAtomTyps(ac);
            var ringSystems             = RingPartitioner.PartitionRings(ringSetMolecule);
            var largestRingSet          = RingSetManipulator.GetLargestRingSet(ringSystems);
            var largestRingSetContainer = RingSetManipulator.GetAllInOneContainer(largestRingSet);

            th3d.MapTemplates(largestRingSetContainer, largestRingSetContainer.Atoms.Count);
            for (int i = 0; i < ac.Atoms.Count; i++)
            {
                Assert.IsNotNull(ac.Atoms[i].Point3D);
            }
            ModelBuilder3DTest.CheckAverageBondLength(ac);
        }
        public void TestMapTemplatesCyclicMol2()
        {
            TemplateHandler3D  tmphandler3d = TemplateHandler3D.Instance;
            string             cyclicMolSmi = "CC(C)(C)NC(=O)C1CN(CCN1CC(CC(Cc1ccccc1)C(=O)NC1c2ccccc2CC1O)O)Cc1cccnc1";
            IChemObjectBuilder builder      = ChemObjectBuilder.Instance;
            SmilesParser       smiparser    = new SmilesParser(builder);
            var molecule = smiparser.ParseSmiles(cyclicMolSmi);
            ForceFieldConfigurator forcefconf = new ForceFieldConfigurator();

            forcefconf.SetForceFieldConfigurator("mmff94");
            IRingSet       rings                  = forcefconf.AssignAtomTyps(molecule);
            var            ringSystems            = RingPartitioner.PartitionRings(rings);
            IRingSet       largestRingSet         = RingSetManipulator.GetLargestRingSet(ringSystems);
            IAtomContainer allAtomsInOneContainer = RingSetManipulator.GetAllInOneContainer(largestRingSet);

            tmphandler3d.MapTemplates(allAtomsInOneContainer, allAtomsInOneContainer.Atoms.Count);
            for (int j = 0; j < allAtomsInOneContainer.Atoms.Count; j++)
            {
                Assert.IsNotNull(allAtomsInOneContainer.Atoms[j].Point3D);
            }
        }
Exemplo n.º 9
0
        public void TestGetAngleValue_String_String_String()
        {
            var parser   = CDK.SmilesParser;
            var smiles   = "CCCCCC";
            var molecule = parser.ParseSmiles(smiles);

            Assert.IsNotNull(molecule);
            ForceFieldConfigurator ffc = new ForceFieldConfigurator();

            ffc.SetForceFieldConfigurator("mmff94");
            AtomPlacer3D atomPlacer3d = new AtomPlacer3D(ffc.GetParameterSet());

            ffc.AssignAtomTyps(molecule);

            string id1 = molecule.Atoms[1].AtomTypeName;
            string id2 = molecule.Atoms[2].AtomTypeName;
            string id3 = molecule.Atoms[3].AtomTypeName;

            double anglev = atomPlacer3d.GetAngleValue(id1, id2, id3);

            Assert.AreEqual(109.608, anglev, 0.001);
        }