ViPErLEED Python API
A core part of the ViPErLEED project is the viperleed
Python package. (See here for installation instructions.)
While viperleed
can be used as a standalone tool to, e.g., perform LEED-I(V)
calculations via viperleed.calc
, it also contains a number of useful library functions
related to surface science and electron diffraction. Through the API,
users can access all of the functionality of viperleed
from within their
own Python programs.
To use the API, you can simply import the viperleed
package and call
the desired functions. Here is a simple example of how to use the API to
find the plane group of a slab from a POSCAR file:
from viperleed.calc import symmetry
from viperleed.calc.classes.rparams import Rparams
from viperleed.calc.files import poscar
# Load a slab from a POSCAR file
example_slab = poscar.read('POSCAR')
# Create an empty parameters object and update the slab
run_params = Rparams()
example_slab.full_update(run_params)
# Detect the plane group of the slab and print it
planegroup = symmetry.findSymmetry(example_slab, run_params)
print(planegroup)