Exemplo n.º 1
0
///
/// @par Detailed description
/// ...
/// @param [in, out] (param1) ...
/// @return ...
/// @note ...
void
sasio::Files::
read_dcd(std::string &dcd_input_file_name)
{

    int input_natoms, input_nset, input_reverseEndian ;
    FILE *dcd_file_pointer ;

    dcd_file_pointer = sasio::open_dcd_read(dcd_input_file_name, input_natoms, input_nset, input_reverseEndian) ;

    int input_frame = 0 ;

    _number_of_frames() = 0 ;

    _x().setZero(_natoms(), input_nset);
    _y().setZero(_natoms(), input_nset);
    _z().setZero(_natoms(), input_nset);

    std::cout << "_x().cols() = " << _x().cols() << std::endl ;
    std::cout << "input_nset = " << input_nset << std::endl ;

    for(int i = 0 ; i < input_nset ; ++i)
    {
        std::cout << "." ;
        read_dcd_step(dcd_file_pointer, i, input_natoms, input_reverseEndian) ;
    }

    int result = close_dcd_read(dcd_file_pointer) ;

    std::cout << std::endl ;

    return ;
}
Exemplo n.º 2
0
static void close_file_read(void *v) {
  dcdhandle *dcd = (dcdhandle *)v;
  close_dcd_read(dcd->freeind, dcd->fixedcoords);
  fio_fclose(dcd->fd);
  free(dcd->x);
  free(dcd->y);
  free(dcd->z);
  free(dcd); 
}
Exemplo n.º 3
0
static PyObject *
__finish_dcd_read(PyObject *self, PyObject *args)
{
  PyObject* temp;
  dcdhandle *dcd;

  if (! self) {
    /* we were in fact called as a module function, try to retrieve
       a matching object from args */
    if( !PyArg_ParseTuple(args, "O", &self) )
      return NULL;
  } else {
    /* we were obviously called as an object method so args should
       only have the int value. */
    if( !PyArg_ParseTuple(args, "") )
      return NULL;
  }

  if ( !PyObject_HasAttrString(self, "_dcd_C_ptr") ) {
    // Raise exception
    PyErr_SetString(PyExc_AttributeError, "_dcd_C_ptr is not an attribute");
    return NULL;
  }

  if ((temp = PyObject_GetAttrString(self, "_dcd_C_ptr")) == NULL) { // This gives me a New Reference
    // Raise exception
    PyErr_SetString(PyExc_AttributeError, "_dcd_C_ptr is not an attribute");
    return NULL;
  }

  dcd = (dcdhandle*)PyCObject_AsVoidPtr(temp);

  close_dcd_read(dcd->freeind, dcd->fixedcoords);
  free(dcd);
  Py_DECREF(temp);
  Py_INCREF(Py_None);
  return Py_None;
}