wulfric.io.load_poscar#

wulfric.io.load_poscar(file_object=None)[source]#

Reads crystal structure from the POSCAR file.

Parameters:
file_objectstr of file-like object, optional

File to be read. If str, then file is opened with the given name. Otherwise it has to have .readlines() method. By default it looks for the "POSCAR" file in the current directory. Behaviour for str:

  • Tries to open the file with the name file_object.

  • Tries to open the file with the name "POSCAR" in the directory file_object.

Returns:
cell(3, 3) numpy.ndarray

Cell of a crystal structure, rows are interpreted as vectors.

cell = [[a1_x, a1_y, a1_z],
        [a2_x, a2_y, a2_z],
        [a3_x, a3_y, a3_z]]
atomsdict

Atoms of the crystal structure. Positions are always relative to the cell.

commentstr

Comment from the first line of the file.

Examples

>>> # Load a POSCAR file
>>> cell, atoms, comment = wulfric.io.load_poscar("POSCAR")