1.python script:
import numpy
def modify(frame, data):
# Access the per-particle displacement magnitudes computed by the
# 'Displacement Vectors' modifier preceding this user-defined modifier in the
# data pipeline:
displacement_magnitudes = data.particles['Displacement Magnitude']
# Compute MSD:
msd = numpy.sum(displacement_magnitudes ** 2) / len(displacement_magnitudes)
# Output value as a global attribute to make it available within OVITO:
data.attributes["MSD"] = msd
2.ovito中的操作
(1)打开unwrap trajectories ,目的是不考虑周期性原子,计算会才会准。
(2)打开以下的功能,运行后,再选择“File”——“export file”,导出数据。