序
前面几篇介绍了ACEMD的安装、入门使用以及可视化,本文将综合前面的内容,实战一个小的分子动力学项目。
Projections in HTMD
#!/usr/bin/python3
# coding: utf-8
# In[1]:导入模块,开启可视化
from htmd.ui import *
config(viewer='webgl')
%pylab inline
# In[2]:交互式可视化轨迹
mol = Molecule('ntl9_structure.pdb')
mol.read('ntl9_trajectory.xtc')
mol.filter('protein')
mol.view()
# In[3]:可视化PDB
crystal = Molecule('ntl9_crystal.pdb')
crystal.view()
# In[4]:计算rmsd,并绘图
metr = MetricRmsd(crystal, 'protein and name CA')
proj = metr.project(mol)
plt.plot(mol.fstep*np.arange(len(proj)), proj)
_ = plt.xlabel('Time (ns)')
_ = plt.ylabel('RMSD to crystal')
# In[5]:获取项目的simlist
sims = simlist(glob('datasets/1/filtered/*/'), 'datasets/1/filtered/filtered.pdb')
metr = Metric(sims)
metr.set(MetricDistance('protein and name CA', 'resname MOL and noh', metric='contacts'))
data = metr.project()
data.fstep = 0.1
# In[6]:Working with data maps
print(data.dat[14].shape)
# In[7]:获取map头部数据
# In[8]:建立mapping,获取其头部数据
mapping = MetricSelfDistance('protein and name CA').getMapping(mol)
mapping.head()
# In[9]:索引pandas数据框
# In[10]:使用数据框索引
# In[11]:获取map特定位置数据
data.map['description'][20]
参考资料
https://software.acellera.com/docs/latest/htmd/tutorials/projections.html
http://gainstrong.net/works/hudong/
https://software.acellera.com/docs/latest/htmd/tutorials/htmd-molecules.html
https://software.acellera.com/docs/latest/htmd/tutorials/visualization.html
领取专属 10元无门槛券
私享最新 技术干货