# pymatgen.cli package

This package contains various command line interfaces for common pymatgen functionality such as file conversion, etc. Entry points to these interfaces are defined in setup.py.

## Submodules

## pymatgen.cli.feff_plot_cross_section module

Script for plotting cross sections generated by FEFF found in xmu.dat files.

main()

  Main function.

## pymatgen.cli.feff_plot_dos module

Script to plot density of states (DOS) generated by an FEFF run either by site, element, or orbital.

main()

  Main function.

## pymatgen.cli.get_environment module

Command line script to get the chemical environment of a structure.

main() → int

  Main function for get_environment CLI.

## pymatgen.cli.pmg module

A master convenience script with many tools for vasp and structure analysis.

diff_incar(args)

  Handle diff commands.

  Parameters:

    args – Args from command.

main()

  Handle main.

parse_view(args)

  Handle view commands.

  Parameters:

    args – Args from command.

## pymatgen.cli.pmg_analyze module

Implementation for pmg analyze CLI.

analyze(args)

  Master function controlling which analysis to call.

  Parameters:

    args (dict) – args from argparse.

get_energies(rootdir, reanalyze, verbose, quick, sort, fmt)

  Get energies of all vaspruns in directory (nested).

  Parameters:

    - rootdir (str) – Root directory.

    - reanalyze (bool) – Whether to ignore saved results and reanalyze

    - verbose (bool) – Verbose mode or not.

    - quick (bool) – Whether to perform a quick analysis (using OSZICAR instead of vasprun.xml

    - sort (bool) – Whether to sort the results in ascending order.

    - fmt (str) – tablefmt passed to tabulate.

get_magnetizations(dirc: str, ion_list: list[int])

  Get magnetization info from OUTCARs.

  Parameters:

    - dirc (str) – Directory name

    - ion_list (list[int]) – List of ions to obtain magnetization information for.

  Returns:

    0 if successful.

  Return type:

    int

## pymatgen.cli.pmg_config module

Implementation for pmg config CLI.

add_config_var(tokens: list[str], backup_suffix: str) → None

  Add/update keys in .pmgrc.yaml config file.

build_bader(fortran_command='gfortran')

  Build bader package.

  Parameters:

    fortran_command – The Fortran compiler command.

build_enum(fortran_command: str = 'gfortran') → bool

  Build enum.

  Parameters:

    fortran_command – The Fortran compiler command.

configure_pmg(args: Namespace)

  Handle configure command.

install_software(install: Literal['enumlib', 'bader'])

  Install all optional external software.

setup_cp2k_data(cp2k_data_dirs: list[str]) → None

  Setup CP2K basis and potential data directory.

setup_potcars(potcar_dirs: list[str])

  Setup POTCAR directories.

## pymatgen.cli.pmg_plot module

Implementation for pmg plot CLI.

get_chgint_plot(args, ax: Axes | None = None) → Axes

  Plot integrated charge from CHGCAR file.

  Parameters:

    - args (dict) – args from argparse.

    - ax (plt.Axes) – Matplotlib Axes object for plotting.

  Returns:

    Matplotlib Axes object.

  Return type:

    plt.Axes

get_dos_plot(args) → Axes

  Plot DOS from vasprun.xml file.

  Parameters:

    args (dict) – Args from argparse.

get_xrd_plot(args) → Axes

  Plot XRD from structure.

  Parameters:

    args (dict) – Args from argparse

plot(args) → None

  Master control function calling other plot functions based on args.

  Parameters:

    args (dict) – Args from argparse.

## pymatgen.cli.pmg_potcar module

Implementation for pmg potcar CLI.

gen_potcar(dirname, filename)

  Generate POTCAR from POTCAR.spec in directories.

  Parameters:

    - dirname (str) – Directory name.

    - filename (str) – Filename in directory.

generate_potcar(args)

  Generate POTCAR.

  Parameters:

    args (dict) – Args from argparse.

proc_dir(dirname, proc_file_function)

  Process a directory.

  Parameters:

    - dirname (str) – Directory name.

    - proc_file_function (callable) – Callable to execute on directory.

## pymatgen.cli.pmg_structure module

Implementation for pmg structure CLI.

analyze_localenv(args)

  Analyze local env of structures in files.

  Parameters:

    args (dict) – Args for argparse.

analyze_structures(args)

  Master function to handle which operation to perform.

  Parameters:

    args (dict) – Args from argparse.

analyze_symmetry(args)

  Analyze symmetry of structures in files.

  Parameters:

    args (dict) – Args from argparse.

compare_structures(args)

  Compare structures in files for similarity using structure matcher.

  Parameters:

    args (dict) – Args from argparse.

convert_fmt(args)

  Convert files from one format to another.

  Parameters:

    args (dict) – Args from argparse.