VASP interface#

For the full technical reference see io.

Wulfric can read and write VASP POSCAR files.

Import#

>>> # Explicit import
>>> from wulfric.io.vasp import load_poscar, dump_poscar
>>> # Recommended import
>>> from wulfric import load_poscar, dump_poscar

Reading#

>>> # Load a POSCAR file
>>> crystal = load_poscar('POSCAR') 
>>> # It can return cell and a list of Atom objects instead of a Crystal instance
>>> cell, atoms = load_poscar('POSCAR', return_cell=False) 
>>> # It can return the comment from the file as well:
>>> crystal, comment = load_poscar('POSCAR', return_comment=True) 
>>> # Or
>>> cell, atoms, comment = load_poscar('POSCAR', return_cell=False, return_comment=True) 

Writing#

>>> # Dump a POSCAR file
>>> dump_poscar(crystal, 'POSCAR') 
>>> # If you want to write a comment as well:
>>> dump_poscar(crystal, 'POSCAR', comment='This is a comment') 
>>> # You can control the amount of decimals in the output:
>>> dump_poscar(crystal, 'POSCAR', decimals=6) 
>>> # You can switch the mode of coordinates between 'Cartesian' and 'Direct' (default):
>>> dump_poscar(crystal, 'POSCAR', mode="Cartesian")