13:53
@DGKang Yes I looked at the code in more detail, and it assumes that the structure is around 0,0,0 because it starts the calculation there.
And I don't understand why they are setting the formula for edges of the bins as
arange(-S, rMax + 1.1 * dr, dr)
. Because the distance is never negative, so it doesn't make sense to start from -S. Maybe they were writing a code for something else, I don't know.
@DGKang Have a look at the answer to one of questions here: mattermodeling.stackexchange.com/questions/4514/…
5 hours later…
18:49
3

Ok, I think I figured out why your code is giving a straight line. This is too big to write as a comment, so I am putting this as answer.
At the start of the function, you are determining the edges of the bins of histograms:
edges = arange(-S, rMax + 1.1 * dr, dr)
So, your edges range between -S...
Thank you for the advice. Still I could not figure out why
result
gives zeros in(result, bins) = histogram(d, bins=edges, density=False)
Could you please explain how g[p,:]
and g[:, i]
works? in g[p,:] = result / numberDensity
, g_average[i] = mean(g[:, i]) / (4.0 / 3.0 * pi * (rOuter**3 - rInner**3))
— DGKang 10 hours ago@DGKang
result
gives zeroes because because the edges
indicates a range where there is no data. Let me write this in detail—when you supply an array to the argument bins=
, numpy calculates the histogram only in that range. You are taking the histogram of the data in d
. But there are no values of d
that fall in the range defined in edges
, so your histogram is zero all over. The problem is in the variables edges
and d
. — S R Maiti 10 hours ago@DGKang My guess about the lines you mentioned:
g[p,:] = result/ numberDensity
here you are dividing the result i.e. histogram counts for each bin by the density of particles to normalise the g(r) against particle density. I am not sure what p
is doing. Similarly, in the line g_average[i] =
you are calculating the volume of each spherical shell denoted by a bin of the histogram. Then you are dividing the histogram counts for each bin by the volume of the shell corresponding to that bin, to normalize the g(r) against shell volumes. — S R Maiti 10 hours agoThank you for the explicit explanations. I will carefully look for
edges
and d
. I just wondered how the format of the code (this part g[p, :]
g[:, i]
) is working. Probably I should ask in StackOverflow for the computer language-related questions. Thank you so much for your effort and help! — DGKang 10 hours ago@DGKang Yes the people at StackOverflow would be able to help with code part better. And no worries! — S R Maiti 9 hours ago
I went through the python script line by line carefully, and I just realised that this RDF script is an "example" (I think). As it draws a sphere(edges) from 0,0,0 coordinate the example structure (which is a cluster) that I attached at the beginning of the question cannot be calculated "properly", unless I move the transform the centre of the structure to (0,0,0). What do you think?? — DGKang 6 hours ago
3 hours later…
« first day (321 days earlier) ← previous day next day → last day (1295 days later) »