htesp.vasp_process

Module to process vasp input files

Functions

band_phonopy(filename)

Write k-points of high-symmetry points for Phonopy band structure plot using 'band.conf' file.

drop_incar_keys(keys[, path])

Remove every line of path that sets one of keys.

eigen_process()

Process the EIGENVAL file generated by VASP.

encut_check()

Function to check ENCUT in INCAR file and replace with 1.3xENCUTMAX of POTCAR, when ENCUT is less than that.

incar_key(line)

Return the INCAR key a line sets, upper-cased, or None.

incar_value(line)

Return the text a line assigns to its key, stripped.

main()

main function

parse_vasp_in([path])

Read vasp.in into an ordered list of (key, value) pairs.

read_incar_lines([path])

Return the lines of an INCAR, or an empty list when it is missing.

split_path_labels(path_string)

Split an ASE band-path string into its labels.

vasp_process()

Processes the INCAR file using the 'vasp.in' file.

write_incar_lines(lines[, path])

Write lines back to an INCAR.

htesp.vasp_process.incar_key(line)[source]

Return the INCAR key a line sets, upper-cased, or None.

A line sets a key when the text before the first = is a single word. This is what sed -i '/KEY/d' was meant to match.

htesp.vasp_process.incar_value(line)[source]

Return the text a line assigns to its key, stripped.

htesp.vasp_process.read_incar_lines(path='INCAR')[source]

Return the lines of an INCAR, or an empty list when it is missing.

htesp.vasp_process.write_incar_lines(lines, path='INCAR')[source]

Write lines back to an INCAR.

htesp.vasp_process.drop_incar_keys(keys, path='INCAR')[source]

Remove every line of path that sets one of keys.

FIX(23): sed -i '/ENCUT/d' INCAR is a substring match, so deleting ENCUT also deleted ENCUTGW and deleting NELM also deleted NELMIN and NELMDL. The key is matched here at the start of the line, followed by optional whitespace and =.

htesp.vasp_process.parse_vasp_in(path='vasp.in')[source]

Read vasp.in into an ordered list of (key, value) pairs.

value is None for a key-only line, which means “delete this key from INCAR”.

FIX(24): the old parser appended keys and values to two independent lists and then paired them by index, so a key-only (delete) line anywhere but at the end shifted every later value onto the wrong key.

htesp.vasp_process.encut_check()[source]

Function to check ENCUT in INCAR file and replace with 1.3xENCUTMAX of POTCAR, when ENCUT is less than that.

htesp.vasp_process.vasp_process()[source]

Processes the INCAR file using the ‘vasp.in’ file. Look for ‘vasp.in’ file in the utility folder as a demo.

If ‘vasp.in’ is found, it reads the file and replaces corresponding keys in the ‘INCAR’ file with the provided values. Existing keys such as ISPIN, MAGMOM, and LORBIT in ‘INCAR’ are removed to avoid conflicts. If magnetic moment values are provided in ‘config.json’, it updates the ‘MAGMOM’ keyword accordingly. If ‘METAGGA’ is present, ‘LMIXTAU = .TRUE.’ is added to ‘INCAR’. To remove unwanted keywords from ‘INCAR’, put those keywords at the bottom in ‘vasp.in’ file after the keyword that has values.

Returns:

None

htesp.vasp_process.eigen_process()[source]

Process the EIGENVAL file generated by VASP.

Reads the ‘input.in’ file to determine if the ‘vasp-line’ keyword is present, indicating a line-mode calculation.

Reads the ‘EIGENVAL’ file to extract band structure data and writes it to ‘band.dat’.

If ‘vasp-line’ is present or the weight of a k-point is less than 0.000001, it writes the k-point index and corresponding band energies to ‘band.dat’. Otherwise, it skips the k-point and its associated data.

Additionally, it creates ‘band.dat.gnu’, a file suitable for plotting band structures in GNUPlot.

Returns:

None

htesp.vasp_process.split_path_labels(path_string)[source]

Split an ASE band-path string into its labels.

'GXWK1G' -> ['G', 'X', 'W', 'K1', 'G']: a digit belongs to the label in front of it.

htesp.vasp_process.band_phonopy(filename)[source]

Write k-points of high-symmetry points for Phonopy band structure plot using ‘band.conf’ file.

Parameters:

filenamestr

The name of the file containing the crystal structure, either ‘POSCAR’ for VASP or ‘scf.in’ for Espresso.

Returns:

None

htesp.vasp_process.main()[source]

main function