Replies: 3 comments
-
|
I think this might not even produce incorrect results but would make the histograms with a lower intensity close to distance=0. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
an on-the-fly chat reinforced my suspicion. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
cf. #143 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I think there might be an error in the calculation of the
diffof the functionspatialcor.__dhist_angleI think for periodic boundary conditions the diff needs to calculated with the commented-out code, respecting the periodic images.
... ... ... sl = slice(chunk, chunk+chunksize) # compute the 2D histogram (r,theta) hist = np.zeros((len(dbins)-1,len(abins)-1), dtype=float) for n in np.arange(len(other_coords))[sl]: # calculate distance vectors if same: # diff = pbc_diff( # other_coords[n], # coords[np.arange(len(coords)) != n], # exclude the particle itself # box_boundary, # pbc=pbc # ) # exclude the particle itself diff = other_coords[n] - coords[np.arange(len(coords)) != n] else: # diff = pbc_diff(other_coords[n], coords, box_boundary, pbc=pbc) diff = other_coords[n] - coords # get distances dist = (diff**2).sum(axis=1)**0.5 # calculate angles theta = np.arccos(np.dot(e, diff.T)/dist) theta[diff[:,1] < 0.0] = 2*np.pi - theta[diff[:,1] < 0.0] # use angles between 0 and 2\pi # orient x-axis along mean sample orientation # The rotation is applied to the difference vectors instead of the # particle positions, since the distances can only calculated # correctly if the particle coordinates and the simulation box # fit to each other (which is no longer the case when coordinates # are rotated)! if angle != 0.0: theta = theta - angle theta[theta<0.0] = theta[theta<0.0] + 2*np.pi theta[theta>2*np.pi] = theta[theta>2*np.pi] - 2*np.pi # calculate 2D histogram hist += np.histogram2d(dist, theta, [dbins,abins])[0]Could anyone confirm or correct my understanding here?
Beta Was this translation helpful? Give feedback.
All reactions