Basically, I am trying to get the running CN, but the result isn’t correct?
I am multiplying the rdf with 4 * np.pi * x * x * Number of Atoms) / (A * B * C) .
from ovito.io import import_file
from ovito.modifiers import CoordinationAnalysisModifier
cutoff=12.0
number_of_bins=200
# Load input data.
pipeline = import_file("./traj/BEC/ge7/run10/local_minima.xyz")
# Print the list of input particle types.
# They are represented by ParticleType objects attached to the 'Particle Type' particle property.
for t in pipeline.compute().particles.particle_types.types:
print("Type %i: %s" % (t.id, t.name))
# Calculate partial RDFs:
pipeline.modifiers.append(CoordinationAnalysisModifier(cutoff=12.0, number_of_bins=200, partial=True))
# Access the output DataTable:
rdf_table = pipeline.compute().tables['coordination-rdf']
# The y-property of the data points of the DataTable is now a vectorial property.
# Each vector component represents one partial RDF.
rdf_names = rdf_table.y.component_names
# The DataTable.xy() method yields everthing as one combined NumPy table.
# This includes the 'r' values in the first array column, followed by the
# tabulated g(r) partial functions in the remaining columns.
dr = cutoff/number_of_bins
x = [x for x in np.arange(0, int(cutoff), dr)]
A = 12.6
B = 12.6
C = 13.3
rdf_gege_lst = []
for i in rdf_table.y[:,4]:
rdf_gege_lst.append(i)
cn_GeGe_final = []
cn_GeGe = (np.array(rdf_gege_lst) * 4 * np.pi * x * x * 10) / (A * B * C)
for i in range(len(x)):
result_GeGe = integrate.simps(cn_GeGe[:i + 1],x[:i+ 1])
cn_GeGe_final.append(result_GeGe)
plt.plot(x, rdf_gege_lst, 'g', label = "Ge-Ge")
plt.plot(x, cn_GeGe_final, 'b', label = "Ge-Ge")