
PLUMED2
STDIOMCP server for generating, validating, and optimizing PLUMED molecular dynamics simulation input files
MCP server for generating, validating, and optimizing PLUMED molecular dynamics simulation input files
The PLUMED2 MCP Server is a Model Context Protocol (MCP) server that provides AI assistants with powerful tools for generating, validating, and optimizing PLUMED input files for molecular dynamics simulations. This server enables seamless integration of PLUMED expertise into AI workflows.
cd plumed_mcp_server pip install -r requirements.txt
Add the following configuration to your MCP client settings (e.g., Claude Desktop, Cline, etc.):
{ "mcpServers": { "plumed2": { "command": "python", "args": [ "-m", "plumed_mcp_server.main" ], "cwd": "/path/to/plumed_mcp_server", "alwaysAllow": [ "generate_plumed_input", "validate_plumed_syntax", "optimize_plumed_performance", "get_plumed_template" ] } } }
Note: Replace /path/to/plumed_mcp_server
with the actual path to your installation directory.
generate_plumed_input
Generate complete PLUMED input files based on simulation requirements.
Parameters:
collective_variables
(required): List of collective variables to computebias_methods
(optional): List of bias methods to applyoutput_config
(optional): Output configuration settingssystem_info
(optional): System information for optimizationmolinfo_config
(optional): Molecular information settingsgroup_definitions
(optional): Custom group definitionsvalidate_plumed_syntax
Validate PLUMED input syntax and check for common errors.
Parameters:
plumed_input
(required): PLUMED input content to validatenumber_of_replicas
(optional): Number of replicas for @replicas syntax validationoptimize_plumed_performance
Get performance optimization suggestions for PLUMED simulations.
Parameters:
plumed_input
(required): PLUMED input content to analyzesystem_info
(optional): System information (number of atoms, simulation length, etc.)get_plumed_template
Retrieve pre-defined or custom PLUMED templates.
Parameters:
template_name
(required): Name of the template to retrievesystem_type
(optional): Type of system for template customizationPrompt to AI:
Generate a PLUMED input file for metadynamics simulation of a protein. I want to use the distance between atoms 1 and 2 as a collective variable, with metadynamics bias. Include output every 100 steps.
Expected AI Response:
The AI will use the generate_plumed_input
tool with parameters like:
{ "collective_variables": [ { "type": "DISTANCE", "label": "d1", "atoms": [1, 2] } ], "bias_methods": [ { "type": "METAD", "arg": "d1", "sigma": 0.1, "height": 1.0, "pace": 500 } ], "output_config": { "stride": 100, "file": "colvar.dat" } }
Generated Output:
# PLUMED input file generated by PLUMED2 MCP Server
# Collective Variables
d1: DISTANCE ATOMS=1,2
# Bias Methods
METAD ARG=d1 SIGMA=0.1 HEIGHT=1.0 PACE=500
# Output
PRINT ARG=d1 STRIDE=100 FILE=colvar.dat
Prompt to AI:
Please validate this PLUMED input:
d: DISTANCE ATOMS=1,2
METAD ARG=d SIGMA=0.1 HEIGHT=1.0 PACE=500
PRINT ARG=d STRIDE=100 FILE=colvar.dat
Expected AI Response:
The AI will use the validate_plumed_syntax
tool and report validation results, including any syntax errors, warnings, or suggestions.
Prompt to AI:
Optimize this PLUMED input for a large system with 100,000 atoms:
[PLUMED input content]
Expected AI Response:
The AI will use the optimize_plumed_performance
tool and provide specific suggestions like using neighbor lists, adjusting stride values, or optimizing collective variable calculations.
Prompt to AI:
Give me a PLUMED template for protein folding studies.
Expected AI Response:
The AI will use the get_plumed_template
tool with template_name: "protein_folding"
and return a complete template with common collective variables and bias methods for protein folding simulations.
Run the test suite to verify installation:
cd plumed_mcp_server python -m pytest tests/ -v
All 33 tests should pass (100% success rate).
The server is built using the FastMCP framework and follows modular design principles:
tools/
: MCP tool implementationslogic/
: Core business logic modulesresources/
: MCP resource providerstests/
: Comprehensive test suiteContributions are welcome! Please ensure all tests pass and follow the existing code style.
This project is open source. Please check the license file for details.
PLUMED2 MCP 服务器是一个模型上下文协议(MCP)服务器,为AI助手提供强大的工具来生成、验证和优化分子动力学模拟的PLUMED输入文件。该服务器能够将PLUMED专业知识无缝集成到AI工作流程中。
cd plumed_mcp_server pip install -r requirements.txt
将以下配置添加到您的MCP客户端设置中(如Claude Desktop、Cline等):
{ "mcpServers": { "plumed2": { "command": "python", "args": [ "-m", "plumed_mcp_server.main" ], "cwd": "/path/to/plumed_mcp_server", "alwaysAllow": [ "generate_plumed_input", "validate_plumed_syntax", "optimize_plumed_performance", "get_plumed_template" ] } } }
注意: 请将 /path/to/plumed_mcp_server
替换为您的实际安装目录路径。
generate_plumed_input
根据模拟需求生成完整的PLUMED输入文件。
参数:
collective_variables
(必需): 要计算的集体变量列表bias_methods
(可选): 要应用的偏置方法列表output_config
(可选): 输出配置设置system_info
(可选): 用于优化的系统信息molinfo_config
(可选): 分子信息设置group_definitions
(可选): 自定义组定义validate_plumed_syntax
验证PLUMED输入语法并检查常见错误。
参数:
plumed_input
(必需): 要验证的PLUMED输入内容number_of_replicas
(可选): 用于@replicas语法验证的副本数量optimize_plumed_performance
获取PLUMED模拟的性能优化建议。
参数:
plumed_input
(必需): 要分析的PLUMED输入内容system_info
(可选): 系统信息(原子数、模拟长度等)get_plumed_template
检索预定义或自定义的PLUMED模板。
参数:
template_name
(必需): 要检索的模板名称system_type
(可选): 用于模板定制的系统类型AI提示词:
为蛋白质的元动力学模拟生成一个PLUMED输入文件。我想使用原子1和2之间的距离作为集体变量,应用元动力学偏置。每100步输出一次。
预期AI响应:
AI将使用 generate_plumed_input
工具,参数如下:
{ "collective_variables": [ { "type": "DISTANCE", "label": "d1", "atoms": [1, 2] } ], "bias_methods": [ { "type": "METAD", "arg": "d1", "sigma": 0.1, "height": 1.0, "pace": 500 } ], "output_config": { "stride": 100, "file": "colvar.dat" } }
生成的输出:
# PLUMED input file generated by PLUMED2 MCP Server
# Collective Variables
d1: DISTANCE ATOMS=1,2
# Bias Methods
METAD ARG=d1 SIGMA=0.1 HEIGHT=1.0 PACE=500
# Output
PRINT ARG=d1 STRIDE=100 FILE=colvar.dat
AI提示词:
请验证这个PLUMED输入:
d: DISTANCE ATOMS=1,2
METAD ARG=d SIGMA=0.1 HEIGHT=1.0 PACE=500
PRINT ARG=d STRIDE=100 FILE=colvar.dat
预期AI响应:
AI将使用 validate_plumed_syntax
工具并报告验证结果,包括任何语法错误、警告或建议。
AI提示词:
为包含100,000个原子的大型系统优化这个PLUMED输入:
[PLUMED输入内容]
预期AI响应:
AI将使用 optimize_plumed_performance
工具并提供具体建议,如使用邻居列表、调整步长值或优化集体变量计算。
AI提示词:
给我一个用于蛋白质折叠研究的PLUMED模板。
预期AI响应:
AI将使用 get_plumed_template
工具,参数为 template_name: "protein_folding"
,并返回包含蛋白质折叠模拟常用集体变量和偏置方法的完整模板。
运行测试套件以验证安装:
cd plumed_mcp_server python -m pytest tests/ -v
所有33个测试都应该通过(100%成功率)。
该服务器使用FastMCP框架构建,遵循模块化设计原则:
tools/
: MCP工具实现logic/
: 核心业务逻辑模块resources/
: MCP资源提供者tests/
: 综合测试套件欢迎贡献!请确保所有测试通过并遵循现有的代码风格。
本项目为开源项目。请查看许可证文件了解详情。