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

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

Main function.

pymatgen.cli.get_environment module

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

main() int[source]

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

Handle diff commands.

Parameters:

args – Args from command.

main()[source]

Handle main.

parse_view(args)[source]

Handle view commands.

Parameters:

args – Args from command.

pymatgen.cli.pmg_analyze module

Implementation for pmg analyze CLI.

analyze(args)[source]

Master function controlling which analysis to call.

Parameters:

args (dict) – args from argparse.

get_energies(rootdir, reanalyze, verbose, quick, sort, fmt)[source]

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(dir: str, ion_list: list[int])[source]

Get magnetization info from OUTCARs.

Parameters:
  • dir (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[source]

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

build_bader(fortran_command='gfortran')[source]

Build bader package.

Parameters:

fortran_command – The Fortran compiler command.

build_enum(fortran_command: str = 'gfortran') bool[source]

Build enum.

Parameters:

fortran_command – The Fortran compiler command.

configure_pmg(args: Namespace)[source]

Handle configure command.

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

Install all optional external software.

setup_cp2k_data(cp2k_data_dirs: list[str]) None[source]

Setup CP2K basis and potential data directory.

setup_potcars(potcar_dirs: list[str])[source]

Setup POTCAR directories.

pymatgen.cli.pmg_plot module

Implementation for pmg plot CLI.

get_chgint_plot(args, ax: Axes = None) Axes[source]

Plot integrated charge.

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

Plot DOS.

Parameters:

args (dict) – Args from argparse.

get_xrd_plot(args)[source]

Plot XRD.

Parameters:

args (dict) – Args from argparse

plot(args)[source]

Master control method calling other plot methods based on args.

Parameters:

args (dict) – Args from argparse.

pymatgen.cli.pmg_potcar module

Implementation for pmg potcar CLI.

gen_potcar(dirname, filename)[source]

Generate POTCAR from POTCAR.spec in directories.

Parameters:
  • dirname (str) – Directory name.

  • filename (str) – Filename in directory.

generate_potcar(args)[source]

Generate POTCAR.

Parameters:

args (dict) – Args from argparse.

proc_dir(dirname, proc_file_function)[source]

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

Analyze local env of structures in files.

Parameters:

args (dict) – Args for argparse.

analyze_structures(args)[source]

Master function to handle which operation to perform.

Parameters:

args (dict) – Args from argparse.

analyze_symmetry(args)[source]

Analyze symmetry of structures in files.

Parameters:

args (dict) – Args from argparse.

compare_structures(args)[source]

Compare structures in files for similarity using structure matcher.

Parameters:

args (dict) – Args from argparse.

convert_fmt(args)[source]

Convert files from one format to another.

Parameters:

args (dict) – Args from argparse.