Esempio n. 1
0
        /// <summary>
        /// Enumerates over all orbital integrals with the same coefficient
        /// as this.
        /// These symmetries arise from:
        /// - Indistinguishability of electrons.
        /// - Orbitals are assumed to be real.
        /// </summary>
        /// <returns>Array of orbital integrals with the same coefficient.</returns>
        public        OrbitalIntegral[] EnumerateOrbitalSymmetries()
        {
            var coefficient = Coefficient;

            if (OrbitalIndices.Length == 2)
            {
                var i          = OrbitalIndices[0];
                var j          = OrbitalIndices[1];
                var symmetries = new Int64[][]
                {
                    new Int64[] { i, j },
                    new Int64[] { j, i }
                };
                return(symmetries.Distinct(new Extensions.IntArrayIEqualityComparer()).Select(o => new OrbitalIntegral(o, coefficient)).ToArray());
            }
            else if (OrbitalIndices.Length == 4)
            {
                var i          = OrbitalIndices[0];
                var j          = OrbitalIndices[1];
                var k          = OrbitalIndices[2];
                var l          = OrbitalIndices[3];
                var symmetries = new Int64[][] {
                    new Int64[] { i, j, k, l }, // 0123
                    new Int64[] { j, i, l, k }, // 1032
                    new Int64[] { k, l, i, j }, // 2301
                    new Int64[] { l, k, j, i }, // 3210
                    new Int64[] { i, k, j, l }, // 0213
                    new Int64[] { k, i, l, j }, // 2031
                    new Int64[] { j, l, i, k }, // 1302
                    new Int64[] { l, j, k, i }  // 3120
                };
                return(symmetries.Distinct(new Extensions.IntArrayIEqualityComparer()).Select(o => new OrbitalIntegral(o, coefficient)).ToArray());
            }
            else
            {
                throw new System.NotImplementedException();
            }
        }