/* Generated by Pyrex 0.9.9 on Fri Jul 30 16:19:43 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 smoothed_static_coherent_structure_factor_pyrex */


/* Declarations from implementation of smoothed_static_coherent_structure_factor_pyrex */

static PyTypeObject *__pyx_ptype_47smoothed_static_coherent_structure_factor_pyrex_array_type = 0;




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



/* Implementation of smoothed_static_coherent_structure_factor_pyrex */

static PyObject *__pyx_f_47smoothed_static_coherent_structure_factor_pyrex_smoothed_static_coherent_structure_factor_pyrex(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_47smoothed_static_coherent_structure_factor_pyrex_smoothed_static_coherent_structure_factor_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_qvalues = 0;
  PyArrayObject *__pyx_v_indexes = 0;
  PyArrayObject *__pyx_v_elements = 0;
  PyArrayObject *__pyx_v_ssftemp = 0;
  PyArrayObject *__pyx_v_scalec = 0;
  int *__pyx_v_atomindex;
  int *__pyx_v_elementindex;
  double *__pyx_v_config;
  double *__pyx_v_cell;
  double *__pyx_v_rcell;
  double *__pyx_v_scaleconfig;
  double *__pyx_v_qval;
  double *__pyx_v_ssf;
  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;
  double __pyx_v_qr;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_ind;
  int __pyx_v_indi;
  int __pyx_v_indj;
  int __pyx_v_dimjk;
  int __pyx_v_dimk;
  int __pyx_v_index;
  PyObject *__pyx_v_k;
  PyObject *__pyx_r;
  int __pyx_1;
  long __pyx_2;
  long __pyx_3;
  int __pyx_4;
  PyObject *__pyx_5 = 0;
  Py_ssize_t __pyx_6;
  int __pyx_7;
  static char *__pyx_argnames[] = {"configuration","directCell","reverseCell","qvalues","indexes","elements","ssftemp","scalec",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOOOOOO", __pyx_argnames, &__pyx_v_configuration, &__pyx_v_directCell, &__pyx_v_reverseCell, &__pyx_v_qvalues, &__pyx_v_indexes, &__pyx_v_elements, &__pyx_v_ssftemp, &__pyx_v_scalec)) return 0;
  Py_INCREF(__pyx_v_configuration);
  Py_INCREF(__pyx_v_directCell);
  Py_INCREF(__pyx_v_reverseCell);
  Py_INCREF(__pyx_v_qvalues);
  Py_INCREF(__pyx_v_indexes);
  Py_INCREF(__pyx_v_elements);
  Py_INCREF(__pyx_v_ssftemp);
  Py_INCREF(__pyx_v_scalec);
  __pyx_v_k = Py_None; Py_INCREF(Py_None);
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_configuration), __pyx_ptype_47smoothed_static_coherent_structure_factor_pyrex_array_type, 1, "configuration")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_directCell), __pyx_ptype_47smoothed_static_coherent_structure_factor_pyrex_array_type, 1, "directCell")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1;}
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_reverseCell), __pyx_ptype_47smoothed_static_coherent_structure_factor_pyrex_array_type, 1, "reverseCell")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; goto __pyx_L1;}
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_qvalues), __pyx_ptype_47smoothed_static_coherent_structure_factor_pyrex_array_type, 1, "qvalues")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; goto __pyx_L1;}
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexes), __pyx_ptype_47smoothed_static_coherent_structure_factor_pyrex_array_type, 1, "indexes")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; goto __pyx_L1;}
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elements), __pyx_ptype_47smoothed_static_coherent_structure_factor_pyrex_array_type, 1, "elements")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; goto __pyx_L1;}
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ssftemp), __pyx_ptype_47smoothed_static_coherent_structure_factor_pyrex_array_type, 1, "ssftemp")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; goto __pyx_L1;}
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_scalec), __pyx_ptype_47smoothed_static_coherent_structure_factor_pyrex_array_type, 1, "scalec")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;}

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

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

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

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

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

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

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

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

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

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

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

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

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

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\smoothed_static_coherent_structure_factor_pyrex.pyx":43 */
  #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 = 43; goto __pyx_L1;}
  }
  #endif

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\smoothed_static_coherent_structure_factor_pyrex.pyx":46 */
  #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 = 46; goto __pyx_L1;}
  }
  #endif

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

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

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

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\smoothed_static_coherent_structure_factor_pyrex.pyx":52 */
  __pyx_v_qval = ((double *)__pyx_v_qvalues->data);

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

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

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\smoothed_static_coherent_structure_factor_pyrex.pyx":55 */
  __pyx_v_ssf = ((double *)__pyx_v_ssftemp->data);

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

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\smoothed_static_coherent_structure_factor_pyrex.pyx":58 */
  __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\smoothed_static_coherent_structure_factor_pyrex.pyx":60 */
    __pyx_v_ind = (3 * (__pyx_v_atomindex[__pyx_v_i]));

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

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

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

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

    /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\smoothed_static_coherent_structure_factor_pyrex.pyx":68 */
    (__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\smoothed_static_coherent_structure_factor_pyrex.pyx":69 */
    (__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\smoothed_static_coherent_structure_factor_pyrex.pyx":70 */
    (__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\smoothed_static_coherent_structure_factor_pyrex.pyx":72 */
  __pyx_v_dimjk = ((__pyx_v_ssftemp->dimensions[1]) * (__pyx_v_ssftemp->dimensions[2]));

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

  /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\smoothed_static_coherent_structure_factor_pyrex.pyx":75 */
  __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\smoothed_static_coherent_structure_factor_pyrex.pyx":77 */
    __pyx_v_indi = (3 * __pyx_v_i);

    /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\smoothed_static_coherent_structure_factor_pyrex.pyx":79 */
    __pyx_v_x = (__pyx_v_scaleconfig[__pyx_v_indi]);

    /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\smoothed_static_coherent_structure_factor_pyrex.pyx":80 */
    __pyx_v_y = (__pyx_v_scaleconfig[(__pyx_v_indi + 1)]);

    /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\smoothed_static_coherent_structure_factor_pyrex.pyx":81 */
    __pyx_v_z = (__pyx_v_scaleconfig[(__pyx_v_indi + 2)]);

    /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\smoothed_static_coherent_structure_factor_pyrex.pyx":83 */
    __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\smoothed_static_coherent_structure_factor_pyrex.pyx":85 */
      __pyx_v_indj = (3 * __pyx_v_j);

      /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\smoothed_static_coherent_structure_factor_pyrex.pyx":87 */
      __pyx_v_sdx = ((__pyx_v_scaleconfig[__pyx_v_indj]) - __pyx_v_x);

      /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\smoothed_static_coherent_structure_factor_pyrex.pyx":88 */
      __pyx_v_sdy = ((__pyx_v_scaleconfig[(__pyx_v_indj + 1)]) - __pyx_v_y);

      /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\smoothed_static_coherent_structure_factor_pyrex.pyx":89 */
      __pyx_v_sdz = ((__pyx_v_scaleconfig[(__pyx_v_indj + 2)]) - __pyx_v_z);

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

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

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

      /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\smoothed_static_coherent_structure_factor_pyrex.pyx":95 */
      __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\smoothed_static_coherent_structure_factor_pyrex.pyx":96 */
      __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\smoothed_static_coherent_structure_factor_pyrex.pyx":97 */
      __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\smoothed_static_coherent_structure_factor_pyrex.pyx":99 */
      __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\smoothed_static_coherent_structure_factor_pyrex.pyx":101 */
      __pyx_v_index = (((__pyx_v_elementindex[__pyx_v_i]) * __pyx_v_dimjk) + ((__pyx_v_elementindex[__pyx_v_j]) * __pyx_v_dimk));

      /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\smoothed_static_coherent_structure_factor_pyrex.pyx":103 */
      __pyx_4 = (__pyx_v_qvalues->dimensions[0]);
      for (__pyx_3 = 0; __pyx_3 < __pyx_4; ++__pyx_3) {
        __pyx_5 = PyInt_FromLong(__pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; goto __pyx_L1;}
        Py_DECREF(__pyx_v_k);
        __pyx_v_k = __pyx_5;
        __pyx_5 = 0;

        /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\smoothed_static_coherent_structure_factor_pyrex.pyx":105 */
        __pyx_6 = PyInt_AsSsize_t(__pyx_v_k); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;}
        __pyx_v_qr = ((__pyx_v_qval[__pyx_6]) * __pyx_v_r);

        /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\smoothed_static_coherent_structure_factor_pyrex.pyx":107 */
        __pyx_7 = (__pyx_v_qr == 0);
        if (__pyx_7) {
          (__pyx_v_ssf[__pyx_v_index]) += 1.0;
          goto __pyx_L10;
        }
        /*else*/ {
          (__pyx_v_ssf[__pyx_v_index]) += (sin(__pyx_v_qr) / __pyx_v_qr);
        }
        __pyx_L10:;

        /* "C:\Datas\Eclipse_Projects\Python\nMOLDYN\trunk\Src\smoothed_static_coherent_structure_factor_pyrex.pyx":113 */
        __pyx_v_index += 1;
      }
    }
  }

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_5);
  __Pyx_AddTraceback("smoothed_static_coherent_structure_factor_pyrex.smoothed_static_coherent_structure_factor_pyrex");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_k);
  Py_DECREF(__pyx_v_configuration);
  Py_DECREF(__pyx_v_directCell);
  Py_DECREF(__pyx_v_reverseCell);
  Py_DECREF(__pyx_v_qvalues);
  Py_DECREF(__pyx_v_indexes);
  Py_DECREF(__pyx_v_elements);
  Py_DECREF(__pyx_v_ssftemp);
  Py_DECREF(__pyx_v_scalec);
  return __pyx_r;
}

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

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

PyMODINIT_FUNC initsmoothed_static_coherent_structure_factor_pyrex(void); /*proto*/
PyMODINIT_FUNC initsmoothed_static_coherent_structure_factor_pyrex(void) {
  __pyx_init_filenames();
  __pyx_m = Py_InitModule4("smoothed_static_coherent_structure_factor_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_47smoothed_static_coherent_structure_factor_pyrex_array_type = __Pyx_ImportType("Scientific.N", "array_type", sizeof(PyArrayObject)); if (!__pyx_ptype_47smoothed_static_coherent_structure_factor_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\smoothed_static_coherent_structure_factor_pyrex.pyx":10 */
  return;
  __pyx_L1:;
  __Pyx_AddTraceback("smoothed_static_coherent_structure_factor_pyrex");
}

static char *__pyx_filenames[] = {
  "smoothed_static_coherent_structure_factor_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);
}
