/* Generated by Pyrex 0.9.9 on Fri Jul 30 16:19:42 2010 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "structmember.h"
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)	PyInt_AsLong(o)
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#include <math.h>
#include "arrayobject.h"
#include "math.h"


typedef struct {PyObject **p; int i; char *s; long n;} __Pyx_StringTabEntry; /*proto*/

static PyObject *__pyx_m;
static PyObject *__pyx_b;
static int __pyx_lineno;
static char *__pyx_filename;
static char **__pyx_f;

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name); /*proto*/

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/

static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size);  /*proto*/

static PyObject *__Pyx_ImportModule(char *name); /*proto*/

static void __Pyx_AddTraceback(char *funcname); /*proto*/

/* Declarations from distance_histogram_pyrex */


/* Declarations from implementation of distance_histogram_pyrex */

static PyTypeObject *__pyx_ptype_24distance_histogram_pyrex_array_type = 0;




static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {0, 0, 0, 0}
};



/* Implementation of distance_histogram_pyrex */

static PyObject *__pyx_f_24distance_histogram_pyrex_distance_histogram_pyrex(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_24distance_histogram_pyrex_distance_histogram_pyrex(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_configuration = 0;
  PyArrayObject *__pyx_v_directCell = 0;
  PyArrayObject *__pyx_v_reverseCell = 0;
  PyArrayObject *__pyx_v_indexes = 0;
  PyArrayObject *__pyx_v_molecules = 0;
  PyArrayObject *__pyx_v_elements = 0;
  PyArrayObject *__pyx_v_histintra = 0;
  PyArrayObject *__pyx_v_histinter = 0;
  PyArrayObject *__pyx_v_scalec = 0;
  double __pyx_v_rmin;
  double __pyx_v_dr;
  int *__pyx_v_atomindex;
  int *__pyx_v_molindex;
  int *__pyx_v_elementindex;
  double *__pyx_v_config;
  double *__pyx_v_cell;
  double *__pyx_v_rcell;
  double *__pyx_v_scaleconfig;
  float *__pyx_v_hintra;
  float *__pyx_v_hinter;
  double __pyx_v_x;
  double __pyx_v_y;
  double __pyx_v_z;
  double __pyx_v_sdx;
  double __pyx_v_sdy;
  double __pyx_v_sdz;
  double __pyx_v_rx;
  double __pyx_v_ry;
  double __pyx_v_rz;
  double __pyx_v_r;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_ind;
  int __pyx_v_indi;
  int __pyx_v_indj;
  int __pyx_v_bin;
  int __pyx_v_hindex;
  int __pyx_v_dimjk;
  int __pyx_v_dimk;
  int __pyx_v_nbins;
  PyObject *__pyx_v_sx;
  PyObject *__pyx_v_sy;
  PyObject *__pyx_v_sz;
  PyObject *__pyx_r;
  int __pyx_1;
  long __pyx_2;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  double __pyx_5;
  int __pyx_6;
  static char *__pyx_argnames[] = {"configuration","directCell","reverseCell","indexes","molecules","elements","histintra","histinter","scalec","rmin","dr",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOOOOOOOdd", __pyx_argnames, &__pyx_v_configuration, &__pyx_v_directCell, &__pyx_v_reverseCell, &__pyx_v_indexes, &__pyx_v_molecules, &__pyx_v_elements, &__pyx_v_histintra, &__pyx_v_histinter, &__pyx_v_scalec, &__pyx_v_rmin, &__pyx_v_dr)) return 0;
  Py_INCREF(__pyx_v_configuration);
  Py_INCREF(__pyx_v_directCell);
  Py_INCREF(__pyx_v_reverseCell);
  Py_INCREF(__pyx_v_indexes);
  Py_INCREF(__pyx_v_molecules);
  Py_INCREF(__pyx_v_elements);
  Py_INCREF(__pyx_v_histintra);
  Py_INCREF(__pyx_v_histinter);
  Py_INCREF(__pyx_v_scalec);
  __pyx_v_sx = Py_None; Py_INCREF(Py_None);
  __pyx_v_sy = Py_None; Py_INCREF(Py_None);
  __pyx_v_sz = Py_None; Py_INCREF(Py_None);
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_configuration), __pyx_ptype_24distance_histogram_pyrex_array_type, 1, "configuration")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_directCell), __pyx_ptype_24distance_histogram_pyrex_array_type, 1, "directCell")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_reverseCell), __pyx_ptype_24distance_histogram_pyrex_array_type, 1, "reverseCell")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1;}
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexes), __pyx_ptype_24distance_histogram_pyrex_array_type, 1, "indexes")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; goto __pyx_L1;}
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_molecules), __pyx_ptype_24distance_histogram_pyrex_array_type, 1, "molecules")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; goto __pyx_L1;}
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elements), __pyx_ptype_24distance_histogram_pyrex_array_type, 1, "elements")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; goto __pyx_L1;}
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_histintra), __pyx_ptype_24distance_histogram_pyrex_array_type, 1, "histintra")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; goto __pyx_L1;}
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_histinter), __pyx_ptype_24distance_histogram_pyrex_array_type, 1, "histinter")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; goto __pyx_L1;}
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_scalec), __pyx_ptype_24distance_histogram_pyrex_array_type, 1, "scalec")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;}

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":34 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  if (!(__pyx_v_configuration->nd == 2)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; goto __pyx_L1;}
  }
  #endif

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":35 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  if (!(__pyx_v_directCell->nd == 1)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; goto __pyx_L1;}
  }
  #endif

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":36 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  if (!(__pyx_v_reverseCell->nd == 1)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; goto __pyx_L1;}
  }
  #endif

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":37 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  if (!(__pyx_v_indexes->nd == 1)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; goto __pyx_L1;}
  }
  #endif

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":38 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  if (!(__pyx_v_molecules->nd == 1)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
  }
  #endif

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":39 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  if (!(__pyx_v_elements->nd == 1)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
  }
  #endif

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":40 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  if (!(__pyx_v_histintra->nd == 3)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; goto __pyx_L1;}
  }
  #endif

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":41 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  if (!(__pyx_v_histinter->nd == 3)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; goto __pyx_L1;}
  }
  #endif

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":42 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  if (!(__pyx_v_scalec->nd == 1)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; goto __pyx_L1;}
  }
  #endif

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":45 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  if (!(__pyx_v_configuration->descr->type_num == PyArray_DOUBLE)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; goto __pyx_L1;}
  }
  #endif

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":46 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  if (!(__pyx_v_directCell->descr->type_num == PyArray_DOUBLE)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; goto __pyx_L1;}
  }
  #endif

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":47 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  if (!(__pyx_v_reverseCell->descr->type_num == PyArray_DOUBLE)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; goto __pyx_L1;}
  }
  #endif

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":48 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  if (!(__pyx_v_scalec->descr->type_num == PyArray_DOUBLE)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; goto __pyx_L1;}
  }
  #endif

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":50 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  __pyx_1 = (__pyx_v_indexes->descr->type_num == PyArray_INT);
  if (!__pyx_1) {
    __pyx_1 = (__pyx_v_indexes->descr->type_num == PyArray_LONG);
  }
  if (__pyx_1) {
    __pyx_1 = (__pyx_v_indexes->descr->elsize == (sizeof(int)));
  }
  if (!__pyx_1) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
  }
  #endif

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":53 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  __pyx_1 = (__pyx_v_molecules->descr->type_num == PyArray_INT);
  if (!__pyx_1) {
    __pyx_1 = (__pyx_v_molecules->descr->type_num == PyArray_LONG);
  }
  if (__pyx_1) {
    __pyx_1 = (__pyx_v_molecules->descr->elsize == (sizeof(int)));
  }
  if (!__pyx_1) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
  }
  #endif

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":56 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  __pyx_1 = (__pyx_v_elements->descr->type_num == PyArray_INT);
  if (!__pyx_1) {
    __pyx_1 = (__pyx_v_elements->descr->type_num == PyArray_LONG);
  }
  if (__pyx_1) {
    __pyx_1 = (__pyx_v_elements->descr->elsize == (sizeof(int)));
  }
  if (!__pyx_1) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; goto __pyx_L1;}
  }
  #endif

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":59 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  if (!(__pyx_v_histintra->descr->type_num == PyArray_FLOAT)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
  }
  #endif

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":60 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  if (!(__pyx_v_histinter->descr->type_num == PyArray_FLOAT)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
  }
  #endif

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":62 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  if (!((__pyx_v_histinter->dimensions[0]) == (__pyx_v_histintra->dimensions[0]))) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
  }
  #endif

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":63 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  if (!((__pyx_v_histinter->dimensions[1]) == (__pyx_v_histintra->dimensions[1]))) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
  }
  #endif

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":64 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  if (!((__pyx_v_histinter->dimensions[2]) == (__pyx_v_histintra->dimensions[2]))) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; goto __pyx_L1;}
  }
  #endif

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":66 */
  __pyx_v_nbins = (__pyx_v_histinter->dimensions[2]);

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":68 */
  __pyx_v_config = ((double *)__pyx_v_configuration->data);

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":69 */
  __pyx_v_cell = ((double *)__pyx_v_directCell->data);

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":70 */
  __pyx_v_rcell = ((double *)__pyx_v_reverseCell->data);

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":71 */
  __pyx_v_atomindex = ((int *)__pyx_v_indexes->data);

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":72 */
  __pyx_v_molindex = ((int *)__pyx_v_molecules->data);

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":73 */
  __pyx_v_elementindex = ((int *)__pyx_v_elements->data);

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":74 */
  __pyx_v_hintra = ((float *)__pyx_v_histintra->data);

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":75 */
  __pyx_v_hinter = ((float *)__pyx_v_histinter->data);

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":76 */
  __pyx_v_scaleconfig = ((double *)__pyx_v_scalec->data);

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":78 */
  __pyx_1 = (__pyx_v_indexes->dimensions[0]);
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_1; ++__pyx_v_i) {

    /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":80 */
    __pyx_v_ind = (3 * (__pyx_v_atomindex[__pyx_v_i]));

    /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":82 */
    __pyx_v_x = (__pyx_v_config[__pyx_v_ind]);

    /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":83 */
    __pyx_v_y = (__pyx_v_config[(__pyx_v_ind + 1)]);

    /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":84 */
    __pyx_v_z = (__pyx_v_config[(__pyx_v_ind + 2)]);

    /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":86 */
    __pyx_v_ind = (3 * __pyx_v_i);

    /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":88 */
    (__pyx_v_scaleconfig[__pyx_v_ind]) = (((__pyx_v_x * (__pyx_v_rcell[0])) + (__pyx_v_y * (__pyx_v_rcell[3]))) + (__pyx_v_z * (__pyx_v_rcell[6])));

    /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":89 */
    (__pyx_v_scaleconfig[(__pyx_v_ind + 1)]) = (((__pyx_v_x * (__pyx_v_rcell[1])) + (__pyx_v_y * (__pyx_v_rcell[4]))) + (__pyx_v_z * (__pyx_v_rcell[7])));

    /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":90 */
    (__pyx_v_scaleconfig[(__pyx_v_ind + 2)]) = (((__pyx_v_x * (__pyx_v_rcell[2])) + (__pyx_v_y * (__pyx_v_rcell[5]))) + (__pyx_v_z * (__pyx_v_rcell[8])));
  }

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":92 */
  __pyx_v_dimjk = ((__pyx_v_histinter->dimensions[1]) * (__pyx_v_histinter->dimensions[2]));

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":93 */
  __pyx_v_dimk = (__pyx_v_histinter->dimensions[2]);

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":95 */
  __pyx_2 = ((__pyx_v_indexes->dimensions[0]) - 1);
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_2; ++__pyx_v_i) {

    /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":97 */
    __pyx_v_indi = (3 * __pyx_v_i);

    /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":99 */
    __pyx_3 = PyFloat_FromDouble((__pyx_v_scaleconfig[__pyx_v_indi])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
    Py_DECREF(__pyx_v_sx);
    __pyx_v_sx = __pyx_3;
    __pyx_3 = 0;

    /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":100 */
    __pyx_3 = PyFloat_FromDouble((__pyx_v_scaleconfig[(__pyx_v_indi + 1)])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; goto __pyx_L1;}
    Py_DECREF(__pyx_v_sy);
    __pyx_v_sy = __pyx_3;
    __pyx_3 = 0;

    /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":101 */
    __pyx_3 = PyFloat_FromDouble((__pyx_v_scaleconfig[(__pyx_v_indi + 2)])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L1;}
    Py_DECREF(__pyx_v_sz);
    __pyx_v_sz = __pyx_3;
    __pyx_3 = 0;

    /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":103 */
    __pyx_1 = (__pyx_v_indexes->dimensions[0]);
    for (__pyx_v_j = (__pyx_v_i + 1); __pyx_v_j < __pyx_1; ++__pyx_v_j) {

      /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":105 */
      __pyx_v_indj = (3 * __pyx_v_j);

      /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":107 */
      __pyx_3 = PyFloat_FromDouble((__pyx_v_scaleconfig[__pyx_v_indj])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;}
      __pyx_4 = PyNumber_Subtract(__pyx_3, __pyx_v_sx); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __pyx_5 = PyFloat_AsDouble(__pyx_4); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;}
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      __pyx_v_sdx = __pyx_5;

      /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":108 */
      __pyx_3 = PyFloat_FromDouble((__pyx_v_scaleconfig[(__pyx_v_indj + 1)])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
      __pyx_4 = PyNumber_Subtract(__pyx_3, __pyx_v_sy); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __pyx_5 = PyFloat_AsDouble(__pyx_4); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      __pyx_v_sdy = __pyx_5;

      /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":109 */
      __pyx_3 = PyFloat_FromDouble((__pyx_v_scaleconfig[(__pyx_v_indj + 2)])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;}
      __pyx_4 = PyNumber_Subtract(__pyx_3, __pyx_v_sz); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __pyx_5 = PyFloat_AsDouble(__pyx_4); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;}
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      __pyx_v_sdz = __pyx_5;

      /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":111 */
      __pyx_v_sdx -= round(__pyx_v_sdx);

      /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":112 */
      __pyx_v_sdy -= round(__pyx_v_sdy);

      /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":113 */
      __pyx_v_sdz -= round(__pyx_v_sdz);

      /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":115 */
      __pyx_v_rx = (((__pyx_v_sdx * (__pyx_v_cell[0])) + (__pyx_v_sdy * (__pyx_v_cell[3]))) + (__pyx_v_sdz * (__pyx_v_cell[6])));

      /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":116 */
      __pyx_v_ry = (((__pyx_v_sdx * (__pyx_v_cell[1])) + (__pyx_v_sdy * (__pyx_v_cell[4]))) + (__pyx_v_sdz * (__pyx_v_cell[7])));

      /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":117 */
      __pyx_v_rz = (((__pyx_v_sdx * (__pyx_v_cell[2])) + (__pyx_v_sdy * (__pyx_v_cell[5]))) + (__pyx_v_sdz * (__pyx_v_cell[8])));

      /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":119 */
      __pyx_v_r = sqrt((((__pyx_v_rx * __pyx_v_rx) + (__pyx_v_ry * __pyx_v_ry)) + (__pyx_v_rz * __pyx_v_rz)));

      /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":121 */
      __pyx_v_bin = ((int)((__pyx_v_r - __pyx_v_rmin) / __pyx_v_dr));

      /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":123 */
      __pyx_6 = (__pyx_v_bin < 0);
      if (!__pyx_6) {
        __pyx_6 = (__pyx_v_bin >= __pyx_v_nbins);
      }
      if (__pyx_6) {
        goto __pyx_L6;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":126 */
      __pyx_v_hindex = ((((__pyx_v_elementindex[__pyx_v_i]) * __pyx_v_dimjk) + ((__pyx_v_elementindex[__pyx_v_j]) * __pyx_v_dimk)) + __pyx_v_bin);

      /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":128 */
      __pyx_6 = ((__pyx_v_molindex[__pyx_v_i]) == (__pyx_v_molindex[__pyx_v_j]));
      if (__pyx_6) {
        (__pyx_v_hintra[__pyx_v_hindex]) += 1.0;
        goto __pyx_L9;
      }
      /*else*/ {
        (__pyx_v_hinter[__pyx_v_hindex]) += 1.0;
      }
      __pyx_L9:;
      __pyx_L6:;
    }
  }

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("distance_histogram_pyrex.distance_histogram_pyrex");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_sx);
  Py_DECREF(__pyx_v_sy);
  Py_DECREF(__pyx_v_sz);
  Py_DECREF(__pyx_v_configuration);
  Py_DECREF(__pyx_v_directCell);
  Py_DECREF(__pyx_v_reverseCell);
  Py_DECREF(__pyx_v_indexes);
  Py_DECREF(__pyx_v_molecules);
  Py_DECREF(__pyx_v_elements);
  Py_DECREF(__pyx_v_histintra);
  Py_DECREF(__pyx_v_histinter);
  Py_DECREF(__pyx_v_scalec);
  return __pyx_r;
}

static struct PyMethodDef __pyx_methods[] = {
  {"distance_histogram_pyrex", (PyCFunction)__pyx_f_24distance_histogram_pyrex_distance_histogram_pyrex, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static void __pyx_init_filenames(void); /*proto*/

PyMODINIT_FUNC initdistance_histogram_pyrex(void); /*proto*/
PyMODINIT_FUNC initdistance_histogram_pyrex(void) {
  __pyx_init_filenames();
  __pyx_m = Py_InitModule4("distance_histogram_pyrex", __pyx_methods, 0, 0, PYTHON_API_VERSION);
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
  Py_INCREF(__pyx_m);
  __pyx_b = PyImport_AddModule("__builtin__");
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
  __pyx_ptype_24distance_histogram_pyrex_array_type = __Pyx_ImportType("Scientific.N", "array_type", sizeof(PyArrayObject)); if (!__pyx_ptype_24distance_histogram_pyrex_array_type) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; goto __pyx_L1;}

  /* "..\Include\nMOLDYN\numeric.pxi":36 */
  import_array();

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\distance_histogram_pyrex.pyx":9 */
  return;
  __pyx_L1:;
  __Pyx_AddTraceback("distance_histogram_pyrex");
}

static char *__pyx_filenames[] = {
  "distance_histogram_pyrex.pyx",
  "numeric.pxi",
};

/* Runtime support code */

static void __pyx_init_filenames(void) {
  __pyx_f = __pyx_filenames;
}

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name) {
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if ((none_allowed && obj == Py_None) || PyObject_TypeCheck(obj, type))
        return 1;
    PyErr_Format(PyExc_TypeError,
        "Argument '%s' has incorrect type (expected %s, got %s)",
        name, type->tp_name, obj->ob_type->tp_name);
    return 0;
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        if (!*t->p)
            return -1;
        if (t->i)
            PyString_InternInPlace(t->p);
        ++t;
    }
    return 0;
}

#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, 
    long size) 
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    
    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    result = PyObject_GetAttrString(py_module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError, 
            "%s.%s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifdef __PYX_CHECK_IMPORTED_TYPES
    if (((PyTypeObject *)result)->tp_basicsize != size) {
        PyErr_Format(PyExc_ValueError, 
            "%s.%s does not appear to be the correct type object",
            module_name, class_name);
        goto bad;
    }
#endif
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return 0;
}
#endif

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(char *name) {
    PyObject *py_name = 0;
    
    py_name = PyString_FromString(name);
    if (!py_name)
        goto bad;
    return PyImport_Import(py_name);
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(char *funcname) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyObject *empty_tuple = 0;
    PyObject *empty_string = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    
    py_srcfile = PyString_FromString(__pyx_filename);
    if (!py_srcfile) goto bad;
    py_funcname = PyString_FromString(funcname);
    if (!py_funcname) goto bad;
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    empty_tuple = PyTuple_New(0);
    if (!empty_tuple) goto bad;
    empty_string = PyString_FromString("");
    if (!empty_string) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        empty_string, /*PyObject *code,*/
        empty_tuple,  /*PyObject *consts,*/
        empty_tuple,  /*PyObject *names,*/
        empty_tuple,  /*PyObject *varnames,*/
        empty_tuple,  /*PyObject *freevars,*/
        empty_tuple,  /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        __pyx_lineno,   /*int firstlineno,*/
        empty_string  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_Get(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(empty_tuple);
    Py_XDECREF(empty_string);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}
