예제 #1
0
파일: test.c 프로젝트: dlonie/XtalComp
static int test_spg_get_symmetry_from_database(void)
{
  int rotations[192][3][3];
  double translations[192][3];
  int i, j, size;
  
  size = spg_get_symmetry_from_database(rotations,
					translations,
					460);
  
  if (size) {
    printf("*** spg_get_symmetry_from_database ***:\n");
    for (i = 0; i < size; i++) {
      printf("--- %d ---\n", i + 1);
      for (j = 0; j < 3; j++) {
	printf("%2d %2d %2d\n",
	       rotations[i][j][0], rotations[i][j][1], rotations[i][j][2]);
      }
      printf("%f %f %f\n",
	     translations[i][0], translations[i][1], translations[i][2]);
    }
    return 0;
  } else {
    return 1;
  }
}
예제 #2
0
static PyObject * get_symmetry_from_database(PyObject *self, PyObject *args)
{
  int hall_number;
  PyArrayObject* rotation;
  PyArrayObject* translation;
  if (!PyArg_ParseTuple(args, "iOO",
      &hall_number,
      &rotation,
      &translation)) {
    return NULL;
  }

  int (*rot)[3][3] = (int(*)[3][3])PyArray_DATA(rotation);
  double (*trans)[3] = (double(*)[3])PyArray_DATA(translation);

  const int num_sym = spg_get_symmetry_from_database(rot, trans, hall_number);

  return PyLong_FromLong((long) num_sym);
}