OVITO > Support Forum

Distribution of coordination number

(1/2) > >>

Mahsa:
Dear supports,

I am trying to get the distribution of coordination number for special atoms around Li ion in my system. I could get the average value of RDF and CN from Gromacs tools before. I converted the trajectory file from MD simulation to a pdb file and then try to analyse that in OVITO.
I followed this post in OVITO forum:
http://forum.ovito.org/index.php?topic=340.0
I did the same steps as in the post, however, the histogram does not show anything and in the data inspector the selection for all particle is 0 (Please see attached to this post the screenshots). What did I miss in the analysis?

Another question is, I have different type of O in the molecules. I'd like to calculate the distribution of coordination numbers of different types of O around Li ions, separately over the trajectory. How can I do this in OVITO?

Best regards,
Mahsa

Constanze Kalcher:
Dear Mahsa,

could you upload an example of your structure here and also paste the python script, then I can help you more easily.

-Constanze

Mahsa:
Dear Constanze,

I can't upload the file because the size is above the limit. Is there another way that I can share the file with you?
This is the script I used from the other post in the forum:

from ovito.data import *
import numpy as np

def modify(frame, input, output):
    # Prefetch the property array containing the particle type information:
    ptypes = input.particles['Particle Type']
   
    #Create a new particle property that stores the number of neighbors with particle type 2 and initialize with zeros
    values = np.zeros(input.particles.count, dtype=int)
    new_property = output.particles.create_property('Type2 Coordination', data=values)
   
    # Initialize neighbor finder object:
    cutoff = 3.
    finder = CutoffNeighborFinder(cutoff, input)
   
    # Loop over all particles:
    for index in range(input.particles.count):
        #Only iterate over particles of type 1
        if(ptypes[index] == 1):
           # Get a list of particle types of all neighbors of the current particle:
            neighbor_types = [ptypes[neigh.index] for neigh in finder.find(index)]
            #Count the number of neighbor types of all types and store the count for type 2 in the newly created particle property
            with new_property:
                new_property[index] = np.bincount(neighbor_types, minlength=4)[2]


-Mahsa

Constanze Kalcher:
Dear Mahsa,

you don't need to upload the whole trajectory, a single shapshot would be enough for me as an example. But yes you can share a download link here or sent a private message to us via the mail support.
The script doesn't seem to be the problem, are you sure the cutoff used for the CutoffNeighborFinder function is appropriate? I'm happy to look into it further once I have access to the data.

-Constanze

Mahsa:
Dear Constanze,

Please find attached to the post, 1ps of the trajectory and the converted file to pdb as an example.

The more reasonable cutoff, is 2 Å for this system but I wanted to see if the script works fine for the system.

-Mahsa

Navigation

[0] Message Index

[#] Next page

Go to full version