コード例 #1
0
ファイル: _spglib.c プロジェクト: CarstenTUBT/spglib
static PyObject * get_grid_points_by_rotations(PyObject *self, PyObject *args)
{
  PyArrayObject* rot_grid_points_py;
  PyArrayObject* address_orig_py;
  PyArrayObject* rot_reciprocal_py;
  PyArrayObject* mesh_py;
  PyArrayObject* is_shift_py;
  if (!PyArg_ParseTuple(args, "OOOOO",
			&rot_grid_points_py,
			&address_orig_py,
			&rot_reciprocal_py,
			&mesh_py,
			&is_shift_py)) {
    return NULL;
  }

  int *rot_grid_points = (int*)PyArray_DATA(rot_grid_points_py);
  const int *address_orig = (int*)PyArray_DATA(address_orig_py);
  SPGCONST int (*rot_reciprocal)[3][3] = (int(*)[3][3])PyArray_DATA(rot_reciprocal_py);
  const int num_rot = PyArray_DIMS(rot_reciprocal_py)[0];
  const int* mesh = (int*)PyArray_DATA(mesh_py);
  const int* is_shift = (int*)PyArray_DATA(is_shift_py);

  spg_get_grid_points_by_rotations(rot_grid_points,
				   address_orig,
				   num_rot,
				   rot_reciprocal,
				   mesh,
				   is_shift);
  Py_RETURN_NONE;
}
コード例 #2
0
ファイル: _spglib.c プロジェクト: arbegla/phonopy
static PyObject * get_grid_points_by_rotations(PyObject *self, PyObject *args)
{
  PyArrayObject* rot_grid_points_py;
  PyArrayObject* rot_reciprocal_py;
  PyArrayObject* mesh_py;
  PyArrayObject* is_shift_py;
  int grid_point;
  if (!PyArg_ParseTuple(args, "OiOOO",
			&rot_grid_points_py,
			&grid_point,
			&rot_reciprocal_py,
			&mesh_py,
			&is_shift_py)) {
    return NULL;
  }

  int *rot_grid_points = (int*)rot_grid_points_py->data;
  SPGCONST int (*rot_reciprocal)[3][3] = (int(*)[3][3])rot_reciprocal_py->data;
  const int num_rot = rot_reciprocal_py->dimensions[0];
  const int* mesh = (int*)mesh_py->data;
  const int* is_shift = (int*)is_shift_py->data;
  
  spg_get_grid_points_by_rotations(rot_grid_points,
				   grid_point,
				   num_rot,
				   rot_reciprocal,
				   mesh,
				   is_shift);
  Py_RETURN_NONE;
}