当前位置: 首页 > news >正文

OpenMM 8 安装与上手指南

OpenMM 8简介

OpenMM 支持多种主流力场(如 AMBER、CHARMM、OPLS-AA 等),并可通过 Python 脚本方便地定义体系、设定模拟参数、执行能量最小化与分子动力学计算。它同时提供可定制的积分器(Integrator)力场插件(Force Plugins),允许研究人员轻松实现新算法或自定义势能函数。

OpenMM 8 在前一版本的基础上进行了显著优化:

  • 增强了 CUDA、OpenCL 与 ROCm 的 GPU 后端性能;

  • 引入了 新的分子约束与虚拟位点算法,提升了大型体系的稳定性与能量守恒;

  • 改进了 序列化(serialization)与插件加载机制,简化了跨平台部署;

  • 提供了与 OpenMMTools、MDTraj、ParmEd、PyTorch 等生态系统的更紧密集成,使其能无缝结合深度学习或自由能计算框架。

此外,OpenMM 可直接读取 PDB、AMBER、GROMACS 等常用分子拓扑文件,并可输出标准的 DCD、PDB、XTC 等轨迹格式,方便后续可视化与分析。结合 Jupyter Notebook 或 Python 环境,研究人员能够快速构建、运行并分析从纳米到微秒级的分子动力学模拟。

凭借其开源、跨平台、高性能的特性,OpenMM 已成为分子模拟领域中广受欢迎的核心计算引擎之一,既适用于基础教学与研究,也能支撑高水平的并行化计算与深度学习驱动的分子建模研究。

OpenMM 8 安装

  • Python 3.12
  • CUDA 12
  • OpenMM 8.2.0

安装

conda create -n openmm8.2
conda activate openmm8.2
conda install -c conda-forge pdbfixer
conda install -c conda-forge openmm cuda-version=12

测试安装

python -m openmm.testInstallation

OpenMM 8 上手指南

from openmm.app import *
from openmm import *
from openmm.unit import *
import mdtraj as md
import numpy as np
import matplotlib.pyplot as plt
import sys
import os
import pandas as pd# Load the PDB structure file
pdb = PDBFile('data/1bna.pdb')# Define the force field (AMBER14 for protein + TIP3P for water)
forcefield = ForceField('amber14-all.xml', 'amber14/tip3p.xml')# Create a modeller and add hydrogens and solvent box
modeller = Modeller(pdb.topology, pdb.positions)
modeller.addHydrogens(forcefield)
modeller.addSolvent(forcefield, model='tip3p', boxSize=Vec3(8, 8, 8)*nanometers, ionicStrength=0.1*molar)# Create the system using Particle Mesh Ewald (PME) for electrostatics,
# constrain all hydrogen bonds, and apply a 1.0 nm cutoff
system = forcefield.createSystem(modeller.topology, nonbondedMethod=PME, constraints=HBonds, nonbondedCutoff=1.0*nanometer)# Define thermodynamic parameters and integrator
temperature = 300*kelvin
pressure = 1*atmosphere
timestep = 2*femtoseconds
integrator = LangevinIntegrator(temperature, 1/picosecond, timestep)# Add a barostat to maintain constant pressure (NPT ensemble)
barostat = MonteCarloBarostat(pressure, temperature)
system.addForce(barostat)# Create the simulation object
simulation = Simulation(modeller.topology, system, integrator)
simulation.context.setPositions(modeller.positions)# --- Energy minimization ---
print("Minimizing energy...")
simulation.minimizeEnergy()# --- Equilibration phase ---
print("Equilibrating the system...")
simulation.context.setVelocitiesToTemperature(temperature)
simulation.step(1000)  # 1000 steps for equilibration# --- Production run ---
print("Running production simulation...")
simulation.reporters.append(StateDataReporter('data/output.log', 1000, step=True, potentialEnergy=True,temperature=True, density=True))
simulation.reporters.append(PDBReporter('data/trajectory.pdb', 1000))
simulation.step(5000)  # Production run: 5000 steps (adjust as needed)# --- Analyze potential energy ---
file_path = 'data/output.log'
column_names = ["Step", "Potential Energy (kJ/mole)", "Temperature (K)", "Density (g/mL)"]# Load the log file as a CSV
data = pd.read_csv(file_path, skiprows=1, names=column_names)# Extract Step and Potential Energy columns
steps = data["Step"]
potential_energy = data["Potential Energy (kJ/mole)"]# Plot potential energy vs step
plt.figure(figsize=(10, 6))
plt.plot(steps, potential_energy, marker='o', linestyle='-', color='b', label='Potential Energy')
plt.title('Potential Energy vs. Step', fontsize=16)
plt.xlabel('Step', fontsize=14)
plt.ylabel('Potential Energy (kJ/mole)', fontsize=14)
plt.grid(True, linestyle='--', alpha=0.6)
plt.legend(fontsize=12)
plt.tight_layout()# Show the plot
plt.show()

参考资料

  • https://openmm.org/
  • https://github.com/openmm/openmm
  • https://anaconda.org/conda-forge/pdbfixer
  • https://anaconda.org/conda-forge/openmm
  • Eastman, Peter, Raimondas Galvelis, Raúl P. Peláez, Charlles RA Abreu, Stephen E. Farr, Emilio Gallicchio, Anton Gorenko et al. "OpenMM 8: molecular dynamics simulation with machine learning potentials." The Journal of Physical Chemistry B 128, no. 1 (2023): 109-116.

http://www.dtcms.com/a/470569.html

相关文章:

  • 网站建设跟网站开发有什么区别吗832网络销售平台
  • 力扣热题100道49字母异位词分组
  • sql优化进阶
  • 网站灰色建设网销怎么找客户资源
  • 库易网网站郑州网站关键词优化公司
  • n8n Code节点模式选择指南:Run Once for All Items与Run Once for Each Item
  • 河南怎样做网站推广怎样设置自己的网站
  • 手写MyBatis第102弹:MapperBuilder与MapperAnnotationBuilder的双重解析机制深度剖析
  • Java知识点储备
  • C++ : AVL 树之 左右双旋(第三章)
  • 查询类网站开发建设网站公司怎么收费
  • 电影发布网站模板WordPress云虚拟空间
  • Android获取外部存储目录
  • AUTOSAR模块架构
  • 简单易做的网站一级域名二级域名区别
  • 一个可计算宇宙模型:热力学规则驱动量子化弹性两层底空间演化的可编程物理模拟自动机设计-从量子过程到数值相对论模拟
  • 编程语言的选择策略:从C语言的OOP到AI与GUI开发的全方位对比
  • 网站 案例展示泗洪做网站公司
  • 做竞拍网站合法吗有谁认识做微网站的
  • 运行smolvlm解析视频
  • 【力扣】hot100系列(三)链表(一)(图示+多解法+时间复杂度分析)
  • 【Linux】linux基础指令入门(1)
  • 广东网站制作公司校园网站建设结论
  • 广州商城型网站福州核酸检测最新通知
  • 关于 旁注
  • mysql数据库介绍
  • Java程序设计
  • JavaScript从入门到实战 (1):JS 入门第一步:它是什么?能做什么?环境怎么搭?
  • Shell 中 $@ 与 $* 的核心区别:双引号包裹下的关键差异解析
  • 重庆网站seo网站外链购买平台