static PyObject * get_spacegroup_type(PyObject *self, PyObject *args) { int n, hall_number; PyObject *array; SpglibSpacegroupType symbols; if (!PyArg_ParseTuple(args, "i",&hall_number)) { return NULL; } symbols = spg_get_spacegroup_type(hall_number); array = PyList_New(5); n = 0; PyList_SetItem(array, n, PYUNICODE_FROMSTRING(symbols.schoenflies)); n++; PyList_SetItem(array, n, PYUNICODE_FROMSTRING(symbols.hall_symbol)); n++; PyList_SetItem(array, n, PYUNICODE_FROMSTRING(symbols.international)); n++; PyList_SetItem(array, n, PYUNICODE_FROMSTRING(symbols.international_full)); n++; PyList_SetItem(array, n, PYUNICODE_FROMSTRING(symbols.international_short)); n++; return array; }
static int test_spg_get_spacegroup_type(void) { SpglibSpacegroupType spgtype; spgtype = spg_get_spacegroup_type(446); printf("*** spg_get_spacegroup_type ***:\n"); if (spgtype.number) { show_spacegroup_type(spgtype); return 0; } else { return 1; } }
static int test_spg_get_spacegroup_type(void) { SpglibSpacegroupType spgtype; spgtype = spg_get_spacegroup_type(446); printf("*** spg_get_spacegroup_type ***:\n"); printf("Number: %d\n", spgtype.number); printf("Schoenflies: %s\n", spgtype.schoenflies); printf("International: %s\n", spgtype.international); printf("International: %s\n", spgtype.international_full); printf("International: %s\n", spgtype.international_short); printf("Hall symbol: %s\n", spgtype.hall_symbol); return 0; }
static int test_spg_get_hall_number_from_symmetry(void) { double lattice[3][3] = {{4, 0, 0}, {0, 4, 0}, {0, 0, 4}}; double position[][3] = { {0, 0, 0}, {0.5, 0.5, 0.5} }; int types[] = {1, 1}; int num_atom = 2; double symprec = 1e-5; int hall_number; SpglibSpacegroupType spgtype; SpglibDataset *dataset; printf("*** spg_get_hall_number_from_symmetry ***:\n"); if ((dataset = spg_get_dataset(lattice, position, types, num_atom, symprec)) == NULL) { return 0; } printf("hall_number = %d is found by spg_get_dataset.\n", dataset->hall_number); hall_number = spg_get_hall_number_from_symmetry(dataset->rotations, dataset->translations, dataset->n_operations, symprec); printf("hall_number = %d is found by spg_get_hall_number_from_symmetry.\n", hall_number); if (hall_number == dataset->hall_number) { spgtype = spg_get_spacegroup_type(hall_number); if (spgtype.number) { show_spacegroup_type(spgtype); return 0; } else { return 1; } } else { return 0; } }