#NEWLINE# @ jit #NEWLINE# def parakeet_dist( x , y , z , L , periodicX , periodicY , periodicZ ) : #NEWLINE# #INDENT# N = len ( x ) #NEWLINE# def periodic_diff( x1 , x2 , periodic ) : #NEWLINE# #INDENT# diff = ( x1 - x2 ) #NEWLINE# if periodic : #NEWLINE# #INDENT# if ( diff > ( L / 2 ) ) : #NEWLINE# #INDENT# diff -= L #NEWLINE# #UNINDENT# if ( diff < ( ( - L ) / 2 ) ) : #NEWLINE# #INDENT# diff += L #NEWLINE# #UNINDENT# #UNINDENT# return diff #NEWLINE# #UNINDENT# dx = np . array ( [ [ periodic_diff ( x1 , x2 , periodicX ) for x1 in x ] for x2 in x ] ) #NEWLINE# dy = np . array ( [ [ periodic_diff ( y1 , y2 , periodicY ) for y1 in y ] for y2 in y ] ) #NEWLINE# dz = np . array ( [ [ periodic_diff ( z1 , z2 , periodicZ ) for z1 in z ] for z2 in z ] ) #NEWLINE# d = ( ( ( dx ** 2 ) + ( dy ** 2 ) ) + ( dz ** 2 ) ) #NEWLINE# for i in xrange ( N ) : #NEWLINE# #INDENT# for j in xrange ( N ) : #NEWLINE# #INDENT# if ( d [ ( z1 , j ) ] == 0 ) : #NEWLINE# #INDENT# d [ ( i , j ) ] = ( - 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# d [ ( i , j ) ] = np . sqrt ( d [ ( i , j ) ] ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return ( d , dx , dy , dz )