Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

Back to skills

Cp2k Relax

ASecurity

CP2K geometry optimization. Handles bulk, slab, and molecular systems with GPW method. Efficient for large systems (200+ atoms).

199 stars
0 votes
0 copies
0 views
Added 9/20/2026
developmentpythongonode

Works with

mcp

Security Analysis

A100/100

Scanned 9/20/2026

Install to Claude Code

$npx -y skills add Hello-QM/catgo-LRG --skill cp2k-relax --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cp2k Relax?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Cp2k Relax
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hello-qm-cp2k-relax/badge)](https://www.skillsdirectory.com/skills/hello-qm-cp2k-relax)

More formats (shields.io, HTML) on the badges page.

Download Zip
Files
SKILL.md
---
name: cp2k-geo-opt
description: CP2K geometry optimization. Handles bulk, slab, and molecular systems with GPW method. Efficient for large systems (200+ atoms).
---

# CP2K Geometry Optimization

Set up and submit CP2K geometry optimizations using the Gaussian and Plane-Wave (GPW) method. CP2K is the preferred code for systems larger than ~200 atoms where VASP becomes memory-limited.

## Scenario 1: Bulk Optimization

Full cell and ionic relaxation for periodic bulk systems.

```python
from catgo.workflow import Workflow

wf = Workflow("CP2K bulk MgO")
struct = wf.add_task("structure_input", structure=bulk_json)

opt = wf.add_task("geo_opt",
                  structure=struct.output.structure,
                  software="cp2k",
                  cell_opt=True,          # Relax cell + ions (like ISIF=3 in VASP)
                  cutoff=600,             # Ry
                  rel_cutoff=60,          # Ry
                  basis_set="DZVP-MOLOPT-SR-GTH",
                  xc_functional="PBE",
                  max_iter=200,           # Max geo_opt steps
                  eps_geo=3e-4,           # Force convergence (Hartree/Bohr)
                  system_name="bulk_MgO")

wf.submit()
```

**MCP equivalent:**
```
catgo_workflow_v2(action="create", params={"name": "CP2K bulk MgO"})

catgo_workflow_v2(action="add_task", params={
  "workflow_id": "wf_xxx",
  "task_type": "structure_input",
  "structure": "<bulk_json>"
})

catgo_workflow_v2(action="add_task", params={
  "workflow_id": "wf_xxx",
  "task_type": "geo_opt",
  "software": "cp2k",
  "structure": "{{t_001.output.structure}}",
  "cell_opt": true,
  "cutoff": 600,
  "basis_set": "DZVP-MOLOPT-SR-GTH",
  "system_name": "bulk_MgO"
})

catgo_workflow_v2(action="submit", params={"workflow_id": "wf_xxx"})
```

## Scenario 2: Slab Optimization

Fixed cell, ionic relaxation with frozen bottom layers. Analogous to VASP ISIF=2.

```python
wf = Workflow("CP2K TiO2 slab")
struct = wf.add_task("structure_input", structure=slab_json)

opt = wf.add_task("geo_opt",
                  structure=struct.output.structure,
                  software="cp2k",
                  cell_opt=False,         # Fix cell (slab)
                  cutoff=600,
                  basis_set="DZVP-MOLOPT-SR-GTH",
                  freeze_layers=2,        # Freeze bottom 2 layers
                  poisson_solver="MT",    # Martyna-Tuckerman for slab geometry
                  system_name="TiO2_slab")

wf.submit()
```

**Slab-specific settings:**
- `cell_opt=False` — mandatory for slabs (equivalent to ISIF=2 in VASP)
- `freeze_layers=2` — freeze bottom layers to mimic bulk
- `poisson_solver="MT"` — Martyna-Tuckerman solver handles the vacuum correctly for 2D-periodic systems. Use "PERIODIC" for bulk (3D-periodic) and "MT" or "WAVELET" for slabs

## Scenario 3: Adsorbate on Slab

Same as slab, with adsorbate atoms free to relax:

```python
opt = wf.add_task("geo_opt",
                  structure=adsorbate_slab_json,
                  software="cp2k",
                  cell_opt=False,
                  freeze_layers=2,
                  cutoff=600,
                  vdw_method="DFTD3",    # Dispersion for adsorption
                  poisson_solver="MT",
                  system_name="*OH_on_TiO2")
```

## Scenario 4: Large System (500+ atoms)

CP2K's GPW method with OT (Orbital Transformation) SCF solver scales linearly for large systems:

```python
opt = wf.add_task("geo_opt",
                  structure=large_system_json,
                  software="cp2k",
                  cutoff=400,                   # Lower cutoff acceptable for screening
                  basis_set="SZV-MOLOPT-SR-GTH", # Minimal basis for speed
                  ot_minimizer="DIIS",           # OT method for large systems
                  ot_preconditioner="FULL_ALL",
                  eps_scf=1e-5,
                  system_name="large_system")
```

**OT vs diagonalization:**
- OT: O(N) scaling, no HOMO-LUMO gap requirement, default for > 100 atoms
- Diagonalization: O(N^3) scaling, needed for metallic systems (zero gap)

**For metals:** OT does not work for metallic systems (zero band gap). Use Fermi-Dirac smearing with diagonalization:
```python
opt = wf.add_task("geo_opt",
                  structure=metal_json,
                  software="cp2k",
                  scf_method="diag",          # Standard diagonalization
                  smearing_method="FERMI_DIRAC",
                  electronic_temperature=300,  # K
                  system_name="metal")
```

## Key Parameters

| Parameter | Default | Purpose |
|---|---|---|
| cutoff | 600 Ry | PW cutoff for density grid |
| rel_cutoff | 60 Ry | Multi-grid relative cutoff |
| basis_set | DZVP-MOLOPT-SR-GTH | Gaussian basis set |
| xc_functional | PBE | Exchange-correlation functional |
| max_iter | 200 | Max geometry optimization steps |
| eps_geo | 3e-4 | Force convergence (Hartree/Bohr, ~ 0.015 eV/A) |
| eps_scf | 1e-6 | SCF convergence (Hartree) |
| cell_opt | False | Whether to optimize cell parameters |
| freeze_layers | 0 | Number of bottom layers to freeze |
| vdw_method | None | Dispersion correction ("DFTD3", "DFTD3(BJ)") |
| poisson_solver | PERIODIC | Poisson solver ("PERIODIC", "MT", "WAVELET") |

## Convergence Monitoring

```
catgo_workflow_v2(action="status", params={"workflow_id": "wf_xxx"})

catgo_analyze(action="convergence", params={"task_id": "t_opt"})
# Returns: energy vs step, max force vs step

catgo_analyze(action="forces", params={"task_id": "t_opt"})
```

## Chain: CP2K Optimization then Frequency

```python
wf = Workflow("CP2K opt + freq")
struct = wf.add_task("structure_input", structure=slab_oh_json)

opt = wf.add_task("geo_opt", structure=struct.output.structure,
                  software="cp2k", freeze_layers=2,
                  system_name="*OH")

frq = wf.add_task("freq", structure=opt.output.structure,
                  software="cp2k",
                  freeze_mode="layers", freeze_layers=4,
                  system_name="*OH")

gib = wf.add_task("gibbs_energy",
                  energy=opt.output.energy,
                  frequencies=frq.output.frequencies,
                  phase="adsorbed", system_name="*OH")

wf.submit()
```

## Output

The geo_opt task produces:
- `output.structure` — optimized structure (pymatgen dict as JSON string)
- `output.energy` — total DFT energy in eV

## Troubleshooting

| Problem | Fix |
|---|---|
| SCF not converging | Use OT method, increase scf_max_iter, reduce mixing |
| Energy oscillations | Increase cutoff (try 800 Ry), check rel_cutoff |
| Forces not converging | Loosen eps_geo, increase max_iter |
| OT fails for metal | Switch to diagonalization with Fermi smearing |
| Memory error | Reduce cutoff, use SZV basis, increase nodes |
| Missing basis for element | Check CP2K basis set library, may need to download |
| Poisson solver error for slab | Use poisson_solver="MT" instead of "PERIODIC" |

## Unit Conversions

CP2K uses atomic units internally. CatGo converts automatically, but for reference:
- 1 Hartree = 27.2114 eV
- 1 Bohr = 0.529177 A
- Force: 1 Ha/Bohr = 51.422 eV/A
- eps_geo=3e-4 Ha/Bohr corresponds to ~0.015 eV/A (comparable to VASP EDIFFG=-0.02)

Attribution

Hello-QMHello-QM
View sourceMore from Hello-QM →
SSkills DirectorySkills Directory

Your tool, in front of Claude Code builders.

3 founder slots · $299/mo · GSC-verified traffic · sponsors can never buy grades.

See placements

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Your tool, in front of Claude Code builders.

3 founder slots · $299/mo · GSC-verified traffic · sponsors can never buy grades.

See placements

Related Skills

Browser Extension Developer

Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.

281612 votes

Seo Optimizer

SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.

2132 votes

Google Official Seo Guide

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

1862 votes

Tanstack Start

Build a full-stack TanStack Start app on Cloudflare Workers from scratch — SSR, file-based routing, server functions, D1+Drizzle, better-auth, Tailwind v4+shadcn/ui. Use whenever the user mentions TanStack Start, asks to scaffold a full-stack Cloudflare app with SSR, wants an SSR dashboard, or asks for a React 19 + Cloudflare Workers app with file-based routing and server functions — even if they don't name TanStack Start specifically. No template repo — Claude generates every file fresh per ...

9881 votes

Pentest

PTES-aligned adversarial security audit for backend, frontend, and mobile applications. Produces a CVSS-scored Hacker Report with verified PoCs and phased remediation.

5491 votes
View all in development →