Пример #1
0
        /// <summary>
        /// Normalize the configuration to the lowest order (1).
        /// </summary>
        /// <remarks>
        /// For example
        /// "C[Co@OH8](F)(Br)(Cl)(I)S"
        /// is the same as
        /// "C[Co@OH1](F)(Cl)(Br)(I)S". The normalised form is easy to
        /// work with as the first and last carriers form an axis, the middle four
        /// equatorial carriers are arranged anti-clockwise looking from the first carrier.
        /// </remarks>
        /// <returns>the normalized form</returns>
        public Octahedral Normalize()
        {
            var cfg = (int)Configure;

            if (cfg == 1)
            {
                return(this);
            }
            if (cfg < 1 || cfg > 30)
            {
                throw new ArgumentException(
                          "Invalid config order: " + cfg + ", octahedral should be"
                          + "1 <= order <= 30!");
            }
            var carriers = InvApply(Carriers.ToArray(), PERMUTATIONS[cfg - 1]);

            return(new Octahedral(Focus, carriers, 1));
        }