In [1]:
execfile('desolvationGrid.py')
self.calc_receptor_SAS_points()
self.calc_receptor_MS()
SAS_r = self.kwargs['ligand_atom_radius'] + self.kwargs['probe_radius']
SAS_sphere_pts = SAS_r*self.unit_sphere_pts
Reading header from /Users/dminh/clusters/CCB/AstexDiv_xtal/3-grids/1tow/header_coarse.dx
*** Files and parameters ***
Input AMBER prmtop : /Users/dminh/clusters/CCB/AstexDiv_xtal/1-build/1tow/receptor.prmtop
Input AMBER inpcrd : /Users/dminh/clusters/CCB/AstexDiv_xtal/3-grids/1tow/receptor.trans.inpcrd
Input grid header file : /Users/dminh/clusters/CCB/AstexDiv_xtal/3-grids/1tow/header_coarse.dx
Output grid : desolv.dx
Grid spacing : [ 0.5 0.5 0.5]
Grid counts : [73 73 73]
Finding receptor SAS points
in 8.93 s
Determining the number of SAS points marking each grid point
in 4.41 s
In [2]:
#Load Robert Kern's line profiler
%load_ext line_profiler
import line_profiler
In [3]:
#Set compiler directives (cf. http://docs.cython.org/src/reference/compilation.html)
from Cython.Compiler.Options import directive_defaults
directive_defaults['linetrace'] = True
directive_defaults['binding'] = True
In [4]:
%load_ext Cython
In [5]:
%%cython -a -f --compile-args=-DCYTHON_TRACE=1
import cython
import numpy as np
cimport numpy as np
ctypedef np.int_t int_t
ctypedef np.float_t float_t
# This is the original python code for enumerate_SAS_points
# def enumerate_SAS_points(to_surround, to_avoid, \
# unit_sphere_pts, SAS_r, LJ_r2):
# SAS_points = []
# for atom_i in range(len(SAS_r)):
# receptor_SAS_points_n = [point for point in \
# to_surround[atom_i,:] + unit_sphere_pts*SAS_r[atom_i] \
# if not (np.sum(np.square(point-to_avoid),1)<LJ_r2).any()]
# SAS_points.extend(receptor_SAS_points_n)
# return SAS_points
@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)
cpdef enumerate_SAS_points(float_t[:,:] to_surround, float_t[:,:] to_avoid, \
float_t[:,:] unit_sphere_pts, float_t[:] SAS_r, float_t[:] LJ_r2):
cdef int_t clash
cdef int_t natoms_to_surround, natoms_to_avoid, nsphere_points
cdef int_t atom_i, atom_j, sphere_i, d
cdef float_t atom_x, atom_y, atom_z
cdef float_t point_x, point_y, point_z
cdef float_t dx, dy, dz
cdef float_t SAS_radius
natoms_to_surround = len(SAS_r)
natoms_to_avoid = len(LJ_r2)
nsphere_points = len(unit_sphere_pts)
SAS_points = []
atom_i = 0
while atom_i < natoms_to_surround:
atom_x = to_surround[atom_i,0]
atom_y = to_surround[atom_i,1]
atom_z = to_surround[atom_i,2]
SAS_radius = SAS_r[atom_i]
sphere_i = 0
while sphere_i < nsphere_points:
# Propose a point at the SAS of the atom
point_x = unit_sphere_pts[sphere_i,0]*SAS_radius + atom_x
point_y = unit_sphere_pts[sphere_i,1]*SAS_radius + atom_y
point_z = unit_sphere_pts[sphere_i,2]*SAS_radius + atom_z
clash = 0
atom_j = 0
while atom_j < natoms_to_avoid:
dx = to_avoid[atom_j,0] - point_x
dy = to_avoid[atom_j,1] - point_y
dz = to_avoid[atom_j,2] - point_z
if (dx*dx + dy*dy + dz*dz) < LJ_r2[atom_j]:
clash = 1
atom_j = natoms_to_avoid
else:
atom_j += 1
if clash==0:
SAS_points.append((point_x,point_y,point_z))
sphere_i += 1
atom_i += 1
return np.array(SAS_points)
# This is the original python code for set_inside_sphere_to
# def set_inside_sphere_to(grid, spacing, counts, point, r, val):
# lower_lim = [max(int(np.floor((point[d]-r)/spacing[d])),0) \
# for d in range(3)]
# upper_lim = [min(int(np.ceil((point[d]+r)/spacing[d])),counts[d]) \
# for d in range(3)]
# r2 = r*r
# for i in range(lower_lim[0],upper_lim[0]):
# dx = point_x-i*spacing[0]
# dx2 = dx*dx
# for j in range(lower_lim[1],upper_lim[1]):
# dy = point_y-j*spacing[1]
# dy2 = dy*dy
# for k in range(lower_lim[2],upper_lim[2]):
# dz = point_z-k*spacing[2]
# dz2 = dz*dz
# if (dx2 + dy2 + dz2) < r2:
# grid[i,j,k]=val
# The following three functions are the same except that
# one sets the grid value,
# one increments the grid value, and
# one decrements the grid value
@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)
cpdef set_inside_sphere_to(\
int_t[:,:,:] grid, \
float_t[:] spacing, \
int_t[:] counts, \
float_t point_x, \
float_t point_y, \
float_t point_z, \
float_t r, \
int_t val):
cdef int_t i, j, k
cdef int_t i_min, i_max, j_min, j_max, k_min, k_max
cdef float_t dx, dy, dz, dx2, dy2, dz2, dx2dy2, r2
i_min = max(int((point_x-r)/spacing[0]),0)
i_max = min(int((point_x+r)/spacing[0])+1,counts[0])
j_min = max(int((point_y-r)/spacing[1]),0)
j_max = min(int((point_y+r)/spacing[1])+1,counts[1])
k_min = max(int((point_z-r)/spacing[2]),0)
k_max = min(int((point_z+r)/spacing[2])+1,counts[2])
r2 = r*r
i = i_min
while i<i_max:
dx = point_x-i*spacing[0]
dx2 = dx*dx
j = j_min
while j<j_max:
dy = point_y-j*spacing[1]
dy2 = dy*dy
dx2dy2 = dx2 + dy2
if dx2dy2 < r2:
k = k_min
while k<k_max:
dz = point_z-k*spacing[2]
dz2 = dz*dz
if (dx2dy2 + dz2) < r2:
grid[i,j,k]=val
k += 1
j += 1
i += 1
@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)
cpdef increment_inside_sphere(\
int_t[:,:,:] grid, \
float_t[:] spacing, \
int_t[:] counts, \
float_t point_x, \
float_t point_y, \
float_t point_z, \
float_t r):
cdef int_t i, j, k
cdef int_t i_min, i_max, j_min, j_max, k_min, k_max
cdef float_t dx, dy, dz, dx2, dy2, dz2, dx2dy2, r2
i_min = max(int((point_x-r)/spacing[0]),0)
i_max = min(int((point_x+r)/spacing[0])+1,counts[0])
j_min = max(int((point_y-r)/spacing[1]),0)
j_max = min(int((point_y+r)/spacing[1])+1,counts[1])
k_min = max(int((point_z-r)/spacing[2]),0)
k_max = min(int((point_z+r)/spacing[2])+1,counts[2])
r2 = r*r
i = i_min
while i<i_max:
dx = point_x-i*spacing[0]
dx2 = dx*dx
j = j_min
while j<j_max:
dy = point_y-j*spacing[1]
dy2 = dy*dy
dx2dy2 = dx2 + dy2
if dx2dy2 < r2:
k = k_min
while k<k_max:
dz = point_z-k*spacing[2]
dz2 = dz*dz
if (dx2dy2 + dz2) < r2:
grid[i,j,k]+=1
k += 1
j += 1
i += 1
@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)
cpdef decrement_inside_sphere(\
int_t[:,:,:] grid, \
float_t[:] spacing, \
int_t[:] counts, \
float_t point_x, \
float_t point_y, \
float_t point_z, \
float_t r):
cdef int_t i, j, k
cdef int_t i_min, i_max, j_min, j_max, k_min, k_max
cdef float_t dx, dy, dz, dx2, dy2, dz2, dx2dy2, r2
i_min = max(int((point_x-r)/spacing[0]),0)
i_max = min(int((point_x+r)/spacing[0])+1,counts[0])
j_min = max(int((point_y-r)/spacing[1]),0)
j_max = min(int((point_y+r)/spacing[1])+1,counts[1])
k_min = max(int((point_z-r)/spacing[2]),0)
k_max = min(int((point_z+r)/spacing[2])+1,counts[2])
r2 = r*r
i = i_min
while i<i_max:
dx = point_x-i*spacing[0]
dx2 = dx*dx
j = j_min
while j<j_max:
dy = point_y-j*spacing[1]
dy2 = dy*dy
dx2dy2 = dx2 + dy2
if dx2dy2 < r2:
k = k_min
while k<k_max:
dz = point_z-k*spacing[2]
dz2 = dz*dz
if (dx2dy2 + dz2) < r2:
grid[i,j,k]-=1
k += 1
j += 1
i += 1
# Performs numerical integrals of r**(-4) over the grid points
# between r_min and r_max, either
# over the low dielectric region or over all points
# Returns the ratio of the integrals
@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)
cpdef fraction_r4inv_low_dielectric(\
int_t[:,:,:] grid, \
float_t[:] spacing, \
int_t[:] counts, \
float_t point_x, \
float_t point_y, \
float_t point_z, \
float_t r_min, \
float_t r_max):
cdef int_t i, j, k
cdef int_t i_min, i_max, j_min, j_max, k_min, k_max
cdef float_t I_low_dielectric, I_total
cdef float_t dx, dy, dz, dx2, dy2, dz2, dx2dy2
cdef float_t r2, r_min2, r_max2, r4inv
I_low_dielectric = 0.
I_total = 0.
i_min = max(int((point_x-r_max)/spacing[0]),0)
i_max = min(int((point_x+r_max)/spacing[0])+1,counts[0])
j_min = max(int((point_y-r_max)/spacing[1]),0)
j_max = min(int((point_y+r_max)/spacing[1])+1,counts[1])
k_min = max(int((point_z-r_max)/spacing[2]),0)
k_max = min(int((point_z+r_max)/spacing[2])+1,counts[2])
r_min2 = r_min*r_min
r_max2 = r_max*r_max
i = i_min
while i<i_max:
dx = point_x-i*spacing[0]
dx2 = dx*dx
j = j_min
while j<j_max:
dy = point_y-j*spacing[1]
dy2 = dy*dy
dx2dy2 = dx2 + dy2
if dx2dy2 < r_max2:
k = k_min
while k<k_max:
dz = point_z-k*spacing[2]
dz2 = dz*dz
r2 = dx2dy2 + dz2
if (r2 < r_max2) and (r2 > r_min2):
r4inv = 1/(r2*r2)
if grid[i,j,k]<1:
I_low_dielectric += r4inv
I_total += r4inv
k += 1
j += 1
i += 1
return I_low_dielectric/I_total
# @cython.boundscheck(False)
# @cython.wraparound(False)
# @cython.cdivision(True)
# cp
def calc_desolvationGrid(int_t[:,:,:] receptor_MS_grid, \
float_t[:] spacing, int_t[:] counts, \
float_t[:,:] receptor_SAS_points, \
float_t[:,:] receptor_coordinates, \
float_t[:,:] SAS_sphere_pts, \
float_t[:] LJ_r2, \
float_t LJ_r_max, \
float_t ligand_atom_radius, \
float_t probe_radius, \
float_t integration_cutoff):
cdef size_t i, j, k, n
cdef int_t nreceptor_SAS_points
cdef float_t SAS_x_min, SAS_x_max, SAS_y_min, SAS_y_max, SAS_z_min, SAS_z_max
cdef float_t clash_filter_r
cdef float_t rec_x_min, rec_x_max, rec_y_min, rec_y_max, rec_z_min, rec_z_max
cdef float_t ligand_atom_radius2
cdef float_t grid_point_x, grid_point_y, grid_point_z
cdef np.ndarray[np.double_t, ndim=3] desolvationGrid
# To use for new SAS points
cdef size_t atom_j, sphere_i, d
cdef int_t clash
cdef int_t nreceptor_atoms, nsphere_points, n_newly_inaccessible_SAS_points
cdef float_t SAS_point_x, SAS_point_y, SAS_point_z
cdef float_t dx, dy, dz
cdef np.ndarray[int_t, ndim=3] grid_c
nreceptor_SAS_points = receptor_SAS_points.shape[0]
nreceptor_atoms = len(LJ_r2)
nsphere_points = len(SAS_sphere_pts)
ligand_atom_radius2 = ligand_atom_radius*ligand_atom_radius
# Receptor atoms that clash with the ligand atom SAS will be within
# the SAS and maximum LJ radius
clash_filter_r = ligand_atom_radius + probe_radius + LJ_r_max
desolvationGrid = np.zeros(shape=tuple(counts), dtype=np.float)
for i in xrange(0,counts[0],10):
grid_point_x = i*spacing[0]
SAS_x_min = grid_point_x - ligand_atom_radius
SAS_x_max = grid_point_x + ligand_atom_radius
receptor_SAS_points_i = [n for n in xrange(nreceptor_SAS_points) \
if (receptor_SAS_points[n,0]>SAS_x_min) and \
(receptor_SAS_points[n,0]<SAS_x_max)]
rec_x_min = grid_point_x - clash_filter_r
rec_x_max = grid_point_x + clash_filter_r
receptor_coordinates_i = [n for n in xrange(nreceptor_atoms) \
if (receptor_coordinates[n,0]>rec_x_min) and \
(receptor_coordinates[n,0]<rec_x_max)]
for j in xrange(0,counts[1],10):
grid_point_y = j*spacing[1]
SAS_y_min = grid_point_y - ligand_atom_radius
SAS_y_max = grid_point_y + ligand_atom_radius
receptor_SAS_points_ij = [n for n in receptor_SAS_points_i \
if (receptor_SAS_points[n,1]>SAS_y_min) and \
(receptor_SAS_points[n,1]<SAS_y_max)]
rec_y_min = grid_point_y - clash_filter_r
rec_y_max = grid_point_y + clash_filter_r
receptor_coordinates_ij = [n for n in receptor_coordinates_i \
if (receptor_coordinates[n,1]>rec_y_min) and \
(receptor_coordinates[n,1]<rec_y_max)]
for k in xrange(0,counts[2],10):
grid_point_z = k*spacing[2]
SAS_z_min = grid_point_z - ligand_atom_radius
SAS_z_max = grid_point_z + ligand_atom_radius
receptor_SAS_points_ijk = [n for n in receptor_SAS_points_ij \
if (receptor_SAS_points[n,2]>SAS_z_min) and \
(receptor_SAS_points[n,2]<SAS_z_max)]
# Find SAS points that are made solvent inaccessible by the ligand atom
newly_inaccessible_SAS_points = []
for n in receptor_SAS_points_ijk:
dx = receptor_SAS_points[n,0]-grid_point_x
dy = receptor_SAS_points[n,1]-grid_point_y
dz = receptor_SAS_points[n,2]-grid_point_z
if (dx*dx + dy*dy + dz*dz)<ligand_atom_radius2:
newly_inaccessible_SAS_points.append(\
np.copy(receptor_SAS_points[n,:]))
n_newly_inaccessible_SAS_points = len(newly_inaccessible_SAS_points)
if n_newly_inaccessible_SAS_points==0:
# If there are no newly inaccessible SAS points,
# perform the numerical integrals over the receptor MS grid.
desolvationGrid[i,j,k] = fraction_r4inv_low_dielectric(\
receptor_MS_grid, spacing, counts, \
grid_point_x, grid_point_y, grid_point_z, \
ligand_atom_radius, integration_cutoff)
else:
rec_z_min = grid_point_z - clash_filter_r
rec_z_max = grid_point_z + clash_filter_r
receptor_coordinates_ijk = [n for n in receptor_coordinates_ij \
if (receptor_coordinates[n,2]>rec_z_min) and \
(receptor_coordinates[n,2]<rec_z_max)]
grid_c = np.copy(receptor_MS_grid)
# Find new SAS points around the ligand atom and
# increment the marks of the grid points within a probe radius
sphere_i = 0
while sphere_i < nsphere_points:
# Propose a point at the SAS of the atom
SAS_point_x = SAS_sphere_pts[sphere_i,0] + grid_point_x
SAS_point_y = SAS_sphere_pts[sphere_i,1] + grid_point_y
SAS_point_z = SAS_sphere_pts[sphere_i,2] + grid_point_z
# Check if the point clashes with a receptor atom
clash = 0
for atom_j in receptor_coordinates_ijk:
dx = receptor_coordinates[atom_j,0] - SAS_point_x
dy = receptor_coordinates[atom_j,1] - SAS_point_y
dz = receptor_coordinates[atom_j,2] - SAS_point_z
if (dx*dx + dy*dy + dz*dz) < LJ_r2[atom_j]:
clash = 1
break
if clash==0:
# If there are no clashes,
# increment the marks of the grid points within a probe radius
increment_inside_sphere(grid_c, spacing, counts, \
SAS_point_x, SAS_point_y, SAS_point_z, probe_radius)
sphere_i += 1
# Decrement of the marks of newly inaccessible grid points
n = 0
while n < n_newly_inaccessible_SAS_points:
decrement_inside_sphere(grid_c, spacing, counts, \
newly_inaccessible_SAS_points[n][0], \
newly_inaccessible_SAS_points[n][1], \
newly_inaccessible_SAS_points[n][2], probe_radius)
n += 1
# Blot the region inside the ligand vdW as low dielectric
set_inside_sphere_to(grid_c, spacing, counts, \
grid_point_x, grid_point_y, grid_point_z, \
ligand_atom_radius, 0)
desolvationGrid[i,j,k] = fraction_r4inv_low_dielectric(grid_c, \
spacing, counts, grid_point_x, grid_point_y, grid_point_z, \
ligand_atom_radius, integration_cutoff)
return desolvationGrid
Out[5]:
Cython: _cython_magic_c7a891f460c6cdee668bf17def65776d.pyx
Generated by Cython 0.24
Yellow lines hint at Python interaction.
Click on a line that starts with a "+
" to see the C code that Cython generated for it.
001:
+002: import cython
__Pyx_TraceLine(2,0,__PYX_ERR(0, 2, __pyx_L1_error))
__pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+003: import numpy as np
__Pyx_TraceLine(3,0,__PYX_ERR(0, 3, __pyx_L1_error))
__pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
004: cimport numpy as np
005:
+006: ctypedef np.int_t int_t
typedef __pyx_t_5numpy_int_t __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t;
007: ctypedef np.float_t float_t
008:
009: # This is the original python code for enumerate_SAS_points
010: # def enumerate_SAS_points(to_surround, to_avoid, \
011: # unit_sphere_pts, SAS_r, LJ_r2):
012: # SAS_points = []
013: # for atom_i in range(len(SAS_r)):
014: # receptor_SAS_points_n = [point for point in \
015: # to_surround[atom_i,:] + unit_sphere_pts*SAS_r[atom_i] \
016: # if not (np.sum(np.square(point-to_avoid),1)<LJ_r2).any()]
017: # SAS_points.extend(receptor_SAS_points_n)
018: # return SAS_points
019:
020: @cython.boundscheck(False)
021: @cython.wraparound(False)
022: @cython.cdivision(True)
+023: cpdef enumerate_SAS_points(float_t[:,:] to_surround, float_t[:,:] to_avoid, \
static PyObject *__pyx_pw_46_cython_magic_c7a891f460c6cdee668bf17def65776d_1enumerate_SAS_points(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_46_cython_magic_c7a891f460c6cdee668bf17def65776d_enumerate_SAS_points(__Pyx_memviewslice __pyx_v_to_surround, __Pyx_memviewslice __pyx_v_to_avoid, __Pyx_memviewslice __pyx_v_unit_sphere_pts, __Pyx_memviewslice __pyx_v_SAS_r, __Pyx_memviewslice __pyx_v_LJ_r2, CYTHON_UNUSED int __pyx_skip_dispatch) {
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_clash;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_natoms_to_surround;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_natoms_to_avoid;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_nsphere_points;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_atom_i;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_atom_j;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_sphere_i;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_atom_x;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_atom_y;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_atom_z;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_x;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_y;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_z;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dx;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dy;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dz;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_SAS_radius;
PyObject *__pyx_v_SAS_points = NULL;
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("enumerate_SAS_points", 0);
__Pyx_TraceCall("enumerate_SAS_points", __pyx_f[0], 23, 0, __PYX_ERR(0, 23, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_24);
__Pyx_XDECREF(__pyx_t_25);
__Pyx_XDECREF(__pyx_t_26);
__Pyx_AddTraceback("_cython_magic_c7a891f460c6cdee668bf17def65776d.enumerate_SAS_points", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_SAS_points);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_46_cython_magic_c7a891f460c6cdee668bf17def65776d_1enumerate_SAS_points(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_46_cython_magic_c7a891f460c6cdee668bf17def65776d_1enumerate_SAS_points(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
__Pyx_memviewslice __pyx_v_to_surround = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_to_avoid = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_unit_sphere_pts = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_SAS_r = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_LJ_r2 = { 0, 0, { 0 }, { 0 }, { 0 } };
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("enumerate_SAS_points (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_to_surround,&__pyx_n_s_to_avoid,&__pyx_n_s_unit_sphere_pts,&__pyx_n_s_SAS_r,&__pyx_n_s_LJ_r2,0};
PyObject* values[5] = {0,0,0,0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_to_surround)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_to_avoid)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("enumerate_SAS_points", 1, 5, 5, 1); __PYX_ERR(0, 23, __pyx_L3_error)
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_unit_sphere_pts)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("enumerate_SAS_points", 1, 5, 5, 2); __PYX_ERR(0, 23, __pyx_L3_error)
}
case 3:
if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_SAS_r)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("enumerate_SAS_points", 1, 5, 5, 3); __PYX_ERR(0, 23, __pyx_L3_error)
}
case 4:
if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_LJ_r2)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("enumerate_SAS_points", 1, 5, 5, 4); __PYX_ERR(0, 23, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "enumerate_SAS_points") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
}
__pyx_v_to_surround = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t(values[0]); if (unlikely(!__pyx_v_to_surround.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
__pyx_v_to_avoid = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t(values[1]); if (unlikely(!__pyx_v_to_avoid.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
__pyx_v_unit_sphere_pts = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t(values[2]); if (unlikely(!__pyx_v_unit_sphere_pts.memview)) __PYX_ERR(0, 24, __pyx_L3_error)
__pyx_v_SAS_r = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t(values[3]); if (unlikely(!__pyx_v_SAS_r.memview)) __PYX_ERR(0, 24, __pyx_L3_error)
__pyx_v_LJ_r2 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t(values[4]); if (unlikely(!__pyx_v_LJ_r2.memview)) __PYX_ERR(0, 24, __pyx_L3_error)
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("enumerate_SAS_points", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("_cython_magic_c7a891f460c6cdee668bf17def65776d.enumerate_SAS_points", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_46_cython_magic_c7a891f460c6cdee668bf17def65776d_enumerate_SAS_points(__pyx_self, __pyx_v_to_surround, __pyx_v_to_avoid, __pyx_v_unit_sphere_pts, __pyx_v_SAS_r, __pyx_v_LJ_r2);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_46_cython_magic_c7a891f460c6cdee668bf17def65776d_enumerate_SAS_points(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_to_surround, __Pyx_memviewslice __pyx_v_to_avoid, __Pyx_memviewslice __pyx_v_unit_sphere_pts, __Pyx_memviewslice __pyx_v_SAS_r, __Pyx_memviewslice __pyx_v_LJ_r2) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("enumerate_SAS_points", 0);
__Pyx_TraceCall("enumerate_SAS_points (wrapper)", __pyx_f[0], 23, 0, __PYX_ERR(0, 23, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
if (unlikely(!__pyx_v_to_surround.memview)) { __Pyx_RaiseUnboundLocalError("to_surround"); __PYX_ERR(0, 23, __pyx_L1_error) }
if (unlikely(!__pyx_v_to_avoid.memview)) { __Pyx_RaiseUnboundLocalError("to_avoid"); __PYX_ERR(0, 23, __pyx_L1_error) }
if (unlikely(!__pyx_v_unit_sphere_pts.memview)) { __Pyx_RaiseUnboundLocalError("unit_sphere_pts"); __PYX_ERR(0, 23, __pyx_L1_error) }
if (unlikely(!__pyx_v_SAS_r.memview)) { __Pyx_RaiseUnboundLocalError("SAS_r"); __PYX_ERR(0, 23, __pyx_L1_error) }
if (unlikely(!__pyx_v_LJ_r2.memview)) { __Pyx_RaiseUnboundLocalError("LJ_r2"); __PYX_ERR(0, 23, __pyx_L1_error) }
__pyx_t_1 = __pyx_f_46_cython_magic_c7a891f460c6cdee668bf17def65776d_enumerate_SAS_points(__pyx_v_to_surround, __pyx_v_to_avoid, __pyx_v_unit_sphere_pts, __pyx_v_SAS_r, __pyx_v_LJ_r2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("_cython_magic_c7a891f460c6cdee668bf17def65776d.enumerate_SAS_points", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__PYX_XDEC_MEMVIEW(&__pyx_v_to_surround, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_to_avoid, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_unit_sphere_pts, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_SAS_r, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_LJ_r2, 1);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
024: float_t[:,:] unit_sphere_pts, float_t[:] SAS_r, float_t[:] LJ_r2):
025: cdef int_t clash
026: cdef int_t natoms_to_surround, natoms_to_avoid, nsphere_points
027: cdef int_t atom_i, atom_j, sphere_i, d
028: cdef float_t atom_x, atom_y, atom_z
029: cdef float_t point_x, point_y, point_z
030: cdef float_t dx, dy, dz
031: cdef float_t SAS_radius
032:
+033: natoms_to_surround = len(SAS_r)
__Pyx_TraceLine(33,0,__PYX_ERR(0, 33, __pyx_L1_error))
__pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_SAS_r, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 33, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_natoms_to_surround = __pyx_t_2;
+034: natoms_to_avoid = len(LJ_r2)
__Pyx_TraceLine(34,0,__PYX_ERR(0, 34, __pyx_L1_error))
__pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_LJ_r2, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 34, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_natoms_to_avoid = __pyx_t_2;
+035: nsphere_points = len(unit_sphere_pts)
__Pyx_TraceLine(35,0,__PYX_ERR(0, 35, __pyx_L1_error))
__pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_unit_sphere_pts, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 35, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_nsphere_points = __pyx_t_2;
036:
+037: SAS_points = []
__Pyx_TraceLine(37,0,__PYX_ERR(0, 37, __pyx_L1_error))
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_SAS_points = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
+038: atom_i = 0
__Pyx_TraceLine(38,0,__PYX_ERR(0, 38, __pyx_L1_error))
__pyx_v_atom_i = 0;
+039: while atom_i < natoms_to_surround:
__Pyx_TraceLine(39,0,__PYX_ERR(0, 39, __pyx_L1_error))
while (1) {
__pyx_t_3 = ((__pyx_v_atom_i < __pyx_v_natoms_to_surround) != 0);
if (!__pyx_t_3) break;
+040: atom_x = to_surround[atom_i,0]
__Pyx_TraceLine(40,0,__PYX_ERR(0, 40, __pyx_L1_error))
__pyx_t_4 = __pyx_v_atom_i;
__pyx_t_5 = 0;
__pyx_v_atom_x = (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_to_surround.data + __pyx_t_4 * __pyx_v_to_surround.strides[0]) ) + __pyx_t_5 * __pyx_v_to_surround.strides[1]) )));
+041: atom_y = to_surround[atom_i,1]
__Pyx_TraceLine(41,0,__PYX_ERR(0, 41, __pyx_L1_error))
__pyx_t_6 = __pyx_v_atom_i;
__pyx_t_7 = 1;
__pyx_v_atom_y = (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_to_surround.data + __pyx_t_6 * __pyx_v_to_surround.strides[0]) ) + __pyx_t_7 * __pyx_v_to_surround.strides[1]) )));
+042: atom_z = to_surround[atom_i,2]
__Pyx_TraceLine(42,0,__PYX_ERR(0, 42, __pyx_L1_error))
__pyx_t_8 = __pyx_v_atom_i;
__pyx_t_9 = 2;
__pyx_v_atom_z = (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_to_surround.data + __pyx_t_8 * __pyx_v_to_surround.strides[0]) ) + __pyx_t_9 * __pyx_v_to_surround.strides[1]) )));
+043: SAS_radius = SAS_r[atom_i]
__Pyx_TraceLine(43,0,__PYX_ERR(0, 43, __pyx_L1_error))
__pyx_t_10 = __pyx_v_atom_i;
__pyx_v_SAS_radius = (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_SAS_r.data + __pyx_t_10 * __pyx_v_SAS_r.strides[0]) )));
+044: sphere_i = 0
__Pyx_TraceLine(44,0,__PYX_ERR(0, 44, __pyx_L1_error))
__pyx_v_sphere_i = 0;
+045: while sphere_i < nsphere_points:
__Pyx_TraceLine(45,0,__PYX_ERR(0, 45, __pyx_L1_error))
while (1) {
__pyx_t_3 = ((__pyx_v_sphere_i < __pyx_v_nsphere_points) != 0);
if (!__pyx_t_3) break;
046: # Propose a point at the SAS of the atom
+047: point_x = unit_sphere_pts[sphere_i,0]*SAS_radius + atom_x
__Pyx_TraceLine(47,0,__PYX_ERR(0, 47, __pyx_L1_error))
__pyx_t_11 = __pyx_v_sphere_i;
__pyx_t_12 = 0;
__pyx_v_point_x = (((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_unit_sphere_pts.data + __pyx_t_11 * __pyx_v_unit_sphere_pts.strides[0]) ) + __pyx_t_12 * __pyx_v_unit_sphere_pts.strides[1]) ))) * __pyx_v_SAS_radius) + __pyx_v_atom_x);
+048: point_y = unit_sphere_pts[sphere_i,1]*SAS_radius + atom_y
__Pyx_TraceLine(48,0,__PYX_ERR(0, 48, __pyx_L1_error))
__pyx_t_13 = __pyx_v_sphere_i;
__pyx_t_14 = 1;
__pyx_v_point_y = (((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_unit_sphere_pts.data + __pyx_t_13 * __pyx_v_unit_sphere_pts.strides[0]) ) + __pyx_t_14 * __pyx_v_unit_sphere_pts.strides[1]) ))) * __pyx_v_SAS_radius) + __pyx_v_atom_y);
+049: point_z = unit_sphere_pts[sphere_i,2]*SAS_radius + atom_z
__Pyx_TraceLine(49,0,__PYX_ERR(0, 49, __pyx_L1_error))
__pyx_t_15 = __pyx_v_sphere_i;
__pyx_t_16 = 2;
__pyx_v_point_z = (((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_unit_sphere_pts.data + __pyx_t_15 * __pyx_v_unit_sphere_pts.strides[0]) ) + __pyx_t_16 * __pyx_v_unit_sphere_pts.strides[1]) ))) * __pyx_v_SAS_radius) + __pyx_v_atom_z);
+050: clash = 0
__Pyx_TraceLine(50,0,__PYX_ERR(0, 50, __pyx_L1_error))
__pyx_v_clash = 0;
+051: atom_j = 0
__Pyx_TraceLine(51,0,__PYX_ERR(0, 51, __pyx_L1_error))
__pyx_v_atom_j = 0;
+052: while atom_j < natoms_to_avoid:
__Pyx_TraceLine(52,0,__PYX_ERR(0, 52, __pyx_L1_error))
while (1) {
__pyx_t_3 = ((__pyx_v_atom_j < __pyx_v_natoms_to_avoid) != 0);
if (!__pyx_t_3) break;
+053: dx = to_avoid[atom_j,0] - point_x
__Pyx_TraceLine(53,0,__PYX_ERR(0, 53, __pyx_L1_error))
__pyx_t_17 = __pyx_v_atom_j;
__pyx_t_18 = 0;
__pyx_v_dx = ((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_to_avoid.data + __pyx_t_17 * __pyx_v_to_avoid.strides[0]) ) + __pyx_t_18 * __pyx_v_to_avoid.strides[1]) ))) - __pyx_v_point_x);
+054: dy = to_avoid[atom_j,1] - point_y
__Pyx_TraceLine(54,0,__PYX_ERR(0, 54, __pyx_L1_error))
__pyx_t_19 = __pyx_v_atom_j;
__pyx_t_20 = 1;
__pyx_v_dy = ((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_to_avoid.data + __pyx_t_19 * __pyx_v_to_avoid.strides[0]) ) + __pyx_t_20 * __pyx_v_to_avoid.strides[1]) ))) - __pyx_v_point_y);
+055: dz = to_avoid[atom_j,2] - point_z
__Pyx_TraceLine(55,0,__PYX_ERR(0, 55, __pyx_L1_error))
__pyx_t_21 = __pyx_v_atom_j;
__pyx_t_22 = 2;
__pyx_v_dz = ((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_to_avoid.data + __pyx_t_21 * __pyx_v_to_avoid.strides[0]) ) + __pyx_t_22 * __pyx_v_to_avoid.strides[1]) ))) - __pyx_v_point_z);
+056: if (dx*dx + dy*dy + dz*dz) < LJ_r2[atom_j]:
__Pyx_TraceLine(56,0,__PYX_ERR(0, 56, __pyx_L1_error))
__pyx_t_23 = __pyx_v_atom_j;
__pyx_t_3 = (((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz)) < (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_LJ_r2.data + __pyx_t_23 * __pyx_v_LJ_r2.strides[0]) )))) != 0);
if (__pyx_t_3) {
/* … */
goto __pyx_L9;
}
+057: clash = 1
__Pyx_TraceLine(57,0,__PYX_ERR(0, 57, __pyx_L1_error))
__pyx_v_clash = 1;
+058: atom_j = natoms_to_avoid
__Pyx_TraceLine(58,0,__PYX_ERR(0, 58, __pyx_L1_error))
__pyx_v_atom_j = __pyx_v_natoms_to_avoid;
059: else:
+060: atom_j += 1
__Pyx_TraceLine(60,0,__PYX_ERR(0, 60, __pyx_L1_error))
/*else*/ {
__pyx_v_atom_j = (__pyx_v_atom_j + 1);
}
__pyx_L9:;
}
+061: if clash==0:
__Pyx_TraceLine(61,0,__PYX_ERR(0, 61, __pyx_L1_error))
__pyx_t_3 = ((__pyx_v_clash == 0) != 0);
if (__pyx_t_3) {
/* … */
}
+062: SAS_points.append((point_x,point_y,point_z))
__Pyx_TraceLine(62,0,__PYX_ERR(0, 62, __pyx_L1_error))
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_point_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_24 = PyFloat_FromDouble(__pyx_v_point_y); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 62, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_24);
__pyx_t_25 = PyFloat_FromDouble(__pyx_v_point_z); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 62, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_25);
__pyx_t_26 = PyTuple_New(3); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 62, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_26);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_24);
PyTuple_SET_ITEM(__pyx_t_26, 1, __pyx_t_24);
__Pyx_GIVEREF(__pyx_t_25);
PyTuple_SET_ITEM(__pyx_t_26, 2, __pyx_t_25);
__pyx_t_1 = 0;
__pyx_t_24 = 0;
__pyx_t_25 = 0;
__pyx_t_27 = __Pyx_PyList_Append(__pyx_v_SAS_points, __pyx_t_26); if (unlikely(__pyx_t_27 == -1)) __PYX_ERR(0, 62, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
+063: sphere_i += 1
__Pyx_TraceLine(63,0,__PYX_ERR(0, 63, __pyx_L1_error))
__pyx_v_sphere_i = (__pyx_v_sphere_i + 1);
}
+064: atom_i += 1
__Pyx_TraceLine(64,0,__PYX_ERR(0, 64, __pyx_L1_error))
__pyx_v_atom_i = (__pyx_v_atom_i + 1);
}
+065: return np.array(SAS_points)
__Pyx_TraceLine(65,0,__PYX_ERR(0, 65, __pyx_L1_error))
__Pyx_XDECREF(__pyx_r);
__pyx_t_25 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 65, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_25);
__pyx_t_24 = __Pyx_PyObject_GetAttrStr(__pyx_t_25, __pyx_n_s_array); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 65, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_24);
__Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
__pyx_t_25 = NULL;
if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_24))) {
__pyx_t_25 = PyMethod_GET_SELF(__pyx_t_24);
if (likely(__pyx_t_25)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_24);
__Pyx_INCREF(__pyx_t_25);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_24, function);
}
}
if (!__pyx_t_25) {
__pyx_t_26 = __Pyx_PyObject_CallOneArg(__pyx_t_24, __pyx_v_SAS_points); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 65, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_26);
} else {
__pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GIVEREF(__pyx_t_25); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_25); __pyx_t_25 = NULL;
__Pyx_INCREF(__pyx_v_SAS_points);
__Pyx_GIVEREF(__pyx_v_SAS_points);
PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_SAS_points);
__pyx_t_26 = __Pyx_PyObject_Call(__pyx_t_24, __pyx_t_1, NULL); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 65, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_26);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
__Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
__pyx_r = __pyx_t_26;
__pyx_t_26 = 0;
goto __pyx_L0;
066:
067: # This is the original python code for set_inside_sphere_to
068: # def set_inside_sphere_to(grid, spacing, counts, point, r, val):
069: # lower_lim = [max(int(np.floor((point[d]-r)/spacing[d])),0) \
070: # for d in range(3)]
071: # upper_lim = [min(int(np.ceil((point[d]+r)/spacing[d])),counts[d]) \
072: # for d in range(3)]
073: # r2 = r*r
074: # for i in range(lower_lim[0],upper_lim[0]):
075: # dx = point_x-i*spacing[0]
076: # dx2 = dx*dx
077: # for j in range(lower_lim[1],upper_lim[1]):
078: # dy = point_y-j*spacing[1]
079: # dy2 = dy*dy
080: # for k in range(lower_lim[2],upper_lim[2]):
081: # dz = point_z-k*spacing[2]
082: # dz2 = dz*dz
083: # if (dx2 + dy2 + dz2) < r2:
084: # grid[i,j,k]=val
085:
086: # The following three functions are the same except that
087: # one sets the grid value,
088: # one increments the grid value, and
089: # one decrements the grid value
090: @cython.boundscheck(False)
091: @cython.wraparound(False)
092: @cython.cdivision(True)
+093: cpdef set_inside_sphere_to(\
static PyObject *__pyx_pw_46_cython_magic_c7a891f460c6cdee668bf17def65776d_3set_inside_sphere_to(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_46_cython_magic_c7a891f460c6cdee668bf17def65776d_set_inside_sphere_to(__Pyx_memviewslice __pyx_v_grid, __Pyx_memviewslice __pyx_v_spacing, __Pyx_memviewslice __pyx_v_counts, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_x, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_y, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_z, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_r, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_val, CYTHON_UNUSED int __pyx_skip_dispatch) {
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_i;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_j;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_k;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_i_min;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_i_max;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_j_min;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_j_max;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_k_min;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_k_max;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dx;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dy;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dz;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dx2;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dy2;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dz2;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dx2dy2;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_r2;
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("set_inside_sphere_to", 0);
__Pyx_TraceCall("set_inside_sphere_to", __pyx_f[0], 93, 0, __PYX_ERR(0, 93, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("_cython_magic_c7a891f460c6cdee668bf17def65776d.set_inside_sphere_to", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_46_cython_magic_c7a891f460c6cdee668bf17def65776d_3set_inside_sphere_to(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_46_cython_magic_c7a891f460c6cdee668bf17def65776d_3set_inside_sphere_to(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
__Pyx_memviewslice __pyx_v_grid = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_spacing = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_counts = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_x;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_y;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_z;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_r;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_val;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("set_inside_sphere_to (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_grid,&__pyx_n_s_spacing,&__pyx_n_s_counts,&__pyx_n_s_point_x,&__pyx_n_s_point_y,&__pyx_n_s_point_z,&__pyx_n_s_r,&__pyx_n_s_val,0};
PyObject* values[8] = {0,0,0,0,0,0,0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_grid)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_spacing)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("set_inside_sphere_to", 1, 8, 8, 1); __PYX_ERR(0, 93, __pyx_L3_error)
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_counts)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("set_inside_sphere_to", 1, 8, 8, 2); __PYX_ERR(0, 93, __pyx_L3_error)
}
case 3:
if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_point_x)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("set_inside_sphere_to", 1, 8, 8, 3); __PYX_ERR(0, 93, __pyx_L3_error)
}
case 4:
if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_point_y)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("set_inside_sphere_to", 1, 8, 8, 4); __PYX_ERR(0, 93, __pyx_L3_error)
}
case 5:
if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_point_z)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("set_inside_sphere_to", 1, 8, 8, 5); __PYX_ERR(0, 93, __pyx_L3_error)
}
case 6:
if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_r)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("set_inside_sphere_to", 1, 8, 8, 6); __PYX_ERR(0, 93, __pyx_L3_error)
}
case 7:
if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("set_inside_sphere_to", 1, 8, 8, 7); __PYX_ERR(0, 93, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_inside_sphere_to") < 0)) __PYX_ERR(0, 93, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 8) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
}
__pyx_v_grid = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t(values[0]); if (unlikely(!__pyx_v_grid.memview)) __PYX_ERR(0, 94, __pyx_L3_error)
__pyx_v_spacing = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t(values[1]); if (unlikely(!__pyx_v_spacing.memview)) __PYX_ERR(0, 95, __pyx_L3_error)
__pyx_v_counts = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t(values[2]); if (unlikely(!__pyx_v_counts.memview)) __PYX_ERR(0, 96, __pyx_L3_error)
__pyx_v_point_x = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_point_x == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L3_error)
__pyx_v_point_y = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_point_y == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 98, __pyx_L3_error)
__pyx_v_point_z = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_point_z == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 99, __pyx_L3_error)
__pyx_v_r = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_r == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L3_error)
__pyx_v_val = __Pyx_PyInt_As_npy_long(values[7]); if (unlikely((__pyx_v_val == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L3_error)
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("set_inside_sphere_to", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 93, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("_cython_magic_c7a891f460c6cdee668bf17def65776d.set_inside_sphere_to", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_46_cython_magic_c7a891f460c6cdee668bf17def65776d_2set_inside_sphere_to(__pyx_self, __pyx_v_grid, __pyx_v_spacing, __pyx_v_counts, __pyx_v_point_x, __pyx_v_point_y, __pyx_v_point_z, __pyx_v_r, __pyx_v_val);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_46_cython_magic_c7a891f460c6cdee668bf17def65776d_2set_inside_sphere_to(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_grid, __Pyx_memviewslice __pyx_v_spacing, __Pyx_memviewslice __pyx_v_counts, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_x, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_y, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_z, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_r, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_val) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("set_inside_sphere_to", 0);
__Pyx_TraceCall("set_inside_sphere_to (wrapper)", __pyx_f[0], 93, 0, __PYX_ERR(0, 93, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
if (unlikely(!__pyx_v_grid.memview)) { __Pyx_RaiseUnboundLocalError("grid"); __PYX_ERR(0, 93, __pyx_L1_error) }
if (unlikely(!__pyx_v_spacing.memview)) { __Pyx_RaiseUnboundLocalError("spacing"); __PYX_ERR(0, 93, __pyx_L1_error) }
if (unlikely(!__pyx_v_counts.memview)) { __Pyx_RaiseUnboundLocalError("counts"); __PYX_ERR(0, 93, __pyx_L1_error) }
__pyx_t_1 = __pyx_f_46_cython_magic_c7a891f460c6cdee668bf17def65776d_set_inside_sphere_to(__pyx_v_grid, __pyx_v_spacing, __pyx_v_counts, __pyx_v_point_x, __pyx_v_point_y, __pyx_v_point_z, __pyx_v_r, __pyx_v_val, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("_cython_magic_c7a891f460c6cdee668bf17def65776d.set_inside_sphere_to", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__PYX_XDEC_MEMVIEW(&__pyx_v_grid, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_spacing, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_counts, 1);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
094: int_t[:,:,:] grid, \
095: float_t[:] spacing, \
096: int_t[:] counts, \
097: float_t point_x, \
098: float_t point_y, \
099: float_t point_z, \
100: float_t r, \
101: int_t val):
102:
103: cdef int_t i, j, k
104: cdef int_t i_min, i_max, j_min, j_max, k_min, k_max
105: cdef float_t dx, dy, dz, dx2, dy2, dz2, dx2dy2, r2
106:
+107: i_min = max(int((point_x-r)/spacing[0]),0)
__Pyx_TraceLine(107,0,__PYX_ERR(0, 107, __pyx_L1_error))
__pyx_t_1 = 0;
__pyx_t_2 = 0;
__pyx_t_3 = __Pyx_PyInt_FromDouble(((__pyx_v_point_x - __pyx_v_r) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_2 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 107, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 107, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (__pyx_t_7) {
__pyx_t_6 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_4 = __pyx_t_6;
__pyx_t_6 = 0;
} else {
__Pyx_INCREF(__pyx_t_3);
__pyx_t_4 = __pyx_t_3;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_4); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_i_min = __pyx_t_8;
+108: i_max = min(int((point_x+r)/spacing[0])+1,counts[0])
__Pyx_TraceLine(108,0,__PYX_ERR(0, 108, __pyx_L1_error))
__pyx_t_9 = 0;
__pyx_t_8 = (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t *) ( /* dim=0 */ (__pyx_v_counts.data + __pyx_t_9 * __pyx_v_counts.strides[0]) )));
__pyx_t_10 = 0;
__pyx_t_4 = __Pyx_PyInt_FromDouble(((__pyx_v_point_x + __pyx_v_r) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_10 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 108, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 108, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 108, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 108, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 108, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
__pyx_t_5 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 108, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_4 = __pyx_t_5;
__pyx_t_5 = 0;
} else {
__Pyx_INCREF(__pyx_t_3);
__pyx_t_4 = __pyx_t_3;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_4); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_i_max = __pyx_t_8;
+109: j_min = max(int((point_y-r)/spacing[1]),0)
__Pyx_TraceLine(109,0,__PYX_ERR(0, 109, __pyx_L1_error))
__pyx_t_1 = 0;
__pyx_t_11 = 1;
__pyx_t_4 = __Pyx_PyInt_FromDouble(((__pyx_v_point_y - __pyx_v_r) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_11 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 109, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 109, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 109, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 109, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (__pyx_t_7) {
__pyx_t_6 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 109, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_3 = __pyx_t_6;
__pyx_t_6 = 0;
} else {
__Pyx_INCREF(__pyx_t_4);
__pyx_t_3 = __pyx_t_4;
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_3); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 109, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_j_min = __pyx_t_8;
+110: j_max = min(int((point_y+r)/spacing[1])+1,counts[1])
__Pyx_TraceLine(110,0,__PYX_ERR(0, 110, __pyx_L1_error))
__pyx_t_12 = 1;
__pyx_t_8 = (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t *) ( /* dim=0 */ (__pyx_v_counts.data + __pyx_t_12 * __pyx_v_counts.strides[0]) )));
__pyx_t_13 = 1;
__pyx_t_3 = __Pyx_PyInt_FromDouble(((__pyx_v_point_y + __pyx_v_r) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_13 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 110, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 110, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 110, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 110, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
__pyx_t_5 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 110, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = __pyx_t_5;
__pyx_t_5 = 0;
} else {
__Pyx_INCREF(__pyx_t_4);
__pyx_t_3 = __pyx_t_4;
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_3); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 110, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_j_max = __pyx_t_8;
+111: k_min = max(int((point_z-r)/spacing[2]),0)
__Pyx_TraceLine(111,0,__PYX_ERR(0, 111, __pyx_L1_error))
__pyx_t_1 = 0;
__pyx_t_14 = 2;
__pyx_t_3 = __Pyx_PyInt_FromDouble(((__pyx_v_point_z - __pyx_v_r) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_14 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 111, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 111, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 111, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (__pyx_t_7) {
__pyx_t_6 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 111, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_4 = __pyx_t_6;
__pyx_t_6 = 0;
} else {
__Pyx_INCREF(__pyx_t_3);
__pyx_t_4 = __pyx_t_3;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_4); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 111, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_k_min = __pyx_t_8;
+112: k_max = min(int((point_z+r)/spacing[2])+1,counts[2])
__Pyx_TraceLine(112,0,__PYX_ERR(0, 112, __pyx_L1_error))
__pyx_t_15 = 2;
__pyx_t_8 = (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t *) ( /* dim=0 */ (__pyx_v_counts.data + __pyx_t_15 * __pyx_v_counts.strides[0]) )));
__pyx_t_16 = 2;
__pyx_t_4 = __Pyx_PyInt_FromDouble(((__pyx_v_point_z + __pyx_v_r) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_16 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 112, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 112, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 112, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
__pyx_t_5 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 112, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_4 = __pyx_t_5;
__pyx_t_5 = 0;
} else {
__Pyx_INCREF(__pyx_t_3);
__pyx_t_4 = __pyx_t_3;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_4); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 112, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_k_max = __pyx_t_8;
113:
+114: r2 = r*r
__Pyx_TraceLine(114,0,__PYX_ERR(0, 114, __pyx_L1_error))
__pyx_v_r2 = (__pyx_v_r * __pyx_v_r);
+115: i = i_min
__Pyx_TraceLine(115,0,__PYX_ERR(0, 115, __pyx_L1_error))
__pyx_v_i = __pyx_v_i_min;
+116: while i<i_max:
__Pyx_TraceLine(116,0,__PYX_ERR(0, 116, __pyx_L1_error))
while (1) {
__pyx_t_7 = ((__pyx_v_i < __pyx_v_i_max) != 0);
if (!__pyx_t_7) break;
+117: dx = point_x-i*spacing[0]
__Pyx_TraceLine(117,0,__PYX_ERR(0, 117, __pyx_L1_error))
__pyx_t_17 = 0;
__pyx_v_dx = (__pyx_v_point_x - (__pyx_v_i * (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_17 * __pyx_v_spacing.strides[0]) )))));
+118: dx2 = dx*dx
__Pyx_TraceLine(118,0,__PYX_ERR(0, 118, __pyx_L1_error))
__pyx_v_dx2 = (__pyx_v_dx * __pyx_v_dx);
+119: j = j_min
__Pyx_TraceLine(119,0,__PYX_ERR(0, 119, __pyx_L1_error))
__pyx_v_j = __pyx_v_j_min;
+120: while j<j_max:
__Pyx_TraceLine(120,0,__PYX_ERR(0, 120, __pyx_L1_error))
while (1) {
__pyx_t_7 = ((__pyx_v_j < __pyx_v_j_max) != 0);
if (!__pyx_t_7) break;
+121: dy = point_y-j*spacing[1]
__Pyx_TraceLine(121,0,__PYX_ERR(0, 121, __pyx_L1_error))
__pyx_t_18 = 1;
__pyx_v_dy = (__pyx_v_point_y - (__pyx_v_j * (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_18 * __pyx_v_spacing.strides[0]) )))));
+122: dy2 = dy*dy
__Pyx_TraceLine(122,0,__PYX_ERR(0, 122, __pyx_L1_error))
__pyx_v_dy2 = (__pyx_v_dy * __pyx_v_dy);
+123: dx2dy2 = dx2 + dy2
__Pyx_TraceLine(123,0,__PYX_ERR(0, 123, __pyx_L1_error))
__pyx_v_dx2dy2 = (__pyx_v_dx2 + __pyx_v_dy2);
+124: if dx2dy2 < r2:
__Pyx_TraceLine(124,0,__PYX_ERR(0, 124, __pyx_L1_error))
__pyx_t_7 = ((__pyx_v_dx2dy2 < __pyx_v_r2) != 0);
if (__pyx_t_7) {
/* … */
}
+125: k = k_min
__Pyx_TraceLine(125,0,__PYX_ERR(0, 125, __pyx_L1_error))
__pyx_v_k = __pyx_v_k_min;
+126: while k<k_max:
__Pyx_TraceLine(126,0,__PYX_ERR(0, 126, __pyx_L1_error))
while (1) {
__pyx_t_7 = ((__pyx_v_k < __pyx_v_k_max) != 0);
if (!__pyx_t_7) break;
+127: dz = point_z-k*spacing[2]
__Pyx_TraceLine(127,0,__PYX_ERR(0, 127, __pyx_L1_error))
__pyx_t_19 = 2;
__pyx_v_dz = (__pyx_v_point_z - (__pyx_v_k * (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_19 * __pyx_v_spacing.strides[0]) )))));
+128: dz2 = dz*dz
__Pyx_TraceLine(128,0,__PYX_ERR(0, 128, __pyx_L1_error))
__pyx_v_dz2 = (__pyx_v_dz * __pyx_v_dz);
+129: if (dx2dy2 + dz2) < r2:
__Pyx_TraceLine(129,0,__PYX_ERR(0, 129, __pyx_L1_error))
__pyx_t_7 = (((__pyx_v_dx2dy2 + __pyx_v_dz2) < __pyx_v_r2) != 0);
if (__pyx_t_7) {
/* … */
}
+130: grid[i,j,k]=val
__Pyx_TraceLine(130,0,__PYX_ERR(0, 130, __pyx_L1_error))
__pyx_t_20 = __pyx_v_i;
__pyx_t_21 = __pyx_v_j;
__pyx_t_22 = __pyx_v_k;
*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_grid.data + __pyx_t_20 * __pyx_v_grid.strides[0]) ) + __pyx_t_21 * __pyx_v_grid.strides[1]) ) + __pyx_t_22 * __pyx_v_grid.strides[2]) )) = __pyx_v_val;
+131: k += 1
__Pyx_TraceLine(131,0,__PYX_ERR(0, 131, __pyx_L1_error))
__pyx_v_k = (__pyx_v_k + 1);
}
+132: j += 1
__Pyx_TraceLine(132,0,__PYX_ERR(0, 132, __pyx_L1_error))
__pyx_v_j = (__pyx_v_j + 1);
}
+133: i += 1
__Pyx_TraceLine(133,0,__PYX_ERR(0, 133, __pyx_L1_error))
__pyx_v_i = (__pyx_v_i + 1);
}
134:
135: @cython.boundscheck(False)
136: @cython.wraparound(False)
137: @cython.cdivision(True)
+138: cpdef increment_inside_sphere(\
static PyObject *__pyx_pw_46_cython_magic_c7a891f460c6cdee668bf17def65776d_5increment_inside_sphere(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_46_cython_magic_c7a891f460c6cdee668bf17def65776d_increment_inside_sphere(__Pyx_memviewslice __pyx_v_grid, __Pyx_memviewslice __pyx_v_spacing, __Pyx_memviewslice __pyx_v_counts, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_x, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_y, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_z, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_r, CYTHON_UNUSED int __pyx_skip_dispatch) {
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_i;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_j;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_k;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_i_min;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_i_max;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_j_min;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_j_max;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_k_min;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_k_max;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dx;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dy;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dz;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dx2;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dy2;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dz2;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dx2dy2;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_r2;
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("increment_inside_sphere", 0);
__Pyx_TraceCall("increment_inside_sphere", __pyx_f[0], 138, 0, __PYX_ERR(0, 138, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("_cython_magic_c7a891f460c6cdee668bf17def65776d.increment_inside_sphere", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_46_cython_magic_c7a891f460c6cdee668bf17def65776d_5increment_inside_sphere(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_46_cython_magic_c7a891f460c6cdee668bf17def65776d_5increment_inside_sphere(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
__Pyx_memviewslice __pyx_v_grid = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_spacing = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_counts = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_x;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_y;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_z;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_r;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("increment_inside_sphere (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_grid,&__pyx_n_s_spacing,&__pyx_n_s_counts,&__pyx_n_s_point_x,&__pyx_n_s_point_y,&__pyx_n_s_point_z,&__pyx_n_s_r,0};
PyObject* values[7] = {0,0,0,0,0,0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_grid)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_spacing)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("increment_inside_sphere", 1, 7, 7, 1); __PYX_ERR(0, 138, __pyx_L3_error)
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_counts)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("increment_inside_sphere", 1, 7, 7, 2); __PYX_ERR(0, 138, __pyx_L3_error)
}
case 3:
if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_point_x)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("increment_inside_sphere", 1, 7, 7, 3); __PYX_ERR(0, 138, __pyx_L3_error)
}
case 4:
if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_point_y)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("increment_inside_sphere", 1, 7, 7, 4); __PYX_ERR(0, 138, __pyx_L3_error)
}
case 5:
if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_point_z)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("increment_inside_sphere", 1, 7, 7, 5); __PYX_ERR(0, 138, __pyx_L3_error)
}
case 6:
if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_r)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("increment_inside_sphere", 1, 7, 7, 6); __PYX_ERR(0, 138, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "increment_inside_sphere") < 0)) __PYX_ERR(0, 138, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
}
__pyx_v_grid = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t(values[0]); if (unlikely(!__pyx_v_grid.memview)) __PYX_ERR(0, 139, __pyx_L3_error)
__pyx_v_spacing = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t(values[1]); if (unlikely(!__pyx_v_spacing.memview)) __PYX_ERR(0, 140, __pyx_L3_error)
__pyx_v_counts = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t(values[2]); if (unlikely(!__pyx_v_counts.memview)) __PYX_ERR(0, 141, __pyx_L3_error)
__pyx_v_point_x = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_point_x == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L3_error)
__pyx_v_point_y = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_point_y == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 143, __pyx_L3_error)
__pyx_v_point_z = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_point_z == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 144, __pyx_L3_error)
__pyx_v_r = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_r == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L3_error)
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("increment_inside_sphere", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 138, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("_cython_magic_c7a891f460c6cdee668bf17def65776d.increment_inside_sphere", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_46_cython_magic_c7a891f460c6cdee668bf17def65776d_4increment_inside_sphere(__pyx_self, __pyx_v_grid, __pyx_v_spacing, __pyx_v_counts, __pyx_v_point_x, __pyx_v_point_y, __pyx_v_point_z, __pyx_v_r);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_46_cython_magic_c7a891f460c6cdee668bf17def65776d_4increment_inside_sphere(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_grid, __Pyx_memviewslice __pyx_v_spacing, __Pyx_memviewslice __pyx_v_counts, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_x, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_y, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_z, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_r) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("increment_inside_sphere", 0);
__Pyx_TraceCall("increment_inside_sphere (wrapper)", __pyx_f[0], 138, 0, __PYX_ERR(0, 138, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
if (unlikely(!__pyx_v_grid.memview)) { __Pyx_RaiseUnboundLocalError("grid"); __PYX_ERR(0, 138, __pyx_L1_error) }
if (unlikely(!__pyx_v_spacing.memview)) { __Pyx_RaiseUnboundLocalError("spacing"); __PYX_ERR(0, 138, __pyx_L1_error) }
if (unlikely(!__pyx_v_counts.memview)) { __Pyx_RaiseUnboundLocalError("counts"); __PYX_ERR(0, 138, __pyx_L1_error) }
__pyx_t_1 = __pyx_f_46_cython_magic_c7a891f460c6cdee668bf17def65776d_increment_inside_sphere(__pyx_v_grid, __pyx_v_spacing, __pyx_v_counts, __pyx_v_point_x, __pyx_v_point_y, __pyx_v_point_z, __pyx_v_r, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("_cython_magic_c7a891f460c6cdee668bf17def65776d.increment_inside_sphere", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__PYX_XDEC_MEMVIEW(&__pyx_v_grid, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_spacing, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_counts, 1);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
139: int_t[:,:,:] grid, \
140: float_t[:] spacing, \
141: int_t[:] counts, \
142: float_t point_x, \
143: float_t point_y, \
144: float_t point_z, \
145: float_t r):
146:
147: cdef int_t i, j, k
148: cdef int_t i_min, i_max, j_min, j_max, k_min, k_max
149: cdef float_t dx, dy, dz, dx2, dy2, dz2, dx2dy2, r2
150:
+151: i_min = max(int((point_x-r)/spacing[0]),0)
__Pyx_TraceLine(151,0,__PYX_ERR(0, 151, __pyx_L1_error))
__pyx_t_1 = 0;
__pyx_t_2 = 0;
__pyx_t_3 = __Pyx_PyInt_FromDouble(((__pyx_v_point_x - __pyx_v_r) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_2 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 151, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 151, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 151, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (__pyx_t_7) {
__pyx_t_6 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 151, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_4 = __pyx_t_6;
__pyx_t_6 = 0;
} else {
__Pyx_INCREF(__pyx_t_3);
__pyx_t_4 = __pyx_t_3;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_4); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 151, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_i_min = __pyx_t_8;
+152: i_max = min(int((point_x+r)/spacing[0])+1,counts[0])
__Pyx_TraceLine(152,0,__PYX_ERR(0, 152, __pyx_L1_error))
__pyx_t_9 = 0;
__pyx_t_8 = (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t *) ( /* dim=0 */ (__pyx_v_counts.data + __pyx_t_9 * __pyx_v_counts.strides[0]) )));
__pyx_t_10 = 0;
__pyx_t_4 = __Pyx_PyInt_FromDouble(((__pyx_v_point_x + __pyx_v_r) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_10 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 152, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 152, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 152, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 152, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 152, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
__pyx_t_5 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 152, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_4 = __pyx_t_5;
__pyx_t_5 = 0;
} else {
__Pyx_INCREF(__pyx_t_3);
__pyx_t_4 = __pyx_t_3;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_4); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 152, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_i_max = __pyx_t_8;
+153: j_min = max(int((point_y-r)/spacing[1]),0)
__Pyx_TraceLine(153,0,__PYX_ERR(0, 153, __pyx_L1_error))
__pyx_t_1 = 0;
__pyx_t_11 = 1;
__pyx_t_4 = __Pyx_PyInt_FromDouble(((__pyx_v_point_y - __pyx_v_r) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_11 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (__pyx_t_7) {
__pyx_t_6 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_3 = __pyx_t_6;
__pyx_t_6 = 0;
} else {
__Pyx_INCREF(__pyx_t_4);
__pyx_t_3 = __pyx_t_4;
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_3); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_j_min = __pyx_t_8;
+154: j_max = min(int((point_y+r)/spacing[1])+1,counts[1])
__Pyx_TraceLine(154,0,__PYX_ERR(0, 154, __pyx_L1_error))
__pyx_t_12 = 1;
__pyx_t_8 = (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t *) ( /* dim=0 */ (__pyx_v_counts.data + __pyx_t_12 * __pyx_v_counts.strides[0]) )));
__pyx_t_13 = 1;
__pyx_t_3 = __Pyx_PyInt_FromDouble(((__pyx_v_point_y + __pyx_v_r) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_13 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 154, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 154, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 154, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 154, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 154, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
__pyx_t_5 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 154, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = __pyx_t_5;
__pyx_t_5 = 0;
} else {
__Pyx_INCREF(__pyx_t_4);
__pyx_t_3 = __pyx_t_4;
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_3); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 154, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_j_max = __pyx_t_8;
+155: k_min = max(int((point_z-r)/spacing[2]),0)
__Pyx_TraceLine(155,0,__PYX_ERR(0, 155, __pyx_L1_error))
__pyx_t_1 = 0;
__pyx_t_14 = 2;
__pyx_t_3 = __Pyx_PyInt_FromDouble(((__pyx_v_point_z - __pyx_v_r) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_14 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 155, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 155, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 155, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 155, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (__pyx_t_7) {
__pyx_t_6 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 155, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_4 = __pyx_t_6;
__pyx_t_6 = 0;
} else {
__Pyx_INCREF(__pyx_t_3);
__pyx_t_4 = __pyx_t_3;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_4); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 155, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_k_min = __pyx_t_8;
+156: k_max = min(int((point_z+r)/spacing[2])+1,counts[2])
__Pyx_TraceLine(156,0,__PYX_ERR(0, 156, __pyx_L1_error))
__pyx_t_15 = 2;
__pyx_t_8 = (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t *) ( /* dim=0 */ (__pyx_v_counts.data + __pyx_t_15 * __pyx_v_counts.strides[0]) )));
__pyx_t_16 = 2;
__pyx_t_4 = __Pyx_PyInt_FromDouble(((__pyx_v_point_z + __pyx_v_r) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_16 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 156, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 156, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 156, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 156, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 156, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
__pyx_t_5 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 156, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_4 = __pyx_t_5;
__pyx_t_5 = 0;
} else {
__Pyx_INCREF(__pyx_t_3);
__pyx_t_4 = __pyx_t_3;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_4); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 156, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_k_max = __pyx_t_8;
157:
+158: r2 = r*r
__Pyx_TraceLine(158,0,__PYX_ERR(0, 158, __pyx_L1_error))
__pyx_v_r2 = (__pyx_v_r * __pyx_v_r);
+159: i = i_min
__Pyx_TraceLine(159,0,__PYX_ERR(0, 159, __pyx_L1_error))
__pyx_v_i = __pyx_v_i_min;
+160: while i<i_max:
__Pyx_TraceLine(160,0,__PYX_ERR(0, 160, __pyx_L1_error))
while (1) {
__pyx_t_7 = ((__pyx_v_i < __pyx_v_i_max) != 0);
if (!__pyx_t_7) break;
+161: dx = point_x-i*spacing[0]
__Pyx_TraceLine(161,0,__PYX_ERR(0, 161, __pyx_L1_error))
__pyx_t_17 = 0;
__pyx_v_dx = (__pyx_v_point_x - (__pyx_v_i * (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_17 * __pyx_v_spacing.strides[0]) )))));
+162: dx2 = dx*dx
__Pyx_TraceLine(162,0,__PYX_ERR(0, 162, __pyx_L1_error))
__pyx_v_dx2 = (__pyx_v_dx * __pyx_v_dx);
+163: j = j_min
__Pyx_TraceLine(163,0,__PYX_ERR(0, 163, __pyx_L1_error))
__pyx_v_j = __pyx_v_j_min;
+164: while j<j_max:
__Pyx_TraceLine(164,0,__PYX_ERR(0, 164, __pyx_L1_error))
while (1) {
__pyx_t_7 = ((__pyx_v_j < __pyx_v_j_max) != 0);
if (!__pyx_t_7) break;
+165: dy = point_y-j*spacing[1]
__Pyx_TraceLine(165,0,__PYX_ERR(0, 165, __pyx_L1_error))
__pyx_t_18 = 1;
__pyx_v_dy = (__pyx_v_point_y - (__pyx_v_j * (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_18 * __pyx_v_spacing.strides[0]) )))));
+166: dy2 = dy*dy
__Pyx_TraceLine(166,0,__PYX_ERR(0, 166, __pyx_L1_error))
__pyx_v_dy2 = (__pyx_v_dy * __pyx_v_dy);
+167: dx2dy2 = dx2 + dy2
__Pyx_TraceLine(167,0,__PYX_ERR(0, 167, __pyx_L1_error))
__pyx_v_dx2dy2 = (__pyx_v_dx2 + __pyx_v_dy2);
+168: if dx2dy2 < r2:
__Pyx_TraceLine(168,0,__PYX_ERR(0, 168, __pyx_L1_error))
__pyx_t_7 = ((__pyx_v_dx2dy2 < __pyx_v_r2) != 0);
if (__pyx_t_7) {
/* … */
}
+169: k = k_min
__Pyx_TraceLine(169,0,__PYX_ERR(0, 169, __pyx_L1_error))
__pyx_v_k = __pyx_v_k_min;
+170: while k<k_max:
__Pyx_TraceLine(170,0,__PYX_ERR(0, 170, __pyx_L1_error))
while (1) {
__pyx_t_7 = ((__pyx_v_k < __pyx_v_k_max) != 0);
if (!__pyx_t_7) break;
+171: dz = point_z-k*spacing[2]
__Pyx_TraceLine(171,0,__PYX_ERR(0, 171, __pyx_L1_error))
__pyx_t_19 = 2;
__pyx_v_dz = (__pyx_v_point_z - (__pyx_v_k * (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_19 * __pyx_v_spacing.strides[0]) )))));
+172: dz2 = dz*dz
__Pyx_TraceLine(172,0,__PYX_ERR(0, 172, __pyx_L1_error))
__pyx_v_dz2 = (__pyx_v_dz * __pyx_v_dz);
+173: if (dx2dy2 + dz2) < r2:
__Pyx_TraceLine(173,0,__PYX_ERR(0, 173, __pyx_L1_error))
__pyx_t_7 = (((__pyx_v_dx2dy2 + __pyx_v_dz2) < __pyx_v_r2) != 0);
if (__pyx_t_7) {
/* … */
}
+174: grid[i,j,k]+=1
__Pyx_TraceLine(174,0,__PYX_ERR(0, 174, __pyx_L1_error))
__pyx_t_20 = __pyx_v_i;
__pyx_t_21 = __pyx_v_j;
__pyx_t_22 = __pyx_v_k;
*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_grid.data + __pyx_t_20 * __pyx_v_grid.strides[0]) ) + __pyx_t_21 * __pyx_v_grid.strides[1]) ) + __pyx_t_22 * __pyx_v_grid.strides[2]) )) += 1;
+175: k += 1
__Pyx_TraceLine(175,0,__PYX_ERR(0, 175, __pyx_L1_error))
__pyx_v_k = (__pyx_v_k + 1);
}
+176: j += 1
__Pyx_TraceLine(176,0,__PYX_ERR(0, 176, __pyx_L1_error))
__pyx_v_j = (__pyx_v_j + 1);
}
+177: i += 1
__Pyx_TraceLine(177,0,__PYX_ERR(0, 177, __pyx_L1_error))
__pyx_v_i = (__pyx_v_i + 1);
}
178:
179: @cython.boundscheck(False)
180: @cython.wraparound(False)
181: @cython.cdivision(True)
+182: cpdef decrement_inside_sphere(\
static PyObject *__pyx_pw_46_cython_magic_c7a891f460c6cdee668bf17def65776d_7decrement_inside_sphere(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_46_cython_magic_c7a891f460c6cdee668bf17def65776d_decrement_inside_sphere(__Pyx_memviewslice __pyx_v_grid, __Pyx_memviewslice __pyx_v_spacing, __Pyx_memviewslice __pyx_v_counts, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_x, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_y, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_z, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_r, CYTHON_UNUSED int __pyx_skip_dispatch) {
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_i;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_j;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_k;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_i_min;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_i_max;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_j_min;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_j_max;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_k_min;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_k_max;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dx;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dy;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dz;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dx2;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dy2;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dz2;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dx2dy2;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_r2;
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("decrement_inside_sphere", 0);
__Pyx_TraceCall("decrement_inside_sphere", __pyx_f[0], 182, 0, __PYX_ERR(0, 182, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("_cython_magic_c7a891f460c6cdee668bf17def65776d.decrement_inside_sphere", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_46_cython_magic_c7a891f460c6cdee668bf17def65776d_7decrement_inside_sphere(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_46_cython_magic_c7a891f460c6cdee668bf17def65776d_7decrement_inside_sphere(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
__Pyx_memviewslice __pyx_v_grid = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_spacing = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_counts = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_x;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_y;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_z;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_r;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("decrement_inside_sphere (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_grid,&__pyx_n_s_spacing,&__pyx_n_s_counts,&__pyx_n_s_point_x,&__pyx_n_s_point_y,&__pyx_n_s_point_z,&__pyx_n_s_r,0};
PyObject* values[7] = {0,0,0,0,0,0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_grid)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_spacing)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("decrement_inside_sphere", 1, 7, 7, 1); __PYX_ERR(0, 182, __pyx_L3_error)
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_counts)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("decrement_inside_sphere", 1, 7, 7, 2); __PYX_ERR(0, 182, __pyx_L3_error)
}
case 3:
if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_point_x)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("decrement_inside_sphere", 1, 7, 7, 3); __PYX_ERR(0, 182, __pyx_L3_error)
}
case 4:
if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_point_y)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("decrement_inside_sphere", 1, 7, 7, 4); __PYX_ERR(0, 182, __pyx_L3_error)
}
case 5:
if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_point_z)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("decrement_inside_sphere", 1, 7, 7, 5); __PYX_ERR(0, 182, __pyx_L3_error)
}
case 6:
if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_r)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("decrement_inside_sphere", 1, 7, 7, 6); __PYX_ERR(0, 182, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decrement_inside_sphere") < 0)) __PYX_ERR(0, 182, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
}
__pyx_v_grid = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t(values[0]); if (unlikely(!__pyx_v_grid.memview)) __PYX_ERR(0, 183, __pyx_L3_error)
__pyx_v_spacing = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t(values[1]); if (unlikely(!__pyx_v_spacing.memview)) __PYX_ERR(0, 184, __pyx_L3_error)
__pyx_v_counts = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t(values[2]); if (unlikely(!__pyx_v_counts.memview)) __PYX_ERR(0, 185, __pyx_L3_error)
__pyx_v_point_x = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_point_x == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L3_error)
__pyx_v_point_y = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_point_y == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 187, __pyx_L3_error)
__pyx_v_point_z = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_point_z == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 188, __pyx_L3_error)
__pyx_v_r = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_r == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L3_error)
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("decrement_inside_sphere", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 182, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("_cython_magic_c7a891f460c6cdee668bf17def65776d.decrement_inside_sphere", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_46_cython_magic_c7a891f460c6cdee668bf17def65776d_6decrement_inside_sphere(__pyx_self, __pyx_v_grid, __pyx_v_spacing, __pyx_v_counts, __pyx_v_point_x, __pyx_v_point_y, __pyx_v_point_z, __pyx_v_r);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_46_cython_magic_c7a891f460c6cdee668bf17def65776d_6decrement_inside_sphere(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_grid, __Pyx_memviewslice __pyx_v_spacing, __Pyx_memviewslice __pyx_v_counts, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_x, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_y, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_z, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_r) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("decrement_inside_sphere", 0);
__Pyx_TraceCall("decrement_inside_sphere (wrapper)", __pyx_f[0], 182, 0, __PYX_ERR(0, 182, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
if (unlikely(!__pyx_v_grid.memview)) { __Pyx_RaiseUnboundLocalError("grid"); __PYX_ERR(0, 182, __pyx_L1_error) }
if (unlikely(!__pyx_v_spacing.memview)) { __Pyx_RaiseUnboundLocalError("spacing"); __PYX_ERR(0, 182, __pyx_L1_error) }
if (unlikely(!__pyx_v_counts.memview)) { __Pyx_RaiseUnboundLocalError("counts"); __PYX_ERR(0, 182, __pyx_L1_error) }
__pyx_t_1 = __pyx_f_46_cython_magic_c7a891f460c6cdee668bf17def65776d_decrement_inside_sphere(__pyx_v_grid, __pyx_v_spacing, __pyx_v_counts, __pyx_v_point_x, __pyx_v_point_y, __pyx_v_point_z, __pyx_v_r, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("_cython_magic_c7a891f460c6cdee668bf17def65776d.decrement_inside_sphere", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__PYX_XDEC_MEMVIEW(&__pyx_v_grid, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_spacing, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_counts, 1);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
183: int_t[:,:,:] grid, \
184: float_t[:] spacing, \
185: int_t[:] counts, \
186: float_t point_x, \
187: float_t point_y, \
188: float_t point_z, \
189: float_t r):
190:
191: cdef int_t i, j, k
192: cdef int_t i_min, i_max, j_min, j_max, k_min, k_max
193: cdef float_t dx, dy, dz, dx2, dy2, dz2, dx2dy2, r2
194:
+195: i_min = max(int((point_x-r)/spacing[0]),0)
__Pyx_TraceLine(195,0,__PYX_ERR(0, 195, __pyx_L1_error))
__pyx_t_1 = 0;
__pyx_t_2 = 0;
__pyx_t_3 = __Pyx_PyInt_FromDouble(((__pyx_v_point_x - __pyx_v_r) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_2 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 195, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 195, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 195, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 195, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (__pyx_t_7) {
__pyx_t_6 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 195, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_4 = __pyx_t_6;
__pyx_t_6 = 0;
} else {
__Pyx_INCREF(__pyx_t_3);
__pyx_t_4 = __pyx_t_3;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_4); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_i_min = __pyx_t_8;
+196: i_max = min(int((point_x+r)/spacing[0])+1,counts[0])
__Pyx_TraceLine(196,0,__PYX_ERR(0, 196, __pyx_L1_error))
__pyx_t_9 = 0;
__pyx_t_8 = (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t *) ( /* dim=0 */ (__pyx_v_counts.data + __pyx_t_9 * __pyx_v_counts.strides[0]) )));
__pyx_t_10 = 0;
__pyx_t_4 = __Pyx_PyInt_FromDouble(((__pyx_v_point_x + __pyx_v_r) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_10 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 196, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 196, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 196, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 196, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
__pyx_t_5 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_4 = __pyx_t_5;
__pyx_t_5 = 0;
} else {
__Pyx_INCREF(__pyx_t_3);
__pyx_t_4 = __pyx_t_3;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_4); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 196, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_i_max = __pyx_t_8;
+197: j_min = max(int((point_y-r)/spacing[1]),0)
__Pyx_TraceLine(197,0,__PYX_ERR(0, 197, __pyx_L1_error))
__pyx_t_1 = 0;
__pyx_t_11 = 1;
__pyx_t_4 = __Pyx_PyInt_FromDouble(((__pyx_v_point_y - __pyx_v_r) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_11 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 197, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 197, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 197, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 197, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (__pyx_t_7) {
__pyx_t_6 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 197, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_3 = __pyx_t_6;
__pyx_t_6 = 0;
} else {
__Pyx_INCREF(__pyx_t_4);
__pyx_t_3 = __pyx_t_4;
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_3); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_j_min = __pyx_t_8;
+198: j_max = min(int((point_y+r)/spacing[1])+1,counts[1])
__Pyx_TraceLine(198,0,__PYX_ERR(0, 198, __pyx_L1_error))
__pyx_t_12 = 1;
__pyx_t_8 = (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t *) ( /* dim=0 */ (__pyx_v_counts.data + __pyx_t_12 * __pyx_v_counts.strides[0]) )));
__pyx_t_13 = 1;
__pyx_t_3 = __Pyx_PyInt_FromDouble(((__pyx_v_point_y + __pyx_v_r) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_13 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 198, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 198, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 198, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 198, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 198, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
__pyx_t_5 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 198, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = __pyx_t_5;
__pyx_t_5 = 0;
} else {
__Pyx_INCREF(__pyx_t_4);
__pyx_t_3 = __pyx_t_4;
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_3); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 198, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_j_max = __pyx_t_8;
+199: k_min = max(int((point_z-r)/spacing[2]),0)
__Pyx_TraceLine(199,0,__PYX_ERR(0, 199, __pyx_L1_error))
__pyx_t_1 = 0;
__pyx_t_14 = 2;
__pyx_t_3 = __Pyx_PyInt_FromDouble(((__pyx_v_point_z - __pyx_v_r) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_14 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 199, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 199, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 199, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 199, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (__pyx_t_7) {
__pyx_t_6 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 199, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_4 = __pyx_t_6;
__pyx_t_6 = 0;
} else {
__Pyx_INCREF(__pyx_t_3);
__pyx_t_4 = __pyx_t_3;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_4); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 199, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_k_min = __pyx_t_8;
+200: k_max = min(int((point_z+r)/spacing[2])+1,counts[2])
__Pyx_TraceLine(200,0,__PYX_ERR(0, 200, __pyx_L1_error))
__pyx_t_15 = 2;
__pyx_t_8 = (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t *) ( /* dim=0 */ (__pyx_v_counts.data + __pyx_t_15 * __pyx_v_counts.strides[0]) )));
__pyx_t_16 = 2;
__pyx_t_4 = __Pyx_PyInt_FromDouble(((__pyx_v_point_z + __pyx_v_r) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_16 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 200, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 200, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 200, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 200, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
__pyx_t_5 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 200, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_4 = __pyx_t_5;
__pyx_t_5 = 0;
} else {
__Pyx_INCREF(__pyx_t_3);
__pyx_t_4 = __pyx_t_3;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_4); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 200, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_k_max = __pyx_t_8;
201:
+202: r2 = r*r
__Pyx_TraceLine(202,0,__PYX_ERR(0, 202, __pyx_L1_error))
__pyx_v_r2 = (__pyx_v_r * __pyx_v_r);
+203: i = i_min
__Pyx_TraceLine(203,0,__PYX_ERR(0, 203, __pyx_L1_error))
__pyx_v_i = __pyx_v_i_min;
+204: while i<i_max:
__Pyx_TraceLine(204,0,__PYX_ERR(0, 204, __pyx_L1_error))
while (1) {
__pyx_t_7 = ((__pyx_v_i < __pyx_v_i_max) != 0);
if (!__pyx_t_7) break;
+205: dx = point_x-i*spacing[0]
__Pyx_TraceLine(205,0,__PYX_ERR(0, 205, __pyx_L1_error))
__pyx_t_17 = 0;
__pyx_v_dx = (__pyx_v_point_x - (__pyx_v_i * (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_17 * __pyx_v_spacing.strides[0]) )))));
+206: dx2 = dx*dx
__Pyx_TraceLine(206,0,__PYX_ERR(0, 206, __pyx_L1_error))
__pyx_v_dx2 = (__pyx_v_dx * __pyx_v_dx);
+207: j = j_min
__Pyx_TraceLine(207,0,__PYX_ERR(0, 207, __pyx_L1_error))
__pyx_v_j = __pyx_v_j_min;
+208: while j<j_max:
__Pyx_TraceLine(208,0,__PYX_ERR(0, 208, __pyx_L1_error))
while (1) {
__pyx_t_7 = ((__pyx_v_j < __pyx_v_j_max) != 0);
if (!__pyx_t_7) break;
+209: dy = point_y-j*spacing[1]
__Pyx_TraceLine(209,0,__PYX_ERR(0, 209, __pyx_L1_error))
__pyx_t_18 = 1;
__pyx_v_dy = (__pyx_v_point_y - (__pyx_v_j * (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_18 * __pyx_v_spacing.strides[0]) )))));
+210: dy2 = dy*dy
__Pyx_TraceLine(210,0,__PYX_ERR(0, 210, __pyx_L1_error))
__pyx_v_dy2 = (__pyx_v_dy * __pyx_v_dy);
+211: dx2dy2 = dx2 + dy2
__Pyx_TraceLine(211,0,__PYX_ERR(0, 211, __pyx_L1_error))
__pyx_v_dx2dy2 = (__pyx_v_dx2 + __pyx_v_dy2);
+212: if dx2dy2 < r2:
__Pyx_TraceLine(212,0,__PYX_ERR(0, 212, __pyx_L1_error))
__pyx_t_7 = ((__pyx_v_dx2dy2 < __pyx_v_r2) != 0);
if (__pyx_t_7) {
/* … */
}
+213: k = k_min
__Pyx_TraceLine(213,0,__PYX_ERR(0, 213, __pyx_L1_error))
__pyx_v_k = __pyx_v_k_min;
+214: while k<k_max:
__Pyx_TraceLine(214,0,__PYX_ERR(0, 214, __pyx_L1_error))
while (1) {
__pyx_t_7 = ((__pyx_v_k < __pyx_v_k_max) != 0);
if (!__pyx_t_7) break;
+215: dz = point_z-k*spacing[2]
__Pyx_TraceLine(215,0,__PYX_ERR(0, 215, __pyx_L1_error))
__pyx_t_19 = 2;
__pyx_v_dz = (__pyx_v_point_z - (__pyx_v_k * (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_19 * __pyx_v_spacing.strides[0]) )))));
+216: dz2 = dz*dz
__Pyx_TraceLine(216,0,__PYX_ERR(0, 216, __pyx_L1_error))
__pyx_v_dz2 = (__pyx_v_dz * __pyx_v_dz);
+217: if (dx2dy2 + dz2) < r2:
__Pyx_TraceLine(217,0,__PYX_ERR(0, 217, __pyx_L1_error))
__pyx_t_7 = (((__pyx_v_dx2dy2 + __pyx_v_dz2) < __pyx_v_r2) != 0);
if (__pyx_t_7) {
/* … */
}
+218: grid[i,j,k]-=1
__Pyx_TraceLine(218,0,__PYX_ERR(0, 218, __pyx_L1_error))
__pyx_t_20 = __pyx_v_i;
__pyx_t_21 = __pyx_v_j;
__pyx_t_22 = __pyx_v_k;
*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_grid.data + __pyx_t_20 * __pyx_v_grid.strides[0]) ) + __pyx_t_21 * __pyx_v_grid.strides[1]) ) + __pyx_t_22 * __pyx_v_grid.strides[2]) )) -= 1;
+219: k += 1
__Pyx_TraceLine(219,0,__PYX_ERR(0, 219, __pyx_L1_error))
__pyx_v_k = (__pyx_v_k + 1);
}
+220: j += 1
__Pyx_TraceLine(220,0,__PYX_ERR(0, 220, __pyx_L1_error))
__pyx_v_j = (__pyx_v_j + 1);
}
+221: i += 1
__Pyx_TraceLine(221,0,__PYX_ERR(0, 221, __pyx_L1_error))
__pyx_v_i = (__pyx_v_i + 1);
}
222:
223: # Performs numerical integrals of r**(-4) over the grid points
224: # between r_min and r_max, either
225: # over the low dielectric region or over all points
226: # Returns the ratio of the integrals
227: @cython.boundscheck(False)
228: @cython.wraparound(False)
229: @cython.cdivision(True)
+230: cpdef fraction_r4inv_low_dielectric(\
static PyObject *__pyx_pw_46_cython_magic_c7a891f460c6cdee668bf17def65776d_9fraction_r4inv_low_dielectric(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_46_cython_magic_c7a891f460c6cdee668bf17def65776d_fraction_r4inv_low_dielectric(__Pyx_memviewslice __pyx_v_grid, __Pyx_memviewslice __pyx_v_spacing, __Pyx_memviewslice __pyx_v_counts, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_x, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_y, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_z, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_r_min, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_r_max, CYTHON_UNUSED int __pyx_skip_dispatch) {
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_i;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_j;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_k;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_i_min;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_i_max;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_j_min;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_j_max;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_k_min;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_k_max;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_I_low_dielectric;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_I_total;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dx;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dy;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dz;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dx2;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dy2;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dz2;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dx2dy2;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_r2;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_r_min2;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_r_max2;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_r4inv;
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("fraction_r4inv_low_dielectric", 0);
__Pyx_TraceCall("fraction_r4inv_low_dielectric", __pyx_f[0], 230, 0, __PYX_ERR(0, 230, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("_cython_magic_c7a891f460c6cdee668bf17def65776d.fraction_r4inv_low_dielectric", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_46_cython_magic_c7a891f460c6cdee668bf17def65776d_9fraction_r4inv_low_dielectric(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_46_cython_magic_c7a891f460c6cdee668bf17def65776d_9fraction_r4inv_low_dielectric(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
__Pyx_memviewslice __pyx_v_grid = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_spacing = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_counts = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_x;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_y;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_z;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_r_min;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_r_max;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("fraction_r4inv_low_dielectric (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_grid,&__pyx_n_s_spacing,&__pyx_n_s_counts,&__pyx_n_s_point_x,&__pyx_n_s_point_y,&__pyx_n_s_point_z,&__pyx_n_s_r_min,&__pyx_n_s_r_max,0};
PyObject* values[8] = {0,0,0,0,0,0,0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_grid)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_spacing)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("fraction_r4inv_low_dielectric", 1, 8, 8, 1); __PYX_ERR(0, 230, __pyx_L3_error)
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_counts)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("fraction_r4inv_low_dielectric", 1, 8, 8, 2); __PYX_ERR(0, 230, __pyx_L3_error)
}
case 3:
if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_point_x)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("fraction_r4inv_low_dielectric", 1, 8, 8, 3); __PYX_ERR(0, 230, __pyx_L3_error)
}
case 4:
if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_point_y)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("fraction_r4inv_low_dielectric", 1, 8, 8, 4); __PYX_ERR(0, 230, __pyx_L3_error)
}
case 5:
if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_point_z)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("fraction_r4inv_low_dielectric", 1, 8, 8, 5); __PYX_ERR(0, 230, __pyx_L3_error)
}
case 6:
if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_r_min)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("fraction_r4inv_low_dielectric", 1, 8, 8, 6); __PYX_ERR(0, 230, __pyx_L3_error)
}
case 7:
if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_r_max)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("fraction_r4inv_low_dielectric", 1, 8, 8, 7); __PYX_ERR(0, 230, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fraction_r4inv_low_dielectric") < 0)) __PYX_ERR(0, 230, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 8) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
}
__pyx_v_grid = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t(values[0]); if (unlikely(!__pyx_v_grid.memview)) __PYX_ERR(0, 231, __pyx_L3_error)
__pyx_v_spacing = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t(values[1]); if (unlikely(!__pyx_v_spacing.memview)) __PYX_ERR(0, 232, __pyx_L3_error)
__pyx_v_counts = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t(values[2]); if (unlikely(!__pyx_v_counts.memview)) __PYX_ERR(0, 233, __pyx_L3_error)
__pyx_v_point_x = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_point_x == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L3_error)
__pyx_v_point_y = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_point_y == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 235, __pyx_L3_error)
__pyx_v_point_z = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_point_z == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 236, __pyx_L3_error)
__pyx_v_r_min = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_r_min == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 237, __pyx_L3_error)
__pyx_v_r_max = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_r_max == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 238, __pyx_L3_error)
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("fraction_r4inv_low_dielectric", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 230, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("_cython_magic_c7a891f460c6cdee668bf17def65776d.fraction_r4inv_low_dielectric", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_46_cython_magic_c7a891f460c6cdee668bf17def65776d_8fraction_r4inv_low_dielectric(__pyx_self, __pyx_v_grid, __pyx_v_spacing, __pyx_v_counts, __pyx_v_point_x, __pyx_v_point_y, __pyx_v_point_z, __pyx_v_r_min, __pyx_v_r_max);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_46_cython_magic_c7a891f460c6cdee668bf17def65776d_8fraction_r4inv_low_dielectric(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_grid, __Pyx_memviewslice __pyx_v_spacing, __Pyx_memviewslice __pyx_v_counts, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_x, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_y, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_point_z, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_r_min, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_r_max) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("fraction_r4inv_low_dielectric", 0);
__Pyx_TraceCall("fraction_r4inv_low_dielectric (wrapper)", __pyx_f[0], 230, 0, __PYX_ERR(0, 230, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
if (unlikely(!__pyx_v_grid.memview)) { __Pyx_RaiseUnboundLocalError("grid"); __PYX_ERR(0, 230, __pyx_L1_error) }
if (unlikely(!__pyx_v_spacing.memview)) { __Pyx_RaiseUnboundLocalError("spacing"); __PYX_ERR(0, 230, __pyx_L1_error) }
if (unlikely(!__pyx_v_counts.memview)) { __Pyx_RaiseUnboundLocalError("counts"); __PYX_ERR(0, 230, __pyx_L1_error) }
__pyx_t_1 = __pyx_f_46_cython_magic_c7a891f460c6cdee668bf17def65776d_fraction_r4inv_low_dielectric(__pyx_v_grid, __pyx_v_spacing, __pyx_v_counts, __pyx_v_point_x, __pyx_v_point_y, __pyx_v_point_z, __pyx_v_r_min, __pyx_v_r_max, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("_cython_magic_c7a891f460c6cdee668bf17def65776d.fraction_r4inv_low_dielectric", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__PYX_XDEC_MEMVIEW(&__pyx_v_grid, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_spacing, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_counts, 1);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
231: int_t[:,:,:] grid, \
232: float_t[:] spacing, \
233: int_t[:] counts, \
234: float_t point_x, \
235: float_t point_y, \
236: float_t point_z, \
237: float_t r_min, \
238: float_t r_max):
239: cdef int_t i, j, k
240: cdef int_t i_min, i_max, j_min, j_max, k_min, k_max
241: cdef float_t I_low_dielectric, I_total
242: cdef float_t dx, dy, dz, dx2, dy2, dz2, dx2dy2
243: cdef float_t r2, r_min2, r_max2, r4inv
244:
+245: I_low_dielectric = 0.
__Pyx_TraceLine(245,0,__PYX_ERR(0, 245, __pyx_L1_error))
__pyx_v_I_low_dielectric = 0.;
+246: I_total = 0.
__Pyx_TraceLine(246,0,__PYX_ERR(0, 246, __pyx_L1_error))
__pyx_v_I_total = 0.;
247:
+248: i_min = max(int((point_x-r_max)/spacing[0]),0)
__Pyx_TraceLine(248,0,__PYX_ERR(0, 248, __pyx_L1_error))
__pyx_t_1 = 0;
__pyx_t_2 = 0;
__pyx_t_3 = __Pyx_PyInt_FromDouble(((__pyx_v_point_x - __pyx_v_r_max) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_2 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 248, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 248, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 248, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 248, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (__pyx_t_7) {
__pyx_t_6 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 248, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_4 = __pyx_t_6;
__pyx_t_6 = 0;
} else {
__Pyx_INCREF(__pyx_t_3);
__pyx_t_4 = __pyx_t_3;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_4); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 248, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_i_min = __pyx_t_8;
+249: i_max = min(int((point_x+r_max)/spacing[0])+1,counts[0])
__Pyx_TraceLine(249,0,__PYX_ERR(0, 249, __pyx_L1_error))
__pyx_t_9 = 0;
__pyx_t_8 = (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t *) ( /* dim=0 */ (__pyx_v_counts.data + __pyx_t_9 * __pyx_v_counts.strides[0]) )));
__pyx_t_10 = 0;
__pyx_t_4 = __Pyx_PyInt_FromDouble(((__pyx_v_point_x + __pyx_v_r_max) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_10 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 249, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 249, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 249, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 249, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 249, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
__pyx_t_5 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 249, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_4 = __pyx_t_5;
__pyx_t_5 = 0;
} else {
__Pyx_INCREF(__pyx_t_3);
__pyx_t_4 = __pyx_t_3;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_4); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 249, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_i_max = __pyx_t_8;
+250: j_min = max(int((point_y-r_max)/spacing[1]),0)
__Pyx_TraceLine(250,0,__PYX_ERR(0, 250, __pyx_L1_error))
__pyx_t_1 = 0;
__pyx_t_11 = 1;
__pyx_t_4 = __Pyx_PyInt_FromDouble(((__pyx_v_point_y - __pyx_v_r_max) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_11 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 250, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 250, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 250, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 250, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (__pyx_t_7) {
__pyx_t_6 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 250, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_3 = __pyx_t_6;
__pyx_t_6 = 0;
} else {
__Pyx_INCREF(__pyx_t_4);
__pyx_t_3 = __pyx_t_4;
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_3); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 250, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_j_min = __pyx_t_8;
+251: j_max = min(int((point_y+r_max)/spacing[1])+1,counts[1])
__Pyx_TraceLine(251,0,__PYX_ERR(0, 251, __pyx_L1_error))
__pyx_t_12 = 1;
__pyx_t_8 = (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t *) ( /* dim=0 */ (__pyx_v_counts.data + __pyx_t_12 * __pyx_v_counts.strides[0]) )));
__pyx_t_13 = 1;
__pyx_t_3 = __Pyx_PyInt_FromDouble(((__pyx_v_point_y + __pyx_v_r_max) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_13 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 251, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 251, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 251, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 251, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
__pyx_t_5 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 251, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = __pyx_t_5;
__pyx_t_5 = 0;
} else {
__Pyx_INCREF(__pyx_t_4);
__pyx_t_3 = __pyx_t_4;
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_3); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 251, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_j_max = __pyx_t_8;
+252: k_min = max(int((point_z-r_max)/spacing[2]),0)
__Pyx_TraceLine(252,0,__PYX_ERR(0, 252, __pyx_L1_error))
__pyx_t_1 = 0;
__pyx_t_14 = 2;
__pyx_t_3 = __Pyx_PyInt_FromDouble(((__pyx_v_point_z - __pyx_v_r_max) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_14 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 252, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 252, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 252, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 252, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (__pyx_t_7) {
__pyx_t_6 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 252, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_4 = __pyx_t_6;
__pyx_t_6 = 0;
} else {
__Pyx_INCREF(__pyx_t_3);
__pyx_t_4 = __pyx_t_3;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_4); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 252, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_k_min = __pyx_t_8;
+253: k_max = min(int((point_z+r_max)/spacing[2])+1,counts[2])
__Pyx_TraceLine(253,0,__PYX_ERR(0, 253, __pyx_L1_error))
__pyx_t_15 = 2;
__pyx_t_8 = (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t *) ( /* dim=0 */ (__pyx_v_counts.data + __pyx_t_15 * __pyx_v_counts.strides[0]) )));
__pyx_t_16 = 2;
__pyx_t_4 = __Pyx_PyInt_FromDouble(((__pyx_v_point_z + __pyx_v_r_max) / (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_16 * __pyx_v_spacing.strides[0]) ))))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 253, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 253, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 253, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 253, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 253, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_7) {
__pyx_t_5 = __Pyx_PyInt_From_npy_long(__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 253, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_4 = __pyx_t_5;
__pyx_t_5 = 0;
} else {
__Pyx_INCREF(__pyx_t_3);
__pyx_t_4 = __pyx_t_3;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = __Pyx_PyInt_As_npy_long(__pyx_t_4); if (unlikely((__pyx_t_8 == (npy_long)-1) && PyErr_Occurred())) __PYX_ERR(0, 253, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_k_max = __pyx_t_8;
254:
+255: r_min2 = r_min*r_min
__Pyx_TraceLine(255,0,__PYX_ERR(0, 255, __pyx_L1_error))
__pyx_v_r_min2 = (__pyx_v_r_min * __pyx_v_r_min);
+256: r_max2 = r_max*r_max
__Pyx_TraceLine(256,0,__PYX_ERR(0, 256, __pyx_L1_error))
__pyx_v_r_max2 = (__pyx_v_r_max * __pyx_v_r_max);
+257: i = i_min
__Pyx_TraceLine(257,0,__PYX_ERR(0, 257, __pyx_L1_error))
__pyx_v_i = __pyx_v_i_min;
+258: while i<i_max:
__Pyx_TraceLine(258,0,__PYX_ERR(0, 258, __pyx_L1_error))
while (1) {
__pyx_t_7 = ((__pyx_v_i < __pyx_v_i_max) != 0);
if (!__pyx_t_7) break;
+259: dx = point_x-i*spacing[0]
__Pyx_TraceLine(259,0,__PYX_ERR(0, 259, __pyx_L1_error))
__pyx_t_17 = 0;
__pyx_v_dx = (__pyx_v_point_x - (__pyx_v_i * (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_17 * __pyx_v_spacing.strides[0]) )))));
+260: dx2 = dx*dx
__Pyx_TraceLine(260,0,__PYX_ERR(0, 260, __pyx_L1_error))
__pyx_v_dx2 = (__pyx_v_dx * __pyx_v_dx);
+261: j = j_min
__Pyx_TraceLine(261,0,__PYX_ERR(0, 261, __pyx_L1_error))
__pyx_v_j = __pyx_v_j_min;
+262: while j<j_max:
__Pyx_TraceLine(262,0,__PYX_ERR(0, 262, __pyx_L1_error))
while (1) {
__pyx_t_7 = ((__pyx_v_j < __pyx_v_j_max) != 0);
if (!__pyx_t_7) break;
+263: dy = point_y-j*spacing[1]
__Pyx_TraceLine(263,0,__PYX_ERR(0, 263, __pyx_L1_error))
__pyx_t_18 = 1;
__pyx_v_dy = (__pyx_v_point_y - (__pyx_v_j * (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_18 * __pyx_v_spacing.strides[0]) )))));
+264: dy2 = dy*dy
__Pyx_TraceLine(264,0,__PYX_ERR(0, 264, __pyx_L1_error))
__pyx_v_dy2 = (__pyx_v_dy * __pyx_v_dy);
+265: dx2dy2 = dx2 + dy2
__Pyx_TraceLine(265,0,__PYX_ERR(0, 265, __pyx_L1_error))
__pyx_v_dx2dy2 = (__pyx_v_dx2 + __pyx_v_dy2);
+266: if dx2dy2 < r_max2:
__Pyx_TraceLine(266,0,__PYX_ERR(0, 266, __pyx_L1_error))
__pyx_t_7 = ((__pyx_v_dx2dy2 < __pyx_v_r_max2) != 0);
if (__pyx_t_7) {
/* … */
}
+267: k = k_min
__Pyx_TraceLine(267,0,__PYX_ERR(0, 267, __pyx_L1_error))
__pyx_v_k = __pyx_v_k_min;
+268: while k<k_max:
__Pyx_TraceLine(268,0,__PYX_ERR(0, 268, __pyx_L1_error))
while (1) {
__pyx_t_7 = ((__pyx_v_k < __pyx_v_k_max) != 0);
if (!__pyx_t_7) break;
+269: dz = point_z-k*spacing[2]
__Pyx_TraceLine(269,0,__PYX_ERR(0, 269, __pyx_L1_error))
__pyx_t_19 = 2;
__pyx_v_dz = (__pyx_v_point_z - (__pyx_v_k * (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_19 * __pyx_v_spacing.strides[0]) )))));
+270: dz2 = dz*dz
__Pyx_TraceLine(270,0,__PYX_ERR(0, 270, __pyx_L1_error))
__pyx_v_dz2 = (__pyx_v_dz * __pyx_v_dz);
+271: r2 = dx2dy2 + dz2
__Pyx_TraceLine(271,0,__PYX_ERR(0, 271, __pyx_L1_error))
__pyx_v_r2 = (__pyx_v_dx2dy2 + __pyx_v_dz2);
+272: if (r2 < r_max2) and (r2 > r_min2):
__Pyx_TraceLine(272,0,__PYX_ERR(0, 272, __pyx_L1_error))
__pyx_t_20 = ((__pyx_v_r2 < __pyx_v_r_max2) != 0);
if (__pyx_t_20) {
} else {
__pyx_t_7 = __pyx_t_20;
goto __pyx_L11_bool_binop_done;
}
__pyx_t_20 = ((__pyx_v_r2 > __pyx_v_r_min2) != 0);
__pyx_t_7 = __pyx_t_20;
__pyx_L11_bool_binop_done:;
if (__pyx_t_7) {
/* … */
}
+273: r4inv = 1/(r2*r2)
__Pyx_TraceLine(273,0,__PYX_ERR(0, 273, __pyx_L1_error))
__pyx_v_r4inv = (1.0 / (__pyx_v_r2 * __pyx_v_r2));
+274: if grid[i,j,k]<1:
__Pyx_TraceLine(274,0,__PYX_ERR(0, 274, __pyx_L1_error))
__pyx_t_21 = __pyx_v_i;
__pyx_t_22 = __pyx_v_j;
__pyx_t_23 = __pyx_v_k;
__pyx_t_7 = (((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_grid.data + __pyx_t_21 * __pyx_v_grid.strides[0]) ) + __pyx_t_22 * __pyx_v_grid.strides[1]) ) + __pyx_t_23 * __pyx_v_grid.strides[2]) ))) < 1) != 0);
if (__pyx_t_7) {
/* … */
}
+275: I_low_dielectric += r4inv
__Pyx_TraceLine(275,0,__PYX_ERR(0, 275, __pyx_L1_error))
__pyx_v_I_low_dielectric = (__pyx_v_I_low_dielectric + __pyx_v_r4inv);
+276: I_total += r4inv
__Pyx_TraceLine(276,0,__PYX_ERR(0, 276, __pyx_L1_error))
__pyx_v_I_total = (__pyx_v_I_total + __pyx_v_r4inv);
+277: k += 1
__Pyx_TraceLine(277,0,__PYX_ERR(0, 277, __pyx_L1_error))
__pyx_v_k = (__pyx_v_k + 1);
}
+278: j += 1
__Pyx_TraceLine(278,0,__PYX_ERR(0, 278, __pyx_L1_error))
__pyx_v_j = (__pyx_v_j + 1);
}
+279: i += 1
__Pyx_TraceLine(279,0,__PYX_ERR(0, 279, __pyx_L1_error))
__pyx_v_i = (__pyx_v_i + 1);
}
+280: return I_low_dielectric/I_total
__Pyx_TraceLine(280,0,__PYX_ERR(0, 280, __pyx_L1_error))
__Pyx_XDECREF(__pyx_r);
__pyx_t_4 = PyFloat_FromDouble((__pyx_v_I_low_dielectric / __pyx_v_I_total)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 280, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L0;
281:
282: # @cython.boundscheck(False)
283: # @cython.wraparound(False)
284: # @cython.cdivision(True)
285: # cp
+286: def calc_desolvationGrid(int_t[:,:,:] receptor_MS_grid, \
/* Python wrapper */
static PyObject *__pyx_pw_46_cython_magic_c7a891f460c6cdee668bf17def65776d_11calc_desolvationGrid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_46_cython_magic_c7a891f460c6cdee668bf17def65776d_11calc_desolvationGrid = {"calc_desolvationGrid", (PyCFunction)__pyx_pw_46_cython_magic_c7a891f460c6cdee668bf17def65776d_11calc_desolvationGrid, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_46_cython_magic_c7a891f460c6cdee668bf17def65776d_11calc_desolvationGrid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
__Pyx_memviewslice __pyx_v_receptor_MS_grid = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_spacing = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_counts = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_receptor_SAS_points = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_receptor_coordinates = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_SAS_sphere_pts = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_LJ_r2 = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_LJ_r_max;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_ligand_atom_radius;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_probe_radius;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_integration_cutoff;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("calc_desolvationGrid (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_receptor_MS_grid,&__pyx_n_s_spacing,&__pyx_n_s_counts,&__pyx_n_s_receptor_SAS_points,&__pyx_n_s_receptor_coordinates,&__pyx_n_s_SAS_sphere_pts,&__pyx_n_s_LJ_r2,&__pyx_n_s_LJ_r_max,&__pyx_n_s_ligand_atom_radius,&__pyx_n_s_probe_radius,&__pyx_n_s_integration_cutoff,0};
PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_receptor_MS_grid)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_spacing)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_desolvationGrid", 1, 11, 11, 1); __PYX_ERR(0, 286, __pyx_L3_error)
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_counts)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_desolvationGrid", 1, 11, 11, 2); __PYX_ERR(0, 286, __pyx_L3_error)
}
case 3:
if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_receptor_SAS_points)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_desolvationGrid", 1, 11, 11, 3); __PYX_ERR(0, 286, __pyx_L3_error)
}
case 4:
if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_receptor_coordinates)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_desolvationGrid", 1, 11, 11, 4); __PYX_ERR(0, 286, __pyx_L3_error)
}
case 5:
if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_SAS_sphere_pts)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_desolvationGrid", 1, 11, 11, 5); __PYX_ERR(0, 286, __pyx_L3_error)
}
case 6:
if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_LJ_r2)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_desolvationGrid", 1, 11, 11, 6); __PYX_ERR(0, 286, __pyx_L3_error)
}
case 7:
if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_LJ_r_max)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_desolvationGrid", 1, 11, 11, 7); __PYX_ERR(0, 286, __pyx_L3_error)
}
case 8:
if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ligand_atom_radius)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_desolvationGrid", 1, 11, 11, 8); __PYX_ERR(0, 286, __pyx_L3_error)
}
case 9:
if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_probe_radius)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_desolvationGrid", 1, 11, 11, 9); __PYX_ERR(0, 286, __pyx_L3_error)
}
case 10:
if (likely((values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_integration_cutoff)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_desolvationGrid", 1, 11, 11, 10); __PYX_ERR(0, 286, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calc_desolvationGrid") < 0)) __PYX_ERR(0, 286, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 11) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
}
__pyx_v_receptor_MS_grid = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t(values[0]); if (unlikely(!__pyx_v_receptor_MS_grid.memview)) __PYX_ERR(0, 286, __pyx_L3_error)
__pyx_v_spacing = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t(values[1]); if (unlikely(!__pyx_v_spacing.memview)) __PYX_ERR(0, 287, __pyx_L3_error)
__pyx_v_counts = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t(values[2]); if (unlikely(!__pyx_v_counts.memview)) __PYX_ERR(0, 287, __pyx_L3_error)
__pyx_v_receptor_SAS_points = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t(values[3]); if (unlikely(!__pyx_v_receptor_SAS_points.memview)) __PYX_ERR(0, 288, __pyx_L3_error)
__pyx_v_receptor_coordinates = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t(values[4]); if (unlikely(!__pyx_v_receptor_coordinates.memview)) __PYX_ERR(0, 289, __pyx_L3_error)
__pyx_v_SAS_sphere_pts = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t(values[5]); if (unlikely(!__pyx_v_SAS_sphere_pts.memview)) __PYX_ERR(0, 290, __pyx_L3_error)
__pyx_v_LJ_r2 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t(values[6]); if (unlikely(!__pyx_v_LJ_r2.memview)) __PYX_ERR(0, 291, __pyx_L3_error)
__pyx_v_LJ_r_max = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_LJ_r_max == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 292, __pyx_L3_error)
__pyx_v_ligand_atom_radius = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_ligand_atom_radius == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 293, __pyx_L3_error)
__pyx_v_probe_radius = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_probe_radius == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 294, __pyx_L3_error)
__pyx_v_integration_cutoff = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_integration_cutoff == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 295, __pyx_L3_error)
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("calc_desolvationGrid", 1, 11, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 286, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("_cython_magic_c7a891f460c6cdee668bf17def65776d.calc_desolvationGrid", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_46_cython_magic_c7a891f460c6cdee668bf17def65776d_10calc_desolvationGrid(__pyx_self, __pyx_v_receptor_MS_grid, __pyx_v_spacing, __pyx_v_counts, __pyx_v_receptor_SAS_points, __pyx_v_receptor_coordinates, __pyx_v_SAS_sphere_pts, __pyx_v_LJ_r2, __pyx_v_LJ_r_max, __pyx_v_ligand_atom_radius, __pyx_v_probe_radius, __pyx_v_integration_cutoff);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_46_cython_magic_c7a891f460c6cdee668bf17def65776d_10calc_desolvationGrid(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_receptor_MS_grid, __Pyx_memviewslice __pyx_v_spacing, __Pyx_memviewslice __pyx_v_counts, __Pyx_memviewslice __pyx_v_receptor_SAS_points, __Pyx_memviewslice __pyx_v_receptor_coordinates, __Pyx_memviewslice __pyx_v_SAS_sphere_pts, __Pyx_memviewslice __pyx_v_LJ_r2, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_LJ_r_max, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_ligand_atom_radius, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_probe_radius, __pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_integration_cutoff) {
size_t __pyx_v_i;
size_t __pyx_v_j;
size_t __pyx_v_k;
size_t __pyx_v_n;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_nreceptor_SAS_points;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_SAS_x_min;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_SAS_x_max;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_SAS_y_min;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_SAS_y_max;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_SAS_z_min;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_SAS_z_max;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_clash_filter_r;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_rec_x_min;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_rec_x_max;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_rec_y_min;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_rec_y_max;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_rec_z_min;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_rec_z_max;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_ligand_atom_radius2;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_grid_point_x;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_grid_point_y;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_grid_point_z;
PyArrayObject *__pyx_v_desolvationGrid = 0;
size_t __pyx_v_atom_j;
size_t __pyx_v_sphere_i;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_clash;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_nreceptor_atoms;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_nsphere_points;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t __pyx_v_n_newly_inaccessible_SAS_points;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_SAS_point_x;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_SAS_point_y;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_SAS_point_z;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dx;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dy;
__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t __pyx_v_dz;
PyArrayObject *__pyx_v_grid_c = 0;
PyObject *__pyx_v_receptor_SAS_points_i = NULL;
PyObject *__pyx_v_receptor_coordinates_i = NULL;
PyObject *__pyx_v_receptor_SAS_points_ij = NULL;
PyObject *__pyx_v_receptor_coordinates_ij = NULL;
PyObject *__pyx_v_receptor_SAS_points_ijk = NULL;
PyObject *__pyx_v_newly_inaccessible_SAS_points = NULL;
PyObject *__pyx_v_receptor_coordinates_ijk = NULL;
__Pyx_LocalBuf_ND __pyx_pybuffernd_desolvationGrid;
__Pyx_Buffer __pyx_pybuffer_desolvationGrid;
__Pyx_LocalBuf_ND __pyx_pybuffernd_grid_c;
__Pyx_Buffer __pyx_pybuffer_grid_c;
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_TraceFrameInit(__pyx_codeobj_)
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("calc_desolvationGrid", 0);
__Pyx_TraceCall("calc_desolvationGrid", __pyx_f[0], 286, 0, __PYX_ERR(0, 286, __pyx_L1_error));
__pyx_pybuffer_desolvationGrid.pybuffer.buf = NULL;
__pyx_pybuffer_desolvationGrid.refcount = 0;
__pyx_pybuffernd_desolvationGrid.data = NULL;
__pyx_pybuffernd_desolvationGrid.rcbuffer = &__pyx_pybuffer_desolvationGrid;
__pyx_pybuffer_grid_c.pybuffer.buf = NULL;
__pyx_pybuffer_grid_c.refcount = 0;
__pyx_pybuffernd_grid_c.data = NULL;
__pyx_pybuffernd_grid_c.rcbuffer = &__pyx_pybuffer_grid_c;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__PYX_XDEC_MEMVIEW(&__pyx_t_51, 1);
__Pyx_XDECREF(__pyx_t_52);
__Pyx_XDECREF(__pyx_t_53);
__PYX_XDEC_MEMVIEW(&__pyx_t_77, 1);
{ PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
__Pyx_PyThreadState_declare
__Pyx_PyThreadState_assign
__Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_desolvationGrid.rcbuffer->pybuffer);
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_grid_c.rcbuffer->pybuffer);
__Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
__Pyx_AddTraceback("_cython_magic_c7a891f460c6cdee668bf17def65776d.calc_desolvationGrid", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
goto __pyx_L2;
__pyx_L0:;
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_desolvationGrid.rcbuffer->pybuffer);
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_grid_c.rcbuffer->pybuffer);
__pyx_L2:;
__Pyx_XDECREF((PyObject *)__pyx_v_desolvationGrid);
__Pyx_XDECREF((PyObject *)__pyx_v_grid_c);
__Pyx_XDECREF(__pyx_v_receptor_SAS_points_i);
__Pyx_XDECREF(__pyx_v_receptor_coordinates_i);
__Pyx_XDECREF(__pyx_v_receptor_SAS_points_ij);
__Pyx_XDECREF(__pyx_v_receptor_coordinates_ij);
__Pyx_XDECREF(__pyx_v_receptor_SAS_points_ijk);
__Pyx_XDECREF(__pyx_v_newly_inaccessible_SAS_points);
__Pyx_XDECREF(__pyx_v_receptor_coordinates_ijk);
__PYX_XDEC_MEMVIEW(&__pyx_v_receptor_MS_grid, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_spacing, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_counts, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_receptor_SAS_points, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_receptor_coordinates, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_SAS_sphere_pts, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_LJ_r2, 1);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__21 = PyTuple_Pack(55, __pyx_n_s_receptor_MS_grid, __pyx_n_s_spacing, __pyx_n_s_counts, __pyx_n_s_receptor_SAS_points, __pyx_n_s_receptor_coordinates, __pyx_n_s_SAS_sphere_pts, __pyx_n_s_LJ_r2, __pyx_n_s_LJ_r_max, __pyx_n_s_ligand_atom_radius, __pyx_n_s_probe_radius, __pyx_n_s_integration_cutoff, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_n, __pyx_n_s_nreceptor_SAS_points, __pyx_n_s_SAS_x_min, __pyx_n_s_SAS_x_max, __pyx_n_s_SAS_y_min, __pyx_n_s_SAS_y_max, __pyx_n_s_SAS_z_min, __pyx_n_s_SAS_z_max, __pyx_n_s_clash_filter_r, __pyx_n_s_rec_x_min, __pyx_n_s_rec_x_max, __pyx_n_s_rec_y_min, __pyx_n_s_rec_y_max, __pyx_n_s_rec_z_min, __pyx_n_s_rec_z_max, __pyx_n_s_ligand_atom_radius2, __pyx_n_s_grid_point_x, __pyx_n_s_grid_point_y, __pyx_n_s_grid_point_z, __pyx_n_s_desolvationGrid, __pyx_n_s_atom_j, __pyx_n_s_sphere_i, __pyx_n_s_d, __pyx_n_s_clash, __pyx_n_s_nreceptor_atoms, __pyx_n_s_nsphere_points, __pyx_n_s_n_newly_inaccessible_SAS_points, __pyx_n_s_SAS_point_x, __pyx_n_s_SAS_point_y, __pyx_n_s_SAS_point_z, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_grid_c, __pyx_n_s_receptor_SAS_points_i, __pyx_n_s_receptor_coordinates_i, __pyx_n_s_receptor_SAS_points_ij, __pyx_n_s_receptor_coordinates_ij, __pyx_n_s_receptor_SAS_points_ijk, __pyx_n_s_newly_inaccessible_SAS_points, __pyx_n_s_receptor_coordinates_ijk); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 286, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__21);
__Pyx_GIVEREF(__pyx_tuple__21);
/* … */
__Pyx_TraceLine(286,0,__PYX_ERR(0, 286, __pyx_L1_error))
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_46_cython_magic_c7a891f460c6cdee668bf17def65776d_11calc_desolvationGrid, 0, __pyx_n_s_calc_desolvationGrid, NULL, __pyx_n_s_cython_magic_c7a891f460c6cdee66, __pyx_d, ((PyObject *)__pyx_codeobj_)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 286, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_calc_desolvationGrid, __pyx_t_1) < 0) __PYX_ERR(0, 286, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(11, 0, 55, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_dminh_ipython_cython__cyt, __pyx_n_s_calc_desolvationGrid, 286, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 286, __pyx_L1_error)
287: float_t[:] spacing, int_t[:] counts, \
288: float_t[:,:] receptor_SAS_points, \
289: float_t[:,:] receptor_coordinates, \
290: float_t[:,:] SAS_sphere_pts, \
291: float_t[:] LJ_r2, \
292: float_t LJ_r_max, \
293: float_t ligand_atom_radius, \
294: float_t probe_radius, \
295: float_t integration_cutoff):
296: cdef size_t i, j, k, n
297: cdef int_t nreceptor_SAS_points
298: cdef float_t SAS_x_min, SAS_x_max, SAS_y_min, SAS_y_max, SAS_z_min, SAS_z_max
299: cdef float_t clash_filter_r
300: cdef float_t rec_x_min, rec_x_max, rec_y_min, rec_y_max, rec_z_min, rec_z_max
301: cdef float_t ligand_atom_radius2
302: cdef float_t grid_point_x, grid_point_y, grid_point_z
303: cdef np.ndarray[np.double_t, ndim=3] desolvationGrid
304:
305: # To use for new SAS points
306: cdef size_t atom_j, sphere_i, d
307: cdef int_t clash
308: cdef int_t nreceptor_atoms, nsphere_points, n_newly_inaccessible_SAS_points
309: cdef float_t SAS_point_x, SAS_point_y, SAS_point_z
310: cdef float_t dx, dy, dz
311: cdef np.ndarray[int_t, ndim=3] grid_c
312:
+313: nreceptor_SAS_points = receptor_SAS_points.shape[0]
__Pyx_TraceLine(313,0,__PYX_ERR(0, 313, __pyx_L1_error))
__pyx_v_nreceptor_SAS_points = (__pyx_v_receptor_SAS_points.shape[0]);
+314: nreceptor_atoms = len(LJ_r2)
__Pyx_TraceLine(314,0,__PYX_ERR(0, 314, __pyx_L1_error))
__pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_LJ_r2, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 314, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 314, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_nreceptor_atoms = __pyx_t_2;
+315: nsphere_points = len(SAS_sphere_pts)
__Pyx_TraceLine(315,0,__PYX_ERR(0, 315, __pyx_L1_error))
__pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_SAS_sphere_pts, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 315, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_nsphere_points = __pyx_t_2;
316:
+317: ligand_atom_radius2 = ligand_atom_radius*ligand_atom_radius
__Pyx_TraceLine(317,0,__PYX_ERR(0, 317, __pyx_L1_error))
__pyx_v_ligand_atom_radius2 = (__pyx_v_ligand_atom_radius * __pyx_v_ligand_atom_radius);
318: # Receptor atoms that clash with the ligand atom SAS will be within
319: # the SAS and maximum LJ radius
+320: clash_filter_r = ligand_atom_radius + probe_radius + LJ_r_max
__Pyx_TraceLine(320,0,__PYX_ERR(0, 320, __pyx_L1_error))
__pyx_v_clash_filter_r = ((__pyx_v_ligand_atom_radius + __pyx_v_probe_radius) + __pyx_v_LJ_r_max);
321:
+322: desolvationGrid = np.zeros(shape=tuple(counts), dtype=np.float)
__Pyx_TraceLine(322,0,__PYX_ERR(0, 322, __pyx_L1_error))
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 322, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 322, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 322, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_counts, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 322, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 322, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_shape, __pyx_t_5) < 0) __PYX_ERR(0, 322, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 322, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 322, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 322, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 322, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 322, __pyx_L1_error)
__pyx_t_6 = ((PyArrayObject *)__pyx_t_4);
{
__Pyx_BufFmt_StackElem __pyx_stack[1];
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_desolvationGrid.rcbuffer->pybuffer);
__pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_desolvationGrid.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack);
if (unlikely(__pyx_t_7 < 0)) {
PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_desolvationGrid.rcbuffer->pybuffer, (PyObject*)__pyx_v_desolvationGrid, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {
Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
__Pyx_RaiseBufferFallbackError();
} else {
PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
}
}
__pyx_pybuffernd_desolvationGrid.diminfo[0].strides = __pyx_pybuffernd_desolvationGrid.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_desolvationGrid.diminfo[0].shape = __pyx_pybuffernd_desolvationGrid.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_desolvationGrid.diminfo[1].strides = __pyx_pybuffernd_desolvationGrid.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_desolvationGrid.diminfo[1].shape = __pyx_pybuffernd_desolvationGrid.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_desolvationGrid.diminfo[2].strides = __pyx_pybuffernd_desolvationGrid.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_desolvationGrid.diminfo[2].shape = __pyx_pybuffernd_desolvationGrid.rcbuffer->pybuffer.shape[2];
if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 322, __pyx_L1_error)
}
__pyx_t_6 = 0;
__pyx_v_desolvationGrid = ((PyArrayObject *)__pyx_t_4);
__pyx_t_4 = 0;
323:
+324: for i in xrange(0,counts[0],10):
__Pyx_TraceLine(324,0,__PYX_ERR(0, 324, __pyx_L1_error))
__pyx_t_11 = 0;
__pyx_t_7 = -1;
if (__pyx_t_11 < 0) {
__pyx_t_11 += __pyx_v_counts.shape[0];
if (unlikely(__pyx_t_11 < 0)) __pyx_t_7 = 0;
} else if (unlikely(__pyx_t_11 >= __pyx_v_counts.shape[0])) __pyx_t_7 = 0;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 324, __pyx_L1_error)
}
__pyx_t_12 = (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t *) ( /* dim=0 */ (__pyx_v_counts.data + __pyx_t_11 * __pyx_v_counts.strides[0]) )));
for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=10) {
__pyx_v_i = __pyx_t_13;
+325: grid_point_x = i*spacing[0]
__Pyx_TraceLine(325,0,__PYX_ERR(0, 325, __pyx_L1_error))
__pyx_t_14 = 0;
__pyx_t_7 = -1;
if (__pyx_t_14 < 0) {
__pyx_t_14 += __pyx_v_spacing.shape[0];
if (unlikely(__pyx_t_14 < 0)) __pyx_t_7 = 0;
} else if (unlikely(__pyx_t_14 >= __pyx_v_spacing.shape[0])) __pyx_t_7 = 0;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 325, __pyx_L1_error)
}
__pyx_v_grid_point_x = (__pyx_v_i * (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_14 * __pyx_v_spacing.strides[0]) ))));
+326: SAS_x_min = grid_point_x - ligand_atom_radius
__Pyx_TraceLine(326,0,__PYX_ERR(0, 326, __pyx_L1_error))
__pyx_v_SAS_x_min = (__pyx_v_grid_point_x - __pyx_v_ligand_atom_radius);
+327: SAS_x_max = grid_point_x + ligand_atom_radius
__Pyx_TraceLine(327,0,__PYX_ERR(0, 327, __pyx_L1_error))
__pyx_v_SAS_x_max = (__pyx_v_grid_point_x + __pyx_v_ligand_atom_radius);
+328: receptor_SAS_points_i = [n for n in xrange(nreceptor_SAS_points) \
__Pyx_TraceLine(328,0,__PYX_ERR(0, 328, __pyx_L1_error))
__pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 328, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_15 = __pyx_v_nreceptor_SAS_points;
for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
__pyx_v_n = __pyx_t_16;
/* … */
__Pyx_TraceLine(328,0,__PYX_ERR(0, 328, __pyx_L1_error))
__pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 328, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 328, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+329: if (receptor_SAS_points[n,0]>SAS_x_min) and \
__Pyx_TraceLine(329,0,__PYX_ERR(0, 329, __pyx_L1_error))
__pyx_t_18 = __pyx_v_n;
__pyx_t_19 = 0;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_18 >= (size_t)__pyx_v_receptor_SAS_points.shape[0])) __pyx_t_7 = 0;
if (__pyx_t_19 < 0) {
__pyx_t_19 += __pyx_v_receptor_SAS_points.shape[1];
if (unlikely(__pyx_t_19 < 0)) __pyx_t_7 = 1;
} else if (unlikely(__pyx_t_19 >= __pyx_v_receptor_SAS_points.shape[1])) __pyx_t_7 = 1;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 329, __pyx_L1_error)
}
__pyx_t_20 = (((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_receptor_SAS_points.data + __pyx_t_18 * __pyx_v_receptor_SAS_points.strides[0]) ) + __pyx_t_19 * __pyx_v_receptor_SAS_points.strides[1]) ))) > __pyx_v_SAS_x_min) != 0);
if (__pyx_t_20) {
} else {
__pyx_t_17 = __pyx_t_20;
goto __pyx_L8_bool_binop_done;
}
/* … */
__Pyx_TraceLine(329,0,__PYX_ERR(0, 329, __pyx_L1_error))
if (__pyx_t_17) {
/* … */
}
}
__Pyx_XDECREF_SET(__pyx_v_receptor_SAS_points_i, ((PyObject*)__pyx_t_4));
__pyx_t_4 = 0;
+330: (receptor_SAS_points[n,0]<SAS_x_max)]
__Pyx_TraceLine(330,0,__PYX_ERR(0, 330, __pyx_L1_error))
__pyx_t_21 = __pyx_v_n;
__pyx_t_22 = 0;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_21 >= (size_t)__pyx_v_receptor_SAS_points.shape[0])) __pyx_t_7 = 0;
if (__pyx_t_22 < 0) {
__pyx_t_22 += __pyx_v_receptor_SAS_points.shape[1];
if (unlikely(__pyx_t_22 < 0)) __pyx_t_7 = 1;
} else if (unlikely(__pyx_t_22 >= __pyx_v_receptor_SAS_points.shape[1])) __pyx_t_7 = 1;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 330, __pyx_L1_error)
}
__pyx_t_20 = (((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_receptor_SAS_points.data + __pyx_t_21 * __pyx_v_receptor_SAS_points.strides[0]) ) + __pyx_t_22 * __pyx_v_receptor_SAS_points.strides[1]) ))) < __pyx_v_SAS_x_max) != 0);
__pyx_t_17 = __pyx_t_20;
__pyx_L8_bool_binop_done:;
+331: rec_x_min = grid_point_x - clash_filter_r
__Pyx_TraceLine(331,0,__PYX_ERR(0, 331, __pyx_L1_error))
__pyx_v_rec_x_min = (__pyx_v_grid_point_x - __pyx_v_clash_filter_r);
+332: rec_x_max = grid_point_x + clash_filter_r
__Pyx_TraceLine(332,0,__PYX_ERR(0, 332, __pyx_L1_error))
__pyx_v_rec_x_max = (__pyx_v_grid_point_x + __pyx_v_clash_filter_r);
+333: receptor_coordinates_i = [n for n in xrange(nreceptor_atoms) \
__Pyx_TraceLine(333,0,__PYX_ERR(0, 333, __pyx_L1_error))
__pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_15 = __pyx_v_nreceptor_atoms;
for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
__pyx_v_n = __pyx_t_16;
/* … */
__Pyx_TraceLine(333,0,__PYX_ERR(0, 333, __pyx_L1_error))
__pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 333, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+334: if (receptor_coordinates[n,0]>rec_x_min) and \
__Pyx_TraceLine(334,0,__PYX_ERR(0, 334, __pyx_L1_error))
__pyx_t_23 = __pyx_v_n;
__pyx_t_24 = 0;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_23 >= (size_t)__pyx_v_receptor_coordinates.shape[0])) __pyx_t_7 = 0;
if (__pyx_t_24 < 0) {
__pyx_t_24 += __pyx_v_receptor_coordinates.shape[1];
if (unlikely(__pyx_t_24 < 0)) __pyx_t_7 = 1;
} else if (unlikely(__pyx_t_24 >= __pyx_v_receptor_coordinates.shape[1])) __pyx_t_7 = 1;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 334, __pyx_L1_error)
}
__pyx_t_20 = (((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_receptor_coordinates.data + __pyx_t_23 * __pyx_v_receptor_coordinates.strides[0]) ) + __pyx_t_24 * __pyx_v_receptor_coordinates.strides[1]) ))) > __pyx_v_rec_x_min) != 0);
if (__pyx_t_20) {
} else {
__pyx_t_17 = __pyx_t_20;
goto __pyx_L13_bool_binop_done;
}
/* … */
__Pyx_TraceLine(334,0,__PYX_ERR(0, 334, __pyx_L1_error))
if (__pyx_t_17) {
/* … */
}
}
__Pyx_XDECREF_SET(__pyx_v_receptor_coordinates_i, ((PyObject*)__pyx_t_4));
__pyx_t_4 = 0;
+335: (receptor_coordinates[n,0]<rec_x_max)]
__Pyx_TraceLine(335,0,__PYX_ERR(0, 335, __pyx_L1_error))
__pyx_t_25 = __pyx_v_n;
__pyx_t_26 = 0;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_25 >= (size_t)__pyx_v_receptor_coordinates.shape[0])) __pyx_t_7 = 0;
if (__pyx_t_26 < 0) {
__pyx_t_26 += __pyx_v_receptor_coordinates.shape[1];
if (unlikely(__pyx_t_26 < 0)) __pyx_t_7 = 1;
} else if (unlikely(__pyx_t_26 >= __pyx_v_receptor_coordinates.shape[1])) __pyx_t_7 = 1;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 335, __pyx_L1_error)
}
__pyx_t_20 = (((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_receptor_coordinates.data + __pyx_t_25 * __pyx_v_receptor_coordinates.strides[0]) ) + __pyx_t_26 * __pyx_v_receptor_coordinates.strides[1]) ))) < __pyx_v_rec_x_max) != 0);
__pyx_t_17 = __pyx_t_20;
__pyx_L13_bool_binop_done:;
+336: for j in xrange(0,counts[1],10):
__Pyx_TraceLine(336,0,__PYX_ERR(0, 336, __pyx_L1_error))
__pyx_t_27 = 1;
__pyx_t_7 = -1;
if (__pyx_t_27 < 0) {
__pyx_t_27 += __pyx_v_counts.shape[0];
if (unlikely(__pyx_t_27 < 0)) __pyx_t_7 = 0;
} else if (unlikely(__pyx_t_27 >= __pyx_v_counts.shape[0])) __pyx_t_7 = 0;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 336, __pyx_L1_error)
}
__pyx_t_15 = (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t *) ( /* dim=0 */ (__pyx_v_counts.data + __pyx_t_27 * __pyx_v_counts.strides[0]) )));
for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=10) {
__pyx_v_j = __pyx_t_16;
+337: grid_point_y = j*spacing[1]
__Pyx_TraceLine(337,0,__PYX_ERR(0, 337, __pyx_L1_error))
__pyx_t_28 = 1;
__pyx_t_7 = -1;
if (__pyx_t_28 < 0) {
__pyx_t_28 += __pyx_v_spacing.shape[0];
if (unlikely(__pyx_t_28 < 0)) __pyx_t_7 = 0;
} else if (unlikely(__pyx_t_28 >= __pyx_v_spacing.shape[0])) __pyx_t_7 = 0;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 337, __pyx_L1_error)
}
__pyx_v_grid_point_y = (__pyx_v_j * (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_28 * __pyx_v_spacing.strides[0]) ))));
+338: SAS_y_min = grid_point_y - ligand_atom_radius
__Pyx_TraceLine(338,0,__PYX_ERR(0, 338, __pyx_L1_error))
__pyx_v_SAS_y_min = (__pyx_v_grid_point_y - __pyx_v_ligand_atom_radius);
+339: SAS_y_max = grid_point_y + ligand_atom_radius
__Pyx_TraceLine(339,0,__PYX_ERR(0, 339, __pyx_L1_error))
__pyx_v_SAS_y_max = (__pyx_v_grid_point_y + __pyx_v_ligand_atom_radius);
+340: receptor_SAS_points_ij = [n for n in receptor_SAS_points_i \
__Pyx_TraceLine(340,0,__PYX_ERR(0, 340, __pyx_L1_error))
__pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 340, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
/* … */
__Pyx_TraceLine(341,0,__PYX_ERR(0, 341, __pyx_L1_error))
__pyx_t_1 = __pyx_v_receptor_SAS_points_i; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
for (;;) {
/* … */
__Pyx_TraceLine(340,0,__PYX_ERR(0, 340, __pyx_L1_error))
if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 340, __pyx_L1_error)
#else
__pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 340, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
#endif
__pyx_t_29 = __Pyx_PyInt_As_size_t(__pyx_t_3); if (unlikely((__pyx_t_29 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 340, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_n = __pyx_t_29;
/* … */
__Pyx_TraceLine(340,0,__PYX_ERR(0, 340, __pyx_L1_error))
__pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 340, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 340, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* … */
__Pyx_TraceLine(340,0,__PYX_ERR(0, 340, __pyx_L1_error))
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF_SET(__pyx_v_receptor_SAS_points_ij, ((PyObject*)__pyx_t_4));
__pyx_t_4 = 0;
+341: if (receptor_SAS_points[n,1]>SAS_y_min) and \
__Pyx_TraceLine(341,0,__PYX_ERR(0, 341, __pyx_L1_error))
__pyx_t_29 = __pyx_v_n;
__pyx_t_30 = 1;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_29 >= (size_t)__pyx_v_receptor_SAS_points.shape[0])) __pyx_t_7 = 0;
if (__pyx_t_30 < 0) {
__pyx_t_30 += __pyx_v_receptor_SAS_points.shape[1];
if (unlikely(__pyx_t_30 < 0)) __pyx_t_7 = 1;
} else if (unlikely(__pyx_t_30 >= __pyx_v_receptor_SAS_points.shape[1])) __pyx_t_7 = 1;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 341, __pyx_L1_error)
}
__pyx_t_20 = (((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_receptor_SAS_points.data + __pyx_t_29 * __pyx_v_receptor_SAS_points.strides[0]) ) + __pyx_t_30 * __pyx_v_receptor_SAS_points.strides[1]) ))) > __pyx_v_SAS_y_min) != 0);
if (__pyx_t_20) {
} else {
__pyx_t_17 = __pyx_t_20;
goto __pyx_L20_bool_binop_done;
}
/* … */
__Pyx_TraceLine(341,0,__PYX_ERR(0, 341, __pyx_L1_error))
if (__pyx_t_17) {
/* … */
}
+342: (receptor_SAS_points[n,1]<SAS_y_max)]
__Pyx_TraceLine(342,0,__PYX_ERR(0, 342, __pyx_L1_error))
__pyx_t_31 = __pyx_v_n;
__pyx_t_32 = 1;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_31 >= (size_t)__pyx_v_receptor_SAS_points.shape[0])) __pyx_t_7 = 0;
if (__pyx_t_32 < 0) {
__pyx_t_32 += __pyx_v_receptor_SAS_points.shape[1];
if (unlikely(__pyx_t_32 < 0)) __pyx_t_7 = 1;
} else if (unlikely(__pyx_t_32 >= __pyx_v_receptor_SAS_points.shape[1])) __pyx_t_7 = 1;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 342, __pyx_L1_error)
}
__pyx_t_20 = (((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_receptor_SAS_points.data + __pyx_t_31 * __pyx_v_receptor_SAS_points.strides[0]) ) + __pyx_t_32 * __pyx_v_receptor_SAS_points.strides[1]) ))) < __pyx_v_SAS_y_max) != 0);
__pyx_t_17 = __pyx_t_20;
__pyx_L20_bool_binop_done:;
+343: rec_y_min = grid_point_y - clash_filter_r
__Pyx_TraceLine(343,0,__PYX_ERR(0, 343, __pyx_L1_error))
__pyx_v_rec_y_min = (__pyx_v_grid_point_y - __pyx_v_clash_filter_r);
+344: rec_y_max = grid_point_y + clash_filter_r
__Pyx_TraceLine(344,0,__PYX_ERR(0, 344, __pyx_L1_error))
__pyx_v_rec_y_max = (__pyx_v_grid_point_y + __pyx_v_clash_filter_r);
+345: receptor_coordinates_ij = [n for n in receptor_coordinates_i \
__Pyx_TraceLine(345,0,__PYX_ERR(0, 345, __pyx_L1_error))
__pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 345, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
/* … */
__Pyx_TraceLine(346,0,__PYX_ERR(0, 346, __pyx_L1_error))
__pyx_t_1 = __pyx_v_receptor_coordinates_i; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
for (;;) {
/* … */
__Pyx_TraceLine(345,0,__PYX_ERR(0, 345, __pyx_L1_error))
if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 345, __pyx_L1_error)
#else
__pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
#endif
__pyx_t_33 = __Pyx_PyInt_As_size_t(__pyx_t_3); if (unlikely((__pyx_t_33 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 345, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_n = __pyx_t_33;
/* … */
__Pyx_TraceLine(345,0,__PYX_ERR(0, 345, __pyx_L1_error))
__pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 345, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* … */
__Pyx_TraceLine(345,0,__PYX_ERR(0, 345, __pyx_L1_error))
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF_SET(__pyx_v_receptor_coordinates_ij, ((PyObject*)__pyx_t_4));
__pyx_t_4 = 0;
+346: if (receptor_coordinates[n,1]>rec_y_min) and \
__Pyx_TraceLine(346,0,__PYX_ERR(0, 346, __pyx_L1_error))
__pyx_t_33 = __pyx_v_n;
__pyx_t_34 = 1;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_33 >= (size_t)__pyx_v_receptor_coordinates.shape[0])) __pyx_t_7 = 0;
if (__pyx_t_34 < 0) {
__pyx_t_34 += __pyx_v_receptor_coordinates.shape[1];
if (unlikely(__pyx_t_34 < 0)) __pyx_t_7 = 1;
} else if (unlikely(__pyx_t_34 >= __pyx_v_receptor_coordinates.shape[1])) __pyx_t_7 = 1;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 346, __pyx_L1_error)
}
__pyx_t_20 = (((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_receptor_coordinates.data + __pyx_t_33 * __pyx_v_receptor_coordinates.strides[0]) ) + __pyx_t_34 * __pyx_v_receptor_coordinates.strides[1]) ))) > __pyx_v_rec_y_min) != 0);
if (__pyx_t_20) {
} else {
__pyx_t_17 = __pyx_t_20;
goto __pyx_L25_bool_binop_done;
}
/* … */
__Pyx_TraceLine(346,0,__PYX_ERR(0, 346, __pyx_L1_error))
if (__pyx_t_17) {
/* … */
}
+347: (receptor_coordinates[n,1]<rec_y_max)]
__Pyx_TraceLine(347,0,__PYX_ERR(0, 347, __pyx_L1_error))
__pyx_t_35 = __pyx_v_n;
__pyx_t_36 = 1;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_35 >= (size_t)__pyx_v_receptor_coordinates.shape[0])) __pyx_t_7 = 0;
if (__pyx_t_36 < 0) {
__pyx_t_36 += __pyx_v_receptor_coordinates.shape[1];
if (unlikely(__pyx_t_36 < 0)) __pyx_t_7 = 1;
} else if (unlikely(__pyx_t_36 >= __pyx_v_receptor_coordinates.shape[1])) __pyx_t_7 = 1;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 347, __pyx_L1_error)
}
__pyx_t_20 = (((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_receptor_coordinates.data + __pyx_t_35 * __pyx_v_receptor_coordinates.strides[0]) ) + __pyx_t_36 * __pyx_v_receptor_coordinates.strides[1]) ))) < __pyx_v_rec_y_max) != 0);
__pyx_t_17 = __pyx_t_20;
__pyx_L25_bool_binop_done:;
+348: for k in xrange(0,counts[2],10):
__Pyx_TraceLine(348,0,__PYX_ERR(0, 348, __pyx_L1_error))
__pyx_t_37 = 2;
__pyx_t_7 = -1;
if (__pyx_t_37 < 0) {
__pyx_t_37 += __pyx_v_counts.shape[0];
if (unlikely(__pyx_t_37 < 0)) __pyx_t_7 = 0;
} else if (unlikely(__pyx_t_37 >= __pyx_v_counts.shape[0])) __pyx_t_7 = 0;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 348, __pyx_L1_error)
}
__pyx_t_38 = (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t *) ( /* dim=0 */ (__pyx_v_counts.data + __pyx_t_37 * __pyx_v_counts.strides[0]) )));
for (__pyx_t_39 = 0; __pyx_t_39 < __pyx_t_38; __pyx_t_39+=10) {
__pyx_v_k = __pyx_t_39;
+349: grid_point_z = k*spacing[2]
__Pyx_TraceLine(349,0,__PYX_ERR(0, 349, __pyx_L1_error))
__pyx_t_40 = 2;
__pyx_t_7 = -1;
if (__pyx_t_40 < 0) {
__pyx_t_40 += __pyx_v_spacing.shape[0];
if (unlikely(__pyx_t_40 < 0)) __pyx_t_7 = 0;
} else if (unlikely(__pyx_t_40 >= __pyx_v_spacing.shape[0])) __pyx_t_7 = 0;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 349, __pyx_L1_error)
}
__pyx_v_grid_point_z = (__pyx_v_k * (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_spacing.data + __pyx_t_40 * __pyx_v_spacing.strides[0]) ))));
+350: SAS_z_min = grid_point_z - ligand_atom_radius
__Pyx_TraceLine(350,0,__PYX_ERR(0, 350, __pyx_L1_error))
__pyx_v_SAS_z_min = (__pyx_v_grid_point_z - __pyx_v_ligand_atom_radius);
+351: SAS_z_max = grid_point_z + ligand_atom_radius
__Pyx_TraceLine(351,0,__PYX_ERR(0, 351, __pyx_L1_error))
__pyx_v_SAS_z_max = (__pyx_v_grid_point_z + __pyx_v_ligand_atom_radius);
+352: receptor_SAS_points_ijk = [n for n in receptor_SAS_points_ij \
__Pyx_TraceLine(352,0,__PYX_ERR(0, 352, __pyx_L1_error))
__pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 352, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
/* … */
__Pyx_TraceLine(353,0,__PYX_ERR(0, 353, __pyx_L1_error))
__pyx_t_1 = __pyx_v_receptor_SAS_points_ij; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
for (;;) {
/* … */
__Pyx_TraceLine(352,0,__PYX_ERR(0, 352, __pyx_L1_error))
if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 352, __pyx_L1_error)
#else
__pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 352, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
#endif
__pyx_t_41 = __Pyx_PyInt_As_size_t(__pyx_t_3); if (unlikely((__pyx_t_41 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_n = __pyx_t_41;
/* … */
__Pyx_TraceLine(352,0,__PYX_ERR(0, 352, __pyx_L1_error))
__pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 352, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 352, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* … */
__Pyx_TraceLine(352,0,__PYX_ERR(0, 352, __pyx_L1_error))
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF_SET(__pyx_v_receptor_SAS_points_ijk, ((PyObject*)__pyx_t_4));
__pyx_t_4 = 0;
+353: if (receptor_SAS_points[n,2]>SAS_z_min) and \
__Pyx_TraceLine(353,0,__PYX_ERR(0, 353, __pyx_L1_error))
__pyx_t_41 = __pyx_v_n;
__pyx_t_42 = 2;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_41 >= (size_t)__pyx_v_receptor_SAS_points.shape[0])) __pyx_t_7 = 0;
if (__pyx_t_42 < 0) {
__pyx_t_42 += __pyx_v_receptor_SAS_points.shape[1];
if (unlikely(__pyx_t_42 < 0)) __pyx_t_7 = 1;
} else if (unlikely(__pyx_t_42 >= __pyx_v_receptor_SAS_points.shape[1])) __pyx_t_7 = 1;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 353, __pyx_L1_error)
}
__pyx_t_20 = (((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_receptor_SAS_points.data + __pyx_t_41 * __pyx_v_receptor_SAS_points.strides[0]) ) + __pyx_t_42 * __pyx_v_receptor_SAS_points.strides[1]) ))) > __pyx_v_SAS_z_min) != 0);
if (__pyx_t_20) {
} else {
__pyx_t_17 = __pyx_t_20;
goto __pyx_L32_bool_binop_done;
}
/* … */
__Pyx_TraceLine(353,0,__PYX_ERR(0, 353, __pyx_L1_error))
if (__pyx_t_17) {
/* … */
}
+354: (receptor_SAS_points[n,2]<SAS_z_max)]
__Pyx_TraceLine(354,0,__PYX_ERR(0, 354, __pyx_L1_error))
__pyx_t_43 = __pyx_v_n;
__pyx_t_44 = 2;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_43 >= (size_t)__pyx_v_receptor_SAS_points.shape[0])) __pyx_t_7 = 0;
if (__pyx_t_44 < 0) {
__pyx_t_44 += __pyx_v_receptor_SAS_points.shape[1];
if (unlikely(__pyx_t_44 < 0)) __pyx_t_7 = 1;
} else if (unlikely(__pyx_t_44 >= __pyx_v_receptor_SAS_points.shape[1])) __pyx_t_7 = 1;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 354, __pyx_L1_error)
}
__pyx_t_20 = (((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_receptor_SAS_points.data + __pyx_t_43 * __pyx_v_receptor_SAS_points.strides[0]) ) + __pyx_t_44 * __pyx_v_receptor_SAS_points.strides[1]) ))) < __pyx_v_SAS_z_max) != 0);
__pyx_t_17 = __pyx_t_20;
__pyx_L32_bool_binop_done:;
355:
356: # Find SAS points that are made solvent inaccessible by the ligand atom
+357: newly_inaccessible_SAS_points = []
__Pyx_TraceLine(357,0,__PYX_ERR(0, 357, __pyx_L1_error))
__pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 357, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_XDECREF_SET(__pyx_v_newly_inaccessible_SAS_points, ((PyObject*)__pyx_t_4));
__pyx_t_4 = 0;
+358: for n in receptor_SAS_points_ijk:
__Pyx_TraceLine(358,0,__PYX_ERR(0, 358, __pyx_L1_error))
__pyx_t_4 = __pyx_v_receptor_SAS_points_ijk; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
for (;;) {
if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 358, __pyx_L1_error)
#else
__pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
#endif
__pyx_t_45 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_45 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 358, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_n = __pyx_t_45;
/* … */
__Pyx_TraceLine(358,0,__PYX_ERR(0, 358, __pyx_L1_error))
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+359: dx = receptor_SAS_points[n,0]-grid_point_x
__Pyx_TraceLine(359,0,__PYX_ERR(0, 359, __pyx_L1_error))
__pyx_t_45 = __pyx_v_n;
__pyx_t_46 = 0;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_45 >= (size_t)__pyx_v_receptor_SAS_points.shape[0])) __pyx_t_7 = 0;
if (__pyx_t_46 < 0) {
__pyx_t_46 += __pyx_v_receptor_SAS_points.shape[1];
if (unlikely(__pyx_t_46 < 0)) __pyx_t_7 = 1;
} else if (unlikely(__pyx_t_46 >= __pyx_v_receptor_SAS_points.shape[1])) __pyx_t_7 = 1;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 359, __pyx_L1_error)
}
__pyx_v_dx = ((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_receptor_SAS_points.data + __pyx_t_45 * __pyx_v_receptor_SAS_points.strides[0]) ) + __pyx_t_46 * __pyx_v_receptor_SAS_points.strides[1]) ))) - __pyx_v_grid_point_x);
+360: dy = receptor_SAS_points[n,1]-grid_point_y
__Pyx_TraceLine(360,0,__PYX_ERR(0, 360, __pyx_L1_error))
__pyx_t_47 = __pyx_v_n;
__pyx_t_48 = 1;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_47 >= (size_t)__pyx_v_receptor_SAS_points.shape[0])) __pyx_t_7 = 0;
if (__pyx_t_48 < 0) {
__pyx_t_48 += __pyx_v_receptor_SAS_points.shape[1];
if (unlikely(__pyx_t_48 < 0)) __pyx_t_7 = 1;
} else if (unlikely(__pyx_t_48 >= __pyx_v_receptor_SAS_points.shape[1])) __pyx_t_7 = 1;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 360, __pyx_L1_error)
}
__pyx_v_dy = ((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_receptor_SAS_points.data + __pyx_t_47 * __pyx_v_receptor_SAS_points.strides[0]) ) + __pyx_t_48 * __pyx_v_receptor_SAS_points.strides[1]) ))) - __pyx_v_grid_point_y);
+361: dz = receptor_SAS_points[n,2]-grid_point_z
__Pyx_TraceLine(361,0,__PYX_ERR(0, 361, __pyx_L1_error))
__pyx_t_49 = __pyx_v_n;
__pyx_t_50 = 2;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_49 >= (size_t)__pyx_v_receptor_SAS_points.shape[0])) __pyx_t_7 = 0;
if (__pyx_t_50 < 0) {
__pyx_t_50 += __pyx_v_receptor_SAS_points.shape[1];
if (unlikely(__pyx_t_50 < 0)) __pyx_t_7 = 1;
} else if (unlikely(__pyx_t_50 >= __pyx_v_receptor_SAS_points.shape[1])) __pyx_t_7 = 1;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 361, __pyx_L1_error)
}
__pyx_v_dz = ((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_receptor_SAS_points.data + __pyx_t_49 * __pyx_v_receptor_SAS_points.strides[0]) ) + __pyx_t_50 * __pyx_v_receptor_SAS_points.strides[1]) ))) - __pyx_v_grid_point_z);
+362: if (dx*dx + dy*dy + dz*dz)<ligand_atom_radius2:
__Pyx_TraceLine(362,0,__PYX_ERR(0, 362, __pyx_L1_error))
__pyx_t_17 = (((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz)) < __pyx_v_ligand_atom_radius2) != 0);
if (__pyx_t_17) {
/* … */
}
+363: newly_inaccessible_SAS_points.append(\
__Pyx_TraceLine(363,0,__PYX_ERR(0, 363, __pyx_L1_error))
__pyx_t_54 = __Pyx_PyList_Append(__pyx_v_newly_inaccessible_SAS_points, __pyx_t_1); if (unlikely(__pyx_t_54 == -1)) __PYX_ERR(0, 363, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+364: np.copy(receptor_SAS_points[n,:]))
__Pyx_TraceLine(364,0,__PYX_ERR(0, 364, __pyx_L1_error))
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 364, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 364, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_51.data = __pyx_v_receptor_SAS_points.data;
__pyx_t_51.memview = __pyx_v_receptor_SAS_points.memview;
__PYX_INC_MEMVIEW(&__pyx_t_51, 0);
{
Py_ssize_t __pyx_tmp_idx = __pyx_v_n;
Py_ssize_t __pyx_tmp_shape = __pyx_v_receptor_SAS_points.shape[0];
Py_ssize_t __pyx_tmp_stride = __pyx_v_receptor_SAS_points.strides[0];
if (1 && (__pyx_tmp_idx < 0))
__pyx_tmp_idx += __pyx_tmp_shape;
if (1 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
__PYX_ERR(0, 364, __pyx_L1_error)
}
__pyx_t_51.data += __pyx_tmp_idx * __pyx_tmp_stride;
}
__pyx_t_51.shape[0] = __pyx_v_receptor_SAS_points.shape[1];
__pyx_t_51.strides[0] = __pyx_v_receptor_SAS_points.strides[1];
__pyx_t_51.suboffsets[0] = -1;
__pyx_t_3 = __pyx_memoryview_fromslice(__pyx_t_51, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 364, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__PYX_XDEC_MEMVIEW(&__pyx_t_51, 1);
__pyx_t_52 = NULL;
if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
__pyx_t_52 = PyMethod_GET_SELF(__pyx_t_5);
if (likely(__pyx_t_52)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
__Pyx_INCREF(__pyx_t_52);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_5, function);
}
}
if (!__pyx_t_52) {
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_GOTREF(__pyx_t_1);
} else {
__pyx_t_53 = PyTuple_New(1+1); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 364, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_53);
__Pyx_GIVEREF(__pyx_t_52); PyTuple_SET_ITEM(__pyx_t_53, 0, __pyx_t_52); __pyx_t_52 = NULL;
__Pyx_GIVEREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_53, 0+1, __pyx_t_3);
__pyx_t_3 = 0;
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_53, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
365:
+366: n_newly_inaccessible_SAS_points = len(newly_inaccessible_SAS_points)
__Pyx_TraceLine(366,0,__PYX_ERR(0, 366, __pyx_L1_error))
__pyx_t_2 = PyList_GET_SIZE(__pyx_v_newly_inaccessible_SAS_points); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 366, __pyx_L1_error)
__pyx_v_n_newly_inaccessible_SAS_points = __pyx_t_2;
+367: if n_newly_inaccessible_SAS_points==0:
__Pyx_TraceLine(367,0,__PYX_ERR(0, 367, __pyx_L1_error))
__pyx_t_17 = ((__pyx_v_n_newly_inaccessible_SAS_points == 0) != 0);
if (__pyx_t_17) {
/* … */
goto __pyx_L37;
}
368: # If there are no newly inaccessible SAS points,
369: # perform the numerical integrals over the receptor MS grid.
+370: desolvationGrid[i,j,k] = fraction_r4inv_low_dielectric(\
__Pyx_TraceLine(370,0,__PYX_ERR(0, 370, __pyx_L1_error))
__pyx_t_4 = __pyx_f_46_cython_magic_c7a891f460c6cdee668bf17def65776d_fraction_r4inv_low_dielectric(__pyx_v_receptor_MS_grid, __pyx_v_spacing, __pyx_v_counts, __pyx_v_grid_point_x, __pyx_v_grid_point_y, __pyx_v_grid_point_z, __pyx_v_ligand_atom_radius, __pyx_v_integration_cutoff, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 370, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_55 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_55 == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 370, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_56 = __pyx_v_i;
__pyx_t_57 = __pyx_v_j;
__pyx_t_58 = __pyx_v_k;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_56 >= (size_t)__pyx_pybuffernd_desolvationGrid.diminfo[0].shape)) __pyx_t_7 = 0;
if (unlikely(__pyx_t_57 >= (size_t)__pyx_pybuffernd_desolvationGrid.diminfo[1].shape)) __pyx_t_7 = 1;
if (unlikely(__pyx_t_58 >= (size_t)__pyx_pybuffernd_desolvationGrid.diminfo[2].shape)) __pyx_t_7 = 2;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 370, __pyx_L1_error)
}
*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_desolvationGrid.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_desolvationGrid.diminfo[0].strides, __pyx_t_57, __pyx_pybuffernd_desolvationGrid.diminfo[1].strides, __pyx_t_58, __pyx_pybuffernd_desolvationGrid.diminfo[2].strides) = __pyx_t_55;
371: receptor_MS_grid, spacing, counts, \
372: grid_point_x, grid_point_y, grid_point_z, \
373: ligand_atom_radius, integration_cutoff)
374: else:
+375: rec_z_min = grid_point_z - clash_filter_r
__Pyx_TraceLine(375,0,__PYX_ERR(0, 375, __pyx_L1_error))
/*else*/ {
__pyx_v_rec_z_min = (__pyx_v_grid_point_z - __pyx_v_clash_filter_r);
+376: rec_z_max = grid_point_z + clash_filter_r
__Pyx_TraceLine(376,0,__PYX_ERR(0, 376, __pyx_L1_error))
__pyx_v_rec_z_max = (__pyx_v_grid_point_z + __pyx_v_clash_filter_r);
+377: receptor_coordinates_ijk = [n for n in receptor_coordinates_ij \
__Pyx_TraceLine(377,0,__PYX_ERR(0, 377, __pyx_L1_error))
__pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 377, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
/* … */
__Pyx_TraceLine(378,0,__PYX_ERR(0, 378, __pyx_L1_error))
__pyx_t_1 = __pyx_v_receptor_coordinates_ij; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
for (;;) {
/* … */
__Pyx_TraceLine(377,0,__PYX_ERR(0, 377, __pyx_L1_error))
if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 377, __pyx_L1_error)
#else
__pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 377, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
#endif
__pyx_t_59 = __Pyx_PyInt_As_size_t(__pyx_t_5); if (unlikely((__pyx_t_59 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 377, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_v_n = __pyx_t_59;
/* … */
__Pyx_TraceLine(377,0,__PYX_ERR(0, 377, __pyx_L1_error))
__pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 377, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 377, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* … */
__Pyx_TraceLine(377,0,__PYX_ERR(0, 377, __pyx_L1_error))
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF_SET(__pyx_v_receptor_coordinates_ijk, ((PyObject*)__pyx_t_4));
__pyx_t_4 = 0;
+378: if (receptor_coordinates[n,2]>rec_z_min) and \
__Pyx_TraceLine(378,0,__PYX_ERR(0, 378, __pyx_L1_error))
__pyx_t_59 = __pyx_v_n;
__pyx_t_60 = 2;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_59 >= (size_t)__pyx_v_receptor_coordinates.shape[0])) __pyx_t_7 = 0;
if (__pyx_t_60 < 0) {
__pyx_t_60 += __pyx_v_receptor_coordinates.shape[1];
if (unlikely(__pyx_t_60 < 0)) __pyx_t_7 = 1;
} else if (unlikely(__pyx_t_60 >= __pyx_v_receptor_coordinates.shape[1])) __pyx_t_7 = 1;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 378, __pyx_L1_error)
}
__pyx_t_20 = (((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_receptor_coordinates.data + __pyx_t_59 * __pyx_v_receptor_coordinates.strides[0]) ) + __pyx_t_60 * __pyx_v_receptor_coordinates.strides[1]) ))) > __pyx_v_rec_z_min) != 0);
if (__pyx_t_20) {
} else {
__pyx_t_17 = __pyx_t_20;
goto __pyx_L41_bool_binop_done;
}
/* … */
__Pyx_TraceLine(378,0,__PYX_ERR(0, 378, __pyx_L1_error))
if (__pyx_t_17) {
/* … */
}
+379: (receptor_coordinates[n,2]<rec_z_max)]
__Pyx_TraceLine(379,0,__PYX_ERR(0, 379, __pyx_L1_error))
__pyx_t_61 = __pyx_v_n;
__pyx_t_62 = 2;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_61 >= (size_t)__pyx_v_receptor_coordinates.shape[0])) __pyx_t_7 = 0;
if (__pyx_t_62 < 0) {
__pyx_t_62 += __pyx_v_receptor_coordinates.shape[1];
if (unlikely(__pyx_t_62 < 0)) __pyx_t_7 = 1;
} else if (unlikely(__pyx_t_62 >= __pyx_v_receptor_coordinates.shape[1])) __pyx_t_7 = 1;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 379, __pyx_L1_error)
}
__pyx_t_20 = (((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_receptor_coordinates.data + __pyx_t_61 * __pyx_v_receptor_coordinates.strides[0]) ) + __pyx_t_62 * __pyx_v_receptor_coordinates.strides[1]) ))) < __pyx_v_rec_z_max) != 0);
__pyx_t_17 = __pyx_t_20;
__pyx_L41_bool_binop_done:;
380:
+381: grid_c = np.copy(receptor_MS_grid)
__Pyx_TraceLine(381,0,__PYX_ERR(0, 381, __pyx_L1_error))
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 381, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_receptor_MS_grid, 3, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_53 = NULL;
if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
__pyx_t_53 = PyMethod_GET_SELF(__pyx_t_5);
if (likely(__pyx_t_53)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
__Pyx_INCREF(__pyx_t_53);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_5, function);
}
}
if (!__pyx_t_53) {
__pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 381, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_GOTREF(__pyx_t_4);
} else {
__pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 381, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_53); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_53); __pyx_t_53 = NULL;
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 381, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 381, __pyx_L1_error)
__pyx_t_63 = ((PyArrayObject *)__pyx_t_4);
{
__Pyx_BufFmt_StackElem __pyx_stack[1];
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_grid_c.rcbuffer->pybuffer);
__pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_grid_c.rcbuffer->pybuffer, (PyObject*)__pyx_t_63, &__Pyx_TypeInfo_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack);
if (unlikely(__pyx_t_7 < 0)) {
PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_grid_c.rcbuffer->pybuffer, (PyObject*)__pyx_v_grid_c, &__Pyx_TypeInfo_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {
Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
__Pyx_RaiseBufferFallbackError();
} else {
PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
}
}
__pyx_pybuffernd_grid_c.diminfo[0].strides = __pyx_pybuffernd_grid_c.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_grid_c.diminfo[0].shape = __pyx_pybuffernd_grid_c.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_grid_c.diminfo[1].strides = __pyx_pybuffernd_grid_c.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_grid_c.diminfo[1].shape = __pyx_pybuffernd_grid_c.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_grid_c.diminfo[2].strides = __pyx_pybuffernd_grid_c.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_grid_c.diminfo[2].shape = __pyx_pybuffernd_grid_c.rcbuffer->pybuffer.shape[2];
if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 381, __pyx_L1_error)
}
__pyx_t_63 = 0;
__Pyx_XDECREF_SET(__pyx_v_grid_c, ((PyArrayObject *)__pyx_t_4));
__pyx_t_4 = 0;
382:
383: # Find new SAS points around the ligand atom and
384: # increment the marks of the grid points within a probe radius
+385: sphere_i = 0
__Pyx_TraceLine(385,0,__PYX_ERR(0, 385, __pyx_L1_error))
__pyx_v_sphere_i = 0;
+386: while sphere_i < nsphere_points:
__Pyx_TraceLine(386,0,__PYX_ERR(0, 386, __pyx_L1_error))
while (1) {
__pyx_t_17 = ((__pyx_v_sphere_i < __pyx_v_nsphere_points) != 0);
if (!__pyx_t_17) break;
387: # Propose a point at the SAS of the atom
+388: SAS_point_x = SAS_sphere_pts[sphere_i,0] + grid_point_x
__Pyx_TraceLine(388,0,__PYX_ERR(0, 388, __pyx_L1_error))
__pyx_t_64 = __pyx_v_sphere_i;
__pyx_t_65 = 0;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_64 >= (size_t)__pyx_v_SAS_sphere_pts.shape[0])) __pyx_t_7 = 0;
if (__pyx_t_65 < 0) {
__pyx_t_65 += __pyx_v_SAS_sphere_pts.shape[1];
if (unlikely(__pyx_t_65 < 0)) __pyx_t_7 = 1;
} else if (unlikely(__pyx_t_65 >= __pyx_v_SAS_sphere_pts.shape[1])) __pyx_t_7 = 1;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 388, __pyx_L1_error)
}
__pyx_v_SAS_point_x = ((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_SAS_sphere_pts.data + __pyx_t_64 * __pyx_v_SAS_sphere_pts.strides[0]) ) + __pyx_t_65 * __pyx_v_SAS_sphere_pts.strides[1]) ))) + __pyx_v_grid_point_x);
+389: SAS_point_y = SAS_sphere_pts[sphere_i,1] + grid_point_y
__Pyx_TraceLine(389,0,__PYX_ERR(0, 389, __pyx_L1_error))
__pyx_t_66 = __pyx_v_sphere_i;
__pyx_t_67 = 1;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_66 >= (size_t)__pyx_v_SAS_sphere_pts.shape[0])) __pyx_t_7 = 0;
if (__pyx_t_67 < 0) {
__pyx_t_67 += __pyx_v_SAS_sphere_pts.shape[1];
if (unlikely(__pyx_t_67 < 0)) __pyx_t_7 = 1;
} else if (unlikely(__pyx_t_67 >= __pyx_v_SAS_sphere_pts.shape[1])) __pyx_t_7 = 1;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 389, __pyx_L1_error)
}
__pyx_v_SAS_point_y = ((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_SAS_sphere_pts.data + __pyx_t_66 * __pyx_v_SAS_sphere_pts.strides[0]) ) + __pyx_t_67 * __pyx_v_SAS_sphere_pts.strides[1]) ))) + __pyx_v_grid_point_y);
+390: SAS_point_z = SAS_sphere_pts[sphere_i,2] + grid_point_z
__Pyx_TraceLine(390,0,__PYX_ERR(0, 390, __pyx_L1_error))
__pyx_t_68 = __pyx_v_sphere_i;
__pyx_t_69 = 2;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_68 >= (size_t)__pyx_v_SAS_sphere_pts.shape[0])) __pyx_t_7 = 0;
if (__pyx_t_69 < 0) {
__pyx_t_69 += __pyx_v_SAS_sphere_pts.shape[1];
if (unlikely(__pyx_t_69 < 0)) __pyx_t_7 = 1;
} else if (unlikely(__pyx_t_69 >= __pyx_v_SAS_sphere_pts.shape[1])) __pyx_t_7 = 1;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 390, __pyx_L1_error)
}
__pyx_v_SAS_point_z = ((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_SAS_sphere_pts.data + __pyx_t_68 * __pyx_v_SAS_sphere_pts.strides[0]) ) + __pyx_t_69 * __pyx_v_SAS_sphere_pts.strides[1]) ))) + __pyx_v_grid_point_z);
391:
392: # Check if the point clashes with a receptor atom
+393: clash = 0
__Pyx_TraceLine(393,0,__PYX_ERR(0, 393, __pyx_L1_error))
__pyx_v_clash = 0;
+394: for atom_j in receptor_coordinates_ijk:
__Pyx_TraceLine(394,0,__PYX_ERR(0, 394, __pyx_L1_error))
__pyx_t_4 = __pyx_v_receptor_coordinates_ijk; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
for (;;) {
if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 394, __pyx_L1_error)
#else
__pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 394, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
#endif
__pyx_t_70 = __Pyx_PyInt_As_size_t(__pyx_t_5); if (unlikely((__pyx_t_70 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 394, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_v_atom_j = __pyx_t_70;
/* … */
__Pyx_TraceLine(394,0,__PYX_ERR(0, 394, __pyx_L1_error))
}
__pyx_L46_break:;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+395: dx = receptor_coordinates[atom_j,0] - SAS_point_x
__Pyx_TraceLine(395,0,__PYX_ERR(0, 395, __pyx_L1_error))
__pyx_t_70 = __pyx_v_atom_j;
__pyx_t_71 = 0;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_70 >= (size_t)__pyx_v_receptor_coordinates.shape[0])) __pyx_t_7 = 0;
if (__pyx_t_71 < 0) {
__pyx_t_71 += __pyx_v_receptor_coordinates.shape[1];
if (unlikely(__pyx_t_71 < 0)) __pyx_t_7 = 1;
} else if (unlikely(__pyx_t_71 >= __pyx_v_receptor_coordinates.shape[1])) __pyx_t_7 = 1;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 395, __pyx_L1_error)
}
__pyx_v_dx = ((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_receptor_coordinates.data + __pyx_t_70 * __pyx_v_receptor_coordinates.strides[0]) ) + __pyx_t_71 * __pyx_v_receptor_coordinates.strides[1]) ))) - __pyx_v_SAS_point_x);
+396: dy = receptor_coordinates[atom_j,1] - SAS_point_y
__Pyx_TraceLine(396,0,__PYX_ERR(0, 396, __pyx_L1_error))
__pyx_t_72 = __pyx_v_atom_j;
__pyx_t_73 = 1;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_72 >= (size_t)__pyx_v_receptor_coordinates.shape[0])) __pyx_t_7 = 0;
if (__pyx_t_73 < 0) {
__pyx_t_73 += __pyx_v_receptor_coordinates.shape[1];
if (unlikely(__pyx_t_73 < 0)) __pyx_t_7 = 1;
} else if (unlikely(__pyx_t_73 >= __pyx_v_receptor_coordinates.shape[1])) __pyx_t_7 = 1;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 396, __pyx_L1_error)
}
__pyx_v_dy = ((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_receptor_coordinates.data + __pyx_t_72 * __pyx_v_receptor_coordinates.strides[0]) ) + __pyx_t_73 * __pyx_v_receptor_coordinates.strides[1]) ))) - __pyx_v_SAS_point_y);
+397: dz = receptor_coordinates[atom_j,2] - SAS_point_z
__Pyx_TraceLine(397,0,__PYX_ERR(0, 397, __pyx_L1_error))
__pyx_t_74 = __pyx_v_atom_j;
__pyx_t_75 = 2;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_74 >= (size_t)__pyx_v_receptor_coordinates.shape[0])) __pyx_t_7 = 0;
if (__pyx_t_75 < 0) {
__pyx_t_75 += __pyx_v_receptor_coordinates.shape[1];
if (unlikely(__pyx_t_75 < 0)) __pyx_t_7 = 1;
} else if (unlikely(__pyx_t_75 >= __pyx_v_receptor_coordinates.shape[1])) __pyx_t_7 = 1;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 397, __pyx_L1_error)
}
__pyx_v_dz = ((*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_receptor_coordinates.data + __pyx_t_74 * __pyx_v_receptor_coordinates.strides[0]) ) + __pyx_t_75 * __pyx_v_receptor_coordinates.strides[1]) ))) - __pyx_v_SAS_point_z);
+398: if (dx*dx + dy*dy + dz*dz) < LJ_r2[atom_j]:
__Pyx_TraceLine(398,0,__PYX_ERR(0, 398, __pyx_L1_error))
__pyx_t_76 = __pyx_v_atom_j;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_76 >= (size_t)__pyx_v_LJ_r2.shape[0])) __pyx_t_7 = 0;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 398, __pyx_L1_error)
}
__pyx_t_17 = (((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz)) < (*((__pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_float_t *) ( /* dim=0 */ (__pyx_v_LJ_r2.data + __pyx_t_76 * __pyx_v_LJ_r2.strides[0]) )))) != 0);
if (__pyx_t_17) {
/* … */
}
+399: clash = 1
__Pyx_TraceLine(399,0,__PYX_ERR(0, 399, __pyx_L1_error))
__pyx_v_clash = 1;
+400: break
__Pyx_TraceLine(400,0,__PYX_ERR(0, 400, __pyx_L1_error))
goto __pyx_L46_break;
+401: if clash==0:
__Pyx_TraceLine(401,0,__PYX_ERR(0, 401, __pyx_L1_error))
__pyx_t_17 = ((__pyx_v_clash == 0) != 0);
if (__pyx_t_17) {
/* … */
}
402: # If there are no clashes,
403: # increment the marks of the grid points within a probe radius
+404: increment_inside_sphere(grid_c, spacing, counts, \
__Pyx_TraceLine(404,0,__PYX_ERR(0, 404, __pyx_L1_error))
__pyx_t_77 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t(((PyObject *)__pyx_v_grid_c));
if (unlikely(!__pyx_t_77.memview)) __PYX_ERR(0, 404, __pyx_L1_error)
/* … */
__Pyx_TraceLine(405,0,__PYX_ERR(0, 405, __pyx_L1_error))
__pyx_t_4 = __pyx_f_46_cython_magic_c7a891f460c6cdee668bf17def65776d_increment_inside_sphere(__pyx_t_77, __pyx_v_spacing, __pyx_v_counts, __pyx_v_SAS_point_x, __pyx_v_SAS_point_y, __pyx_v_SAS_point_z, __pyx_v_probe_radius, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 404, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__PYX_XDEC_MEMVIEW(&__pyx_t_77, 1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
405: SAS_point_x, SAS_point_y, SAS_point_z, probe_radius)
+406: sphere_i += 1
__Pyx_TraceLine(406,0,__PYX_ERR(0, 406, __pyx_L1_error))
__pyx_v_sphere_i = (__pyx_v_sphere_i + 1);
}
407:
408: # Decrement of the marks of newly inaccessible grid points
+409: n = 0
__Pyx_TraceLine(409,0,__PYX_ERR(0, 409, __pyx_L1_error))
__pyx_v_n = 0;
+410: while n < n_newly_inaccessible_SAS_points:
__Pyx_TraceLine(410,0,__PYX_ERR(0, 410, __pyx_L1_error))
while (1) {
__pyx_t_17 = ((__pyx_v_n < __pyx_v_n_newly_inaccessible_SAS_points) != 0);
if (!__pyx_t_17) break;
+411: decrement_inside_sphere(grid_c, spacing, counts, \
__Pyx_TraceLine(411,0,__PYX_ERR(0, 411, __pyx_L1_error))
__pyx_t_77 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t(((PyObject *)__pyx_v_grid_c));
if (unlikely(!__pyx_t_77.memview)) __PYX_ERR(0, 411, __pyx_L1_error)
/* … */
__Pyx_TraceLine(411,0,__PYX_ERR(0, 411, __pyx_L1_error))
__pyx_t_5 = __pyx_f_46_cython_magic_c7a891f460c6cdee668bf17def65776d_decrement_inside_sphere(__pyx_t_77, __pyx_v_spacing, __pyx_v_counts, __pyx_t_78, __pyx_t_79, __pyx_t_80, __pyx_v_probe_radius, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 411, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__PYX_XDEC_MEMVIEW(&__pyx_t_77, 1);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+412: newly_inaccessible_SAS_points[n][0], \
__Pyx_TraceLine(412,0,__PYX_ERR(0, 412, __pyx_L1_error))
__pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_newly_inaccessible_SAS_points, __pyx_v_n, size_t, 0, __Pyx_PyInt_FromSize_t, 1, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 412, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 412, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_78 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_78 == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 412, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+413: newly_inaccessible_SAS_points[n][1], \
__Pyx_TraceLine(413,0,__PYX_ERR(0, 413, __pyx_L1_error))
__pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_newly_inaccessible_SAS_points, __pyx_v_n, size_t, 0, __Pyx_PyInt_FromSize_t, 1, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 413, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_4 = __Pyx_GetItemInt(__pyx_t_5, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 413, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_79 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_79 == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 413, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+414: newly_inaccessible_SAS_points[n][2], probe_radius)
__Pyx_TraceLine(414,0,__PYX_ERR(0, 414, __pyx_L1_error))
__pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_newly_inaccessible_SAS_points, __pyx_v_n, size_t, 0, __Pyx_PyInt_FromSize_t, 1, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 414, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 414, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_80 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_80 == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 414, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+415: n += 1
__Pyx_TraceLine(415,0,__PYX_ERR(0, 415, __pyx_L1_error))
__pyx_v_n = (__pyx_v_n + 1);
}
416:
417: # Blot the region inside the ligand vdW as low dielectric
+418: set_inside_sphere_to(grid_c, spacing, counts, \
__Pyx_TraceLine(418,0,__PYX_ERR(0, 418, __pyx_L1_error))
__pyx_t_77 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t(((PyObject *)__pyx_v_grid_c));
if (unlikely(!__pyx_t_77.memview)) __PYX_ERR(0, 418, __pyx_L1_error)
/* … */
__Pyx_TraceLine(420,0,__PYX_ERR(0, 420, __pyx_L1_error))
__pyx_t_5 = __pyx_f_46_cython_magic_c7a891f460c6cdee668bf17def65776d_set_inside_sphere_to(__pyx_t_77, __pyx_v_spacing, __pyx_v_counts, __pyx_v_grid_point_x, __pyx_v_grid_point_y, __pyx_v_grid_point_z, __pyx_v_ligand_atom_radius, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 418, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__PYX_XDEC_MEMVIEW(&__pyx_t_77, 1);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
419: grid_point_x, grid_point_y, grid_point_z, \
420: ligand_atom_radius, 0)
421:
+422: desolvationGrid[i,j,k] = fraction_r4inv_low_dielectric(grid_c, \
__Pyx_TraceLine(422,0,__PYX_ERR(0, 422, __pyx_L1_error))
__pyx_t_77 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_nn___pyx_t_46_cython_magic_c7a891f460c6cdee668bf17def65776d_int_t(((PyObject *)__pyx_v_grid_c));
if (unlikely(!__pyx_t_77.memview)) __PYX_ERR(0, 422, __pyx_L1_error)
/* … */
__Pyx_TraceLine(424,0,__PYX_ERR(0, 424, __pyx_L1_error))
__pyx_t_5 = __pyx_f_46_cython_magic_c7a891f460c6cdee668bf17def65776d_fraction_r4inv_low_dielectric(__pyx_t_77, __pyx_v_spacing, __pyx_v_counts, __pyx_v_grid_point_x, __pyx_v_grid_point_y, __pyx_v_grid_point_z, __pyx_v_ligand_atom_radius, __pyx_v_integration_cutoff, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 422, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__PYX_XDEC_MEMVIEW(&__pyx_t_77, 1);
/* … */
__Pyx_TraceLine(422,0,__PYX_ERR(0, 422, __pyx_L1_error))
__pyx_t_55 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_55 == (npy_double)-1) && PyErr_Occurred())) __PYX_ERR(0, 422, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_81 = __pyx_v_i;
__pyx_t_82 = __pyx_v_j;
__pyx_t_83 = __pyx_v_k;
__pyx_t_7 = -1;
if (unlikely(__pyx_t_81 >= (size_t)__pyx_pybuffernd_desolvationGrid.diminfo[0].shape)) __pyx_t_7 = 0;
if (unlikely(__pyx_t_82 >= (size_t)__pyx_pybuffernd_desolvationGrid.diminfo[1].shape)) __pyx_t_7 = 1;
if (unlikely(__pyx_t_83 >= (size_t)__pyx_pybuffernd_desolvationGrid.diminfo[2].shape)) __pyx_t_7 = 2;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 422, __pyx_L1_error)
}
*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_desolvationGrid.rcbuffer->pybuffer.buf, __pyx_t_81, __pyx_pybuffernd_desolvationGrid.diminfo[0].strides, __pyx_t_82, __pyx_pybuffernd_desolvationGrid.diminfo[1].strides, __pyx_t_83, __pyx_pybuffernd_desolvationGrid.diminfo[2].strides) = __pyx_t_55;
}
__pyx_L37:;
}
}
}
423: spacing, counts, grid_point_x, grid_point_y, grid_point_z, \
424: ligand_atom_radius, integration_cutoff)
425:
+426: return desolvationGrid
__Pyx_TraceLine(426,0,__PYX_ERR(0, 426, __pyx_L1_error))
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(((PyObject *)__pyx_v_desolvationGrid));
__pyx_r = ((PyObject *)__pyx_v_desolvationGrid);
goto __pyx_L0;
In [6]:
#Print profiling statistics using the `line_profiler` API
profile = line_profiler.LineProfiler(calc_desolvationGrid)
profile.runcall(calc_desolvationGrid, self.receptor_MS_grid, self.kwargs['spacing'], \
self.kwargs['counts'], self.receptor_SAS_points, self.crd, \
SAS_sphere_pts, self.LJ_r2, max(np.sqrt(self.LJ_r2)), self.kwargs['ligand_atom_radius'], \
self.kwargs['probe_radius'], self.kwargs['integration_cutoff'])
profile.print_stats()
Timer unit: 1e-06 s
Total time: 81.7338 s
File: /Users/dminh/.ipython/cython/_cython_magic_c7a891f460c6cdee668bf17def65776d.pyx
Function: calc_desolvationGrid at line 286
Line # Hits Time Per Hit % Time Line Contents
==============================================================
286 def calc_desolvationGrid(int_t[:,:,:] receptor_MS_grid, \
287 float_t[:] spacing, int_t[:] counts, \
288 float_t[:,:] receptor_SAS_points, \
289 float_t[:,:] receptor_coordinates, \
290 float_t[:,:] SAS_sphere_pts, \
291 float_t[:] LJ_r2, \
292 float_t LJ_r_max, \
293 float_t ligand_atom_radius, \
294 float_t probe_radius, \
295 float_t integration_cutoff):
296 cdef size_t i, j, k, n
297 cdef int_t nreceptor_SAS_points
298 cdef float_t SAS_x_min, SAS_x_max, SAS_y_min, SAS_y_max, SAS_z_min, SAS_z_max
299 cdef float_t clash_filter_r
300 cdef float_t rec_x_min, rec_x_max, rec_y_min, rec_y_max, rec_z_min, rec_z_max
301 cdef float_t ligand_atom_radius2
302 cdef float_t grid_point_x, grid_point_y, grid_point_z
303 cdef np.ndarray[np.double_t, ndim=3] desolvationGrid
304
305 # To use for new SAS points
306 cdef size_t atom_j, sphere_i, d
307 cdef int_t clash
308 cdef int_t nreceptor_atoms, nsphere_points, n_newly_inaccessible_SAS_points
309 cdef float_t SAS_point_x, SAS_point_y, SAS_point_z
310 cdef float_t dx, dy, dz
311 cdef np.ndarray[int_t, ndim=3] grid_c
312
313 1 2 2.0 0.0 nreceptor_SAS_points = receptor_SAS_points.shape[0]
314 1 20 20.0 0.0 nreceptor_atoms = len(LJ_r2)
315 1 6 6.0 0.0 nsphere_points = len(SAS_sphere_pts)
316
317 1 2 2.0 0.0 ligand_atom_radius2 = ligand_atom_radius*ligand_atom_radius
318 # Receptor atoms that clash with the ligand atom SAS will be within
319 # the SAS and maximum LJ radius
320 1 1 1.0 0.0 clash_filter_r = ligand_atom_radius + probe_radius + LJ_r_max
321
322 1 781 781.0 0.0 desolvationGrid = np.zeros(shape=tuple(counts), dtype=np.float)
323
324 1 2 2.0 0.0 for i in xrange(0,counts[0],10):
325 8 35 4.4 0.0 grid_point_x = i*spacing[0]
326 8 21 2.6 0.0 SAS_x_min = grid_point_x - ligand_atom_radius
327 8 10 1.2 0.0 SAS_x_max = grid_point_x + ligand_atom_radius
328 365302 263235 0.7 0.3 receptor_SAS_points_i = [n for n in xrange(nreceptor_SAS_points) \
329 10660512 7405129 0.7 9.1 if (receptor_SAS_points[n,0]>SAS_x_min) and \
330 2509549 1735135 0.7 2.1 (receptor_SAS_points[n,0]<SAS_x_max)]
331 8 7 0.9 0.0 rec_x_min = grid_point_x - clash_filter_r
332 8 4 0.5 0.0 rec_x_max = grid_point_x + clash_filter_r
333 3886 2645 0.7 0.0 receptor_coordinates_i = [n for n in xrange(nreceptor_atoms) \
334 32944 21390 0.6 0.0 if (receptor_coordinates[n,0]>rec_x_min) and \
335 9062 5789 0.6 0.0 (receptor_coordinates[n,0]<rec_x_max)]
336 8 8 1.0 0.0 for j in xrange(0,counts[1],10):
337 64 75 1.2 0.0 grid_point_y = j*spacing[1]
338 64 57 0.9 0.0 SAS_y_min = grid_point_y - ligand_atom_radius
339 64 48 0.8 0.0 SAS_y_max = grid_point_y + ligand_atom_radius
340 6050894 4251982 0.7 5.2 receptor_SAS_points_ij = [n for n in receptor_SAS_points_i \
341 5844768 4078570 0.7 5.0 if (receptor_SAS_points[n,1]>SAS_y_min) and \
342 1511887 1043418 0.7 1.3 (receptor_SAS_points[n,1]<SAS_y_max)]
343 64 41 0.6 0.0 rec_y_min = grid_point_y - clash_filter_r
344 64 53 0.8 0.0 rec_y_max = grid_point_y + clash_filter_r
345 69633 48545 0.7 0.1 receptor_coordinates_ij = [n for n in receptor_coordinates_i \
346 62112 42007 0.7 0.1 if (receptor_coordinates[n,1]>rec_y_min) and \
347 18811 12612 0.7 0.0 (receptor_coordinates[n,1]<rec_y_max)]
348 64 52 0.8 0.0 for k in xrange(0,counts[2],10):
349 512 665 1.3 0.0 grid_point_z = k*spacing[2]
350 512 366 0.7 0.0 SAS_z_min = grid_point_z - ligand_atom_radius
351 512 409 0.8 0.0 SAS_z_max = grid_point_z + ligand_atom_radius
352 3409560 2403194 0.7 2.9 receptor_SAS_points_ijk = [n for n in receptor_SAS_points_ij \
353 3297504 2326821 0.7 2.8 if (receptor_SAS_points[n,2]>SAS_z_min) and \
354 1043036 717626 0.7 0.9 (receptor_SAS_points[n,2]<SAS_z_max)]
355
356 # Find SAS points that are made solvent inaccessible by the ligand atom
357 512 29540 57.7 0.0 newly_inaccessible_SAS_points = []
358 112056 79216 0.7 0.1 for n in receptor_SAS_points_ijk:
359 111544 77649 0.7 0.1 dx = receptor_SAS_points[n,0]-grid_point_x
360 111544 75275 0.7 0.1 dy = receptor_SAS_points[n,1]-grid_point_y
361 111544 75857 0.7 0.1 dz = receptor_SAS_points[n,2]-grid_point_z
362 111544 75867 0.7 0.1 if (dx*dx + dy*dy + dz*dz)<ligand_atom_radius2:
363 58567 46557 0.8 0.1 newly_inaccessible_SAS_points.append(\
364 58567 587691 10.0 0.7 np.copy(receptor_SAS_points[n,:]))
365
366 512 369 0.7 0.0 n_newly_inaccessible_SAS_points = len(newly_inaccessible_SAS_points)
367 512 347 0.7 0.0 if n_newly_inaccessible_SAS_points==0:
368 # If there are no newly inaccessible SAS points,
369 # perform the numerical integrals over the receptor MS grid.
370 234 2773235 11851.4 3.4 desolvationGrid[i,j,k] = fraction_r4inv_low_dielectric(\
371 receptor_MS_grid, spacing, counts, \
372 grid_point_x, grid_point_y, grid_point_z, \
373 ligand_atom_radius, integration_cutoff)
374 else:
375 278 197 0.7 0.0 rec_z_min = grid_point_z - clash_filter_r
376 278 178 0.6 0.0 rec_z_max = grid_point_z + clash_filter_r
377 101692 70399 0.7 0.1 receptor_coordinates_ijk = [n for n in receptor_coordinates_ij \
378 88326 59423 0.7 0.1 if (receptor_coordinates[n,2]>rec_z_min) and \
379 29914 19991 0.7 0.0 (receptor_coordinates[n,2]<rec_z_max)]
380
381 278 138185 497.1 0.2 grid_c = np.copy(receptor_MS_grid)
382
383 # Find new SAS points around the ligand atom and
384 # increment the marks of the grid points within a probe radius
385 278 520 1.9 0.0 sphere_i = 0
386 278 296 1.1 0.0 while sphere_i < nsphere_points:
387 # Propose a point at the SAS of the atom
388 278000 200896 0.7 0.2 SAS_point_x = SAS_sphere_pts[sphere_i,0] + grid_point_x
389 278000 201460 0.7 0.2 SAS_point_y = SAS_sphere_pts[sphere_i,1] + grid_point_y
390 278000 200001 0.7 0.2 SAS_point_z = SAS_sphere_pts[sphere_i,2] + grid_point_z
391
392 # Check if the point clashes with a receptor atom
393 278000 191350 0.7 0.2 clash = 0
394 9114391 6443703 0.7 7.9 for atom_j in receptor_coordinates_ijk:
395 8955264 6236368 0.7 7.6 dx = receptor_coordinates[atom_j,0] - SAS_point_x
396 8955264 6206337 0.7 7.6 dy = receptor_coordinates[atom_j,1] - SAS_point_y
397 8955264 6256251 0.7 7.7 dz = receptor_coordinates[atom_j,2] - SAS_point_z
398 8955264 6225464 0.7 7.6 if (dx*dx + dy*dy + dz*dz) < LJ_r2[atom_j]:
399 118873 82061 0.7 0.1 clash = 1
400 118873 81749 0.7 0.1 break
401 278000 194136 0.7 0.2 if clash==0:
402 # If there are no clashes,
403 # increment the marks of the grid points within a probe radius
404 159127 715201 4.5 0.9 increment_inside_sphere(grid_c, spacing, counts, \
405 159127 9970198 62.7 12.2 SAS_point_x, SAS_point_y, SAS_point_z, probe_radius)
406 278000 210713 0.8 0.3 sphere_i += 1
407
408 # Decrement of the marks of newly inaccessible grid points
409 278 195 0.7 0.0 n = 0
410 278 243 0.9 0.0 while n < n_newly_inaccessible_SAS_points:
411 117134 4307772 36.8 5.3 decrement_inside_sphere(grid_c, spacing, counts, \
412 58567 66061 1.1 0.1 newly_inaccessible_SAS_points[n][0], \
413 58567 51426 0.9 0.1 newly_inaccessible_SAS_points[n][1], \
414 58567 51374 0.9 0.1 newly_inaccessible_SAS_points[n][2], probe_radius)
415 58567 46984 0.8 0.1 n += 1
416
417 # Blot the region inside the ligand vdW as low dielectric
418 278 1010 3.6 0.0 set_inside_sphere_to(grid_c, spacing, counts, \
419 grid_point_x, grid_point_y, grid_point_z, \
420 278 16768 60.3 0.0 ligand_atom_radius, 0)
421
422 556 1811 3.3 0.0 desolvationGrid[i,j,k] = fraction_r4inv_low_dielectric(grid_c, \
423 spacing, counts, grid_point_x, grid_point_y, grid_point_z, \
424 278 5302668 19074.3 6.5 ligand_atom_radius, integration_cutoff)
425
426 1 91 91.0 0.0 return desolvationGrid
Content source: CCBatIIT/AlGDock
Similar notebooks: