hylight.vasp package

Submodules

hylight.vasp.common module

Common utilities to read and write VASP files.

class hylight.vasp.common.Poscar(lattice, species, species_names=None)

Bases: Struct

A crystal cell from a VASP POSCAR file.

classmethod from_file(filename)

Load a POSCAR file

Parameters:

filename – path to the file to read

Returns:

a Poscar object.

to_file(path='POSCAR', cartesian=True)

Write to a POSCAR file.

The property system_name may be set to change the comment at the top of the file.

Parameters:
  • path – path to the file to write

  • cartesian

    • if True, write the file in cartesian representation,

    • if False, write in fractional representation

to_stream(out, cartesian=True)

Write a POSCAR content to a stream.

The property system_name may be set to change the comment at the top of the file.

Parameters:
  • path – path to the file to write

  • cartesian

    • if True, write the file in cartesian representation,

    • if False, write in fractional representation

hylight.vasp.loader module

Read vibrational modes from VASP files.

hylight.vasp.loader.load_phonons(path: str) tuple[list[Mode], list[int], list[float]]

Load phonons from a OUTCAR.

Note

This function is a bit heavy because of text parsing. You may want to use hyligh-modes to parse the file once and later load that preparsed file using hylight.npz.load_phonons() instead.

Returns:

(phonons, pops, masses)

  • phonons: list of hylight.mode.Mode instances

  • pops: population for each atom species

  • masses: list of SI masses

hylight.vasp.loader.load_poscar(path)

Read the positions from a POSCAR.

Returns:

a numpy.ndarray((natoms, 3), dtype=float)

hylight.vasp.loader.load_poscar_latt(path)

Read the positions and the lattice parameters from a POSCAR.

Returns:

a (np.ndarray((natoms, 3), dtype=float), nd.array((3, 3), dtype=float))

  • first element is the set of positions

  • second element is the lattice parameters

hylight.vasp.utils module

Pervasive utilities for hylight.vasp submodule.

hylight.vasp.utils.make_finite_diff_poscar(outcar, poscar_gs, poscar_es, A=0.01, *, load_phonons=<function load_phonons>, bias=0, mask=None)

Compute positions for evaluation of the curvature of the ES PES.

Parameters:
  • outcar – the name of the file where the phonons will be read.

  • poscar_gs – the path to the ground state POSCAR

  • poscar_es – the path to the excited state POSCAR, it will be used as a base for the generated Poscars

  • A – (optional, 0.01) the amplitude of the displacement in A.

  • load_phonons – (optional, vasp.loader.load_phonons) the procedure use to read outcar

  • bias – an energy under which modes are ignored, 0 by default

  • mask – a mode.Mask to select the modes to consider, override the bias.

Returns:

(mu, pes_left, pes_right)

  • mu: the effective mass in kg

  • pes_left: a Poscar instance representing the left displacement

  • pes_right: a Poscar instance representing the right displacement

Module contents

VASP related utilities.