packmol

This skill should be used when the user asks to "create a packmol input", "pack molecules with packmol", "solvate a protein", "build an initial configuration", "setup molecular dynamics", or discusses molecular packing, solvation, or building simulation starting structures.

242 stars

Best use case

packmol is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. This skill should be used when the user asks to "create a packmol input", "pack molecules with packmol", "solvate a protein", "build an initial configuration", "setup molecular dynamics", or discusses molecular packing, solvation, or building simulation starting structures.

This skill should be used when the user asks to "create a packmol input", "pack molecules with packmol", "solvate a protein", "build an initial configuration", "setup molecular dynamics", or discusses molecular packing, solvation, or building simulation starting structures.

Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.

Practical example

Example input

Use the "packmol" skill to help with this workflow task. Context: This skill should be used when the user asks to "create a packmol input", "pack molecules with packmol", "solvate a protein", "build an initial configuration", "setup molecular dynamics", or discusses molecular packing, solvation, or building simulation starting structures.

Example output

A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.

When to use this skill

  • Use this skill when you want a reusable workflow rather than writing the same prompt again and again.

When not to use this skill

  • Do not use this when you only need a one-off answer and do not need a reusable workflow.
  • Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/packmol/SKILL.md --create-dirs "https://raw.githubusercontent.com/aiskillstore/marketplace/main/skills/chenghao-wu/packmol/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/packmol/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How packmol Compares

Feature / AgentpackmolStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

This skill should be used when the user asks to "create a packmol input", "pack molecules with packmol", "solvate a protein", "build an initial configuration", "setup molecular dynamics", or discusses molecular packing, solvation, or building simulation starting structures.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Packmol Skill

Build initial configurations for molecular dynamics simulations using Packmol.

## What is Packmol?

Packmol creates initial configurations for MD simulations by packing molecules according to spatial constraints. It places molecules in boxes, around proteins, at interfaces, or within complex geometries (spheres, cylinders, ellipsoids) while ensuring no overlaps.

## Installation

Install Packmol via pip:

```bash
pip install packmol
```

Verify installation:

```bash
packmol -h
```

For more installation options, see the [Packmol website](https://m3g.github.io/packmol/).

## Quick Start

### Basic Box Packing

Create a simple box of water molecules:

```text
# water_box.inp
tolerance 2.0
filetype pdb
output water_box.pdb

structure water.pdb
  number 1000
  inside box 0. 0. 0. 40. 40. 40.
end structure
```

Run Packmol:

```bash
packmol < water_box.inp
```

### Solvate a Protein

Solvate a protein with water and ions:

```text
# solvation.inp
tolerance 2.0
filetype pdb
output solvated.pdb

structure protein.pdb
  number 1
  fixed 0. 0. 0. 0. 0. 0.
  center
end structure

structure water.pdb
  number 5000
  inside box -10. -10. -10. 50. 50. 50.
end structure

structure SOD.pdb
  number 10
  inside box -10. -10. -10. 50. 50. 50.
end structure

structure CLA.pdb
  number 10
  inside box -10. -10. -10. 50. 50. 50.
end structure
```

### Liquid-Liquid Interface

Build a water/chloroform interface:

```text
# interface.inp
tolerance 2.0
filetype pdb
output interface.pdb
pbc -20. -20. -30. 20. 20. 30.

structure water.pdb
  number 1000
  below plane 0. 0. 1. 0.
end structure

structure chloroform.pdb
  number 200
  above plane 0. 0. 1. 0.
end structure
```

## Core Concepts

### Input File Structure

Every Packmol input file requires:

1. **tolerance**: Minimum distance between atoms (Å)
2. **output**: Output filename
3. **filetype**: Format (pdb, xyz, tinker)
4. **structure blocks**: Define molecules to place

### Structure Block Syntax

```text
structure molecule.pdb
  number <N>                          # Number of molecules
  inside|outside <constraint>         # Spatial constraint
  [optional parameters]
end structure
```

### Common Constraint Types

- **box**: `inside box xmin ymin zmin xmax ymax zmax`
- **sphere**: `inside sphere xcenter ycenter zcenter radius`
- **cylinder**: `inside cylinder x1 y1 z1 dx dy dz radius length`
- **plane**: `above plane a b c d` or `below plane a b c d`
- **ellipsoid**: `inside ellipsoid xc yc zc xa yb zc scale`

See [references/constraints.md](references/constraints.md) for complete constraint documentation.

## Workflows

### 1. Basic Molecular Packing

Build boxes with multiple molecule types.

**Example**: Water/ethanol mixture

```text
tolerance 2.0
output mixture.pdb
filetype pdb

structure water.pdb
  number 800
  inside box 0. 0. 0. 40. 40. 40.
end structure

structure ethanol.pdb
  number 200
  inside box 0. 0. 0. 40. 40. 40.
end structure
```

### 2. Protein Solvation

Solvate biomolecules with water and ions for neutralization.

**Key parameters**:
- Use `fixed` with `center` for the protein
- Add Na+/Cl- ions for neutrality and concentration
- Calculate box size based on protein + solvent shell

**Automatic solvation helper**:

```bash
python scripts/solvate_helper.py protein.pdb --shell 15.0 --charge +4
```

### 3. Interface Systems

Build liquid-liquid or liquid-vapor interfaces using plane constraints.

**Example**: Water/hexane interface

```text
tolerance 2.0
output interface.pdb
pbc -20. -20. -30. 20. 20. 30.

structure water.pdb
  number 1000
  below plane 0. 0. 1. 0.
end structure

structure hexane.pdb
  number 200
  above plane 0. 0. 1. 0.
end structure
```

### 4. Advanced Constraints

Use spherical, cylindrical, or ellipsoidal constraints for complex geometries.

**Example**: Spherical vesicle

```text
structure lipid.pdb
  number 2000
  inside sphere 0. 0. 0. 40.
  atoms 1 2 3 4
    outside sphere 0. 0. 0. 35.
  end atoms
end structure

structure water.pdb
  number 2000
  inside sphere 0. 0. 0. 35.
end structure

structure water.pdb
  number 5000
  outside sphere 0. 0. 0. 45.
end structure
```

## Input Parameters

### Required Parameters

- **tolerance** `<distance>`: Minimum intermolecular distance (Å). Default: 2.0 for all-atom
- **output** `<filename>`: Output file name
- **filetype** `<format>`: pdb, xyz, or tinker

### Optional Parameters

- **pbc** `<dimensions>`: Periodic boundary conditions (e.g., `pbc 30. 30. 60.`)
- **seed** `<integer>`: Random seed for reproducibility
- **discale** `<factor>`: Distance scaling for optimization (default: 1.0)
- **maxit** `<N>`: Maximum iterations (default: 20)
- **precision** `<value>`: Convergence precision (default: 0.01)

See [references/parameters.md](references/parameters.md) for complete parameter reference.

## Structure Block Options

### Positioning Options

- **number**: Molecule count
- **inside/outside**: Spatial constraint
- **fixed**: Fix position and rotation (6 parameters: x, y, z, α, β, γ)
- **center**: Use center of mass for positioning

### Rotation Constraints

```text
constrain_rotation x 180. 20.  # Constrain rotation around x-axis
constrain_rotation y 180. 20.  # Constrain rotation around y-axis
constrain_rotation z 180. 20.  # Constrain rotation around z-axis
```

### Atom Selection

Apply constraints to specific atoms within molecules:

```text
structure molecule.pdb
  number 100
  inside box 0. 0. 0. 30. 30. 30.
  atoms 1 2 3
    inside box 0. 0. 25. 30. 30. 30.
  end atoms
end structure
```

## Running Packmol

### Basic Execution

```bash
packmol < input.inp
```

### Output Interpretation

Success message:

```
------------------------------
Success!
Final objective function value: .22503E-01
Maximum violation of target distance: 0.000000
Maximum violation of the constraints: .78985E-02
------------------------------
```

Check that both violations are < 0.01 for a valid solution.

## Validation

### Check Overlaps

```bash
python scripts/check_overlaps.py output.pdb --tolerance 2.0
```

### Verify Success

```bash
python scripts/verify_success.py input.inp output.pdb
```

### Analyze Density

```bash
python scripts/analyze_density.py output.pdb
```

### Validate Input

```bash
python scripts/validate_input.py input.inp
```

## Troubleshooting

### Common Issues

1. **"Killed" error**: System too large
   - Reduce number of molecules
   - Use restart files to build incrementally
   - See [references/troubleshooting.md](references/troubleshooting.md)

2. **No convergence**:
   - Try `discale 1.5` to scale distances
   - Reduce molecule count
   - Simplify constraints
   - Increase `maxit`

3. **Strange geometries**:
   - Add `check` keyword to validate constraints without packing
   - Verify constraint syntax
   - Check for conflicting constraints

4. **Incorrect atom count**:
   - Verify structure files are readable
   - Check for duplicate atoms in input files
   - Validate with `scripts/validate_input.py`

See [references/troubleshooting.md](references/troubleshooting.md) for detailed solutions.

## Examples

Explore example input files in the `examples/` directory:

- **Basic**: [examples/basic/](examples/basic/) - Simple boxes and mixtures
- **Solvation**: [examples/solvation/](examples/solvation/) - Proteins with water and ions
- **Interface**: [examples/interface/](examples/interface/) - Liquid-liquid interfaces
- **Advanced**: [examples/advanced/](examples/advanced/) - Vesicles, bilayers, complex geometries

## Templates

Use templates in `templates/` as starting points:

- **[templates/basic_template.inp](templates/basic_template.inp)**: Minimal template for simple packing
- **[templates/solvation_template.inp](templates/solvation_template.inp)**: Protein solvation setup
- **[templates/interface_template.inp](templates/interface_template.inp)**: Interface systems

## Helper Scripts

Use Python scripts in `scripts/` for automation:

- **generate_input.py**: Generate inputs programmatically
- **validate_input.py**: Validate input syntax before running
- **check_overlaps.py**: Detect atomic overlaps in output
- **analyze_density.py**: Calculate system density
- **solvate_helper.py**: Automatic protein solvation setup
- **verify_success.py**: Verify Packmol completed successfully

## Advanced Topics

### Periodic Boundary Conditions

Use `pbc` for periodic systems:

```text
pbc 30. 30. 60.  # or pbc xmin ymin zmin xmax ymax zmax
```

### Restart Files

Build large systems incrementally:

```text
structure water.pdb
  number 1000
  inside box 0. 0. 0. 40. 40. 40.
  restart_to water1.pack
end structure
```

Then restart:

```text
structure water.pdb
  number 1000
  restart_from water1.pack
end structure
```

### Atom-Specific Radii

Set different radii for multiscale models:

```text
structure molecule.pdb
  number 100
  radius 1.5  # All atoms
end structure

structure molecule.pdb
  number 100
  atoms 1 2
    radius 1.5  # Specific atoms
  end atoms
end structure
```

### Constraint Validation

Validate constraints without packing:

```text
structure molecule.pdb
  number 100
  inside box 0. 0. 0. 30. 30. 30.
  check
end structure
```

## Best Practices

1. **Start simple**: Test with few molecules before scaling up
2. **Use appropriate tolerance**: 2.0 Å for all-atom, larger for coarse-grained
3. **Check constraints**: Add `check` keyword to validate regions
4. **Validate output**: Use scripts to check overlaps and density
5. **Reproducibility**: Set `seed` for repeatable results
6. **Large systems**: Use restart files or build in stages
7. **Box size**: Allow 10-15 Å padding around solutes for solvation

## Tips for Common Use Cases

### Protein Solvation

- Add 10-15 Å solvent shell around protein
- Calculate ions for neutrality: `N_ions = charge / e`
- Add salt ions for desired concentration (e.g., 0.15 M NaCl)
- Use `fixed` with `center` for protein positioning

### Mixed Solvents

- Calculate total number of molecules from desired molar ratios
- Use same tolerance for all components
- Test with small systems first

### Membrane Systems

- Use `constrain_rotation` to orient lipids
- Build in stages: lipids first, then water
- Consider using specialized membrane builders for large systems

### Nanotubes/Pores

- Use `cylinder` constraint for pore region
- Combine with `outside` constraint for bulk region
- May need atom selection for specific molecule orientations

## Resources

- Official documentation: [Packmol User Guide](https://m3g.github.io/packmol/userguide.shtml)
- Examples: [Packmol Examples](https://m3g.github.io/packmol/examples.shtml)
- GitHub: [Packmol Repository](https://github.com/m3g/packmol)
- Paper: [Martínez et al. J Comput Chem 2009](https://doi.org/10.1002/jcc.21224)

## References

For detailed information on specific topics, see:

- [constraints.md](references/constraints.md) - Complete constraint syntax and examples
- [parameters.md](references/parameters.md) - All input parameters and options
- [file_formats.md](references/file_formats.md) - File format specifications
- [troubleshooting.md](references/troubleshooting.md) - Problem-solving guide

Related Skills

azure-quotas

242
from aiskillstore/marketplace

Check/manage Azure quotas and usage across providers. For deployment planning, capacity validation, region selection. WHEN: "check quotas", "service limits", "current usage", "request quota increase", "quota exceeded", "validate capacity", "regional availability", "provisioning limits", "vCPU limit", "how many vCPUs available in my subscription".

DevOps & Infrastructure

raindrop-io

242
from aiskillstore/marketplace

Manage Raindrop.io bookmarks with AI assistance. Save and organize bookmarks, search your collection, manage reading lists, and organize research materials. Use when working with bookmarks, web research, reading lists, or when user mentions Raindrop.io.

Data & Research

zlibrary-to-notebooklm

242
from aiskillstore/marketplace

自动从 Z-Library 下载书籍并上传到 Google NotebookLM。支持 PDF/EPUB 格式,自动转换,一键创建知识库。

discover-skills

242
from aiskillstore/marketplace

当你发现当前可用的技能都不够合适(或用户明确要求你寻找技能)时使用。本技能会基于任务目标和约束,给出一份精简的候选技能清单,帮助你选出最适配当前任务的技能。

web-performance-seo

242
from aiskillstore/marketplace

Fix PageSpeed Insights/Lighthouse accessibility "!" errors caused by contrast audit failures (CSS filters, OKLCH/OKLAB, low opacity, gradient text, image backgrounds). Use for accessibility-driven SEO/performance debugging and remediation.

project-to-obsidian

242
from aiskillstore/marketplace

将代码项目转换为 Obsidian 知识库。当用户提到 obsidian、项目文档、知识库、分析项目、转换项目 时激活。 【激活后必须执行】: 1. 先完整阅读本 SKILL.md 文件 2. 理解 AI 写入规则(默认到 00_Inbox/AI/、追加式、统一 Schema) 3. 执行 STEP 0: 使用 AskUserQuestion 询问用户确认 4. 用户确认后才开始 STEP 1 项目扫描 5. 严格按 STEP 0 → 1 → 2 → 3 → 4 顺序执行 【禁止行为】: - 禁止不读 SKILL.md 就开始分析项目 - 禁止跳过 STEP 0 用户确认 - 禁止直接在 30_Resources 创建(先到 00_Inbox/AI/) - 禁止自作主张决定输出位置

obsidian-helper

242
from aiskillstore/marketplace

Obsidian 智能笔记助手。当用户提到 obsidian、日记、笔记、知识库、capture、review 时激活。 【激活后必须执行】: 1. 先完整阅读本 SKILL.md 文件 2. 理解 AI 写入三条硬规矩(00_Inbox/AI/、追加式、白名单字段) 3. 按 STEP 0 → STEP 1 → ... 顺序执行 4. 不要跳过任何步骤,不要自作主张 【禁止行为】: - 禁止不读 SKILL.md 就开始工作 - 禁止跳过用户确认步骤 - 禁止在非 00_Inbox/AI/ 位置创建新笔记(除非用户明确指定)

internationalizing-websites

242
from aiskillstore/marketplace

Adds multi-language support to Next.js websites with proper SEO configuration including hreflang tags, localized sitemaps, and language-specific content. Use when adding new languages, setting up i18n, optimizing for international SEO, or when user mentions localization, translation, multi-language, or specific languages like Japanese, Korean, Chinese.

google-official-seo-guide

242
from aiskillstore/marketplace

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

github-release-assistant

242
from aiskillstore/marketplace

Generate bilingual GitHub release documentation (README.md + README.zh.md) from repo metadata and user input, and guide release prep with git add/commit/push. Use when the user asks to write or polish README files, create bilingual docs, prepare a GitHub release, or mentions release assistant/README generation.

doc-sync-tool

242
from aiskillstore/marketplace

自动同步项目中的 Agents.md、claude.md 和 gemini.md 文件,保持内容一致性。支持自动监听和手动触发。

deploying-to-production

242
from aiskillstore/marketplace

Automate creating a GitHub repository and deploying a web project to Vercel. Use when the user asks to deploy a website/app to production, publish a project, or set up GitHub + Vercel deployment.