IO functions

Readers

class storq.vasp.readers.Readers[source]

Mixin class of reader-type methods for the Vasp calculator.

These methods are all dependent on some calculator property or reimplement ASE methods and hence cannot be factored out of the calculator.

read_atoms()[source]

Read the first and final atoms objects.

Return type:

Atoms or None

read_forces(latest=True)[source]

Method that reads forces from OUTCAR file.

If ‘latest’ is switched off, the forces for all ionic steps in the OUTCAR file be returned, in other case only the forces for the last ionic configuration is returned.

read_incar(fname=None)[source]

Read fname (defaults to INCAR).

This only reads simple INCAR files, e.g. one tag per line, and with no comments in the line. There is no knowledge of any Vasp keywords in this, and the values are converted to Python types by some simple rules.

Parameters:

fname (str) – name of input file

Returns:

parameters from INCAR file

Return type:

dict

read_kpoints(fname=None)[source]

Read KPOINTS file.

Parameters:

fname (str) – name of input file

Returns:

k-point tags

Return type:

ASE Parameters dictionary

read_parameters()[source]
read_potcar(fname: str | None = None)[source]

Read the POTCAR file to get the information regarding PAW/pseudopotential setups.

Parameters:

fname (str) – name of input file

Returns:

PAW/pseudopotential setups

Return type:

ASE Parameters dictionary

read_results()[source]

Read energy, forces, stress, magmom and magmoms from output file.

Other quantities will be read by other functions. This depends on the calculator state.

Todo

complete docstring with description of parameters and return value

storq.vasp.readers.isfloat(s)[source]

Return True if s is a float.

We check if it is not an integer first, then try to cast it as a float.

Parameters:

s (str) – input string

Return type:

boolean

storq.vasp.readers.read_convergence(outcar=None)[source]

Checks whether a calculation has converged.

Performs a strict convergence checks in the sense that electronic as well as ionic convergence is explicitly chechked for by comparing their magnitude to EDIFF and EDIFFG.

Returns:

A list of two bools indicating if the electronic SCF cycle and the ionic relaxation converged, respectively.

Return type:

list

storq.vasp.readers.read_enmax(potcar)[source]

Return ENMAX from the potcar file.

storq.vasp.readers.read_enmin(potcar)[source]

Return ENMIN from the potcar file.

storq.vasp.readers.read_num_ionic_steps(outcar: str | None = None) int[source]

Returns the number of ionic steps from the OUTCAR file.

Parameters:

outcar – name of input file [default: OUTCAR]

storq.vasp.readers.read_outcar_validity(outcar: str | None = None) bool[source]

Returns True if VASP finished properly.

If VASP itself is cancelled (batch_walltime or explicitly by user) or encounters certain errors it won’t ouput the typical Voluntary context switch count on the last line of the OUTCAR.

Parameters:

outcar – name of input file [default: OUTCAR]

storq.vasp.readers.read_zval(potcar)[source]

Return the ZVAL for a potcar file.

parse this line:

POMASS = 106.420; ZVAL = 10.000 mass and valenz

Writers

class storq.vasp.writers.Writers[source]
write_incar()[source]

Write INCAR file.

Boolean values are written as .TRUE./.FALSE.; integers, floats and strings are written out as is; lists and tuples are written out as space separated values.

Parameters:

fname (str) – output file name

write_input()[source]

Writes all VASP input files required for a calculation.

This includes the vdW kernel, which is symlinked if needed, but not the storq persistence database which is handled separately.

write_kpoints()[source]

Write KPOINTS file.

The KPOINTS file format is as follows:

  • line 1: a comment

  • line 2: number of kpoints
    • n <= 0 Automatic kpoint generation

    • n > 0 explicit number of kpoints

  • line 3: kpt format
    • if n > 0: C,c,K,k = cartesian coordinates anything else = reciprocal coordinates

    • if n <= 0: M,m,G,g for Monkhorst-Pack or Gamma grid anything else is a special case

  • line 4: * if n <= 0, the Monkhorst-Pack grid * if n > 0, then one line per kpoint

  • line 5: if n <= 0 it is the gamma shift

write_persistence_db(atoms=None, data=None)[source]

Database containing persistence information for storq calculations.

Contains atoms, results, parameters and confiugration for easy restart. Note that the datbase should only contain a single row.

write_poscar()[source]

Write POSCAR file.

write_potcar()[source]

Write POTCAR file.