AgentSkillsCN

Skill

技能

SKILL.md

Ogre DFT Workflow Skill

A Claude Code skill for automated DFT calculation workflows on epitaxial interfaces

This skill automates the complete workflow for running VASP DFT calculations on structures generated by OgreInterface, from setup to energy extraction.

What This Skill Does

When invoked, this skill helps you:

  1. Setup calculation directories - Automatically creates calc_XXXX folders and copies template files (POTCAR, INCAR, KPOINTS, SLURM scripts)
  2. Update DIPOL values - Calculates mass-weighted center of mass from POSCAR and updates DIPOL tags in INCAR files
  3. Submit jobs - Submits calculations to SLURM queue with proper sequencing
  4. Extract energies - Collects final energies from OUTCAR files and saves to energies.npy

Usage

Prerequisites

Before using this skill, ensure you have:

  • OgreInterface-generated POSCAR files in PES/poscars, zdist/poscars, or reference/poscars
  • Template files prepared in templates/ directory:
    • POTCAR (your pseudopotential file)
    • INCAR_template (with DIPOL = PLACEHOLDER_DIPOL)
    • KPOINTS_template (your k-point settings)
    • job_template.slurm (your SLURM submission script)

Invoking the Skill

Simply drag your calculation folder into Claude Code and ask:

code
"Setup calculation folders, update DIPOL, and submit jobs"

Or be more specific:

code
"Setup PES calculations and submit to SLURM"
code
"Extract energies from completed calculations"
code
"Setup reference calculations for interface energy"

Workflow Steps

1. Setup Calculations

Creates calculation directories (calc_0000, calc_0001, ...) for each POSCAR file and copies template files.

Command: ./scripts/1_setup_calculations.sh <type> <poscars_dir>

  • <type>: "pes", "zdist", or "reference"
  • <poscars_dir>: Directory containing POSCAR files

2. Update DIPOL

Calculates the mass-weighted center of mass for each structure and updates the DIPOL tag in INCAR files.

Command: python scripts/2_update_dipol.py [--force] [--verbose] [--dry-run]

3. Submit Jobs

Submits all calculations to the SLURM queue.

Command: ./scripts/3_submit_jobs.sh [--dry-run] [--delay N] [--check-dipol]

4. Extract Energies

After calculations complete, extracts final energies from OUTCAR files.

Command: python scripts/4_extract_energies.py

5. Create NPY Array

Creates energies.npy file from extracted energies.

Command: python scripts/5_create_npy.py

Special: Reference Calculations

For interface energy calculations, use:

code
"Setup reference calculations"

This creates four reference calculation directories (calc_0000 to calc_0003):

  • E1 = film slab
  • E2 = substrate slab
  • E3 = film double slab
  • E4 = substrate double slab

Interface energy is calculated as: E_interface = E_total - (E1 + E2) + 0.5*(E3 + E4)

Output

The workflow produces:

  • energies.npy - NumPy array of final energies ordered by POSCAR suffix
  • energies_YYYYMMDD_HHMMSS.csv - Human-readable CSV of extracted energies
  • Organized calculation directories ready for VASP execution

Tips for Effective Use

  1. Prepare templates first - Use vaspkit to generate optimized INCAR and KPOINTS
  2. Check DIPOL - Always verify DIPOL values are correctly updated before submission
  3. Monitor queue - Use squeue -u $USER to track job status
  4. Batch processing - The skill handles multiple structures automatically
  5. Error recovery - If submission fails, re-run with --check-dipol to verify setup

Directory Structure

code
your-project/
├── PES/poscars/              # OgreInterface output
│   ├── POSCAR_0000
│   ├── POSCAR_0001
│   └── ...
├── PES/                      # Calculation workspace
│   ├── calc_0000/
│   │   ├── POSCAR
│   │   ├── POTCAR
│   │   ├── INCAR
│   │   ├── KPOINTS
│   │   └── job.slurm
│   └── energies.npy          # Final output
└── templates/                # Your system templates
    ├── POTCAR
    ├── INCAR_template
    ├── KPOINTS_template
    └── job_template.slurm

Related Tools

  • OgreInterface - Generate epitaxial interface structures
  • VASP - Vienna Ab initio Simulation Package
  • vaspkit - VASP pre/post-processing toolkit

License

MIT License - See LICENSE file for details

Acknowledgments

Built on top of OgreInterface by Zefeng Cai for streamlined epitaxial interface DFT calculations.