IO functions

Readers

class storq.vasp.readers.Readers[source]
read(restart=None)[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.

Todo

complete docstring with description of parameters and return value

read_atoms()[source]

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_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_neb()[source]

Read an NEB calculator.

Todo

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_potcar(fname=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
Returns:
Return type:boolean

Writers

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.

Parameters:
  • 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(incar=None)[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(atoms=None, properties=None, system_changes=None)[source]

Writes all input files required for a calculation.

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

Todo

Complete docstring

write_kpoints(fname=None)[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

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(fname=None)[source]

Write POSCAR file.

Parameters:fname (str) – output file name
write_potcar(fname=None)[source]

Write POTCAR file.

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

Parameters:fname (str) – output file name