IO functions


class storq.vasp.readers.Readers[source]

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


Read the final atoms object. and return the user defined order (unsort) if able.

Returns:atomic structure
Return type:ASE Atoms object
static read_convergence()[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

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 an NEB calculator.


complete docstring

static read_number_of_ionic_steps()[source]

Read the number of ionic steps from the OUTCAR file.

Returns:the number of ionic steps
Return type:int
static read_outcar_validity()[source]

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

Returns:True if VASP finished properly.
Return type:bool
static read_poscar()[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


class storq.vasp.writers.Writers[source]
write_db(fname=None, atoms=None, parser=None, overwrite=True, keys={}, data={}, del_info=[], **kwargs)[source]

Compile vasp calculation information into a database. primarily used to write the database file. Only row 1 should be in the current DB database.

  • fname (str) – The name of the database to collect calculator information in. Defaults to storq.db in vasp dir.
  • 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 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(atoms=None, properties=None, system_changes=None)[source]

Writes all input files required for a calculation.

  • atoms (ASE Atoms object) – atomic structure, for which calculation is to be performed
  • properties
  • system_changes


Complete docstring


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

Parameters:fname (str) – output file name

Write POTCAR file.

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

Parameters:fname (str) – output file name