static PyObject * find_primitive(PyObject *self, PyObject *args) { double symprec, angle_tolerance; PyArrayObject* lattice; PyArrayObject* position; PyArrayObject* atom_type; if (!PyArg_ParseTuple(args, "OOOdd", &lattice, &position, &atom_type, &symprec, &angle_tolerance)) { return NULL; } double (*lat)[3] = (double(*)[3])lattice->data; double (*pos)[3] = (double(*)[3])position->data; int num_atom = position->dimensions[0]; int* types = (int*)atom_type->data; int num_atom_prim = spgat_find_primitive(lat, pos, types, num_atom, symprec, angle_tolerance); return PyInt_FromLong((long) num_atom_prim); }
static PyObject * find_primitive(PyObject *self, PyObject *args) { double symprec, angle_tolerance; PyArrayObject* lattice; PyArrayObject* position; PyArrayObject* atom_type; if (!PyArg_ParseTuple(args, "OOOdd", &lattice, &position, &atom_type, &symprec, &angle_tolerance)) { return NULL; } double (*lat)[3] = (double(*)[3])PyArray_DATA(lattice); double (*pos)[3] = (double(*)[3])PyArray_DATA(position); int num_atom = PyArray_DIMS(position)[0]; int* types = (int*)PyArray_DATA(atom_type); int num_atom_prim = spgat_find_primitive(lat, pos, types, num_atom, symprec, angle_tolerance); return PyLong_FromLong((long) num_atom_prim); }
static PyObject * find_primitive(PyObject *self, PyObject *args) { int i; double symprec, angle_tolerance; PyArrayObject* lattice; PyArrayObject* position; PyArrayObject* atom_type; if (!PyArg_ParseTuple(args, "OOOdd", &lattice, &position, &atom_type, &symprec, &angle_tolerance)) { return NULL; } double (*lat)[3] = (double(*)[3])lattice->data; double (*pos)[3] = (double(*)[3])position->data; int num_atom = position->dimensions[0]; long* types_long = (long*)atom_type->data; int types[num_atom]; for (i = 0; i < num_atom; i++) { types[i] = (int)types_long[i]; } int num_atom_prim = spgat_find_primitive(lat, pos, types, num_atom, symprec, angle_tolerance); for (i = 0; i < num_atom_prim; i++) { types_long[i] = types[i]; } return PyInt_FromLong((long) num_atom_prim); }