public void TestAdd3DCoordinatesForSinglyBondedLigands_IAtomContainer()
        {
            IAtom atom1 = new Atom("C")
            {
                Point3D = new Vector3(1, 1, 1)
            };
            IAtom          atom2 = new Atom("H");
            IAtom          atom3 = new Atom("H");
            IAtom          atom4 = new Atom("H");
            IAtom          atom5 = new Atom("H");
            IBond          bond1 = new Bond(atom1, atom2);
            IBond          bond2 = new Bond(atom1, atom3);
            IBond          bond3 = new Bond(atom1, atom4);
            IBond          bond4 = new Bond(atom1, atom5);
            IAtomContainer ac    = atom1.Builder.NewAtomContainer();

            atom1.FormalNeighbourCount = 4;
            atom2.FormalNeighbourCount = 1;
            atom3.FormalNeighbourCount = 1;
            atom4.FormalNeighbourCount = 1;
            atom5.FormalNeighbourCount = 1;
            ac.Atoms.Add(atom1);
            ac.Atoms.Add(atom2);
            ac.Atoms.Add(atom3);
            ac.Atoms.Add(atom4);
            ac.Atoms.Add(atom5);
            ac.Bonds.Add(bond1);
            ac.Bonds.Add(bond2);
            ac.Bonds.Add(bond3);
            ac.Bonds.Add(bond4);
            new AtomTetrahedralLigandPlacer3D().Add3DCoordinatesForSinglyBondedLigands(ac);
            ModelBuilder3DTest.CheckAverageBondLength(ac);
        }
        public void TestGet3DCoordinatesForLigands_IAtom_IAtomContainer_IAtomContainer_IAtom_int_Double_double()
        {
            IAtom atom1 = new Atom("C")
            {
                Point3D = new Vector3(1, 1, 1)
            };
            IAtom          atom2 = new Atom("H");
            IAtom          atom3 = new Atom("H");
            IAtom          atom4 = new Atom("H");
            IAtom          atom5 = new Atom("H");
            IBond          bond1 = new Bond(atom1, atom2);
            IBond          bond2 = new Bond(atom1, atom3);
            IBond          bond3 = new Bond(atom1, atom4);
            IBond          bond4 = new Bond(atom1, atom5);
            IAtomContainer ac    = atom1.Builder.NewAtomContainer();

            ac.Atoms.Add(atom1);
            ac.Atoms.Add(atom2);
            ac.Atoms.Add(atom3);
            ac.Atoms.Add(atom4);
            ac.Atoms.Add(atom5);
            atom1.FormalNeighbourCount = 4;
            atom2.FormalNeighbourCount = 1;
            atom3.FormalNeighbourCount = 1;
            atom4.FormalNeighbourCount = 1;
            atom5.FormalNeighbourCount = 1;
            ac.Bonds.Add(bond1);
            ac.Bonds.Add(bond2);
            ac.Bonds.Add(bond3);
            ac.Bonds.Add(bond4);
            IAtomContainer noCoords   = AtomTetrahedralLigandPlacer3D.GetUnsetAtomsInAtomContainer(atom1, ac);
            IAtomContainer withCoords = AtomTetrahedralLigandPlacer3D.GetPlacedAtomsInAtomContainer(atom1, ac);
            var            placer     = new AtomTetrahedralLigandPlacer3D();

            Vector3[] newPoints = placer.Get3DCoordinatesForLigands(atom1, noCoords, withCoords, null, 4, placer.DefaultBondLengthH, -1);
            for (int j = 0; j < noCoords.Atoms.Count; j++)
            {
                if (newPoints[j] == null)
                {
                    Assert.Fail("No coordinates generated for atom " + j);
                }
                IAtom ligand = noCoords.Atoms[j];
                ligand.Point3D = newPoints[j];
            }
            ModelBuilder3DTest.CheckAverageBondLength(ac);
        }
Esempio n. 3
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);
        }