Claude Code Plugins

Community-maintained marketplace

Feedback
15
0

Quantum ESPRESSO interface for first-principles electronic structure calculations. Use for DFT calculations, phonon dispersions, and electronic properties of battery materials.

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name quantum-espresso
description Quantum ESPRESSO interface for first-principles electronic structure calculations. Use for DFT calculations, phonon dispersions, and electronic properties of battery materials.

Quantum ESPRESSO

Tools for first-principles calculations using Quantum ESPRESSO.

ASE Interface

from ase import Atoms
from ase.calculators.espresso import Espresso

# Define structure
atoms = Atoms('LiCoO2', positions=[[0, 0, 0], [0.5, 0.5, 0.5], ...])

# Setup QE calculator
pseudopotentials = {
    'Li': 'Li.pbe-s-kjpaw_psl.1.0.0.UPF',
    'Co': 'Co.pbe-spn-kjpaw_psl.1.0.0.UPF',
    'O': 'O.pbe-n-kjpaw_psl.1.0.0.UPF'
}

calc = Espresso(
    pseudopotentials=pseudopotentials,
    tstress=True,
    tprnfor=True,
    kpts=(4, 4, 4),
    ecutwfc=60,
    ecutrho=600,
    occupations='smearing',
    smearing='gaussian',
    degauss=0.02,
    mixing_beta=0.3,
    conv_thr=1.0e-8
)

atoms.calc = calc
energy = atoms.get_potential_energy()

Input File Generation

def write_pwscf_input(atoms, filename='pw.in'):
    """Generate Quantum ESPRESSO input file."""
    input_text = f"""
&CONTROL
    calculation = 'scf'
    pseudo_dir = './pseudo'
    outdir = './tmp'
    prefix = 'battery'
/
&SYSTEM
    ibrav = 0
    nat = {len(atoms)}
    ntyp = {len(set(atoms.get_chemical_symbols()))}
    ecutwfc = 60
    ecutrho = 600
/
&ELECTRONS
    conv_thr = 1.0d-8
    mixing_beta = 0.3
/
ATOMIC_SPECIES
Li  6.941  Li.pbe-s-kjpaw_psl.1.0.0.UPF
...
"""
    with open(filename, 'w') as f:
        f.write(input_text)

Phonon Calculations

# Run phonon calculation
ph.x -input ph.in > ph.out

# ph.in example
&inputph
    prefix = 'battery'
    outdir = './tmp'
    fildyn = 'battery.dyn'
    ldisp = .true.
    nq1 = 2
    nq2 = 2
    nq3 = 2
/

Band Structure Calculation

from ase.calculators.espresso import Espresso
from ase.dft.kpoints import bandpath

# Get band path
path = bandpath('GXWKGLUWLK', atoms.cell, npoints=100)

# Setup bands calculation
calc_bands = Espresso(
    pseudopotentials=pseudopotentials,
    calculation='bands',
    kpts=path.kpts,
    ecutwfc=60
)

atoms.calc = calc_bands
atoms.get_potential_energy()

Post-Processing

import numpy as np

def parse_qe_output(filename):
    """Parse Quantum ESPRESSO output file."""
    with open(filename, 'r') as f:
        content = f.read()

    # Extract total energy
    import re
    energy_match = re.search(r'total energy\s+=\s+([-\d.]+)\s+Ry', content)
    if energy_match:
        energy_ry = float(energy_match.group(1))
        energy_ev = energy_ry * 13.6057  # Ry to eV
        return energy_ev
    return None