Example #1
0
static PyObject * standardize_cell(PyObject *self, PyObject *args)
{
  int num_atom, to_primitive, no_idealize;
  double symprec, angle_tolerance;
  PyArrayObject* lattice;
  PyArrayObject* position;
  PyArrayObject* atom_type;
  if (!PyArg_ParseTuple(args, "OOOiiidd",
			&lattice,
			&position,
			&atom_type,
			&num_atom,
			&to_primitive,
			&no_idealize,
			&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_standardize_cell(lat,
					    pos,
					    typat,
					    num_atom,
					    to_primitive,
					    no_idealize,
					    symprec,
					    angle_tolerance);

  return PyLong_FromLong((long) num_atom_std);
}
Example #2
0
File: spglib.c Project: nfh/phonopy
/* Return 0 if failed */
int spg_standardize_cell(double lattice[3][3],
			 double position[][3],
			 int types[],
			 const int num_atom,
			 const int to_primitive,
			 const int no_idealize,
			 const double symprec)
{
  return spgat_standardize_cell(lattice,
				position,
				types,
				num_atom,
				to_primitive,
				no_idealize,
				symprec,
				-1.0);
}