/* Retrun pointgroup.number = 0 if failed */ Pointgroup ptg_get_transformation_matrix(int transform_mat[3][3], SPGCONST int rotations[][3][3], const int num_rotations) { int i, j, pg_num; int axes[3]; PointSymmetry pointsym; Pointgroup pointgroup; debug_print("ptg_get_transformation_matrix:\n"); for (i = 0; i < 3; i++) { for (j = 0; j < 3; j++) { transform_mat[i][j] = 0; } } pg_num = get_pointgroup_number_by_rotations(rotations, num_rotations); if (pg_num > 0) { pointgroup = ptg_get_pointgroup(pg_num); pointsym = ptg_get_pointsymmetry(rotations, num_rotations); get_axes(axes, pointgroup.laue, &pointsym); set_transformation_matrix(transform_mat, axes); } else { pointgroup = ptg_get_pointgroup(0); } return pointgroup; }
static int get_pointgroup_number_by_rotations(SPGCONST int rotations[][3][3], const int num_rotations) { PointSymmetry pointsym; pointsym = ptg_get_pointsymmetry(rotations, num_rotations); return get_pointgroup_number(&pointsym); }
/* Return spacegroup.number = 0 if failed */ static Spacegroup search_spacegroup(SPGCONST Cell * primitive, const int candidates[], const int num_candidates, const double symprec) { int hall_number; double conv_lattice[3][3]; double origin_shift[3]; Spacegroup spacegroup; Symmetry *symmetry; PointSymmetry pointsym; debug_print("search_spacegroup (tolerance = %f):\n", symprec); symmetry = NULL; hall_number = 0; spacegroup.number = 0; if ((symmetry = sym_get_operation(primitive, symprec)) == NULL) { goto ret; } pointsym = ptg_get_pointsymmetry(symmetry->rot, symmetry->size); if (pointsym.size < symmetry->size) { warning_print("spglib: Point symmetry of primitive cell is broken. "); warning_print("(line %d, %s).\n", __LINE__, __FILE__); sym_free_symmetry(symmetry); symmetry = NULL; goto ret; } hall_number = iterative_search_hall_number(origin_shift, conv_lattice, candidates, num_candidates, primitive, symmetry, symprec); sym_free_symmetry(symmetry); symmetry = NULL; spacegroup = get_spacegroup(hall_number, origin_shift, conv_lattice); ret: return spacegroup; }