static PyObject * refine_cell(PyObject *self, PyObject *args) { int num_atom; double symprec, angle_tolerance; PyArrayObject* lattice; PyArrayObject* position; PyArrayObject* atom_type; if (!PyArg_ParseTuple(args, "OOOidd", &lattice, &position, &atom_type, &num_atom, &symprec, &angle_tolerance)) { return NULL; } double (*lat)[3] = (double(*)[3])PyArray_DATA(lattice); SPGCONST double (*pos)[3] = (double(*)[3])PyArray_DATA(position); int* typat = (int*)PyArray_DATA(atom_type); int num_atom_std = spgat_refine_cell(lat, pos, typat, num_atom, symprec, angle_tolerance); return PyLong_FromLong((long) num_atom_std); }
static PyObject * refine_cell(PyObject *self, PyObject *args) { int i, num_atom; double symprec, angle_tolerance; PyArrayObject* lattice; PyArrayObject* position; PyArrayObject* atom_type; if (!PyArg_ParseTuple(args, "OOOidd", &lattice, &position, &atom_type, &num_atom, &symprec, &angle_tolerance)) { return NULL; } double (*lat)[3] = (double(*)[3])lattice->data; SPGCONST double (*pos)[3] = (double(*)[3])position->data; long* typat_long = (long*)atom_type->data; int typat[atom_type->dimensions[0]]; for (i = 0; i < num_atom; i++) { typat[i] = (int)typat_long[i]; } int num_atom_brv = spgat_refine_cell(lat, pos, typat, num_atom, symprec, angle_tolerance); for (i = 0; i < num_atom_brv; i++) { typat_long[i] = typat[i]; } return PyInt_FromLong((long) num_atom_brv); }