Skip to content

Instantly share code, notes, and snippets.

@simonbatzner
simonbatzner / npz_to_extxyz.py
Last active January 3, 2025 08:36
Convert npz data to extxyz for NequIP input
import numpy as np
from ase import Atoms
from ase.io import write
from ase.calculators.singlepoint import SinglePointCalculator
# read in npz file
in_filename = 'data.npz'
out_filename = 'nequip-data.extxyz'
data = np.load(in_filename)
@simonbatzner
simonbatzner / vasp_to_extxyz.py
Created February 19, 2022 17:18
Convert VASP OUTCAR to extxyz file for NequIP input
from ase.io import read, write
# outcar contanining one (single-point) or multiple (trajectory) DFT frames
in_filename = './OUTCAR'
out_filename = 'nequip-data.extxyz'
# read all frames into a list of ase.Atoms objects
all_atoms = read(in_filename, format='vasp-out', index=':')
for curr_atoms in enumerate(all_atoms):