# [Pw_forum] How to calculate Mean Square Displacement (MSD)

Nam Tran vnt981 at uowmail.edu.au
Tue Oct 31 01:25:33 CET 2017

```Dear Vahid

I don't know whether VASP folds back atoms in their output or not. If they do then the msd.f90 you recommended is not accurate. Because the code simply calculate the distance between two position

dRx = Rx(j) - Rx0(j)

dRy = Ry(j) - Ry0(j)

dRz = Rz(j) - Rz0(j)

sum_msd = sum_msd + (dRx**2 + dRy**2 + dRz**2)

One thing is that I tried to create a .axsf file using cppx. And the atoms seem to be not folded back. Can someone confirm me that?

Best Regards,

Nam Tran

________________________________
From: pw_forum-bounces at pwscf.org <pw_forum-bounces at pwscf.org> on behalf of Vahid Askarpour <vh261281 at dal.ca>
Sent: Monday, October 30, 2017 11:00:01 PM
To: PWSCF Forum
Subject: Re: [Pw_forum] How to calculate Mean Square Displacement (MSD)

There is a collection of fortran codes (for VASP mainly but can easily be adapted) for processing simulation output including MSD calculation and the treatment of periodic images. They can be found at https://github.com/boates under the Physics repository (see msd.f90).

Cheers,

Vahid

Department of Physics and Atmospheric Science
Dalhousie University,

On Oct 30, 2017, at 4:29 AM, Nam Tran <vnt981 at uowmail.edu.au<mailto:vnt981 at uowmail.edu.au>> wrote:

Dear QE experts,

I am trying to evaluate MSD for my simulation.
My problem is that when an atom exits the simulation cell.
I do not know whether I should consider the distance with atom that goes about outside the box (a) or its image (b). Please check the image below (Blue is the original position t=0, red is the position at time t)

<Screenshot from 2017-10-30 14-53-57.png>
Best Regards
Nam Tran
_______________________________________________
Pw_forum mailing list
Pw_forum at pwscf.org<mailto:Pw_forum at pwscf.org>
http://pwscf.org/mailman/listinfo/pw_forum

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quantum-espresso.org/pipermail/users/attachments/20171031/bf80e428/attachment.html>
```