# Fileset

[Spglib  a software library for crystal symmetry search.pdf](https://mdr.nims.go.jp/filesets/d30a5177-949d-44e2-880b-5f08d13673e3/download)

## Creator

[Atsushi Togo](https://orcid.org/0000-0001-8393-9766), Kohei Shinohara, Isao Tanaka

## Rights

[Creative Commons BY Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0/)

## Other metadata

[Spglib: a software library for crystal symmetry search](https://mdr.nims.go.jp/datasets/c45f8c83-c091-407e-a7e4-758dd34f559b)

## Fulltext

Spglib: a software library for crystal symmetry searchScience and Technology of Advanced Materials: MethodsISSN: (Print) (Online) Journal homepage: www.tandfonline.com/journals/tstm20Spglib: a software library for crystal symmetrysearchAtsushi Togo, Kohei Shinohara & Isao TanakaTo cite this article: Atsushi Togo, Kohei Shinohara & Isao Tanaka (2024) Spglib: a softwarelibrary for crystal symmetry search, Science and Technology of Advanced Materials: Methods,4:1, 2384822, DOI: 10.1080/27660400.2024.2384822To link to this article:  https://doi.org/10.1080/27660400.2024.2384822© 2024 The Author(s). Published by NationalInstitute for Materials Science in partnershipwith Taylor & Francis GroupPublished online: 16 Oct 2024.Submit your article to this journal Article views: 807View related articles View Crossmark dataCiting articles: 4 View citing articles Full Terms & Conditions of access and use can be found athttps://www.tandfonline.com/action/journalInformation?journalCode=tstm20https://www.tandfonline.com/journals/tstm20?src=pdfhttps://www.tandfonline.com/action/showCitFormats?doi=10.1080/27660400.2024.2384822https://doi.org/10.1080/27660400.2024.2384822https://www.tandfonline.com/action/authorSubmission?journalCode=tstm20&show=instructions&src=pdfhttps://www.tandfonline.com/action/authorSubmission?journalCode=tstm20&show=instructions&src=pdfhttps://www.tandfonline.com/doi/mlt/10.1080/27660400.2024.2384822?src=pdfhttps://www.tandfonline.com/doi/mlt/10.1080/27660400.2024.2384822?src=pdfhttp://crossmark.crossref.org/dialog/?doi=10.1080/27660400.2024.2384822&domain=pdf&date_stamp=16%20Oct%202024http://crossmark.crossref.org/dialog/?doi=10.1080/27660400.2024.2384822&domain=pdf&date_stamp=16%20Oct%202024https://www.tandfonline.com/doi/citedby/10.1080/27660400.2024.2384822?src=pdfhttps://www.tandfonline.com/doi/citedby/10.1080/27660400.2024.2384822?src=pdfhttps://www.tandfonline.com/action/journalInformation?journalCode=tstm20Spglib: a software library for crystal symmetry searchAtsushi Togoa,b, Kohei Shinoharac and Isao Tanakab,d,eaCenter for Basic Research on Materials, National Institute for Materials Science, Tsukuba, Japan; bCenter for Elements Strategy Initiative for Structural Materials, Kyoto University, Kyoto, Japan; cPreferred Networks, Inc, Tokyo, Japan; dDepartment of Materials Science and Engineering, Kyoto University, Kyoto, Japan; eNanostructures Research Laboratory, Japan Fine Ceramics Center, Nagoya, JapanABSTRACTA computer algorithm to search the symmetries of crystal structures, as implemented in the spglib code, is described. An iterative algorithm is employed to robustly identify space group types, tolerating a certain amount of distortion in the crystal structures. The source code is distributed under the 3-Clause BSD License, a permissive open-source software license. This paper focuses on the algorithm for identifying the space group symmetry of crystal structures.IMPACT STATEMENTThis paper presents a detailed description of the computer algorithm utilized in the spglib code, which is a computer software library for determining crystal symmetry and space group type classifications.ARTICLE HISTORY Received 15 March 2024  Revised 18 July 2024  Accepted 22 July 2024 KEYWORDS Space group; crystal symmetry; space group type; crystallographic point group1. IntroductionCrystal symmetry is essential information for understanding various crystal properties. It is also useful for compressing information about the physical states of crystals, e.g. in electronic structure calculations. The crystal symmetry is composed of a set of symmetry operations that map a crystal structure onto itself, and the set forms a space group. There are 230 space group types. Each crystal structure is uniquely assigned to one of the space-group types [1]. Here, the crystal structure is a mathematical model, where equivalent unit cells are arranged on a periodic lattice, and each unit cell is defined by basis vectors and point coordinates of atoms labeled by atomic species.CONTACT Atsushi Togo togo.atsushi@nims.go.jp Center for Basic Research on Materials, National Institute for Materials Science, Tsukuba 305- 0047, JapanSCIENCE AND TECHNOLOGY OF ADVANCED MATERIALS: METHODS 2024, VOL. 4, NO. 1, 2384822 https://doi.org/10.1080/27660400.2024.2384822© 2024 The Author(s). Published by National Institute for Materials Science in partnership with Taylor & Francis Group  This is an Open Access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. The terms on which this article has been published allow the posting of the Accepted Manuscript in a repository by the author(s) or with their consent.http://www.tandfonline.comhttps://crossmark.crossref.org/dialog/?doi=10.1080/27660400.2024.2384822&domain=pdf&date_stamp=2024-10-14Assuming the periodicity, a crystal structure is represented by the numerical values of the basis vectors and point coordinates in a unit cell. The symmetry operations are also numerically represented with respect to the unit cell. Due to the periodicity of unit cells, another linear combination of the basis vectors can also be a valid unit cell, resulting in different matrix representations of the symmetry operations. It is inconvenient to represent the same crystal symmetry in various representations. To obtain a unique matrix representation of symmetry operations, conventional choices and settings for unit cell representations are employed in crystallography. These matrix representations of the space-group types are tabulated in the International Tables for Crystallography Volume A (ITA) [1].Given a crystal structure, its symmetry operations are searched computationally, and then the space-group type is identified. If the crystal structure is provided in a standard setting, the identification is straightforward. However, it is often provided with a different choice of basis vectors and an arbitrary origin shift, i.e. a non- standard setting. Furthermore, when the basis vectors and point coordinates are slightly distorted with respect to the expected crystal symmetry, the symmetry search becomes a challenging task. The spglib code has been developed to solve these difficulties.There already exist crystal symmetry-finding codes. The FINDSYM code in the ISOTROPY Software Suite [2–4] is well known; however, its source code is not publicly available. The cctbx [5–9] code is an open- source computational crystallography toolbox under a BSD-type variant license. The sginfo [5–8] code, which is currently distributed under an open-source software license, has been superseded by the space group toolbox (sgtbx) in the cctbx code. The AFLOW-SYM [10] code is an open-source crystal symmetry analysis code under the GNU General Public License. The spglib code is another open- source code distributed under the 3-Clause BSD license, which is a permissive open-source software license [11].Because the spglib code operates as a software library and is not directly visible to users, its widespread use across various software packages may not be apparent. However, the spglib code is widely utilized by numerous software packages for atomistic simulation, visualization, and utilities, including the CP2K [12], Octopus [13], phonopy [14], pymatgen [15], ASE [16], and Avogadro codes [17], as well as online materials databases such as the Materials Project [18] and NOMAD [19]. Since many software packages already rely on it, the spglib code is expected to be well maintained and have a longer lifespan. Therefore, this paper aims to engage developers of the spglib code by presenting a detailed algorithm implemented in the spglib code.Using the spglib code, space group operations are searched from a crystal structure in which small deviations from ideal atomic positions are tolerated. As a result, we obtain the coset representatives ðW i;wiÞof the space group S with respect to the translation group T, defined by the coset decomposition: where ðW i;wiÞ is explained in Appendix A. Some other useful information about crystal symmetry is simultaneously derived while running the algorithm. The information obtained through the spglib code is applicable to research in materials science or condensed matter physics. Reading the references [20–22] can be useful for gaining a deeper understanding of these subjects.In the algorithm outlined in this paper, an iterative approach is employed to determine space group operations for the initial input crystal structure at a given distance tolerance. The flowchart of the algorithm is presented in Figure A1. There are four stages in the algorithm: primitive cell search, space group operation search, identification of space group type, and finalization. These stages are subdivided into smaller steps. The algorithm continues until the obtained symmetry operations satisfy all given crystallographic constraints under minimum adjustment of the tolerance value. Nested iteration loops are present in the algorithm, some of which are explicitly depicted in Figure A1. Additional loops are contained within the blocks. The tolerance value decreases whenever an operation fails in any of the loops. One exception is step (e), where attempts are made to both increase and decrease the tolerance value.This paper focuses on the algorithms designed for searching space group operations and identifying space group types. The algorithm related to the magnetic space group, which builds upon the space group algorithm, is discussed in another publication [23]. A tolerance parameter, crucial for the algorithm in the spglib code, is detailed in the following section. Notations, algebra, and look-up tables utilized in this paper are compiled in the Appendices.2. Tolerance parameter in crystal symmetry operation searchIn the spglib code, numerical searches for symmetry operations of a given input unit cell utilize a small Euclidean distance, ε, as a tolerance parameter. The value of the tolerance parameter is adjusted during the algorithmic process to identify a possible space group. Sci. Technol. Adv. Mater. Meth. 4 (2024) 2                                                                                                                                               A. TOGO et al.This section explains how it is used to examine the symmetrical equivalence of two atomic points. The method of its adjustment is detailed in subsequent sections. Symbols used in this section are summarized in Appendices A.1–A.4.2.1. Lattice translation to a point near originEach element of point coordinates, x ¼ ðx1; x2; x3Þ`, is confined within the interval ½� 0:5; 0:5Þ by the operation: where xib e denotes rounding xi to the nearest integer. For the coordinates, this operation is concisely represented as and similarly for vectors as, 2.2. Determination of equivalent points under lattice periodicityThe tolerance parameter, ε, is used to determine whether two points ~x and x0 occupy the same atomic site. This is examined using the position difference, �x ¼ ~x � x0, by evaluating where ða; b; cÞ represent the basis vectors of the unit cell. To accommodate lattice periodicity, condition (5) is reformulated using operation (4) as This expression is frequently used in the implemen- tation.2.3. Examination of a symmetry operationGiven a space group operation ðW;wÞ, which may or may not be a valid symmetry operation, an atomic point x is transformed to ~x ¼ ðW;wÞx by Eq. (A8). If ðW;wÞ represents a valid space group operation, ~x must be located at one of atomic sites, x0, having the same atomic type. In the algorithm, this is examined for all atoms in either the input unit cell or the primitive cell using condition (6). When this is satisfied, the given space group operation ðW;wÞ is accepted.3. Machine precision issueIt is assumed that the spglib code is used on both 32- and 64-bit computer systems. As reported in Ref [6], length comparisons must be carefully implemented in the code due to finite machine precision. For example, an inequality x< y might be implemented as x < y � ε0 with ε0 being a small positive value [6]. Most inequalities in the implementation follow the style of Equation (6) and no special adjustments are applied in these cases. Conversely, the operation to take modulo by Z employs the above inequality, using ε0. Through this operation, a value xi is adjusted to fall within the interval ½� ε0; 1 � ε0Þ. In the current version of the spglib code, ε0 is set to 10� 10.4. Primitive cell searchIn the first stage of the space group symmetry search, a primitive cell is identified from lattice points in the input unit cell. These lattice points are obtained through a search for pure translation operations.4.1. Step (a): Searching pure translation operationsThe input unit cell contains multiple lattice points in it if it is not a primitive cell. These lattice points are obtained as translation parts wI of pure translation operations of fðI;wIÞg within the input unit cell, where I is the identity matrix. The pure translation operations of fðI;wIÞg are searched as follows: Candidates of the translation parts wcI are selected from vectors that extend from a fixed atomic site x to all atomic sites x0of the same atomic type A, i.e. wcI ¼ x0A � xA. To minimize the computational demand, the fixed atomic site is chosen among atoms having an atomic type that comprises the smallest number of atoms [24]. Then, ðI;wcIÞis examined as described in Sec. 2.3.If the input unit cell is a primitive cell, only one ðI;wIÞ with wI ¼ ð0; 0; 0Þ` should be found, otherwise a set of multiple pure translation operations of fðI;wIÞg is obtained.In typical use cases, this step is the most computationally demanding part of the entire process. The brute-force algorithm has a time complexity of OðN3Þ, with N denoting the number of type A atoms. However, this complexity is empirically reduced to OðN2 log NÞ by sorting the atoms, which minimizes worst-case scenarios [25].4.2. Step (b): Choosing basis vectors of primitive cellCandidates for the three basis vectors of a primitive cell ðacp; bcp; ccpÞ are chosen from the set of vectors Ti [ Tp, where Ti ¼ fai; bi; cig is the set composed of the basis vectors of the input unit cell, and Tp ¼ fwIg found at step (a). Three basis vectors are chosen to create a right-handed coordinate system. The volume of the primitive cell, Vp, is expected to be approximately the volume of the Sci. Technol. Adv. Mater. Meth. 4 (2024) 3                                                                                                                                               A. TOGO et al.input unit cell, Vi, divided by jTpj. Therefore, the basis vectors of the primitive cell are searched under the following condition: 4.3. Step (c): Failure of finding primitive cell basis vectorsFor distorted input unit cells, the condition (7) may not always be satisfied. For example, the number of pure translations found can be either more or less than those expected. In this case, the sequence of steps (b), (c), and (d) is iterated by reducing the tolerance value. If this loop is repeated many times, the procedure restarts from step (a) with the tolerance value reduced from that previously used in step (a).4.4. Step (d): Thinning out pure translationsSome of the pure translations that do not satisfy condition (7) are discarded by re-examining the existing pure translations with a tightened tolerance value. Typically, this operation is far more computationally efficient than restarting from step (a) with a tightened tolerance value.4.5. Step (e): Creating a primitive cellThe primitive cell basis vectors ðacp; bcp; ccpÞ found at step (b) are transformed into a different set of primitive cell basis vectors ðap; bp; cpÞ by the Delaunay reduction [1,26]. This transformation is written as QD is an integer matrix and is chosen such that detðQDÞ ¼ 1.Similarly, the transformation of the basis vectors of the primitive cell basis vectors to those of the input unit cell ðai; bi; ciÞ in a right handed coordinate system is written by the change-of-basis matrix Qp!i as where Qp!i is chosen as an integer matrix with detðQp!iÞ � 1 although Equation (9) is an approximation if Tp ¼ fwg found at step (a) is distorted with respect to the lattice of the primitive cell.Point coordinates in the input unit cell, xi, are transformed to their corresponding coordinates in the primitive cell, xp�, by where xp� is brought into the interval ½� 0:5; 0:5Þ by operation (2). When detðQp!iÞ> 1, multiple xi should be mapped to a point xp� with respect to ðap; bp; cpÞusing condition (6). The tolerance value ε in condition (6) is adjusted until the multiplicity becomes detðQp!iÞfor all translationally independent xp�. If this fails, the procedure restarts from step (a) with the tolerance value tightened from that previously used in step (a).Upon successful verification, the point coordinates of translationally equivalent atoms are averaged to produce xp along with boundary treatment for xp�located close to the boundary of ½� 0:5; 0:5Þ. Finally, a primitive cell is created from ðap; bp; cpÞ and fxpg.5. Space group operation searchThe purpose of the second stage is to search a set of space group operations fðWp;wpÞg of the primitive cell obtained in the first stage. Candidates of the rotation parts fWcg are given by an exhaustive search of lattice point group operations. Using obtained fWcgand the point coordinates fxpg, a set of space group operations fðWp;wpÞg is searched.5.1. Step (f): Searching lattice point group operationsA set of possible candidates for lattice point group operations fWcLg is exhaustively generated by filling the matrix elements with −1, 0, or 1 under the constraint of j detðWcLÞj ¼ 1. As described in Appendice A.3, a set of lattice point group operations of the primitive cell, fWLg, is searched within fWcLg using the metric tensor G that is rotated by WL as ~G ¼ ðWLÞ`GWL.Comparison of G and ~G is performed as follows: The diagonal elements of the matrix G provide information about the lengths of the basis vectors, while the off-diagonal elements indicate the angles between these vectors. The differences in lengths can be straightforwardly compared using the tolerance ε based on Euclidean distance. For angle comparison, an angle tolerance parameter can be employed. However, this addition of an extra tolerance parameter may complicate usage. Therefore, in the current implementation, if an angle tolerance is not explicitly specified, the distance tolerance ε is approximated for angle comparisons. This approach is applied, for instance, in the evaluation of G12, as shown in the following equation: where �θ is the angle difference between the two pairs of vectors a-b and ~a-~b, The angle difference �θ is compared with the tolerance value using the averaged lengths of the basis vectors. The left-hand side of Equation (11) is given Sci. Technol. Adv. Mater. Meth. 4 (2024) 4                                                                                                                                               A. TOGO et al.by the matrix elements of G and ~G such as a � b ¼ G12, jaj ¼ffiffiffiffiffiffiffiG11p, and jbj ¼ffiffiffiffiffiffiffiG22p.In a similar way to that applied in step (a), the corresponding translation part wp is searched using WL instead of I in step (a).5.2. Step (g): Searching space group operationsA set of space group operations fðWp;wpÞg is searched in the following way. The rotation matrices fWLg found in step (f) are used as candidates of the rotation parts of fðWp;wpÞg. From Equation (A8), a space group operation ðWp;wpÞ satisfies ~x ¼Wpx þ wp. Therefore, candidates of translation parts for WL are given by wcp ¼ ~x � WLx over possible combinations of x and ~x.To limit its search space, for a fixed x, ~x are selected from all atoms with the same atomic type as x in the primitive cell. Then, ðWL;wcpÞ is examined by applying condition (6) with �x ¼ WL;wcp� �x � ~x for all x and ~x. If none of wcp is found, this WL is discarded, otherwise ðWL;wcpÞ is adopted as ðWp;wpÞ. This procedure is repeated over all elements of fWLg. Finally, a set of space group operations fðWp;wpÞg is obtained. In the next stage, it is verified that fðWp;wpÞg constitutes the coset representatives of the factor group S=T.6. Identification of space group typeIn this third stage, a space group type is identified by comparing the set of the space group operations fðWp;wpÞg obtained in the last stage with those sets coded in the Hall symbols [27,28]. To achieve this, the primitive cell is transformed into the corresponding conventional unit cell in a specific setting. The space group operations for this setting are matched with the matrix representations decoded from the Hall symbols, and the origin shift is simultaneously determined during the matching process [8]. The algorithm presented in this section follows almost exactly that reported by Grosse-Kunstleve and Adams in Ref [8], and it is described as implemented in the spglib code.6.1. Step (h): Identify crystallographic point groupThe crystallographic point group is given by collecting the rotation parts of the space group operations, i.e. P ¼ fWpjðWp;wpÞ 2 fðWp;wpÞgg. The crystallographic point group type is identified from the traces and determinants of the matrices of fWpg by using the look-up Tables B1 and B2 presented in Appendix B. If the identification of the crystallographic point group type fails, the procedure restarts from step (a) with the tolerance value tightened from that previously used in step (a).6.2. Step (i): Transformation from primitive cell to conventional unit cellThe Laue class is the information necessary to transform the basis vectors of the primitive cell to those of the corresponding conventional unit cell. It is easily known once the crystal class, which is equivalent to the crystallographic point group type, is determined as shown in Table B2.The transformation of the basis vectors of the primitive cell ðap; bp; cpÞ to those of the conventional unit cell ðac; bc; ccÞ is written as M0 is constructed from three axis directions ðex; ey; ezÞsuch as with detðM0Þ> 0. These axis directions are determined from the rotation axes that characterize the Laue class. The rotation axis direction of each Wp is found by solving the following equation: where Wprop ¼ detðWpÞWp is the proper rotation matrix of Wp. The rotation axis direction e can be determined through an exhaustive search, wherein three integer values are evaluated as the components of e. The rotation order n of Wp is defined by the smallest n> 0 that satisfies Except for the Laue class �1, the primary axis direction epri is determined by selecting a primary proper rotation matrix Wpri of the rotation order npri presented in Table 1. The axis direction e0 perpendicular to epri is determined to satisfy the following equation:where S ¼Pnprii¼1 Wprii . The conditions that the primary, secondary (esec), and ternary (eter) axis directions have to satisfy are listed in Table 1 for Laue classes. For the Laue class �1, M0 is determined so as to make the left-hand side of Equation (13) become the Niggli cell [6,29–32]. For the Laue class 2=m, the b axis direction is set as epri along the two-fold rotation axis by Equation (15). The a and c axis directions are found to be perpendicular to epri by Equation (17). Therefore ðex; ey; ezÞ ¼ ðeter; epri; esecÞ. For the Laue classes of 4=m, 4=mmm, �3, �3m, 6=m, and 6=mmm, the c axis direction is set as epri along the four or three- fold rotation axis by Equation (15). esec is found to be perpendicular to epri by Equation (17), and eter ¼Wpriesec. Therefore ðex; ey; ezÞ ¼ ðesec; eter; epriÞ. Sci. Technol. Adv. Mater. Meth. 4 (2024) 5                                                                                                                                               A. TOGO et al.Among the possible sets of ðesec; eter; epriÞ, one having the smallest j detðM0Þj � 0 is selected to avoid wrongly-centred ðac; bc; ccÞ. For the Laue classes of mmm, m�3, and m�3m, three axis directions along two- or four-fold rotation axes are determined by Equation (15). When detðM0Þ< 0, the secondary and ternary axis directions are swapped to make the system of basis vectors right-handed.For convenience in the following steps, the basis vectors are further transformed to have a specific centering type by multiplying a correction matrix M with M0 for the Laue classes of 2=m, mmm, and the rhombohedral system. Otherwise, M is considered as an identity matrix. For those, the correction matrices are listed in Table 2. The current centering type is easily identified from M0 using Table 3.For the Laue class 2=m, the basis vectors with the I, A, and B centering types are transformed to those with the C centering type. For the Laue class mmm, those with the A, and B centering types are transformed to those with the C centering type. For the rhombohedral system, a rhombohedrally-centred hexagonal cell is obtained by M0 in either the obverse or reverse setting. This is transformed to the primitive rhombohedral cell by Mobv if it is the obverse setting or by Mrev if it is the reverse setting. Only one of M0Mobv or M0Mrev has to be an integer matrix, which is chosen as the transformation matrix to a primitive rhombohedral cell.6.3. Step (j): Identification of hall symbolThe space group operations obtained in the second stage are compared with the datasets generated by decoding the Hall symbols. The Hall symbols are the explicit-origin space group notation proposed by Hall in Ref [27]. The method to decode the Hall symbols is also found in International Tables for Crystallography Volume B [28]. The 530 sets of matrix representations are pre-decoded and stored in the spglib source code.To perform the comparison, the set of space group operations has to be represented in the same coordinate system as that in the datasets. Using the transformation matrix M0M obtained in step (i) as described in Equation (C2), the space group operations are transformed into those corresponding to one specific conventional unit cell setting.To match those in different unique axes, settings, or cell choices described by the Hall symbols, an additional change-of-basis matrix Q0 is employed. In the spglib code, the matrix Q0 can be selected such that after the transformation, it favors the conditions jacj � jbcj, jacj � jccj, or jbcj � jccj, and being similar to the input unit cell in orientation. This preference is permissible when the choice of change-of-basis matrix is not constrained by the Hall symbol. Thus, the change-of- basis matrix M0M is updated by Q0 to M0MQ0. For the space group type Pa�3, two change-of-basis matrices, M0M and M0MQ0Pa�3, are examined to match [8], where Q0Pa�3 used in the spglib code is given by The matrix representations of the space group operations of fðWp;wpÞg in the second stage are given for the primitive cell. Each ðWp;wpÞ is transformed to that in the conventional unit cell, ðWc;wcÞ, Table 1. Axis directions for Laue classes. npri, nsec, and nter are the rotation orders of the primary (Wpri), secondary (Wsec), and ternary (Wter) proper rotation matrices, respectively.Laue class Condition implemented in the spglib code�1 Do nothing2=m npri ¼ 2 for bc, Sesec ¼ 0, Seter ¼ 0, esec�eter4=m npri ¼ 4 for cc, Sesec ¼ 0, eter ¼ Wpriesec4=mmm Same as 4=m�3 npri ¼ 3 for cc, Sesec ¼ 0, eter ¼ Wpriesec�3m Same as �36=m Same as �36=mmm Same as �3mmm npri ¼ nsec ¼ nter ¼ 2 for ac, bc, ccm�3 Same as mmmm�3m npri ¼ nsec ¼ nter ¼ 4 for ac, bc, ccTable 2. Correction matrices M.2=m, A! CM2=m;A ¼0 0 10 �1 01 0 00@1A2=m, B! CM2=m;B ¼0 1 00 0 11 0 00@1A2=m, I! CM2=m;I ¼1 0 �10 1 01 0 00@1Ammm, A! CMmmm;A ¼0 0 11 0 00 1 00@1Ammm, B! C Mmmm;B ¼ M2=m;BObverse hexagonal cell! primitive rhombohedral cellMobv ¼23�13�131313�231313130@1AReverse hexagonal cell! primitive rhombohedral cellMrev ¼13�231323�13�131313130@1AOtherwise,M ¼1 0 00 1 00 0 10@1ATable 3. Conditions to determine the centering types.Centering type detðM0Þ Row vectors of M0P 1 –A 2 9i;Pj M0 ij���� ¼ 1, M0 i1j j ¼ 1B 2 9i;Pj M0 ij���� ¼ 1, M0 i2j j ¼ 1C 2 9i;Pj M0 ij���� ¼ 1, M0 i3j j ¼ 1I (body) 2 "i;Pj M0 ij���� ¼ 2R (rhombohedral) 3 –F (face) 4 –Sci. Technol. Adv. Mater. Meth. 4 (2024) 6                                                                                                                                               A. TOGO et al.by M0MQ0 as described in Equation (C2). After this transformation, the rotation matrices of fWcg are directly comparable with those in the datasets.To compare the translation parts to those in the datasets, their origins have to be aligned. An origin shift is determined using the generators of the space group operations represented in the primitive cell setting. For a system having any centering, ðWc;wcÞ is transformed to ðWX;wXÞ by using the transformation matrix PX as presented in Table 4.When the space group operation is represented by ðWX;wXÞ with reference to the origin O and by ðWX;wdXÞ with respect to Od, and both matrix representations describe the same operation, they are interconnected by where pp is the origin shift from Od to O, i.e., O ¼ Od þ pp.Consider ðWdX;wdXÞ as the reference provided from the dataset, and ðWX;wXÞ as derived using this symmetry-finding algorithm, where WdX ¼WX . To determine pp, at most three matrix representations of the generators are required. For example, using these three generators, we can solve the equation below: This is rewritten as where A set of solutions is obtained by applying the Smith normal form D given by where U and V are the unimodular matrices. In the case with three generators, N is a 9� 3 matrix and its Smith normal form D becomes The 3� 9 matrix T of the inverse diagonal elements of D is made as When λn ¼ 0, the corresponding elements of T are set to 0. Since DV� 1pp ¼ U�wp, one of the solutions is given by A Python script was written to compute the matrices VTU for crystal systems and their centering types and axis settings using the SageMath code [33]. The precomputed VTU matrices are stored in the spglib source code together with the corresponding sets of the rotation parts of the generators in the primitive cell setting.With the origin shift pp obtained in Equation (26), the translation parts of the space group operations are compared with the datasets by Equation (19). Finally, the Hall symbol is identified by verifying that fðWX;wXÞg is mapped to fðWdX;wdXÞg.For subsequent use, the basis vectors of the primitive cell as obtained in Equation (8) are transformed to those of the conventional unit cell by Table 4. Transformation matrices used in the hall symbol matching. These matrices transform conventional unit cell settings to respective primitive cell settings. The subscripts X of the matrices PX indicate the centering types: A, B, C for the base centering types, I and F for the body and face centering types, respectively, and R for the (obverse) rhombohedral centering type.PA ¼1 0 00 12�120 12120B@1CA, PB ¼12 0 �120 1 012 0 120BB@1CCA, PC ¼1212 0�1212 00 0 10BB@1CCA,PI ¼�12121212�12121212�120BB@1CCA, PF ¼0 121212 0 121212 00BB@1CCA, PR ¼23�13�131313�231313130BB@1CCA.Sci. Technol. Adv. Mater. Meth. 4 (2024) 7                                                                                                                                               A. TOGO et al.Furthermore, the origin shift in the coordinate system of the conventional unit cell is given by 6.4. Step (k): Failure of identification of space group typeWhen the Hall symbol matching at step (j) fails, the tolerance value is shortened, and the current set of the space group operations is re-examined in step (l). Following this, the sequence from steps (i) to (l) is reiterated. This process continues until a Hall symbol is successfully identified. In cases where this loop is executed numerous times without success, the entire procedure is restarted from step (a), employing a tolerance value shortened from the one utilized in the last attempt at step (a).6.5. Step (l): Thinning out space group operationsThe space group operations in fðWp;wpÞg are re- evaluated in a way similar to step (g) with the shortened tolerance value. As a result, certain space group operations in fðWp;wpÞg may be excluded. Since wp is given, this re-examination requires significantly less computational demand compared to the full execution of step (g). Following this, the procedure revisits step (i) with the refined set of space group operations.7. FinalizationIn the fourth stage, the results from the previous stages are organized to enhance their usefulness and intuitiveness. The matrix representations of the space group operations for the input unit cell are reconstructed using the transformation matrix, origin shift, and the Hall symbol dataset to minimize distortions in the translational parts. Additionally, Wyckoff positions are determined and a distortion-free crystal structure of the conventional unit cell, which is derived from the input unit cell, is suggested.7.1. Step (m): Removal of distortion from basis vectorsThe tolerance introduced in the symmetry identification process may lead to some distortion in ðac; bc; ccÞ compared to their ideal values for the determined lattice system. This distortion is rectified by averaging the lengths of symmetrically equivalent basis vectors to align with the expected values for the lattice system. The specific lattice system conditions required for this adjustment are detailed in Appendix D, where the basis vectors ðas; bs; csÞ are adjusted for an intuitive alignment with the Cartesian axes. In this rectification process, the basis vectors ðac; bc; ccÞ are subject to a rotation in Cartesian coordinates, approximately represented by the equation: where ðas; bs; csÞ represent the idealized basis vectors of the conventional unit cell.7.2. Step (n): Reconstruction of matrix representations of space group operations of input unit cellThe set of matrix representations of the space group operations corresponding to the Hall symbol, fðWd;wdÞg, is obtained from the dataset. This is transformed to that of the input unit cell fðW i;wiÞgusing the following procedure.The basis vectors ðac; bc; ccÞ, as specified by Equation (27), follow the symmetry of fðWd;wdÞg. However, the basis vectors resulting from applying a rotation Wd� 2 fWdg are also valid: Consequently, as a potentially more suitable choice of basis vectors, ðac; bc; ccÞ may be replaced by ða0c; b0c; c0cÞ. This replacement aims to minimize the following expression: As this involves a transformation of the coordinate system, pc as given by Equation (28) is also transformed according to: Details of this coordinate transformation are provided in Appendix E. For conventional unit cells having any centering, ðWd�;wd�Þ that gives the shortest p0c is employed. With the use of p0c, the translation parts of fðWd;wdÞg are redefined as: Every ðWd;wd0Þ is transformed to that of the primitive cell ðWdp;wd0p Þ as the transformation detailed in Appendix C. The transformation matrix Qc!p is defined by the equation: Note that Q� 1c!p is an integer matrix. To ensure that fðWdp;wd0p Þg represents the set of coset representatives, only one space group operation is included in fðWdp;wd0p Þg for each rotation part Wdp.Sci. Technol. Adv. Mater. Meth. 4 (2024) 8                                                                                                                                               A. TOGO et al.Then, fðWdp;wd0p Þg is transformed to that of the input unit cell fðW i;pwi;pÞg. The transformation matrix Qp!i is defined by the equation: where the elements of the matrix Qp!i are rounded to their nearest integer values, thereby constituting an integer matrix. Thus obtained W i;p may not be an integer matrix if the order of the lattice point group of ðai; bi; ciÞ is smaller than that of ðap; bp; cpÞ. Those space group operations with non- integer matrices of W i;p are excluded from fðW i;p;wi;pÞg.When the input unit cell is not a primitive cell, fðW i;p;wi;pÞg is extended by a set of lattice point vectors in the input unit cell, ftjg, The lattice point vectors of ftjg are easily obtained from Qp!i [14].7.3. Step (o): Removal of distortion from point coordinates and determination of Wyckoff positionsPoint coordinates in the primitive cell xp are transformed to those in the conventional unit cell xc by Applying fðWd;wdÞg to fxcg, symmetrically independent points and sets of symmetrically equivalent points are obtained.Site symmetry operations of fðWx;i;wx;iÞg at xc are the space group operations that leave the coordinates of a point xc unchanged, i.e. fðWx;i;wx;iÞg is expected to form the site symmetry group Sx of the finite order jSxj. Using Sx, the special position operator [7] ðWspx ;wspx Þ is defined as Point coordinates xc can be slightly dislocated from the exact location. By Equation (39), the exact location xS of xc is obtained by In the spglib implementation, fðWx;i;wx;iÞg is obtained from fðWd;wdÞg. Since fðWd;wdÞg is the coset representatives of the lattice translation group of the conventional unit cell, i.e. it is a finite set unlike the space group, Equation (38) is examined using the condition (6) as Using Equation (41), Equations (39) and (40) are rewritten as The number of the symmetrically equivalent points of the point xS in the conventional unit cell is called multiplicity Mx. Note that Mx is defined with respect to the conventional unit cell but not the primitive cell as following the convention of the International Tables for Crystallography Volume A [1]. These have to satisfy the following relationship: where jS=Tj denotes the order of the factor group. This is the same as the cardinality of the coset representatives obtained for the primitive cell. Obviously detðP� 1X Þ is equivalent to the number of lattice points in the conventional unit cell. Finally, xS of the symmetrically independent points are obtained, and these points are then expanded to their symmetrically equivalent points.The Wyckoff letter of xS is determined using Coordinates in the Wyckoff position dataset. Coordinates are listed in the International Tables for Crystallography Volume A [1]. The dataset in the spglib code was provided by Y. Seto [34] for all the Hall symbols. The first entries of Coordinates of Wyckoff positions for each Hall symbol is necessary to match xS with a Wyckoff letter. All those first entries of Coordinates are stored in the spglib source code in a matrix format. For example, the first entry of the Wyckoff letter f of P4212 (No. 90) is ðx; x; 12Þ, which is represented by The 3� 3 and 3� 1 matrices are encoded and stored in the spglib source code. Matching with the dataset is performed by examining ðx; x; 12ÞxS ¼ xS ðmod ZÞ. The multiplicity Mx is also stored in the dataset. With this Mx, Equation (43) is verified. If this fails, the procedure restarts from step (a) with the tolerance value shortened from that used last time at step (a).8. SummaryThe spglib code is designed for the identification and symmetrization of crystal structures, which are provided as basis vectors, point coordinates, and atomic types, tolerating slight distortion. Utilizing established crystallography knowledge and algorithms, it examines crystal symmetry and validates symmetry Sci. Technol. Adv. Mater. Meth. 4 (2024) 9                                                                                                                                               A. TOGO et al.operations searched numerically. During this process, an input tolerance value is adjusted to align matrix representations of symmetry operations with one of the space group types.As the development of the spglib code has evolved, its source code has become less readable due to the series of incremental improvements made over time. This paper aims to clarify the implementation strategy of the current version of the spglib code, particularly for those keen on understanding the framework. Therefore, every detail is thoroughly described as it is implemented.The accumulation of technical debt has complicated code maintenance, necessitating periodic major updates to support sustained scientific progress. This will be achieved by selecting a suitable programming language for each respective situation along with keeping the core of the code concise and efficient.Disclosure statementNo potential conflict of interest was reported by the author(s).FundingThis work was supported by JSPS KAKENHI Grant Numbers JP21K04632, JP24K08021 and JP24H00190.References[1] Aroyo MI. International tables for crystallography. 6th ed. Vol. A. Hoboken, NJ: Wiley; 2016.[2] Stokes HT, Hatch DM. FINDSYM: program for identifying the space-group symmetry of a crystal. J Appl Crystallogr. 2005;38(1):237. doi: 10.1107/S00218898 04031528  [3] FINDSYM. Available from: http://stokes.byu.edu/iso/ findsym.php [4] ISOTROPY Software Suite. Available from: http:// stokes.byu.edu/iso/isotropy.php [5] Grosse-Kunstleve RW, Sauter NK, Moriarty NW, et al. The computational crystallography toolbox: crystallographic algorithms in a reusable software framework. J Appl Crystallogr. 2002;35(1):126. doi:  10.1107/S0021889801017824  [6] Grosse-Kunstleve RW, Sauter NK, Adams PD. Numerically stable algorithms for the computation of reduced unit cells. Acta Crystallogr A Found Crystallogr. 2004;60(1):1–6. doi: 10.1107/S010876730 302186X  [7] Grosse-Kunstleve RW, Adams PD. Algorithms for deriving crystallographic space-group information. II. Treatment of special positions. Acta Crystallogr A Found Crystallogr. 2002;58(1):60. doi: 10.1107/ S0108767301016658  [8] Grosse-Kunstleve RW. Algorithms for deriving crystallographic space-group information. Acta Crystallogr A Found Crystallogr. 1999;55(2):383. doi: 10.1107/ S0108767398010186  [9] Computational Crystallography Toolbox. Available from: https://cctbx.github.io/ [10] Hicks D, Oses C, Gossett E, et al. AFLOW-SYM: platform for the complete, automatic and self-consistent symmetry analysis of crystals. Acta Crystallogr A Found Adv. 2018;74(3):184. doi: 10.1107/ S2053273318003066  [11] Spglib. version 2.3.1. https://github.com/spglib/spglib [12] Kühne TD, Iannuzzi M, Del Ben M, et al. CP2K: an electronic structure and molecular dynamics software package - quickstep: efficient and accurate electronic structure calculations. J Chem Phys. 2020;152 (19):194103. doi: 10.1063/5.0007045  [13] Tancogne-Dejean N, Oliveira MJT, Andrade X, et al. Octopus, a computational framework for exploring light-driven phenomena and quantum dynamics in extended and finite systems. J Chem Phys. 2020;152 (12):124119. doi: 10.1063/1.5142502  [14] Togo A, Chaput L, Tadano T, et al. Implementation strategies in phonopy and phono3py. J Phys: Condens Matter. 2023;35(35):353001. doi: 10.1088/1361-648X/ acd831  [15] Ong SP, Richards WD, Jain A, et al. Python materials genomics (pymatgen): a robust, open-source python library for materials analysis. J Comput Mater Sci. 2013;68:314. doi: 10.1016/j.commatsci.2012.10.028  [16] Larsen AH, Mortensen JJ, Blomqvist J, et al. The atomic simulation environment—a python library for working with atoms. J Phys: Condens Matter. 2017;29(27):273002. doi: 10.1088/1361-648X/aa680e  [17] Hanwell MD, Curtis DE, Lonie DC, et al. Avogadro: an advanced semantic chemical editor, visualization, and analysis platform. J Chem inform. 2012;4(1):17. doi: 10.1186/1758-2946-4-17  [18] Jain A, Ong SP, Hautier G, et al. Commentary: the materials project: a materials genome approach to accelerating materials innovation. APL Mater. 2013;1(1):011002. doi: 10.1063/1.4812323  [19] Scheidgen M, Himanen L, Ladines AN, et al. Nomad: a distributed web-based platform for managing materials science research data. J Open Source Softw. 2023;8(90):5388. doi: 10.21105/joss.05388  [20] Nye JF. Physical properties of crystals. Oxford, UK: Oxford University Press; 1985.[21] Mller U. Symmetry relationships between crystal structures: applications of crystallographic group theory in crystal chemistry. Oxford, UK: Oxford University Press; 2013.[22] El-Batanouny M, Wooten F. Symmetry and condensed matter physics: a computational ApproachPhysical properties of crystals. Cambridge, UK: Cambridge University Press; 2008.[23] Shinohara K, Togo A, Tanaka I. Algorithms for magnetic symmetry operation search and identification of magnetic space group from magnetic crystal structure, acta crystallographica section a. Acta Crystallogr Sect A Found And Adv. 2023;79(5):390. doi: 10.1107/ S2053273323005016  [24] Hannemann A, Hundt R, Schön JC, et al. A new algorithm for space-group determination. J Appl Crystallogr. 1998;31(6):922. doi: 10.1107/S002188989 8008735  [25] Lamparski M. Large-scale atomistic computations of the phonons in twisted bilayer graphene [Phd thesis]. Troy (NY): Department of Physics, Applied Physics, and Astronomy Rens-selaer Polytechnic Institute; 2020. Available from: https://hdl.handle.net/20.500. 13015/2605 Sci. Technol. Adv. Mater. Meth. 4 (2024) 10                                                                                                                                             A. TOGO et al.https://doi.org/10.1107/S0021889804031528https://doi.org/10.1107/S0021889804031528http://stokes.byu.edu/iso/findsym.phphttp://stokes.byu.edu/iso/findsym.phphttp://stokes.byu.edu/iso/isotropy.phphttp://stokes.byu.edu/iso/isotropy.phphttps://doi.org/10.1107/S0021889801017824https://doi.org/10.1107/S0021889801017824https://doi.org/10.1107/S010876730302186Xhttps://doi.org/10.1107/S010876730302186Xhttps://doi.org/10.1107/S0108767301016658https://doi.org/10.1107/S0108767301016658https://doi.org/10.1107/S0108767398010186https://doi.org/10.1107/S0108767398010186https://cctbx.github.io/https://doi.org/10.1107/S2053273318003066https://doi.org/10.1107/S2053273318003066https://github.com/spglib/spglibhttps://doi.org/10.1063/5.0007045https://doi.org/10.1063/1.5142502https://doi.org/10.1088/1361-648X/acd831https://doi.org/10.1088/1361-648X/acd831https://doi.org/10.1016/j.commatsci.2012.10.028https://doi.org/10.1088/1361-648X/aa680ehttps://doi.org/10.1186/1758-2946-4-17https://doi.org/10.1063/1.4812323https://doi.org/10.21105/joss.05388https://doi.org/10.1107/S2053273323005016https://doi.org/10.1107/S2053273323005016https://doi.org/10.1107/S0021889898008735https://doi.org/10.1107/S0021889898008735https://hdl.handle.net/20.500.13015/2605https://hdl.handle.net/20.500.13015/2605[26] Delaunay B. Neue darstellung der geometrischen kristallographie. Z für Kristallogr - Crystalline Mater. 1933;84(1–6):109. doi: 10.1524/zkri.1933.84.1.109  [27] Hall SR. Space-group notation with an explicit origin. Acta Cryst A. 1981;37(4):517. doi: 10.1107/S0567739 481001228  [28] Shmueli U. International tables for crystallography, vol. B. Hoboken, NJ: Wiley; 2008.[29] Niggli P. Krystallographische und strukturtheoretische Grundbegriffe. In: Handbuch der Experimental- physik. Vol. 7. Leipzig: Akademische Verlagsgesell- schaft; 1928. p. 108–176.[30] Gruber B. The relationship between reduced cells in a general Bravais lattice. Acta Cryst A. 1973;29(4):433. doi: 10.1107/S0567739473001063  [31] Křivý I, Gruber B. A unified algorithm for determining the reduced (Niggli) cell. Acta Cryst A. 1976;32 (2):297. doi: 10.1107/S0567739476000636  [32] Niggli cell. Available from: http://atztogo.github.io/ niggli/ [33] SageMath, the Sage Mathematics Software System. Available from: http://www.sagemath.org [34] Seto’s Home Page. Available from: https://yseto.net/? page_id=29&lang=enSci. Technol. Adv. Mater. Meth. 4 (2024) 11                                                                                                                                             A. TOGO et al.https://doi.org/10.1524/zkri.1933.84.1.109https://doi.org/10.1107/S0567739481001228https://doi.org/10.1107/S0567739481001228https://doi.org/10.1107/S0567739473001063https://doi.org/10.1107/S0567739476000636http://atztogo.github.io/niggli/http://atztogo.github.io/niggli/http://www.sagemath.orghttps://yseto.net/?page_id=29%26lang=enhttps://yseto.net/?page_id=29%26lang=enAppendix A. Notations and conventionsIn this section, the notations and conventions used in this paper are summarized. Basically, we follow and respect the notations and conventions of International Tables for Crystallography Volume A [1] and Refs. [7,8].A.1. Basis vectors ða; b; cÞBasis vectors are represented by three column vectors: a ¼axayaz0@1A; b ¼bxbybz0@1A; c ¼cxcycz0@1A; (A1) in the Cartesian coordinates.A.2. Atomic point coordinates xCoordinates of an atomic point x are represented by three values relative to basis vectors as follows: x ¼x1x2x30@1A: (A2) A position vector x in the Cartesian coordinates are obtained by x ¼ ða; b; cÞx: (A3) A.3. Metric tensor G and point-group operation of lattice WThe metric tensor is defined by G ¼ ða; b; cÞ`ða; b; cÞ: (A4) A rotation matrix W is applied to the basis vectors such as, ð~a; ~b;~cÞ ¼ ða; b; cÞW: (A5) The metric tensor of ð~a; ~b;~cÞ is given by ~G ¼ ð~a; ~b;~cÞ`ð~a; ~b;~cÞ¼W`ða; b; cÞ`ða; b; cÞW ¼W`GW: (A6) The lattice point group operations are obtained by searching matrices Wf g that satisfy G ¼W`GW, where W is the integer matrix and the determinant is either 1 or � 1.A.4. Space group operation ðW;wÞA crystal structure is transformed by a space group operation in which the coordinate system is at rest. Instead of rotating basis vectors as given in Equation (A5), a point in direct space, x, is transformed to a point ~x by a rotation by ~x ¼Wx: (A7) A space group operation has a rotation part W and a translation part w. This is represented by the Seitz symbol ðW;wÞ that transforms x to ~x as ~x ¼ ðW;wÞx ¼Wxþ w: (A8) W and w are represented by a 3� 3 integer matrix and a 3� 1 column matrix, respectively. The point ~x has to be equal to one of the points x in the primitive cell up to lattice translation, for ðW;wÞ to be a space group operation.A.5. Transformation of coordinate system ðP; pÞThe coordinate system of a crystal structure at rest is transformed by a pair of a 3� 3 matrix P and a 3� 1 column matrix p, which is denoted by ðP; pÞ. The transformation matrix P changes a choice of basis vectors as follows ða; b; cÞ ¼ ðas; bs; csÞP; (A9) where ða; b; cÞ and ðas; bs; csÞ are, e.g., the basis vectors of a primitive cell and those of the conventional unit cell, respectively. The transformation matrix doesn’t rotate a crystal in startSearch pure translationsendChoose primitiveThin out pure translationsSearch lattice point group operationsSearch space group operationsTransform primitive cellto conventional unit cellThin out space group operationsIdentify Hall symbolCreate a primitive cellIdentify Wyckoff positionSucceededFailedSucceededFailedFailedSucceededSucceededFailedFailed many times?NoYesTighten toleranceTighten toleranceFailed many times?SucceededFailedNoTighten toleranceYesReconstruction of space group operationsof input unit cell structureIdentify crystallographicpoint group typeFailedSucceededRemoval of distortion from basis vectorsand removal of distortionfrom point coordinatesbasis vectors Primitive cell searchSpace group operation searchIdentification of space group type(a)(b)(c)(d)(e)(f)(g)(i)(k)(j)(l)(m)Finalization(n)(h)(o)Figure A1. Flowchart of algorithm in the spglib code.Sci. Technol. Adv. Mater. Meth. 4 (2024) 12                                                                                                                                             A. TOGO et al.the Cartesian coordinates, but just changes the choices of the basis vectors. The origin shift p gives the vector from the origin of an original coordinate system Os to that of any other coordinate system O, which is written as p ¼ O � Os: (A10) The origin shift does not move the crystal in the Cartesian coordinates, but just change the origin to measure the point coordinates.The point coordinates in the original coordinate system xs and those in the transformed coordinate system x are related by xs ¼ ðP; pÞx ¼ Pxþ p; (A11) where p is given with respect to the original basis vectors. Equivalently, x ¼ P� 1xs � P� 1p: (A12) An illustration is presented in Figure A2. In this case, the following P is applied: P ¼1212 0�1212 00 0 10BB@1CCA: (A13) Appendix B. Crystallographic point groupThe crystallographic point group type (crystal class) is uniquely determined from matrix representations of the rotation parts of the coset representatives [1]. The rotation type is identified using Table B1 with the determinant and trace of W. The crystal class is found comparing the list of numbers of the rotation types with Table B2. Crystal system and Laue class are uniquely assigned from the crystal class.Appendix C. Transformation of matrix representation of space group operationWhen basis vectors ðai; bi; ciÞ are transformed to another basis vectors ðaf ; bf ; cfÞ by a change-of-basis matrix Q as ðaf ; bf ; cfÞ ¼ ðai; bi; ciÞQ; (C1) the matrix representation of the space group operation ðWi;wiÞ is transformed to ðWf ;wfÞ ¼ ðQ� 1WiQ;Q� 1wiÞ: (C2) When transforming space group operations of a primitive cell to those of a non-primitive cell, careful consideration is required. Denote the basis vectors of the primitive and non- primitive cells as ðap; bp; cpÞ and ðanp; bnp; cnpÞ, respectively. A change-of-basis matrix relates them as ðanp; bnp; cnpÞ ¼ ðap; bp; cpÞQ: (C3) We expect Wnp ¼ Q� 1WpQ: (C4) However, when Q breaks the point group symmetry of ðap; bp; cpÞ, Wnp becomes a non-integer matrix. This situation arises when the lattice point group types associated with the basis vectors ðap; bp; cpÞ and ðanp; bnp; cnpÞ of the primitive and non-primitive cells, respectively, are not equivalent.Appendix D. spglib convention of symmetrization of basis vectorsThe spglib code uses specific conventions to idealize crystal structures, which are detailed for each crystal system.D.1. Triclinic(1) The Niggli reduced cell is used for choosing a, b, and c. (2) a is aligned with þx direction of Cartesian coordinates. (3) b is positioned in x � y plane of Cartesian coordinates, ensuring that a� b aligns with þz direction of Cartesian coordinates.D.2. Monoclinic(1) The b axis is taken as the unique axis. (2) α ¼ 90� and γ ¼ 90� (3) 90� < β< 120�. (4) a is aligned with þx direction of Cartesian coordinates. (5) b is aligned with þy direction of Cartesian coordinates. (6) c is positioned in x � z plane of Cartesian coordinates.D.3. Orthorhombic(1) α ¼ β ¼ γ ¼ 90�. (2) a is aligned with þx direction of Cartesian coordinates. (3) b is aligned with þy direction of Cartesian coordinates. (4) c is aligned with þz direction of Cartesian coordinates.asbsabpa = 1/2as + 1/2bsb = −1/2as + 1/2bsOsO p = O − OsFigure A2. Transformation of coordinate system.Table B1. Look-up table to identify the types of the rotation parts of the space group operations from their matrix representations.Type of W –6 –4 –3 –2 –1 1 2 3 4 6trðWÞ –2 –1 0 1 –3 3 –1 0 1 2detðWÞ –1 –1 –1 –1 –1 1 1 1 1 1Sci. Technol. Adv. Mater. Meth. 4 (2024) 13                                                                                                                                             A. TOGO et al.D.4. Tetragonal(1) α ¼ β ¼ γ ¼ 90�. (2) a ¼ b. (3) a is aligned with þx direction of Cartesian coordinates. (4) b is aligned with þy direction of Cartesian coordinates. (5) c is aligned with þz direction of Cartesian coordinates.D.5. Rhombohedral(1) α ¼ β ¼ γ. (2) a ¼ b ¼ c. (3) When projected onto x � y plane in Cartesian coordinates, a, b, and c become axy, bxy, and cxy, respectively, with their angles denoted as αxy, βxy, γxy. (4) The projections of a, b, and c along z-axis in Cartesian coordinates are az, bz, and cz, respectively. (5) axy is oriented along a ray rotated 30� counter-clockwise from the þx direction in Cartesian coordinates, with bxy and cxy positioned at angles of 120� and 240� counter-clockwise from axy, respectively. (6) αxy ¼ βxy ¼ γxy ¼ 120�. (7) axy ¼ bxy ¼ cxy. (8) az ¼ bz ¼ cz.D.6. Hexagonal(1) α ¼ β ¼ 90�. (2) γ ¼ 120�. (3) a ¼ b. (4) a is aligned with þx direction of Cartesian coordinates. (5) b is positioned in x � y plane of Cartesian coordinates. (6) c is aligned with þz direction of Cartesian coordinates.D.7. Cubic(1) α ¼ β ¼ γ ¼ 90�. (2) a ¼ b ¼ c. (3) a is aligned with þx direction of Cartesian coordinates. (4) b is aligned with þy direction of Cartesian coordinates. (5) c is aligned with þz direction of Cartesian coordinates.Appendix E. Transformation of origin shift by space group operationWhen considering a space group operation ðW;wÞ as a transformation of the coordinate system, as detailed in Appendix Table B2. Look-up table of crystal class with the numbers of rotation types.Crystal Crystal Laue Numbers of types of Wsystem class class –6 –4 –3 –2 –1 1 2 3 4 6Triclinic 1 �1 0 0 0 0 0 1 0 0 0 0�1 0 0 0 0 1 1 0 0 0 0Monoclinic 2 2=m 0 0 0 0 0 1 1 0 0 0m 0 0 0 1 0 1 0 0 0 02=m 0 0 0 1 1 1 1 0 0 0Orthorhombic 222 mmm 0 0 0 0 0 1 3 0 0 0mm2 0 0 0 2 0 1 1 0 0 0mmm 0 0 0 3 1 1 3 0 0 0Tetragonal 4 4=m 0 0 0 0 0 1 1 0 2 0�4 0 2 0 0 0 1 1 0 0 04=m 0 2 0 1 1 1 1 0 2 0422 4=mmm 0 0 0 0 0 1 5 0 2 04mm 0 0 0 4 0 1 1 0 2 0�42m 0 2 0 2 0 1 3 0 0 04=mmm 0 2 0 5 1 1 5 0 2 0Trigonal 3 �3 0 0 0 0 0 1 0 2 0 0�3 0 0 2 0 1 1 0 2 0 032 �3m 0 0 0 0 0 1 3 2 0 03m 0 0 0 3 0 1 0 2 0 0�3m 0 0 2 3 1 1 3 2 0 0Hexagonal 6 6=m 0 0 0 0 0 1 1 2 0 2�6 2 0 0 1 0 1 0 2 0 06=m 2 0 2 1 1 1 1 2 0 2622 6=mmm 0 0 0 0 0 1 7 2 0 26mm 0 0 0 6 0 1 1 2 0 2�62m 2 0 0 4 0 1 3 2 0 06=mmm 2 0 2 7 1 1 7 2 0 2Cubic 23 m�3 0 0 0 0 0 1 3 8 0 0m�3 0 0 8 3 1 1 3 8 0 0432 m�3m 0 0 0 0 0 1 9 8 6 0�43m 0 6 0 6 0 1 3 8 0 0m�3m 0 6 8 9 1 1 9 8 6 0Sci. Technol. Adv. Mater. Meth. 4 (2024) 14                                                                                                                                             A. TOGO et al.A.5, the new point coordinates xnew are related to the original point coordinates xorig through Equation (A11) by xorig ¼ ðW;wÞxnew: (E1) By definition (A9), ðanew; bnew; cnewÞ ¼ ðaorig; borig; corigÞW: (E2) Due to the space group operation ðW;wÞ, the sets of point coordinates in the original and new coordinate systems are equal up to lattice translation, fxnewg ¼ fxorigg ðmod ZÞ: (E3) Consequently, the same set of matrix representations for the elements of ðW;wÞf g is applicable to xnewf g.An origin shift from the original coordinate system is represented in the new coordinate system as follows. Considering an origin shift ðI; pÞ with respect to the original coordinate system, the point coordinates xp after this origin shift are related to xorig by xorig ¼ ðI; pÞxp: (E4) From Equations. (E1) and (E4), xnew and xp are related as xnew ¼ ðW;wÞ� 1ðI; pÞxp ¼ ðW� 1; � W� 1wÞðI; pÞxp: (E5) Viewed from the new coordinate system, The origin shift pnew is determined by setting xp ¼ 0, pnew ¼ ðW� 1; � W� 1wÞp ¼W� 1ðp � wÞ: (E6) Sci. Technol. Adv. Mater. Meth. 4 (2024) 15                                                                                                                                             A. TOGO et al. Abstract Abstract 1. Introduction 2. Tolerance parameter in crystal symmetry operation search 2.1. Lattice translation to a point near origin 2.2. Determination of equivalent points under lattice periodicity 2.3. Examination of a symmetry operation 3. Machine precision issue 4. Primitive cell search 4.1. Step (a): Searching pure translation operations 4.2. Step (b): Choosing basis vectors of primitive cell 4.3. Step (c): Failure of finding primitive cell basis vectors 4.4. Step (d): Thinning out pure translations 4.5. Step (e): Creating a primitive cell 5. Space group operation search 5.1. Step (f): Searching lattice point group operations 5.2. Step (g): Searching space group operations 6. Identification of space group type 6.1. Step (h): Identify crystallographic point group 6.2. Step (i): Transformation from primitive cell to conventional unit cell 6.3. Step (j): Identification of hall symbol 6.4. Step (k): Failure of identification of space group type 6.5. Step (l): Thinning out space group operations 7. Finalization 7.1. Step (m): Removal of distortion from basis vectors 7.2. Step (n): Reconstruction of matrix representations of space group operations of input unit cell 7.3. Step (o): Removal of distortion from point coordinates and determination of Wyckoff positions 8. Summary Disclosure statement Funding References Appendix A. Notations and conventions Appendix B. Crystallographic point group Appendix C. Transformation of matrix representation of space group operation Appendix D. spglib convention of symmetrization of basis vectors Appendix E. Transformation of origin shift by space group operation