Esempio n. 1
0
        /// <summary>
        /// is two space groups same or not
        /// </summary>
        /// <param name="spaceGroup1"></param>
        /// <param name="spaceGroup2"></param>
        /// <returns></returns>
        public int CompareTwoSpaceGroups(string spaceGroup1, string spaceGroup2)
        {
            SpaceGroupSymmetryMatrices sgMatrices1 = FindSpaceGroupMatrices(spaceGroup1);
            SpaceGroupSymmetryMatrices sgMatrices2 = FindSpaceGroupMatrices(spaceGroup2);

            return(CompareTwoSpaceGroups(sgMatrices1, sgMatrices2));
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="spaceGroup1"></param>
        /// <param name="spaceGroup2"></param>
        /// <returns></returns>
        private int CompareTwoSpaceGroups(SpaceGroupSymmetryMatrices spaceGroup1,
                                          SpaceGroupSymmetryMatrices spaceGroup2)
        {
            if (spaceGroup1 == null || spaceGroup2 == null)
            {
                return(-1);
            }
            SymOpMatrix[] symOpList1      = spaceGroup1.SymmetryOpList;
            SymOpMatrix[] symOpList2      = spaceGroup2.SymmetryOpList;
            int           sameSymOpsCount = 0;

            foreach (SymOpMatrix symOp1 in symOpList1)
            {
                foreach (SymOpMatrix symOp2 in symOpList2)
                {
                    if (AreSymOpMatricesSame(symOp1, symOp2))
                    {
                        sameSymOpsCount++;
                        break;
                    }
                }
            }
            if (symOpList1.Length == symOpList2.Length)
            {
                if (sameSymOpsCount == symOpList1.Length)
                {
                    // same space groups
                    return(0);
                }
                else
                {
                    // different space groups
                    return(-1);
                }
            }
            else
            {
                // space group 1 is a subset
                if (sameSymOpsCount == symOpList1.Length)
                {
                    return(1);
                }
                // space group 1 is a superset
                else if (sameSymOpsCount == symOpList2.Length)
                {
                    return(2);
                }
                else
                {
                    // different
                    return(-1);
                }
            }
        }
Esempio n. 3
0
 /// <summary>
 /// add symmetry operators of a space group
 /// </summary>
 /// <param name="symMatricesInSg"></param>
 public void Add(SpaceGroupSymmetryMatrices symMatricesInSg)
 {
     symOpsInSpaceGroupList.Add(symMatricesInSg);
 }