IO functions


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 the final atoms object. and return the user defined order (unsort) if able.

Return type:Atoms or None

Read the self.parameters and atoms, not the results(!).

Overwrites the parent ase calculator method, and is called upon initialization of the calculator. Restart is ignored but part of the signature for ase.


complete docstring with description of parameters and return value


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 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 file.

Parameters:fname (str) – name of input file
Returns:k-point tags
Return type:ASE Parameters dictionary
read_potcar(fname: str = 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 energy, forces, stress, magmom and magmoms from output file.

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


complete docstring with description of parameters and return value


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

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

Return ENMAX from the potcar file.


Return ENMIN from the potcar file.

storq.vasp.readers.read_num_ionic_steps(outcar: str = 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) → 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]

Return the ZVAL for a potcar file.

parse this line:
POMASS = 106.420; ZVAL = 10.000 mass and valenz


class storq.vasp.writers.Writers[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

Writes all input files required for a calculation.


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

After the kpts may follow information regarding the tetrahedra, but we do not support that for now.

Parameters:fname (str) – output file name
write_persistence_db(atoms=None, parser=None, overwrite=True, keys={}, data={}, del_info=[], **kwargs)[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.

  • atoms (ASE Atoms objectc) – Structure to write to the database. If None, the atoms object will be the image attached to the calculator.
  • parser (str) – A tool for generating key-value-pairs from the calculators directory path. Pairs will be separated by directory and key- values will be separated by parser. If None, no key-value-pair information will be collected.
  • overwrite (bool) – Whether the database file should be overwritten or not.
  • keys (dict) – Additional key-value-pairs to include in the database.
  • data (dict) – Additional data to include in the database.
  • del_info (list) – Keys to be removed from the data of key_value_pairs of the database file.

Write POSCAR file.


Write POTCAR file.

POTCARs are expected to reside in self.conf[‘vasp_potentials’].

Parameters:fname (str) – output file name