dfttk package

Submodules

dfttk.eos_fit module

dfttk.workflows module

Workflows to automate VASP calculations using custodian.

dfttk.workflows.NELM_reached(path)[source]

Prints the path of the calculations that have reached NELM.

Parameters:

path (str) – path to the folder containing all the calculation folders. E.g. vol_1, phonon_1, etc.

Return type:

None

dfttk.workflows.charge_density_difference(path, vasp_cmd, handlers, backup=False, max_errors=10)[source]

Runs a charge density difference calculation. The charge_density_difference is calculated as the difference between the charge density of the final electronic step and the charge density of a single step.

Parameters:
  • path (str) – path that contains the VASP input files.

  • vasp_cmd (list[str]) – VASP commands to run VASP specific to your system. E.g. [“srun”, “vasp_std”].

  • handlers (list[str]) – custodian handlers to catch errors. See class ‘custodian.vasp.handlers.VaspErrorHandler’.

  • backup (bool, optional) – If True, the starting INCAR, KPOINTS, POSCAR and POTCAR files will be copied with a “.orig”

  • False. (appended. Defaults to)

  • max_errors (int, optional) – maximum number of errors before stopping the calculation. Defaults to 10.

Returns:

The charge density difference between the final electronic step and a single step.

Return type:

Chgcar

dfttk.workflows.custodian_errors_location(path)[source]

Prints the calculation folders containing the custodian errors in the specified path.

Parameters:

path (str) – path to the folder containing all the calculation folders. E.g. vol_1, phonon_1, etc.

Returns:

volume folders that encountered VASP errors list[str]: phonon folders that encountered VASP errors

Return type:

list[str]

dfttk.workflows.elec_dos_parallel(path, volumes, kppa, run_file, scaling_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)))[source]

Runs the run_elec_dos function in parallel for a list of volumes.

Parameters:
  • path (str) – path to the folder containing the VASP input files.

  • volumes (list[float]) – a list of volumes to run the electron DOS calculations for.

  • kppa (float) – k-point grid density.

  • run_file (str) – bash script to run the electron DOS calculations.

  • scaling_matrix (tuple[tuple[int]]) – scaling matrix for the supercell. The default is the identity matrix.

Return type:

None

dfttk.workflows.encut_conv_test(path, vasp_cmd, handlers, encut_list=[270, 320, 370, 420, 470, 520, 570, 620, 670, 720, 770, 820], backup=False, max_errors=10)[source]

Runs a series of VASP calculations with different ENCUT values for convergence testing.

Parameters:
  • path (str) – path to the folder containing the VASP input files

  • vasp_cmd (list[str]) – VASP commands to run VASP specific to your system. E.g. [“srun”, “vasp_std”].

  • handlers (list[str]) – custodian handlers to catch errors. See class ‘custodian.vasp.handlers.VaspErrorHandler’.

  • encut_list (list[int], optional) – list of ENCUT values to run the calculations for.

  • [270 (Defaults to)

  • 320

  • 370

  • 420

  • 470

  • 520

  • 570

  • 620

  • 670

  • 720

  • 770

  • 820].

  • backup (bool, optional) – If True, appends the original POSCAR, POTCAR, INCAR, and KPOINTS files with .orig. Defaults to False.

  • max_errors (int, optional) – maximum number of errors before stopping the calculation. Defaults to 10.

dfttk.workflows.ev_curve_series(path, volumes, vasp_cmd, handlers, restarting=False, keep_wavecar=False, keep_chgcar=False, copy_magmom=True, default_settings=True, override_2relax=None, override_3static=None, max_errors=10)[source]

Runs a series of three_step_relaxation calculations for a list of volumes.

Parameters:
  • path (str) – path to the folder containing the VASP input files.

  • volumes (list[float]) – list of volumes

  • vasp_cmd (list[str]) – VASP commands to run VASP specific to your system. E.g. [“srun”, “vasp_std”].

  • handlers (list[str]) – custodian handlers to catch errors. See class ‘custodian.vasp.handlers.VaspErrorHandler’.

  • restarting (bool, optional) – for restarting failed jobs. Defaults to False.

  • keep_wavecar (bool, optional) – if True, does not delete WAVECAR.3static. Defaults to False.

  • keep_chgcar (bool, optional) – if True, does not delete CHGCAR.3static. Defaults to False.

  • copy_magmom (bool, optional) – If True, copies the magmom from an OUTCAR file of one run to the INCAR

  • False. (file of the next run. Defaults to)

  • default_settings (bool, optional) – Use the default settings for three_step_relaxation. Defaults to True.

  • override_2relax (list, optional) – override settings for the second relaxation step. Defaults to None.

  • override_3static (list, optional) – override settings for the final static step. Defaults to None.

  • max_errors (int, optional) – maximum number of errors before stopping the calculation. Defaults to 10.

Return type:

None

dfttk.workflows.kpoints_conv_test(path, vasp_cmd, handlers, kppa_list=[1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000], force_gamma=True, backup=False, max_errors=10)[source]

Runs a series of VASP calculations with different k-point densities for convergence testing.

Parameters:
  • path (str) – the path to the folder containing the VASP input files

  • vasp_cmd (list[str]) – the VASP commands to run VASP specific to your system. E.g. [“srun”, “vasp_std”].

  • handlers (list[str]) – custodian handlers to catch errors. See class ‘custodian.vasp.handlers.VaspErrorHandler’.

  • kppa_list (list[float], optional) – k-point densities. Defaults to [ 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, ].

  • force_gamma (bool, optional) – If True, forces a gamma-centered mesh. Defaults to True.

  • backup (bool, optional) – If True, appends the original POSCAR, POTCAR, INCAR, and KPOINTS files with

  • False. (.orig. Defaults to)

  • max_errors (int, optional) – maximum number of errors before stopping the calculation. Defaults to 10.

dfttk.workflows.merge_custodian_json_files(path)[source]

Merges the custodian.json and prev_custodian.json files in the path. The prev_custodian.json file is the custodian.json file from the previous run, while the custodian.json file is the custodian.json file from the current restart run. The merged custodian.json file will contain the combined settings from the two files.

Parameters:

path (str) – path to the folder containing the custodian.json and prev_custodian.json files.

Return type:

None

dfttk.workflows.move_folders(src_path, dest_path, folders)[source]

Moves folders from the source path to the destination path. It is used to move previous error folders when restarting a job to a temporary folder.

Parameters:
  • src_path (str) – path to the source folder containing the error folders.

  • dest_path (str) – path to the destination folder to move the error folders.

  • folders (list[str]) – list of error folders to move.

Return type:

None

dfttk.workflows.phonons_parallel(path, phonon_volumes, kppa, run_file, scaling_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)))[source]

Executes the run_phonons function in parallel for a list of phonon volumes.

Parameters:
  • path (str) – path to the folder containing the vol_* folders.

  • phonon_volumes (list[float]) – a list of volumes to run the phonon calculations for. Must match the volumes in the vol_* folders.

  • kppa (int) – kppa of the phonon calculations.

  • run_file (str) – job script to run the phonon calculations.

  • scaling_matrix (tuple[tuple[int]]) – scaling matrix for the supercell. Defaults to ((1, 0, 0), (0, 1, 0), (0, 0, 1)).

  • relax (bool, optional) – whether to run a relaxation before the phonon calculation. Defaults to True.

Return type:

None

dfttk.workflows.process_error_folders(path, prev_error_folders_count)[source]

Processes the error folders in the path by renaming and moving them. It is used to rename the error folders when restarting a job according to the number of error folders that were moved to a temporary folder from the previous run. For example, if the error folders in the temporary folder are error.1.tar and error.2.tar, the error folders in the path will be renamed from error.1.tar to error.3.tar and error.2.tar to error.4.tar. Then, the error folders in the temporary folder will be moved to the path and the temporary folder will be removed.

Parameters:
  • path (str) – path to the folder containing the error folders.

  • prev_error_folders_count (int) – count of error folders that was moved using move_folders.

Return type:

None

dfttk.workflows.process_phonon_dos_YPHON(path)[source]

Processes the phonon DOS calculations using YPHON.

Parameters:

path (str) – path to the folder containing all the phonon calculation folders. E.g. phonon_1, phonon_2, etc.

dfttk.workflows.rename_error_folders(path, error_folders_old, prev_error_folders_count)[source]

Renames the error folders in the path. It is used to rename the error folders when restarting a job according to the number of error folders that were moved to a temporary folder from the previous run. For example, if the error folders in the temporary folder are error.1.tar and error.2.tar, the error folders in the path will be renamed from error.1.tar to error.3.tar and error.2.tar to error.4.tar.

Parameters:
  • path (str) – path to the folder containing the error folders.

  • error_folders_old (list[str]) – list of error folders to rename.

  • prev_error_folders_count (int) – count of error folders that was moved using move_folders.

Return type:

None

dfttk.workflows.run_elec_dos(vasp_cmd, handlers, NEDOS=10001, backup=False, max_errors=10)[source]

Runs an electronic DOS calculation.

Parameters:
  • vasp_cmd (list[str]) – VASP commands to run VASP specific to your system. E.g. [“srun”, “vasp_std”].

  • handlers (list[str]) – custodian handlers to catch errors. See class ‘custodian.vasp.handlers.VaspErrorHandler’.

  • copy_magmom (bool, optional) – If True, copies the magmom from an OUTCAR file of one run to the INCAR

  • False. (.orig. Defaults to)

  • backup (bool, optional) – If True, appends the original POSCAR, POTCAR, INCAR, and KPOINTS files with

  • False.

  • max_errors (int, optional) – maximum number of errors before stopping the calculation. Defaults to 10.

dfttk.workflows.run_phonons(vasp_cmd, handlers, copy_magmom=True, backup=False, max_errors=10, relax=True)[source]

Runs a relaxation followed by a phonon calculation.

Parameters:
  • vasp_cmd (list[str]) – VASP commands to run VASP specific to your system. E.g. [“srun”, “vasp_std”].

  • handlers (list[str]) – custodian handlers to catch errors. See class ‘custodian.vasp.handlers.VaspErrorHandler’.

  • copy_magmom (bool, optional) – If True, copies the magmom from an OUTCAR file of one run to the INCAR

  • False. (.orig. Defaults to)

  • backup (bool, optional) – If True, appends the original POSCAR, POTCAR, INCAR, and KPOINTS files with

  • False.

  • max_errors (int, optional) – maximum number of errors before stopping the calculation. Defaults to 10.

  • relax (bool, optional) – if True, runs a relaxation before the phonon calculation. Defaults to True.

dfttk.workflows.three_step_relaxation(path, vasp_cmd, handlers, copy_magmom=True, backup=False, default_settings=True, override_2relax=None, override_3static=None, max_errors=10, restart=None)[source]
Runs a three-step relaxation - two consecutive relaxations followed by

one static.

Parameters:
  • path (str) – path to the folder containing the VASP input files

  • vasp_cmd (list[str]) – VASP commands to run VASP specific to your system. E.g. [“srun”, “vasp_std”].

  • handlers (list[str]) – custodian handlers to catch errors. See class ‘custodian.vasp.handlers.VaspErrorHandler’.

  • copy_magmom (bool, optional) – If True, copies the magmom from an OUTCAR file of one run to the INCAR

  • False. (.orig. Defaults to)

  • backup (bool, optional) – If True, appends the original POSCAR, POTCAR, INCAR, and KPOINTS files with

  • False.

  • default_settings (bool, optional) – if True, uses the default settings for the relaxation and static steps. Defaults to True.

  • override_2relax (list, optional) – override settings for the second relaxation step. Defaults to None.

  • override_3static (list, optional) – override settings for the final static step. Defaults to None.

  • max_errors (int, optional) – maximum number of errors before stopping the calculation. Defaults to 10.

  • restart (str, optional) – if not None, restarts the calculation from the specified step. Defaults to None.

Return type:

None

Module contents