cif-to-vasp
БесплатноБез исполняемых скриптовНе проверенGenerate VASP input files (POSCAR, INCAR, KPOINTS, POTCAR) from CIF crystal structure files. Use this skill whenever the user needs to prepare VASP…
от pdl-openair★ 16 звёзд на GitHubОб этом скилле
CIF to VASP Input Generator
Generate correct, validated VASP input files from CIF crystal structures.
The most common VASP failures (ZHEGV failed, Cannot allocate memory) trace back to two root causes this skill prevents:
- Wrong POSCAR coordinates — placing conventional-cell atomic positions into a reduced/primitive cell (atoms overlap, overlap matrix becomes singular)
- Aggressive INCAR settings — PREC=Accurate + dense KPOINTS + high ENCUT overwhelms HPC memory
Workflow
Step 1: Read and validate the CIF
Read the CIF file. Check:
- Space group and symmetry operations
- Number of atoms in the asymmetric unit
- Expected total atom count (asymmetric unit × multiplicity)
- Lattice parameters (a, b, c, alpha, beta, gamma)
If the CIF looks malformed or has missing symmetry info, ask the user before proceeding.
Step 2: Generate POSCAR from CIF
Always use pymatgen to convert CIF → POSCAR. This ensures symmetry operations are applied correctly and coordinates match the lattice vectors.
from pymatgen.core import Structure
struct = Structure.from_file("input.cif")
struct.to(fmt="poscar", filename="POSCAR")
After writing, clean the POSCAR by removing species charge labels from coordinate lines (e.g., Al3+ → just the three fractional coordinates). VASP does not expect text after coordinate values.
Critical: validate the POSCAR before proceeding. Run this check every time:
from pymatgen.core import Structure
s = Structure.from_file("POSCAR")
min_dist = float('inf')
for i in range(len(s)):
for j in range(i+1, len(s)):
d = s.get_distance(i, j)
if d < min_dist:
min_dist = d
print(f"Atoms: {len(s)}, Min distance: {min_dist:.4f} A")
Validation rules:
- Minimum interatomic distance must be > 1.5 A. If it's below this threshold, the POSCAR is wrong (atoms overlap, ZHEGV will fail). Go back to the CIF and regenerate.
- Typical bond lengths for reference:
- Metal-chalcogen (Al-Se, In-Se, etc.): 2.3-2.8 A
- Metal-metal: > 2.5 A
- Chalcogen-chalcogen: > 2.3 A
- If the minimum distance looks wrong, the CIF-to-POSCAR conversion had a cell mismatch. Never try to fix this manually — regenerate from the CIF.
Step 3: Determine the POTCAR element order
Read the POSCAR species order (the line like Al In Se in POSCAR). The POTCAR must concatenate pseudopotentials in exactly this order.
POTCAR generation options:
- VASPKit (if installed): run
vaspkit→ task 103 (generate POTCAR automatically from POSCAR) - pymatgen (if
PMG_VASP_PSP_DIRis set): useMPRelaxSet(struct).potcar - Manual: concatenate PAW_PBE pseudopotential files in the POSCAR species order
If no POTCAR source is available, write a potcar_generator.sh helper script that documents the required order.
Step 4: Generate KPOINTS
The k-point mesh density must match the cell size. Larger cells need fewer k-points because the Brillouin zone is smaller.
Rule of thumb for Gamma-centered meshes:
| Cell dimension (A) | K-points along that axis |
|---|---|
| < 5 | 6-8 |
| 5-8 | 4-6 |
| 8-12 | 3-4 |
| 12-20 | 2-3 |
| > 20 | 1-2 |
For the c-axis specifically: if c > 15 A with layered/van der Waals structure, use 1-2 k-points along c.
For initial relaxation, always use Gamma-centered (not Monkhorst-Pack) to avoid Gamma-point duplication issues.
Example KPOINTS for a hexagonal cell with a=7.07, c=18.84:
Kpoints for relaxation
0
Gamma
3 3 1
0 0 0
Step 5: Generate INCAR
Use conservative, memory-safe defaults for initial relaxation. The user can tighten parameters for production runs later.
Default INCAR template for relaxation:
System = [FORMULA]
# Electronic Optimization
ENCUT = [ENCUT]
PREC = Normal
ALGO = Normal
EDIFF = 1E-5
NELM = 200
ISMEAR = 0
SIGMA = 0.05
LREAL = A
# Ionic Optimization
IBRION = 2
ISIF = 3
NSW = 100
EDIFFG = -0.01
# Output
LCHARG = .TRUE.
LWAVE = .FALSE.
ENCUT determination:
- Read ENMAX values from each pseudopotential in the POTCAR
- Set ENCUT = max(ENMAX) × 1.3, rounded up to nearest 10 eV
- Example: max ENMAX = 240.3 → ENCUT = 320
Why these defaults:
PREC = Normal(not Accurate): Accurate doubles FFT grid dimensions, multiplying memory ~8x. Normal is sufficient for relaxation. Use Accurate only for final static calculations.LREAL = A: Real-space projection operators. Reduces memory significantly for systems with >20 atoms.ISMEAR = 0; SIGMA = 0.05: Gaussian smearing for semiconductors/insulators. For metals, switch to ISMEAR=1, SIGMA=0.2.EDIFF = 1E-5(not 1E-6): Consistent with Normal precision. Tighter convergence wastes SCF cycles at Normal grid resolution.- No
NCORE/KPARby default: Let VASP auto
Установить cif-to-vasp в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл cif-to-vasp?
Generate VASP input files (POSCAR, INCAR, KPOINTS, POTCAR) from CIF crystal structure files. Use this skill whenever the user needs to prepare VASP calculations from crystal structure data, convert CIF to POSCAR, set up relaxation or static calculations, or generate VASP input sets. Also trigger when the user mentions VASP input preparation, POSCAR generation, or asks why their VASP calculation fails with ZHEGV/memory errors after generating input files — the root cause is often incorrect POSCAR coordinates or overly aggressive INCAR settings. This skill encodes hard-won lessons about cell-coordinate mismatches and memory-safe parameter choices.
Как установить скилл cif-to-vasp?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл cif-to-vasp запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic