Python interface and reconstructing various RDF species combinations

I’m using the very helpfully fast ovito RDF calculations via the python interface for the first time, but I’m interested in something beyond just total and all the A-B pair partials. There are two things I want, and one is straightforward, but the other I’m just not sure how to do efficiently. I was hoping someone here could suggest documentation to look at or a specific approach I could try.

  1. I want the A-* RDF, i.e. properly weighted sum of \sum_i w_i \mathrm{rdf}(A, B_i). I suppose the weights would just be the number fraction of B_i, x(B_i), right? If so, how can I get those? Is there a pipeline modifier that would return that info?

  2. I sometimes want both total and various A-B partials. I can presumably attach two
    CoordinationAnalysisModifiers, one with partial=True, one without. Could I instead reconstruct the total from a weighted sum of the partials? If so, what are the weights? Is it, as I suspect, x(A)^2 for A-A and 2 x(A) x(B) for A != B (presumably once I figure out the correct formula I can evaluate it with whatever strategy works for question 1)?

Please have a look at section “Element-wise RDFs” in the online documentation of the Coordination analysis modifier for the explanation how to compute the total RDF from the partial ones. Coordination analysis — OVITO User Manual 3.9.4 documentation

Thanks, that does confirm what I expected for the weights, and it’s good to know that the GUI docs explain some of the details that the python docs skip.

Is there a modifier I can use in the python interface to compute the concentrations that are mentioned in that section?

Since you are using Python, you can directly calculate the concentrations from the particle types property array, e.g. like this

numpy.unique(data.particles.particle_types, return_counts = True)[1]/data.particles.count
1 Like