### Author Topic: Problem in MSD results from ovito  (Read 964 times)

#### prash

• Newbie
• Posts: 15
##### Problem in MSD results from ovito
« on: October 23, 2018, 01:58:12 PM »
Dear all,

I'm new to ovito. I have 16000 atoms in my simulation box.Which contain two type of atoms.
I have to calculate MSD of both type of atoms.
So, The procedure I followed is:
for 2nd type of atoms
1) Select type
2)Delete selected (deleted 1st type of atoms)
3) Displacement Vectors modifier (with reference file)
4) MSD from python script as given on ovito help site.

But when I seen the MSD graph it is not as expected like increasing with time frame.

#### Constanze Kalcher

• Full Member
• Posts: 233
##### Re: Problem in MSD results from ovito
« Reply #1 on: October 23, 2018, 02:20:19 PM »
Dear prash,

I'm afraid you will need to get more specific for people to be able to help you, i.e. show us the python script modifier you are using and the MSD graph. If your trajectory is not too large it would be helpful if you uploaded it here too.

-Constanze

#### prash

• Newbie
• Posts: 15
##### Re: Problem in MSD results from ovito
« Reply #2 on: October 23, 2018, 02:31:22 PM »
I use this python script in my virtual ovito
Code: [Select]
`from ovito.data import *import numpy#def modify(frame, input, output):# print("Input particle properties:")# for name in input.particles.keys():# print(name)def modify(frame, input, output):    # Access the per-particle displacement magnitudes computed by an existing     # Displacement Vectors modifier that precedes this custom modifier in the     # data pipeline:    displacement_magnitudes = input.particle_properties.displacement_magnitude.array    # Compute MSD:    msd = numpy.sum(displacement_magnitudes ** 2) / len(displacement_magnitudes)    # Output MSD value as a global attribute:     output.attributes["MSD"] = msd    print (msd)`

#### Constanze Kalcher

• Full Member
• Posts: 233
##### Re: Problem in MSD results from ovito
« Reply #3 on: October 24, 2018, 03:01:32 PM »
The script doesn't seem to be the issue.

#### prash

• Newbie
• Posts: 15
##### Re: Problem in MSD results from ovito
« Reply #4 on: October 24, 2018, 04:38:09 PM »
I'm attaching here the screen shot of  MSD vs timeframe graph and settings for Displacemnet vectors which I used.
Also some example frame and reference file.

#### Constanze Kalcher

• Full Member
• Posts: 233
##### Re: Problem in MSD results from ovito
« Reply #5 on: October 25, 2018, 12:10:52 PM »
Dear prash,

as far as I can see there's no issue with the way you calculate the MSD with OVITO, it's rather a problem with your reference structure. Are you sure that this is the correct reference file?

Note that the Displacement vectors modifier uses the Particle Identifiers and I found that you have different numbers of atoms in your reference and in your example frames. It seems that you were able to avoid this problem by deleting all particles of type 1. However, it appears that the Particle Identifiers of the atoms in your binary system do not correspond to their original ID's anymore. Can you explain how you inserted your second particle type in the reference structure?
Did you maybe not only change the atom type of some of your particles but also unintentionally their Particle Identifiers? And this is why you get these large displacements because you're actually comparing "different particles" so to say.

I'm also wondering, if you want the MSD of particle type 2 only, wouldn't it make more sense to use "frame 0" as a reference in the Displacement vectors modifier instead of the external reference structure, where these particles are not even present yet?
Hope that helps,

-Constanze
« Last Edit: October 25, 2018, 12:22:31 PM by Constanze Kalcher »