matlab读取NAMD轨迹dcd文件

版权声明: https://blog.csdn.net/qq_36170511/article/details/85318084

* Example usage *

1. alanin.dcd is a DCD file containing 100 frames of a 66 atom trajectory.
xyz will be a 100x198 matrix with each row containing coordinates in the
order [x1 y1 z1 x2 y2 z2 ...]

>> xyz = readdcd('/home/justin/alanin.dcd', 1:66);

2. Same dcd file; now we read only a list of selected atoms.

>>> atomlist = [2 5 9 13];
>>> xyz2 = readdcd('/home/justin/alanin.dcd', atomlist);

The rows of xyz2 will contain coordinates [x2 y2 z2 x5 y5 z5 ...]

3. Writing a DCD: say we modified xyz and want save it in a new DCD file.
We split the coordinates into separate arrays for the x, y, and z coordinates.
The syntax is:

x=xyz(:,1:3:end);
y=xyz(:,2:3:end);
z=xyz(:,3:3:end);
writedcd('alanin_new.dcd', x,y,z);

猜你喜欢

转载自blog.csdn.net/qq_36170511/article/details/85318084
今日推荐