Plumed分子模拟后分析

news/2024/10/8 22:59:44

技术背景

在前面的几篇博客中,我们分别介绍过Histogram算法的使用、Plumed安装与简单使用。Plumed一般就是两种用法:要么在运行分子动力学模拟的过程中实时的对接,要么就是把分子模拟的相关轨迹保存下来,然后再使用Plumed进行后分析,本文介绍的是后面这种使用方法。

轨迹准备

做后分析,我们要先准备一手轨迹。比如我们做Histogram,那么就需要保留一条CV的轨迹,或者说反应坐标的轨迹。一般为了归一化的需求,我们可能还需要保留反应坐标所对应的单点能,或者称之为Bias偏置势。如下是一条轨迹的示例record_cv_bias.txt,含有100个点:

#! FIELDS time rbias dcomb
0 1.0 0.722307
1 1.0 0.929853
2 1.0 1.046353
3 1.0 0.849326
4 1.0 0.635665
5 1.0 1.133585
6 1.0 1.602735
7 1.0 1.11138
8 1.0 0.815045
9 1.0 0.744088
10 1.0 0.631533
11 1.0 1.006049
12 1.0 0.507855
13 1.0 0.620414
14 1.0 1.43557
15 1.0 0.798832
16 1.0 1.007135
17 1.0 0.684447
18 1.0 1.073844
19 1.0 0.952023
20 1.0 0.754293
21 1.0 0.530406
22 1.0 1.078594
23 1.0 1.325044
24 1.0 1.418314
25 1.0 1.110357
26 1.0 0.964378
27 1.0 0.893131
28 1.0 1.473515
29 1.0 1.103729
30 1.0 1.019812
31 1.0 1.037889
32 1.0 1.092906
33 1.0 0.602312
34 1.0 1.016394
35 1.0 0.845226
36 1.0 1.210281
37 1.0 0.744589
38 1.0 0.666467
39 1.0 1.276913
40 1.0 0.976801
41 1.0 0.92263
42 1.0 1.386575
43 1.0 1.243241
44 1.0 1.442755
45 1.0 1.284636
46 1.0 0.756184
47 1.0 1.162758
48 1.0 1.177665
49 1.0 0.717487
50 1.0 1.193379
51 1.0 0.798996
52 1.0 1.045093
53 1.0 1.489541
54 1.0 1.067574
55 1.0 1.10109
56 1.0 1.135074
57 1.0 1.049557
58 1.0 0.362635
59 1.0 1.030856
60 1.0 1.323538
61 1.0 1.405822
62 1.0 0.935292
63 1.0 0.868032
64 1.0 0.946401
65 1.0 1.468123
66 1.0 1.062565
67 1.0 1.05637
68 1.0 0.962974
69 1.0 1.50403
70 1.0 0.95933
71 1.0 1.218142
72 1.0 1.303102
73 1.0 0.876645
74 1.0 1.188313
75 1.0 1.31572
76 1.0 0.693456
77 1.0 0.54377
78 1.0 1.026873
79 1.0 1.3925
80 1.0 1.317733
81 1.0 0.972162
82 1.0 1.373311
83 1.0 1.244547
84 1.0 1.00565
85 1.0 1.180062
86 1.0 1.221193
87 1.0 1.046702
88 1.0 1.409161
89 1.0 1.132955
90 1.0 0.428334
91 1.0 0.890674
92 1.0 0.63586
93 1.0 0.997099
94 1.0 0.969676
95 1.0 1.280118
96 1.0 1.19793
97 1.0 1.112535
98 1.0 1.388056
99 1.0 0.946911

有了轨迹之后,写一个简单的Plumed配置文件plumed.dat

cv: READ FILE=record_cv_bias.txt VALUES=dcomb IGNORE_TIME
w: READ FILE=record_cv_bias.txt VALUES=rbias IGNORE_TIME
rw: REWEIGHT_BIAS ARG=w TEMP=300
hh: HISTOGRAM ...ARG=cvKERNEL=gaussianGRID_MIN=0.3GRID_MAX=1.65GRID_BIN=50BANDWIDTH=0.05NORMALIZATION=trueLOGWEIGHTS=rw
...
DUMPGRID GRID=hh FILE=histo 

这个文件的逐行释义为:

1. 读取record_cv_bias.txt文件中标签为dcomb的一列,作为cv
2. 读取record_cv_bias.txt文件中标签为rbias的一列,作为w
3. 使用w定义一个归一化的系数rw,对应的温度为300K
4~13. 定义Histogram参数,使用高斯核,区间最小值为0.3,区间最大值为1.65,区间内分50个格子,波包带宽为0.05,使用rw进行归一化
14. 将输出数据保存到名为histo的文件内

运行Plumed

安装好plumed以后,之间在对应文件的目录下运行:

$ plumed driver --plumed plumed.dat --noatoms
PLUMED: PLUMED is starting
PLUMED: Version: 2.7.1 (git: Unknown) compiled on Jul 12 2021 at 09:24:30
PLUMED: Please cite these papers when using PLUMED [1][2]
PLUMED: For further information see the PLUMED web page at http://www.plumed.org
PLUMED: Root: /usr/local/lib/plumed
PLUMED: For installed feature, see /usr/local/lib/plumed/src/config/config.txt
PLUMED: Molecular dynamics engine: driver
PLUMED: Precision of reals: 8
PLUMED: Running over 1 node
PLUMED: Number of threads: 1
PLUMED: Cache line size: 512
PLUMED: Number of atoms: 0
PLUMED: File suffix: 
PLUMED: FILE: plumed.dat
PLUMED: Action READ
PLUMED:   with label cv
PLUMED:   with stride 1
PLUMED:   reading data from file record_cv_bias.txt
PLUMED:   reading value dcomb and storing as cv
PLUMED: Action READ
PLUMED:   with label w
PLUMED:   with stride 1
PLUMED:   reading data from file record_cv_bias.txt
PLUMED:   reading value rbias and storing as w
PLUMED: Action REWEIGHT_BIAS
PLUMED:   with label rw
PLUMED:   with arguments w
PLUMED: Action HISTOGRAM
PLUMED:   with label hh
PLUMED:   with stride 1
PLUMED:   with arguments cv
PLUMED:   reweighting using weights from rw 
PLUMED:   grid of 51 equally spaced points between (0.3) and (1.65)
PLUMED: Action DUMPGRID
PLUMED:   with label @4
PLUMED:   with stride 0
PLUMED:   outputting grid calculated by action hh to file named histo with format %f 
PLUMED:   outputting data for replicas 0 END FILE: plumed.dat
PLUMED: Timestep: 1.000000
PLUMED: KbT has not been set by the MD engine
PLUMED: It should be set by hand where needed
PLUMED: Relevant bibliography:
PLUMED:   [1] The PLUMED consortium, Nat. Methods 16, 670 (2019)
PLUMED:   [2] Tribello, Bonomi, Branduardi, Camilloni, and Bussi, Comput. Phys. Commun. 185, 604 (2014)
PLUMED: Please read and cite where appropriate!
PLUMED: Finished setup
PLUMED:                                               Cycles        Total      Average      Minimum      Maximum
PLUMED:                                                    1     0.007538     0.007538     0.007538     0.007538
PLUMED: 1 Prepare dependencies                            99     0.000267     0.000003     0.000002     0.000008
PLUMED: 2 Sharing data                                    99     0.000007     0.000000     0.000000     0.000000
PLUMED: 3 Waiting for data                                99     0.000010     0.000000     0.000000     0.000000
PLUMED: 4 Calculating (forward loop)                      99     0.001478     0.000015     0.000014     0.000057
PLUMED: 5 Applying (backward loop)                        99     0.000130     0.000001     0.000001     0.000003
PLUMED: 6 Update                                          99     0.003019     0.000030     0.000014     0.000093

运行完成后,如果没有报错,会在当前目录下生成一个histo文件,内容为:

#! FIELDS cv hh dhh_cv
#! SET normalisation  146.331611
#! SET min_cv 0.3
#! SET max_cv 1.65
#! SET nbins_cv  50
#! SET periodic_cv false0.300000 0.040185 1.0870320.327000 0.073737 1.3336740.354000 0.108112 1.1387880.381000 0.132720 0.6735290.408000 0.146143 0.3874850.435000 0.158725 0.6476240.462000 0.185775 1.3998490.489000 0.233253 2.0348140.516000 0.290241 2.1099990.543000 0.347304 2.2003850.570000 0.415370 2.9312290.597000 0.504292 3.5031450.624000 0.592054 2.7633090.651000 0.645747 1.2086070.678000 0.663637 0.2973210.705000 0.670123 0.2686240.732000 0.677724 0.2335520.759000 0.679871 -0.0771800.786000 0.677381 0.0207350.813000 0.688778 0.9564080.840000 0.733653 2.4319840.867000 0.822586 4.2094990.894000 0.963284 6.2302390.921000 1.155414 7.8412430.948000 1.373556 8.0561590.975000 1.575612 6.6910821.002000 1.725112 4.2272841.029000 1.795526 0.8564521.056000 1.767797 -2.8711051.083000 1.648824 -5.6509001.110000 1.480563 -6.4429011.137000 1.318483 -5.3097151.164000 1.198476 -3.6003761.191000 1.115220 -2.7448031.218000 1.043134 -2.6007411.245000 0.977289 -2.1557491.272000 0.928752 -1.4431361.299000 0.894999 -1.1099551.326000 0.868484 -0.7434081.353000 0.859332 0.1204171.380000 0.869809 0.4448831.407000 0.867177 -0.9066271.434000 0.811246 -3.2577111.461000 0.694147 -5.2745891.488000 0.536089 -6.2156851.515000 0.370839 -5.7471501.542000 0.236681 -4.0402891.569000 0.154469 -2.1280901.596000 0.112702 -1.1424701.623000 0.083908 -1.0713801.650000 0.053970 -1.101246

这个结果的三列数据分别为:cv值、密度值和标准差,对于我们而言,主要关注下前两列的结果即可,可以写一个Python脚本做一下简单的可视化:

import numpy as np
with open('histo', 'r') as hfile:hlines = hfile.readlines()
hcv = []
hbar = []
for hline in hlines[6:]:hcv.append(float(hline.strip().split()[0]))hbar.append(float(hline.strip().split()[1]))
hcv = np.array(hcv)
hbar = np.array(hbar)
from matplotlib import pyplot as plt
plt.figure()
plt.plot(hcv, hbar, color='black')
plt.show()

输出结果为:

总结概要

Plumed是一个强大的分子模拟数据处理工具,可以在模拟的过程中逐步分析,也可以保存模拟的轨迹做后分析。本文紧接前面的“增强采样软件PLUMED的安装与使用”文章,还有“直方图与核密度估计”文章。介绍了如何使用Plumed后分析工具,对输出的反应坐标的轨迹进行核密度估计。

版权声明

本文首发链接为:https://www.cnblogs.com/dechinphy/p/plumed-post.html

作者ID:DechinPhy

更多原著文章:https://www.cnblogs.com/dechinphy/

请博主喝咖啡:https://www.cnblogs.com/dechinphy/gallery/image/379634.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.ryyt.cn/news/28035.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈,一经查实,立即删除!

相关文章

动手学深度学习——卷积操作

卷积 卷积概念卷积原属于信号处理中的一种运算,引入CNN中,作为从输入中提取特征的基本操作 补零:在输入端外侧填补0值使得卷积输出结果满足某种大小,在外侧的每一边都添加0值,使得输出可以达到某种预定形状 跨步:卷积核在输入上滑动时每次移动到下一步的距离使用张量实现…

MyBatis-Plus 分页查询配置

说明一下 ,使用MyBatis-Plus 进行分页查询时 ,要先进行配置添加配置 /*** @Author North* @Date 2024/5/6*/ @Configuration public class MPConfig {@Beanpublic MybatisPlusInterceptor mybatisPlusInterceptor() {MybatisPlusInterceptor mybatisPlusInterceptor = new My…

VS打包项目成.exe.msi

VS打包项目成.exe&.msi ref:https://blog.csdn.net/weixin_44790046/article/details/103016154准备工作VS 2022(VS2017无法安装Installer Projects扩展,未知原因) Installer Projects (扩展 > 管理扩展 > 联机 > 搜索 > Microsoft Visual Studio Installe…

Spring学习之——Bean加载流程

Spring IOC容器就像是一个生产产品的流水线上的机器,Spring创建出来的Bean就好像是流水线的终点生产出来的一个个精美绝伦的产品。既然是机器,总要先启动,Spring也不例外。因此Bean的加载流程总体上来说可以分为两个阶段:容器启动阶段 Bean创建阶段一、容器启动阶段: 容器…

阿里实习生:面试阿里其实并没有那么难。

Go语言中的数据结构并发安全特性、单例模式实现及sync.map底层原理解析。分享一位同学在阿里的Go后端实习面经详解, 希望对你有帮助。愉快的五一假期已经结束了, 又要投入到学习和工作当中了。 今天分享一位同学在阿里的Go后端实习面经详解, 希望对你有帮助。Go里有哪些数据结构…

Mac 安装 RabbitMQ

一般来说,安装分为两种方式:通过 brew 命令安装。在这里,推荐使用 brew 来安装,非常强大的 Mac 端包管理工具。 下载 RabbitMQ 源文件,解压源文件之后进行安装。 Docker启动一、brew 命令安装Mac安装 RabbitMQ 1、安装 erlang brew install erlang2、安装 rabbitmq brew i…

Deepin-Docker-Memcached

目标:基于deepin+docker安装 memchaed 1.镜像下载 docker pull memcached:latest 2.容器启动 docker run -d -p 11211:11211 --name memcached-test memcached:latest 3.启动检查4.启动Ok

多区域协作时 如何实现便捷可控的文件跨域传输?

文件跨域传输的场景在现代企业运营中非常普遍,特别是在那些具有分布式结构或需要跨地域合作的组织中。 以下是一些典型的多区域文件传输场景: 1、企业内部跨地域传输:大型企业或跨国公司在不同地区设有分支机构,需要在这些分支机构之间传输业务数据和公司文件。 2、供应链…