Skip to content

mfherbst/ASEconvert.jl

Repository files navigation

ASEconvert

Stable Dev Build Status Coverage

Light-weight module to install ASE and provide routines for converting between the Atoms datastructure from ASE and atomistic data provided in the AtomsBase ecosystem. For both the package makes use of the PythonCall.

This can be used for example as follows

using ASEconvert

# Make a silicon supercell using ASE
atoms_ase = ase.build.bulk("Si") * pytuple((4, 1, 1))

# Convert to an AtomsBase-compatible structure
atoms_ab = pyconvert(AbstractSystem, atoms_ase)

# Convert back to ASE and create a vacancy
newatoms_ase = convert_ase(atoms_ab)
newatoms_ase.pop(4)

AtomsCalculators interface

You can use ASE calculators in julia, by wrapping them to a ASEcalculator structure. Here is a brief example:

using AtomsCalculators
using AtomsBuilder
using ASEconvert
using PythonCall

# Setup calculator in ASE
potential = "path to eam potential file"
ase_calc = pyimport("ase.calculators.eam").EAM(potential)

# Convert into AtomsCalculator-compatible calculator
calc = ASEcalculator(ase_calc)

# Use it to compute a Nickel supercell
system = bulk(:Ni) * (4, 3, 2)
AtomsCalculators.potential_energy(system, calc)
AtomsCalculators.forces(system, calc)
AtomsCalculators.virial(system, calc)