예제 #1
0
        public void TestParity_Four_NNNU()
        {
            Vector2[] coords = new Vector2[] { new Vector2((float)-7.75, (float)5.79), // -O
                                               new Vector2((float)-6.42, (float)3.48), // -N
                                               new Vector2((float)-9.09, (float)3.48), // -C
                                               new Vector2(-9.09, (float)5.02),        // -H (up)
            };
            int[]           elev   = new int[] { 0, 0, 0, 1 };
            GeometricParity parity = new Tetrahedral2DParity(coords, elev);

            Assert.AreEqual(AntiClockwise, parity.Parity);
        }
예제 #2
0
        public void TestParity_Four_NNNN()
        {
            Vector2[] coords = new Vector2[] { new Vector2((float)-7.75, (float)5.79), // -O
                                               new Vector2((float)-6.42, (float)3.48), // -N
                                               new Vector2((float)-9.09, (float)3.48), // -C
                                               new Vector2((float)-9.09, (float)5.02), // -H
            };
            int[]           elev   = new int[] { 0, 0, 0, 0 };                         // no wedge/hatch bonds
            GeometricParity parity = new Tetrahedral2DParity(coords, elev);

            Assert.AreEqual(None, parity.Parity);
        }
예제 #3
0
        public void TestParity_Three_DDD()
        {
            Vector2[] coords = new Vector2[] { new Vector2(-7.75, (float)5.79),        // -O (down)
                                               new Vector2((float)-6.42, (float)3.48), // -N
                                               new Vector2((float)-9.09, (float)3.48), // -C
                                               new Vector2(-7.75, (float)4.25),        //  C (centre)
            };
            int[]           elev   = new int[] { -1, -1, -1, 0 };
            GeometricParity parity = new Tetrahedral2DParity(coords, elev);

            Assert.AreEqual(AntiClockwise, parity.Parity);
        }
        /// <summary>
        /// Create an encoder for axial 2D stereochemistry for the given start and
        /// end atoms.
        /// </summary>
        /// <param name="container">the molecule</param>
        /// <param name="start">start of the cumulated system</param>
        /// <param name="startBonds">bonds connected to the start</param>
        /// <param name="end">end of the cumulated system</param>
        /// <param name="endBonds">bonds connected to the end</param>
        /// <returns>an encoder</returns>
        private static IStereoEncoder Axial2DEncoder(IAtomContainer container, IAtom start, IEnumerable <IBond> startBonds, IAtom end, IEnumerable <IBond> endBonds)
        {
            Vector2[] ps = new Vector2[4];
            int[]     es = new int[4];

            PermutationParity perm = new CombinedPermutationParity(Fill2DCoordinates(container, start, startBonds, ps, es, 0), Fill2DCoordinates(container, end, endBonds, ps, es, 2));
            GeometricParity   geom = new Tetrahedral2DParity(ps, es);

            int u = container.Atoms.IndexOf(start);
            int v = container.Atoms.IndexOf(end);

            return(new GeometryEncoder(new int[] { u, v }, perm, geom));
        }