Forum Navigation
You need to log in to create posts and topics.

Coordination Analysis Output

Hello,

I'm new to OVITO and trajectory analysis in general. I have a 63 atom (two element) system in which a single carbon atom is surrounded by an aluminum solvent (62 Al atoms). I was able to use the Compute property modification to obtain the coordination number and cutoff radius of 2.1A. I then see that I have the data requested in the Particles tab. This gives me the CN for all 63 atoms in the system based on the criteria (@ParticleType==2 && ParticleType==1). However I can only view this data for an individual frame in my 3000+ time steps of trajectory data. Is there a way to export only this particular data for each timestep? 

i.e. A simple table of Time Step Carbon1_CN, Carbon2_CN, etc.

I'm unable to place this information into the Global Attributes tab in order to actually then save in the Table of Values. Could you please advise me on the proper formatting? I don't need to do any sort of data manipulation, simply export the number of particles surrounding the C within 2.1A. I do have additional files in which I have 2 C atoms, 3 C atoms, etc, and would be doing the same.

I've called my compute property "CACN" which allows me to see the coordination number in the Particles tab.

I also tried to use the following script to include it in the global attributes, which did not work but also produces no errors. I've also attached my trajectory file as reference.

from ovito.data import *
from ovito.io import export_file
import numpy as np

data = pipeline.compute()

def modify(frame, data):
data.attributes["export"] = data.particles["CACN"]

Thanks and Best Regards,
Dev

Uploaded files:
  • You need to login to have access to uploads.

Hello,

welcome to the OVITO community! Please have a look at these introductory sections in the scripting manual,  if this hasn't caught your attention yet. There are different ways of using the python API and if you are working in GUI, you'll probably find this section about user defined modifiers helpful: https://www.ovito.org/docs/current/python/introduction/custom_modifiers.php.

"CACN" is a particle property, which behave like numpy arrays. Thus you can easily look up the coordination number only those particles, that are carbon atoms and store this as a global attribute. If you like, you can the following example in the GUI, which stores the coordination numbers of the first and second carbon atom in your attached example file as global attributes. The time-evolution of the global attributes can be exported using OVITO's file-export function "Table of Values".

def modify(frame, data): 
    ptypes = data.particles["Particle Type"] 
    coord = data.particles["CACN"] 
    data.attributes["export CACN C_1"] = coord[ptypes == 2][0]
    data.attributes["export CACN C_2"] = coord[ptypes == 2][1]

Please also note, that since you are using the xyz-file format you should manually set the periodic boundary conditions under DataSource -> Simulation Cell if you want them to apply.

-Constanze