Пример #1
0
        public void TestNewRingSet()
        {
            IChemObjectBuilder builder = RootObject.Builder;
            IRingSet           set     = builder.NewRingSet();

            Assert.IsNotNull(set);
        }
Пример #2
0
        public void TestRingAlreadyInSet_IRing_IRingSet()
        {
            IRing r1 = builder.NewRing(5, "C");
            IRing r2 = builder.NewRing(3, "C");

            IRingSet rs = builder.NewRingSet();

            Assert.IsFalse(RingSetManipulator.RingAlreadyInSet(r1, rs));
            Assert.IsFalse(RingSetManipulator.RingAlreadyInSet(r2, rs));

            rs.Add(r1);
            Assert.IsTrue(RingSetManipulator.RingAlreadyInSet(r1, rs));
            Assert.IsFalse(RingSetManipulator.RingAlreadyInSet(r2, rs));

            rs.Add(r2);
            Assert.IsTrue(RingSetManipulator.RingAlreadyInSet(r1, rs));
            Assert.IsTrue(RingSetManipulator.RingAlreadyInSet(r2, rs));
        }
Пример #3
0
        public void TestIsEmpty_RingSet()
        {
            var model = (IChemModel)NewChemObject();
            IChemObjectBuilder builder = model.Builder;

            IRing container = builder.NewRing();    // NCDK does not allow to add Ring to RingSet
            IRingSet ringset = builder.NewRingSet();

            Assert.IsTrue(model.IsEmpty());
            model.RingSet = ringset;
            Assert.IsTrue(model.IsEmpty());
            ringset.Add(container);
            Assert.IsFalse(model.IsEmpty());
            model.RingSet = null;
            Assert.IsTrue(model.IsEmpty());
        }
Пример #4
0
        public void TestGet2DCenterIRingSet()
        {
            var atom1 = builder.NewAtom("C");

            atom1.Point2D = new Vector2(1, 1);
            var atom2 = builder.NewAtom("C");

            atom2.Point2D = new Vector2(1, 0);
            var ac = builder.NewRing();

            ac.Atoms.Add(atom1);
            ac.Atoms.Add(atom2);
            var ringset = builder.NewRingSet();

            ringset.Add(ac);
            var p = GeometryUtil.Get2DCenter(ac);

            Assert.AreEqual(p.X, 1.0, .1);
            Assert.AreEqual(p.Y, 0.5, .1);
        }
Пример #5
0
        public void SetUp()
        {
            builder    = ChemObjectBuilder.Instance;
            ringset    = builder.NewRingSet();
            ring1Atom1 = builder.NewAtom("C"); // rather artificial molecule
            IAtom ring1Atom2 = builder.NewAtom("C");

            ring1Atom3 = builder.NewAtom("C");
            IAtom ring2Atom1 = builder.NewAtom("C");
            IAtom ring2Atom2 = builder.NewAtom("C");

            ring2Atom3 = builder.NewAtom("C");
            IAtom ring3Atom3 = builder.NewAtom("C");
            IAtom ring3Atom4 = builder.NewAtom("C");

            IAtom ring4Atom1 = builder.NewAtom("C");
            IAtom ring4Atom2 = builder.NewAtom("C");

            IBond ring1Bond1 = builder.NewBond(ring1Atom1, ring1Atom2);
            IBond ring1Bond2 = builder.NewBond(ring1Atom2, ring1Atom3);
            IBond ring1Bond3 = builder.NewBond(ring1Atom3, ring1Atom1);

            bondRing2Ring3 = builder.NewBond(ring2Atom1, ring2Atom2);
            IBond ring2Bond2     = builder.NewBond(ring2Atom2, ring2Atom3);
            IBond ring2Bond3     = builder.NewBond(ring2Atom3, ring2Atom1, BondOrder.Double);
            IBond ring3Bond2     = builder.NewBond(ring2Atom2, ring3Atom3);
            IBond bondRing3Ring4 = builder.NewBond(ring3Atom3, ring3Atom4);
            IBond ring3Bond4     = builder.NewBond(ring3Atom4, ring2Atom1);
            IBond ring4Bond1     = builder.NewBond(ring4Atom1, ring4Atom2);
            IBond ring4Bond2     = builder.NewBond(ring4Atom2, ring3Atom3);
            IBond ring4Bond3     = builder.NewBond(ring3Atom4, ring4Atom1);

            IRing ring1 = builder.NewRing();

            ring1.Atoms.Add(ring1Atom1);
            ring1.Atoms.Add(ring1Atom2);
            ring1.Atoms.Add(ring1Atom3);
            ring1.Bonds.Add(ring1Bond1);
            ring1.Bonds.Add(ring1Bond2);
            ring1.Bonds.Add(ring1Bond3);

            ring2 = builder.NewRing();
            ring2.Atoms.Add(ring2Atom1);
            ring2.Atoms.Add(ring2Atom2);
            ring2.Atoms.Add(ring2Atom3);
            ring2.Bonds.Add(bondRing2Ring3);
            ring2.Bonds.Add(ring2Bond2);
            ring2.Bonds.Add(ring2Bond3);

            ring3 = builder.NewRing();
            ring3.Atoms.Add(ring2Atom1);
            ring3.Atoms.Add(ring2Atom2);
            ring3.Atoms.Add(ring3Atom3);
            ring3.Atoms.Add(ring3Atom4);
            ring3.Bonds.Add(bondRing2Ring3);
            ring3.Bonds.Add(ring3Bond2);
            ring3.Bonds.Add(bondRing3Ring4);
            ring3.Bonds.Add(ring3Bond4);

            IRing ring4 = builder.NewRing();

            ring4.Atoms.Add(ring4Atom1);
            ring4.Atoms.Add(ring4Atom2);
            ring4.Atoms.Add(ring3Atom3);
            ring4.Atoms.Add(ring3Atom4);
            ring4.Bonds.Add(bondRing3Ring4);
            ring4.Bonds.Add(ring4Bond1);
            ring4.Bonds.Add(ring4Bond2);
            ring4.Bonds.Add(ring4Bond3);

            ringset.Add(ring1);
            ringset.Add(ring2);
            ringset.Add(ring3);
            ringset.Add(ring4);
        }