shakenbreak.io module#

Module to parse input and output files for VASP, Quantum Espresso, FHI-aims, CASTEP and CP2K.

shakenbreak.io.parse_energies(defect: str, path: str | None = '.', code: str | None = 'vasp', filename: str | None = 'OUTCAR', verbose: bool = False) None[source]#

Parse final energy for all distortions present in the given defect directory and write them to a yaml file in the defect directory. Returns the energies_file path.

Parameters:
  • defect (str) – Name of defect to parse, including charge state. Should match the name of the defect folder.

  • ( (path) – obj: str): Path to the top-level directory containing the defect folder. Defaults to current directory (“.”).

  • code (str) – Name of ab-initio code used to run the geometry optimisations, case insensitive. Options include: “vasp”, “cp2k”, “espresso”, “castep” and “fhi-aims”. Defaults to “vasp”.

  • filename (str) – Filename of the output file, if different from the ShakeNBreak defaults that are defined in the default input files: (i.e. vasp: “OUTCAR”, cp2k: “relax.out”, espresso: “espresso.out”, castep: “*.castep”, fhi-aims: “aims.out”) Default to the ShakeNBreak default filenames.

  • verbose (bool) – If True, print information about renamed/saved-over files. Defaults to False.

Returns: energies_file path.

shakenbreak.io.parse_fhi_aims_input(path: str) dict[source]#

Parse the input file of FHI-aims and return it as a dictionary of the parameters.

Parameters:

path (str) – Path to the Quantum Espresso input file.

Returns: dict

shakenbreak.io.parse_qe_input(path: str) dict[source]#

Parse the input file of Quantum Espresso and return it as a dictionary of the parameters.

Parameters:

path (str) – Path to the Quantum Espresso input file.

Returns: dict

shakenbreak.io.parse_structure(code: str, structure_path: str, structure_filename: str) Structure | str[source]#

Parses the output structure from different codes (VASP, CP2K, Quantum Espresso, CATSEP, FHI-aims) and converts it to a pymatgen Structure object.

Parameters:
  • code (str) – Code used for geometry optimizations. Valid code names are: “vasp”, “espresso”, “cp2k”, “castep” and “fhi-aims” (case insensitive).

  • structure_path (str) – Path to directory containing the structure file.

  • structure_filename (str) – Name of the structure file or the output file containing the optimized structure. If not set, the following values will be used for each code: vasp: “CONTCAR”, cp2k: “cp2k.restart” (The restart file is used), Quantum espresso: “espresso.out”, castep: “castep.castep” (castep output file is used) fhi-aims: geometry.in.next_step

Returns:

pymatgen Structure object

Return type:

Structure

shakenbreak.io.read_castep_structure(filename: str) Structure | str[source]#

Reads a structure from CASTEP output (.castep) file and returns it as a pymatgen Structure.

Parameters:

filename (str) – Path to the CASTEP output file.

Returns:

pymatgen Structure object

Return type:

Structure

shakenbreak.io.read_cp2k_structure(filename: str) Structure | str[source]#

Reads a structure from CP2K restart file and returns it as a pymatgen Structure.

Parameters:

filename (str) – Path to the cp2k restart file.

Returns:

pymatgen Structure object

Return type:

Structure

shakenbreak.io.read_espresso_structure(filename: str) Structure | str[source]#

Reads a structure from Quantum Espresso output and returns it as a pymatgen Structure.

Parameters:

filename (str) – Path to the Quantum Espresso output file.

Returns:

pymatgen Structure object

Return type:

Structure

shakenbreak.io.read_fhi_aims_structure(filename: str, format='aims') Structure | str[source]#

Reads a structure from FHI-aims output and returns it as a pymatgen Structure.

Parameters:
  • filename (str) – Path to the FHI-aims output file.

  • format (str) – either aims-output (output file) aims (geometry file)

Returns:

pymatgen Structure object

Return type:

Structure

shakenbreak.io.read_vasp_structure(file_path: str) Structure | str[source]#

Read VASP structure from file_path and convert to pymatgen Structure object.

Parameters:

file_path (str) – Path to VASP CONTCAR file

Returns:

pymatgen Structure object

Return type:

Structure