doped module (__init__.py)

doped is a python package for managing solid-state defect calculations, with functionality to generate defect structures and relevant competing phases (for chemical potentials), interface with ShakeNBreak (https://shakenbreak.readthedocs.io) for defect structure-searching (see https://www.nature.com/articles/s41524-023-00973-1), write VASP input files for defect supercell calculations, and automatically parse and analyse the results.

exception doped.ParameterOrderWarning[source]

Bases: FutureWarning

Warning about the (bulk, defect) -> (defect, bulk) parameter ordering change for some functions in doped v4.0.

TODO: Remove all parameter-order warning handling in v4.1.

doped.get_mp_context()[source]

Get a multiprocessing context that is compatible with the current OS.

doped.get_mp_processes(processes: int | None = None)[source]

Get the number of processes to use with Pool.

doped.patch_vise_for_windows()[source]

Context manager to patch vise.defaults.UserSettings._make_yaml_file_list, so that it returns an empty list.

Fixes an issue where this function gives an infinite recursive search on Windows, causing hanging.

doped.pool_manager(processes: int | None = None)[source]

Context manager for multiprocessing Pool, to throw a clearer error message when RuntimeErrors are raised multiprocessing within doped is used in a python script.

See the Errors with Python Scripts section.

Parameters:

processes (int | None) – Number of processes to use with Pool. If None, will use mp.cpu_count() - 1 (i.e. one less than the number of available CPUs).

Yields:

Pool – A Pool object with the specified number of processes.

doped.suppress_logging(level=50)[source]

Context manager to catch and suppress logging messages.

doped.vise_handling(level=50)[source]

Suppress logging, patch fatal Windows issue and prevent warning suppression with vise/pydefect, by combining the suppress_logging(), patch_vise_for_windows() and warnings.catch_warnings() context managers.