Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cython3 syntax .pyx files - WARNING: not tested #8

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8,068 changes: 5,566 additions & 2,502 deletions newanalysis/functions/py_functions.c

Large diffs are not rendered by default.

68,560 changes: 38,437 additions & 30,123 deletions newanalysis/gfunction/gfunction.cpp

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions newanalysis/gfunction/gfunction.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class RDF(object):
if use_cuda and cu.cuda:
self.cuda = True
elif use_cuda and not cu.cuda:
print "No suitable CUDA device was found to calculate radial distribution functions. Using CPU instead."
print("No suitable CUDA device was found to calculate radial distribution functions. Using CPU instead.")
self.cuda = False
else:
self.cuda = False
Expand Down Expand Up @@ -577,16 +577,16 @@ cdef void calcHistoVoronoi(double *core_xyz, double *surr_xyz, double *core_dip,
cdef double *dest = <double*> np_dest.data
cdef double *box_dim = <double*> np_box_dim.data
cdef int ds_pos1, ds_pos2, shell, ix3, ix4
cdef int apr_core = ncore / nm_core
cdef int apr_surround = nsurround / nm_surround
cdef int apr_core = ncore // nm_core
cdef int apr_surround = nsurround // nm_surround


#TODO: Change with nm_core, int nm_surround, int delaunay_matrix, nshells

for i in prange(ncore, nogil=True):
#ix2=i*histo_n
ix2 = i*nshells*histo_n #ROLLBACK: ERASE THESE 2, UNCOMMENT ABOVE
ds_pos1 = i/apr_core
ds_pos1 = i//apr_core

if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32:
cpx = core_dip[i*3]
Expand All @@ -598,7 +598,7 @@ cdef void calcHistoVoronoi(double *core_xyz, double *surr_xyz, double *core_dip,
else:
j_begin = 0
for j in range(j_begin,nsurround):
ds_pos2 = j/apr_surround # ROLLBACK: ERASE THESE 2
ds_pos2 = j//apr_surround # ROLLBACK: ERASE THESE 2
shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped?
shell = shell-1
if shell < 0: shell = nshells-1
Expand Down Expand Up @@ -674,16 +674,16 @@ cdef void calcHistoVoronoiNonSelf(double *core_xyz, double *surr_xyz, double *co
cdef double *dest = <double*> np_dest.data
cdef double *box_dim = <double*> np_box_dim.data
cdef int ds_pos1, ds_pos2, shell, ix3, ix4
cdef int apr_core = ncore / nm_core
cdef int apr_surround = nsurround / nm_surround
cdef int apr_core = ncore // nm_core
cdef int apr_surround = nsurround // nm_surround


#TODO: Change with nm_core, int nm_surround, int delaunay_matrix, nshells

for i in prange(ncore, nogil=True):
#ix2=i*histo_n
ix2 = i*nshells*histo_n #ROLLBACK: ERASE THESE 2, UNCOMMENT ABOVE
ds_pos1 = i/apr_core
ds_pos1 = i//apr_core

if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32:
cpx = core_dip[i*3]
Expand All @@ -695,7 +695,7 @@ cdef void calcHistoVoronoiNonSelf(double *core_xyz, double *surr_xyz, double *co
else:
j_begin = 0
for j in range(j_begin,nsurround):
ds_pos2 = j/apr_surround # ROLLBACK: ERASE THESE 3
ds_pos2 = j//apr_surround # ROLLBACK: ERASE THESE 3
if(ds_pos1 == ds_pos2): continue
shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped?
shell = shell-1
Expand Down Expand Up @@ -799,7 +799,7 @@ class RDF_voronoi(object):
if use_cuda and cu.cuda:
self.cuda = True
elif use_cuda and not cu.cuda:
print "No suitable CUDA device was found to calculate radial distribution functions. Using CPU instead."
print("No suitable CUDA device was found to calculate radial distribution functions. Using CPU instead.")
self.cuda = False
else:
self.cuda = False
Expand Down
Loading