OpenMM MCP服务器
______________________________________________________________________
🧬 OpenMM和Abacus MCP服务器
使用Abacus的OpenMM和DFT计算进行分子动力学模拟的综合模型上下文协议(MCP)服务器。该服务器通过LLM集成为复杂的分子模拟提供了一个自然语言接口。
✨ 特性
- 完整的OpenMM集成:支持所有OpenMM功能,包括高级积分器、气压计和约束
- DFT计算:量子力学计算的Abacus DFT引擎集成
- 预配置模板:用于蛋白质模拟、膜系统等的即用型设置
- 高级采样:元动力学、自由能计算和增强采样方法
- GPU加速:CUDA和OpenCL平台支持高性能计算
- 任务管理:具有持久性和监控功能的异步任务执行
- 自然语言接口:使用简单的英文命令与复杂的模拟进行交互
🚀 快速开始
安装
# Clone the repository
git clone
cd openmm-mcp-server
# Install dependencies
pip install -r requirements.txt
# Optional: Install OpenMM for actual simulations
conda install -c conda-forge openmm
# Test installation
python test_mcp_server.pyRoo代码集成
添加到您的Code/Cline/Claude MCP设置中:
{
"mcpServers": {
"openmm-server": {
"command": "python",
"args": ["run_openmm_server.py"],
"cwd": "path-to\\openmm-mcp-server",
"alwaysAllow": [
"create_md_simulation",
"create_advanced_md_simulation",
"setup_protein_simulation",
"setup_membrane_simulation",
"create_dft_calculation",
"control_simulation",
"get_task_status",
"list_all_tasks",
"analyze_results"
]
}
}
}重要:将路径替换为实际项目路径!
🛠️ 可用工具
基本工具
create_md_simulation-创建简单的MD模拟create_dft_calculation-创建DFT计算control_simulation-控制模拟执行(启动/停止/暂停)get_task_status-检查任务状态list_all_tasks-列出所有任务analyze_results-分析仿真结果
高级工具
create_advanced_md_simulation-完整的OpenMM功能支持(50+参数)setup_protein_simulation-预配置的蛋白质模拟模板setup_membrane_simulation-膜蛋白模拟装置
💬 使用示例
简单的水模拟
"Run a molecular dynamics simulation of a water molecule at 300K for 10000 steps"高级蛋白质模拟
"Set up a protein production simulation for 100 nanoseconds at physiological temperature 310K, using Amber19 force field with TIP3P-FB water model, 0.15M salt concentration, and GPU acceleration"膜蛋白模拟
"Create a POPC membrane protein simulation for 50 nanoseconds with surface tension control"📊 OpenMM参数参考
积分器
LangevinMiddle-朗之万中间积分器(推荐)Verlet-Verlet积分器(NVE集成)Brownian-布朗动力学VariableLangevin-可变步长朗之万VariableVerlet-可变步长VerletNoseHoover-鼻胡佛恒温器
力场
- Amber14:
["amber14-all.xml", "amber14/tip3pfb.xml"] - Amber19:
["amber19-all.xml", "amber19/tip3pfb.xml"] - 字符36:
["charmm36_2024.xml", "charmm36/water.xml"]
水模型
tip3p-TIP3P水模型tip3pfb-TIP3P-FB水模型(推荐)tip4pew-TIP4P Ew水模型spce-SPC/E水模型
平台
CUDA- NVIDIA GPU(最固定)OpenCL-通用GPUCPU-CPU计算Reference-参考实施
非粘结方法
PME-粒子网格埃瓦尔德(推荐用于周期系统)NoCutoff-无截断(小型系统)CutoffNonPeriodic-非周期性截止CutoffPeriodic-定期截止Ewald-传统埃瓦尔德总结
约束条件
None-无约束HBonds-氢键约束(推荐)AllBonds-所有债券约束HAngles-氢角约束
Barostats
MonteCarloBarostat-各向同性压力控制MonteCarloAnisotropicBarostat-各向异性压力控制MonteCarloMembraneBarostat-膜系统压力控制
精确度
mixed-混合精度(推荐)single-单精度double-双精度
🔧 配置
环境变量:
export TASK_DATA_DIR="./simulation_data"
export MAX_CONCURRENT_TASKS=4
export DEFAULT_OPENMM_PLATFORM="CUDA"
export LOG_LEVEL="INFO"
export LOG_FILE="./mcp_server.log"📁 项目结构
openmm-mcp-server/
├── run_openmm_server.py # Startup script
├── test_mcp_server.py # Test script
├── requirements.txt # Dependencies
├── README.md # English documentation
├── README_CN.md # Chinese documentation
├── src/
│ ├── server_new.py # Main server
│ ├── advanced_md_tools.py # Advanced MD tools
│ ├── task_manager.py # Task management
│ ├── openmm_engine.py # OpenMM engine
│ ├── abacus_engine.py # Abacus DFT engine
│ ├── config.py # Configuration management
│ ├── tools/ # MCP tool implementations
│ ├── resources/ # MCP resource implementations
│ └── utils/ # Utility functions
├── tests/ # Test files
├── examples/ # Example code
├── docs/ # Documentation
└── task_data/ # Task data directory (auto-created)📚 其他文件
🔍 故障排除
常见问题
- “找不到OpenMM”警告
- 这是正常的,服务器将以模拟模式运行 - 对于实际模拟,请安装OpenMM: conda install -c conda-forge openmm
- “找不到命令”错误
- 检查Python是否在PATH中 - 验证项目路径是否正确 - 尝试使用绝对路径
- 权限错误
- 确保项目目录的读/写权限 - 检查task_data目录是否可写
验证配置
# Test server startup
python run_openmm_server.py
# Test MCP functionality
python test_mcp_server.py🤝 贡献
- 分叉存储库
- 创建要素分支
- 进行更改
- 添加测试
- 提交拉取请求
🆘 支持
如果您遇到任何问题:
- 运行测试脚本:
python test_mcp_server.py - 审查文件
- 检查日志文件(如果已配置)
- 在GitHub上提交问题
📄 许可证
此项目根据GNU通用公共许可证v3.0获得许可。
______________________________________________________________________
快乐模拟! 🎉
