Amber分子动力学作图Frame与Time换算

Frame与Time换算

经过Amber模拟后,再使用CPPTRAJ软件处理坐标轨迹和数据文件并作图后,得到的结果如下所示:
请添加图片描述

但我们为了更直观地展示数据,我们需要将横坐标轴从frame转换为time。

转换原理

i i i f r a m e frame frame的时间 t t t为: t = i × n t w x × d t = i × 10 ( p s ) = i × 0.01 ( n s ) t = i\times ntwx\times dt = i \times 10 (ps) = i \times 0.01 (ns) t=i×ntwx×dt=i×10(ps)=i×0.01(ns)

n t w x ntwx ntwx d t dt dt的值均在md.in中设置。

参数解释:
dt=0.002:积分步长为 2 p s 2 ps 2ps
ntwx=5000:每5000步输出一次轨迹坐标,用于后续的轨迹分析。

原始数据rmsd.dat

#Frame ToFirst
1 0.0000
2 0.9008
3 0.9561
4 1.0030
5 1.0868
6 1.1593
7 1.1733
8 1.2441
9 1.1592
10 1.1371

转换后的数据rmsd_ns.dat

0.010000 0.0000
0.020000 0.9008
0.030000 0.9561
0.040000 1.0030
0.050000 1.0868
0.060000 1.1593
0.070000 1.1733
0.080000 1.2441
0.090000 1.1592
0.100000 1.1371

转换的python代码

# 读取输入文件并处理数据
with open('rmsd.dat', 'r') as input_file:
    lines = input_file.readlines()
# 处理每一行并写入新文件
with open('rms_ns.dat', 'w') as output_file:
    for line in lines:
        # 跳过以'#'开头的标题行
        if line.startswith('#'):
            continue
        # 分割每行的数据
        columns = line.split()
        # 将第一列转换为浮点数并乘以0.01
        first_column = float(columns[0]) * 0.01
        # 保留第二列数据
        second_column = float(columns[1])
        # 写入新文件
        output_file.write(f"{first_column:.6f}    {second_column}\n")

请添加图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值