@@ -147,21 +147,24 @@ def init_neighbours(self):
147147 self .index (k , j , i + 1 ), # over
148148 ]]
149149
150- n_neighbours = [other for other in [
150+ nngbs = [other for other in [
151151 self .index (k - 2 , j , i ), # left
152152 self .index (k + 2 , j , i ), # right
153153 self .index (k , j - 2 , i ), # behind
154154 self .index (k , j + 2 , i ), # in front
155155 self .index (k , j , i - 2 ), # under
156156 self .index (k , j , i + 2 ), # over
157157 ]]
158+
159+ # July 1st, 2016 Weiwei: I think it's okay for a cell with its neighbour is itself
160+ # if periodic boundary conditions are used. For example, if we only have cell and enable
161+ # periodic boundary condition in x-direction, then we got a rod.
162+ # therefore, I commented two lines below.
158163 # no cell should be its own neighbour
159- neighbours = [other if other != cell
160- else - 1 for other in ngbs ]
161- next_neighbours = [other if other != cell
162- else - 1 for other in n_neighbours ]
163- connectivity .append (neighbours )
164- connectivity_next .append (next_neighbours )
164+ # neighbours = [other if other != cell
165+ # else -1 for other in ngbs]
166+ connectivity .append (ngbs )
167+ connectivity_next .append (nngbs )
165168
166169 return np .array (connectivity , dtype = np .int32 ), np .array (connectivity_next , dtype = np .int32 )
167170
0 commit comments