分子动力学模拟服务器

基于GROMACS 2025.4的分子动力学模拟服务器,提供TPR文件分析、模拟工作流执行、批量分析等功能,适用于生物分子和化学系统研究。

  • by MacromNex
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 Biomolecular-Design-Nexus/gromacs_mcp

使用说明

GROMACS MCP服务器

通过Docker使用GROMACS 2025.4进行分子动力学模拟

用于GROMACS分子动力学的MCP(模型上下文协议)服务器,具有6个核心工具:

  • 运行GROMACS命令并分析TPR文件
  • 执行预定义的模拟工作流
  • 提交具有异步作业跟踪的长时间运行的MD模拟
  • 批量分析多个分子系统
  • 监控和检索模拟结果
  • 列出可用的GROMACS命令和工作流

Docker快速入门

方法1:从GitHub中提取预构建映像

最快的开始方式。每次发布时,预构建的Docker镜像都会自动发布到GitHub容器注册表。

# Pull the latest image
docker pull ghcr.io/macromnex/gromacs_mcp:latest

# Register with Claude Code (runs as current user to avoid permission issues)
claude mcp add gromacs -- docker run -i --rm --user `id -u`:`id -g` -v `pwd`:`pwd` ghcr.io/macromnex/gromacs_mcp:latest

注: 从项目目录运行。 `pwd` 展开到当前工作目录。

要求:

  • 码头工人
  • 已安装克劳德代码

就是这样!GROMACS MCP服务器现在可以在Claude Code中使用。


方法2:在本地构建Docker镜像

自己构建映像并将其安装到Claude Code中。适用于自定义或离线环境。

# Clone the repository
git clone https://github.com/MacromNex/gromacs_mcp.git
cd gromacs_mcp

# Build the Docker image
docker build -t gromacs_mcp:latest .

# Register with Claude Code (runs as current user to avoid permission issues)
claude mcp add gromacs -- docker run -i --rm --user `id -u`:`id -g` -v `pwd`:`pwd` gromacs_mcp:latest

注: 从项目目录运行。 `pwd` 展开到当前工作目录。

要求:

  • 码头工人
  • 已安装克劳德代码
  • Git(克隆存储库)

关于Docker标志:

  • -i --Claude Code的交互模式
  • --rm --退出后自动移除容器
  • --user `id -u`:`id -g` --以当前用户身份运行容器,因此输出文件归您所有(不是root)
  • -v --装载您的项目目录,以便容器可以访问您的数据

验证安装

添加MCP服务器后,您可以验证它是否正常工作:

# List registered MCP servers
claude mcp list

# You should see 'gromacs' in the output

在Claude Code中,您现在可以使用所有6个GROMACS工具:

  • run_gromacs_command
  • run_gromacs_workflow
  • submit_md_simulation
  • submit_batch_analysis
  • get_job_status
  • get_job_result

后续步骤

  • 详细文件:参见 detail.md 有关以下内容的全面指南:
    • 可用的MCP工具和参数
    • 本地Python环境设置(Docker的替代方案)
    • 示例工作流和用例
    • 配置文件选项
    • GROMACS命令参考

使用示例

注册后,您可以直接在Claude Code中使用GROMACS工具。以下是一些常见的工作流程:

示例1:分析仿真文件

I have a GROMACS TPR file at /path/to/simulation.tpr. Can you use run_gromacs_command with the dump command to analyze what's in the file and show me the simulation parameters?

示例2:运行一个简短的MD模拟

I want to test my GROMACS setup with a short MD run. Can you use submit_md_simulation with the TPR file at /path/to/system.tpr for 1000 steps and save the outputs to /path/to/results/? Monitor the job until it finishes.

示例3:多个系统的批量分析

I have several TPR files in /path/to/simulations/ directory. Can you submit batch analysis using submit_batch_analysis to extract energetics and structural parameters from all of them, saving results to /path/to/analysis/?

故障排除

找不到Docker?

docker --version  # Install Docker if missing

未找到克劳德代码?

# Install Claude Code
npm install -g @anthropic-ai/claude-code

GROMACS在集装箱内不工作?

  • 容器包括预装的GROMACS 2025.4
  • 通过以下方式进行验证: docker run --rm ghcr.io/macromnex/gromacs_mcp:latest gmx --version

许可证

LGPL(GROMACS)