abipy.scripts package

Empty file, needed by sphinxarg.ext so that scripts can be imported.

Submodules

abipy.scripts.abicheck module

Diagnostic tool to verify the AbiPy environment and configuration.

This script checks that the required Python packages are installed, the Abinit executable is reachable, and the configuration files (manager.yml, scheduler.yml) are correctly set up.

It can also be used to automatically install template configuration files and run a small test flow to verify the entire toolchain.

Examples

Run basic consistency checks:

$ abicheck.py

Run a full test including the execution of a small Abinit flow:

$ abicheck.py –with-flow

Install template configuration files in ~/.abinit/abipy/:

$ abicheck.py -c

Show available manager templates provided by AbiPy:

$ abicheck.py -m

abipy.scripts.abicheck.show_managers(options)[source]

Print a table with manager configuration files provided by AbiPy.

Parameters:

options – Namespace object containing command-line options.

Returns:

System exit code.

Return type:

int

abipy.scripts.abicheck.get_epilog()[source]

Return the epilog string for the command-line parser.

Return type:

str

abipy.scripts.abicheck.get_parser(with_epilog=False)[source]

Return the ArgumentParser object for the script.

Parameters:

with_epilog – If True, include the epilog in the parser.

abipy.scripts.abicheck.main()[source]

Main entry point for the script.

abipy.scripts.abicheck.make_scf_nscf_inputs(paral_kgb=0)[source]

Returns two input files: GS run and NSCF on a high symmetry k-mesh.

abipy.scripts.abicheck.run_flow(options)[source]

Build and run a small Abinit flow to test the environment.

Parameters:

options – Namespace object containing command-line options.

Returns:

Exit code of the scheduler.

Return type:

int

abipy.scripts.abicomp module

Command-line tool to compare results from multiple Abinit files.

This script allows users to perform comparative analysis of structures, electron band structures/DOS, phonon properties, and more across multiple output files. It uses “Robots” to aggregate data from many files and provides tools for grouping structures by similarity, comparing space groups, and generating multi-dataset plots.

Main Categories:

Structure: Compare crystal structures, lattice parameters, and XRD patterns. Electrons: Compare band structures and DOS on the same plot. Phonons: Compare phonon dispersion and DOS from different DDB/PHBST files. Robots: Batch process and compare data from netcdf files (GSR, SIGRES, etc.).

Examples

Compare lattice parameters for a list of CIF/netcdf files:

$ abicomp.py structure *.cif

Compare electron band structures from two GSR files:

$ abicomp.py ebands run1_GSR.nc run2_GSR.nc

Group structures by similarity (using pymatgen’s StructureMatcher):

$ abicomp.py structure –group *.poscar

Compare space group recognition between Abinit and spglib:

$ abicomp.py spg out_GSR.nc

Batch compare results from all GSR files in a directory:

$ abicomp.py gsr .

abipy.scripts.abicomp.remove_disordered(structures, paths)[source]

Remove disordered structures and print warning message.

abipy.scripts.abicomp.df_to_clipboard(options, df)[source]

Copy dataframe to clipboard if options.clipboard.

abipy.scripts.abicomp.abicomp_structure(options)[source]

Compare crystalline structures and print lattice parameters/coordinates.

Use the –group option to group structures by similarity.

Parameters:

options – Namespace object containing command-line options.

Returns:

System exit code.

Return type:

int

abipy.scripts.abicomp.compare_structures(options)[source]

Inspired to a similar function in pmg_structure.

abipy.scripts.abicomp.abicomp_spg(options)[source]

Compare the space group found by Abinit with the spglib results for a set of crystalline structure(s) read from FILE(s).

abipy.scripts.abicomp.abicomp_mp_structure(options)[source]

Compare the crystalline structure(s) read from FILE with the one(s) reported in the materials project database.

abipy.scripts.abicomp.abicomp_cod_structure(options)[source]

Compare the crystalline structure(s) read from FILE with the one(s) given in the COD database (http://www.crystallography.net/cod).

abipy.scripts.abicomp.abicomp_xrd(options)[source]

Compare X-ray diffraction plots (requires FILES with structure).

abipy.scripts.abicomp.abicomp_data(options)[source]

Compare results stored in multiple files with data in tabular format.

abipy.scripts.abicomp.abicomp_png(options)[source]

Use matplotlib to plot multiple png files on a grid.

abipy.scripts.abicomp.abicomp_ebands(options)[source]

Plot electron bands on a grid.

abipy.scripts.abicomp.abicomp_edos(options)[source]

Plot electron DOSes on a grid.

abipy.scripts.abicomp.abicomp_phbands(options)[source]

Plot phonon bands on a grid.

abipy.scripts.abicomp.abicomp_phdos(options)[source]

Compare multiple PHDOS files.

abipy.scripts.abicomp.abicomp_getattr(options)[source]

Extract attribute from Abipy object for all files listed on the command line and print them. Use –list option to list the attributes available (in the first file).

abipy.scripts.abicomp.abicomp_gsr(options)[source]

Compare multiple GSR files.

abipy.scripts.abicomp.abicomp_hist(options)[source]

Compare multiple HIST files.

abipy.scripts.abicomp.abicomp_ddb(options)[source]

Compare multiple DDB files. Assume DDB files with a list of q-points in the IBZ corresponding to homogeneous sampling i.e. files that have been merged with mrgddb.

abipy.scripts.abicomp.abicomp_anaddb(options)[source]

Compare multiple anaddb.nc files.

abipy.scripts.abicomp.abicomp_phbst(options)[source]

Compare multiple PHBST.nc files.

abipy.scripts.abicomp.abicomp_sigres(options)[source]

Compare multiple SIGRES files.

abipy.scripts.abicomp.abicomp_mdf(options)[source]

Compare macroscopic dielectric functions stored in multiple MDF files.

abipy.scripts.abicomp.abicomp_optic(options)[source]

Compare results stored in OPTIC.nc files.

abipy.scripts.abicomp.abicomp_a2f(options)[source]

Compare results stored in A2f.nc files.

abipy.scripts.abicomp.abicomp_gkq(options)[source]

Compare multiple GKQ files with EPH matrix elements for a given q-point.

abipy.scripts.abicomp.abicomp_v1qavg(options)[source]

Compare multiple V1QAVG files with the average of the DFPT V1 potentials as function of q-point.

abipy.scripts.abicomp.abicomp_sigeph(options)[source]

Compare multiple SIGEPH files storing the e-ph self-energy.

abipy.scripts.abicomp.abicomp_rta(options)[source]

Compare multiple RTA files.

abipy.scripts.abicomp.abicomp_abiwan(options)[source]

Compare multiple ABIWAN files.

abipy.scripts.abicomp.abicomp_abiwan_ebands(options)[source]

Compare Wannier-interpolated band structure with ab-initio data.

abipy.scripts.abicomp.abicomp_skw_ibz_kpath(options)[source]

Compare star-function-interpolated band structure with ab-initio band structure computed along a k-path.

abipy.scripts.abicomp.abicomp_pseudos(options)[source]

Compare multiple pseudos and print table to terminal.

abipy.scripts.abicomp.abicomp_psps(options)[source]

Compare multiple PSPS.nc files.

abipy.scripts.abicomp.abicomp_gwr(options)[source]

Compare multiple GWR files.

abipy.scripts.abicomp.abicomp_gs_scf(options)[source]

Compare ground-state SCF cycles.

abipy.scripts.abicomp.abicomp_dfpt2_scf(options)[source]

Compare DFPT SCF cycles.

abipy.scripts.abicomp.abicomp_text(options)[source]

Compare 2+ text files in the browser.

abipy.scripts.abicomp.abicomp_time(options)[source]

Analyze/plot the timing data of single or multiple runs.

abipy.scripts.abicomp.get_epilog()[source]

Return the epilog string for the command-line parser.

abipy.scripts.abicomp.get_parser(with_epilog=False)[source]

Return the ArgumentParser object for the script.

Parameters:

with_epilog – If True, include the epilog in the parser.

abipy.scripts.abicomp.serve_kwargs_from_options(options)[source]

Build and return a dictionary with keyword arguments for serving the panel app.

Parameters:

options – Namespace object containing command-line options.

abipy.scripts.abicomp.main()[source]

Main entry point for the script.

abipy.scripts.abidoc module

Command-line interface to access the documentation of ABINIT input variables.

This script allows users to search for variables, view their documentation, browse them in an external web browser, and visualize variable dependencies. It also provides documentation for AbiPy’s TaskManager and Scheduler options.

Examples

Show documentation for the ecut variable:

$ abidoc.py man ecut

Search for variables related to paw:

$ abidoc.py find paw

Open the official ABINIT documentation for acell in a web browser:

$ abidoc.py browse acell

Visualize dependencies for tolvrs using Graphviz:

$ abidoc.py graphviz tolvrs

List all variables in the base varset:

$ abidoc.py list –mode s

abipy.scripts.abidoc.print_vlist(vlist, options)[source]

Print a list of variables to the terminal.

Parameters:
  • vlist – List of AbinitVariable objects.

  • options – Namespace object containing command-line options.

abipy.scripts.abidoc.get_epilog()[source]

Return the epilog string for the command-line parser.

Return type:

str

abipy.scripts.abidoc.get_parser(with_epilog=False)[source]

Return the ArgumentParser object for the script.

Parameters:

with_epilog – If True, include the epilog in the parser.

abipy.scripts.abidoc.main()[source]

Main entry point for the script.

abipy.scripts.abigui module

Command-line tool to start the interactive AbiPy web GUI.

This script launches a multi-page web application built with the Panel framework. The GUI provides a user-friendly interface for Abinit input file generation, structure analysis, and comparative studies of electronic and vibrational properties against the Materials Project database.

Main Pages:

Input Generator: Interactive builder for Abinit input files. Structure Analyzer: Tools for visualizing and analyzing crystal structures. DDB/Ebands: Comparative analysis of phonon and electron results. Robot Analyzer: Batch process and compare multiple netcdf files.

Examples

Start the GUI locally on the default port:

$ abigui.py

Start the GUI with 4 worker processes and verbose logging:

$ abigui.py –num_procs 4 –verbose

Start the GUI in “remote server” mode (restricts certain local operations):

$ abigui.py –has-remote-server

abipy.scripts.abigui.main()[source]

Main entry point for the script.

abipy.scripts.abiml module

Command-line tool for Machine Learning (ML) potential calculations with ASE.

This script integrates Machine Learning potentials (e.g., CHGNet, MACE, M3GNet) with the Atomistic Simulation Environment (ASE) to perform geometry optimizations, molecular dynamics, and vibrational analysis (via Phonopy). It provides a simplified interface to various ML force fields and supports exporting results to standard formats.

Main Tasks:

Opt: Geometry optimization using various ASE optimizers. MD: Molecular dynamics simulations (NVE, NVT, NPT). Phonon: Phonon frequency calculations and band structures using ML potentials. Elastic: Computation of elastic constants. Energy: Single-point energy and force calculations.

Examples

Relax a structure using CHGNet (default):

$ abiml.py opt crystal.cif

Run NVT molecular dynamics for 1000 steps at 300K:

$ abiml.py md structure.poscar –steps 1000 –temperature 300 –ensemble nvt

Compute phonon bands using MACE potential:

$ abiml.py phonon structure.cif –potential-name mace

Calculate the elastic tensor of a material:

$ abiml.py elastic mp-149

abipy.scripts.abiml.set_default(ctx, param, filepath)[source]

To have config file for a single command: Based on https://stackoverflow.com/questions/46358797/python-click-supply-arguments-and-options-from-a-configuration-file

abipy.scripts.abiml.herald(f)[source]

Decorator to print the name of the function and the execution time.

abipy.scripts.abiml.add_constraint_opts(f)[source]

Add CLI options to constrain atoms.

abipy.scripts.abiml.add_relax_opts(f)[source]

Add CLI options for structural relaxations with ASE.

abipy.scripts.abiml.add_phonopy_opts(f, supercell=(2, 2, 2))[source]

Add CLI options for phonopy_calculations.

abipy.scripts.abiml.add_neb_opts(f)[source]

Add CLI options for NEB calculations with ASE.

abipy.scripts.abiml.add_nprocs_opt(f)[source]

Add CLI options for multiprocessing.

abipy.scripts.abiml.add_workdir_verbose_opts(f)[source]

Add workdir and verbose options to CLI subcommand.

abipy.scripts.abiml.add_nn_name_opt(f)[source]

Add CLI options to select the NN potential.

abipy.scripts.abiml.add_nn_names_opt(f)[source]

Add CLI options to select multiple NN potentials.

abipy.scripts.abiml.phddb_add_phonopy_opts(f)[source]

Change default value of supercell.

abipy.scripts.abinp module

Command-line interface to AbiPy’s input factory functions.

This script provides a simplified way to generate input files for Abinit and other supported codes (VASP, Wannier90, Lobster) from various structure file formats. It also includes tools for validating Abinit inputs, finding space groups, analyzing k-point grids, and more.

Examples

Generate a ground-state Abinit input from a CIF file:

$ abinp.py gs crystal.cif > run.abi

Generate Abinit inputs for an electron band structure using a structure from MP:

$ abinp.py ebands mp-149

Validate an existing Abinit input file:

$ abinp.py validate run.abi

Generate VASP input files (INCAR, KPOINTS, etc.) from a POSCAR:

$ abinp.py vasp POSCAR

Note: For more complex workflows or fine-grained control, it is recommended to use the AbiPy Python API directly.

abipy.scripts.abinp.vasp_dict_set_cls(s)[source]

Return a subclass of DictSect from string s. If s == “__all__”, return list with all VaspInputSet subclasses supported by pymatgen.

Return type:

type | list[str]

abipy.scripts.abinp.finalize(obj, options)[source]

Finalize the object and print the input file to stdout.

Parameters:
  • obj – The object to finalize (e.g. AbinitInput or MultiDataset).

  • options – Namespace object containing command-line options.

abipy.scripts.abinp.build_abinit_input_from_file(options, **abivars)[source]

Build and return an AbinitInput instance from filepath.

abivars are optional variables that will be added to the input.

abipy.scripts.abinp.abinp_validate(options)[source]

Validate an Abinit input file by calling Abinit in dry-run mode.

Parameters:

options – Namespace object containing command-line options.

Returns:

Abinit exit code (0 if valid).

Return type:

int

abipy.scripts.abinp.abinp_autoparal(options)[source]

Compute autoparal configurations.

abipy.scripts.abinp.abinp_abispg(options)[source]

Call Abinit with chkprim = 0 to find space group.

abipy.scripts.abinp.abinp_ibz(options)[source]

Get k-points in the irreducible weights.

abipy.scripts.abinp.abinp_phperts(options)[source]

Get list of phonon perturbations.

abipy.scripts.abinp.abinp_gs(options)[source]

Generate an Abinit input for a ground-state (GS) calculation.

Parameters:

options – Namespace object containing command-line options.

Returns:

System exit code.

Return type:

int

abipy.scripts.abinp.abinp_ebands(options)[source]

Build Abinit input for band structure calculations.

abipy.scripts.abinp.abinp_phonons(options)[source]

Build Abinit input for phonon calculations.

abipy.scripts.abinp.abinp_g0w0(options)[source]

Generate input files for G0W0 calculations.

abipy.scripts.abinp.abinp_anaph(options)[source]

Build Anaddb input file for the computation of phonon bands DOS.

abipy.scripts.abinp.abinp_vasp(options)[source]

Build VASP input files from a FILE defining the structure.

abipy.scripts.abinp.abinp_wannier90(options)[source]

Build wannier90 template input file from Abinit input/output file. possibly with electron bands.

abipy.scripts.abinp.abinp_lobster(options)[source]

Build and print Lobster input file from directory with files file (for pseudos) and GSR.nc output file (multidatasets are not allowed). Supports also directory with vasprun.xml and POTCAR file.

abipy.scripts.abinp.abinp_slurm(options)[source]

Print template for Slurm submmission script.

abipy.scripts.abinp.get_epilog()[source]

Return the epilog string for the command-line parser.

abipy.scripts.abinp.get_parser(with_epilog=False)[source]

Build parser.

abipy.scripts.abinp.main()[source]

Main entry point for the script.

abipy.scripts.abiopen module

Interactive tool to open and analyze files produced by Abinit and other atomistic codes.

This script supports a wide range of file formats, including NetCDF files (GSR, DDB, PHBST, etc.), Abinit input and output files, structure files (CIF, POSCAR, XYZ), and more.

By default, the script starts an interactive IPython session with the file object loaded as abifile or obj. This allows for direct interaction with the data and execution of class methods.

Alternatively, it can generate Jupyter notebooks, serve interactive Dashboards using the panel package, or automatically generate Matplotlib/Plotly figures.

Examples

Open a GSR file in an interactive shell:

$ abiopen.py out_GSR.nc

Print basic information about a structure file:

$ abiopen.py crystal.cif -p

Automatically generate and show plots for a phonon band structure:

$ abiopen.py out_PHBST.nc -e

Serve an interactive Dashboard for a DDB file:

$ abiopen.py out_DDB -pn

Generate a Jupyter-lab notebook to analyze a file:

$ abiopen.py out_SIGRES.nc -nb

abipy.scripts.abiopen.make_and_open_notebook(options)[source]

Generate a Jupyter notebook and open it in the browser.

Parameters:

options – Namespace object containing command-line options.

Returns:

System exit code (0 for success).

Return type:

int

Raises:

RuntimeError – If jupyter is not found in the system PATH.

abipy.scripts.abiopen.get_epilog()[source]

Return the epilog string for the command-line parser.

Return type:

str

abipy.scripts.abiopen.get_parser(with_epilog=False)[source]

Return the ArgumentParser object for the script.

Parameters:

with_epilog – If True, include the epilog in the parser.

abipy.scripts.abiopen.serve_kwargs_from_options(options)[source]

Build and return a dictionary with keyword arguments for serving the panel app.

Parameters:

options – Namespace object containing command-line options.

abipy.scripts.abiopen.main()[source]

Main entry point for the script.

abipy.scripts.abiopen.handle_object(obj, options)[source]

Postprocess or visualize the object according to command-line options.

Parameters:
  • obj – The AbiPy object to handle.

  • options – Namespace object containing command-line options.

Returns:

System exit code.

Return type:

int

abipy.scripts.abiopen.handle_ase_traj(obj, options)[source]

Handle ASE trajectory file.

abipy.scripts.abiopen.handle_ase_md_log(options)[source]

Handle ASE MD log file.

abipy.scripts.abiopen.handle_csv(options)[source]

Handle CSV file.

abipy.scripts.abiopen.handle_json(options)[source]

Handle JSON files by loading them with MSONable support.

Parameters:

options – Namespace object containing command-line options.

Returns:

System exit code.

Return type:

int

abipy.scripts.abips module

Command-line interface to manage and analyze pseudopotential (PS) tables.

This script allows users to browse available PS tables on the web, install them locally, validate their checksums, and perform basic analysis such as computing form factors by calling the Abinit executable.

Examples

List all PS repositories available for download:

$ abips.py avail

List PS repositories already installed on the local machine:

$ abips.py list

Install a specific repository by name:

$ abips.py install ONCVPSP-PBEsol-SR-PDv0.4

Show details of installed pseudos for a specific element (e.g., Oxygen):

$ abips.py element O

Compute and plot the form factors for a PS file with a specific cutoff:

$ abips.py mkff Si.psp8 –ecut 20

abipy.scripts.abips.abips_list(options)[source]

List pseudopotential repositories installed on the local machine.

Parameters:

options – Namespace object containing command-line options.

Returns:

Number of checksum validation errors found (if requested).

Return type:

int

abipy.scripts.abips.abips_avail(options)[source]

Show available pseudopotential repos.

Return type:

int

abipy.scripts.abips.abips_install(options)[source]

Install pseudopotential repositories by name(s). Use avail command to get repo names.

Return type:

int

abipy.scripts.abips.abips_show(options)[source]

Show info on pseudopotential table(s).

Return type:

int

abipy.scripts.abips.abips_element(options)[source]

Find all pseudos in the installed tables for the given element (symbol or znucl).

Return type:

int

abipy.scripts.abips.abips_mkff(options)[source]

Compute pseudopotential form factors (PSPS.nc) by calling Abinit.

Parameters:

options – Namespace object containing command-line options.

Returns:

System exit code.

Return type:

int

abipy.scripts.abips.get_epilog()[source]

Return the epilog string for the command-line parser.

Return type:

str

abipy.scripts.abips.get_parser(with_epilog=False)[source]

Return the ArgumentParser object for the script.

Parameters:

with_epilog – If True, include the epilog in the parser.

abipy.scripts.abips.main()[source]

Main entry point for the script.

abipy.scripts.abirun module

Command-line tool to manage and execute Abinit workflows (Flows).

This script is the primary interface for running calculations, monitoring their status, and analyzing results within an AbiPy Flow. It supports various execution modes, including a robust Python-based scheduler for large-scale simulations and a rapid-fire mode for smaller tasks.

Main Commands:

scheduler: Run the flow using a persistent Python scheduler. status: Display a table with the current status of all tasks. rapid: Execute all currently ready tasks in rapid-fire mode. cancel: Cancel jobs currently running in the queue. events: Analyze log files for Abinit warnings, errors, and comments. ipython: Open the flow object in an interactive IPython session.

Examples

Monitor the status of a flow in the current directory:

$ abirun.py status

Start the scheduler with a 60-second check interval:

$ abirun.py FLOWDIR scheduler -s 60

Analyze the last 5 tasks for potential errors:

$ abirun.py FLOWDIR status -n -5:

Open the flow in a Jupyter notebook for custom analysis:

$ abirun.py FLOWDIR notebook

abipy.scripts.abirun.straceback()[source]

Returns a string with the traceback.

Return type:

str

abipy.scripts.abirun.parse_strings(s)[source]

Parse comma separated values. Return None if s is None.

abipy.scripts.abirun.flowdir_wname_tname(dirname)[source]

Locate the flow directory and identify the work/task context.

Parameters:

dirname (str) – Path to a directory within a Flow structure.

Returns:

(flow_dir, work_name, task_name)

flow_dir: Absolute path to the Flow root directory. work_name: Basename of the work directory (if applicable). task_name: Basename of the task directory (if applicable).

Return type:

tuple

Raises:

RuntimeError – If the Flow root (containing the pickle file) cannot be found.

abipy.scripts.abirun.select_nids(flow, options)[source]

Return the set of node ids selected by the user via the command line interface.

Return type:

set

abipy.scripts.abirun.cli_abiopen(options, filepath)[source]

Code taken from abiopen.py.

abipy.scripts.abirun.flow_debug_reset_tasks(flow, nids=None, verbose=0)[source]

Analyze error files produced by reset tasks for possible error messages

Parameters:
  • nids – List of node identifiers. By defaults all nodes that have been reset are analyzed.

  • verbose – Verbosity level.

Return type:

None

abipy.scripts.abirun.flow_watch_status(flow, delay=5, nids=None, verbose=0, func_name='show_func')[source]

Enter an infinite loop and delay execution for the given number of seconds. (default: 5 secs).

Parameters:
  • delay – delay execution for the given number of seconds. (default: 5 secs).

  • nids – List of node identifiers. By defaults all nodes that have been reset are analyzed.

  • verbose – Verbosity level.

  • func_name – Name of the function used to show the status of the flow.

abipy.scripts.abirun.get_epilog()[source]

Return the epilog string for the command-line parser.

Return type:

str

abipy.scripts.abirun.get_parser(with_epilog=False)[source]

Return the ArgumentParser object for the script.

Parameters:

with_epilog – If True, include the epilog in the parser.

abipy.scripts.abirun.serve_kwargs_from_options(options)[source]

Build and return a dictionary with keyword arguments for serving the panel app.

Parameters:

options – Namespace object containing command-line options.

Return type:

dict

abipy.scripts.abirun.main()[source]

Main entry point for the script.

abipy.scripts.abislurm module

Command-line tool to retrieve information on Slurm jobs.

This script provides a convenient way to monitor the status of Slurm jobs running on the cluster and retrieve detailed accounting information for completed jobs.

Examples

List all running jobs for the current user:

$ abislurm.py running

Get detailed information for a list of completed job IDs:

$ abislurm.py completed 123456 123457

abipy.scripts.abislurm.get_epilog()[source]

Return a string with usage examples.

Return type:

str

abipy.scripts.abislurm.get_parser(with_epilog=False)[source]

Return the ArgumentParser object for the script.

Parameters:

with_epilog – If True, include the epilog in the parser.

abipy.scripts.abislurm.main()[source]

Main entry point for the script.

abipy.scripts.abistruct module

Command-line tool for the analysis, conversion, and visualization of crystal structures.

This script provides a comprehensive set of tools for manipulating crystal structures produced by Abinit and other codes. It supports symmetry analysis (via spglib), supercell generation, structure conversion (CIF, POSCAR, XYZ, etc.), k-point grid generation, and direct integration with online databases like Materials Project (MP) and the Crystallography Open Database (COD).

Main Categories:

Symmetry: Spglib analysis, primitive/conventional cell generation, re-symmetrization. Conversion: Format conversion (Abinit, CIF, VASP, QE, etc.), supercell building. K-points: K-path generation, BZ visualization, k-mesh sampling (IBZ weights). Databases: Search and fetch structures from MP and COD using formulas or IDs. Visualization: Export to VESTA, XCrySDen, OVITO, or generate interactive Dashboards.

Examples

Analyze the symmetry of an Abinit output file:

$ abistruct.py spglib out_GSR.nc

Convert a CIF file to Abinit input variables:

$ abistruct.py convert crystal.cif

Generate a 2x2x2 supercell from a POSCAR and save it as a CIF:

$ abistruct.py supercell POSCAR -s 2 2 2 –savefile super.cif

Search for MgB2 structures in the Materials Project database:

$ abistruct.py mp_search MgB2

Visualize a structure using VESTA:

$ abistruct.py visualize out_DDB -a vesta

abipy.scripts.abistruct.save_structure(structure, options)[source]

Save the crystalline structure to a file.

Parameters:
  • structure – Structure object to be saved.

  • options – Namespace object containing command-line options (must have savefile).

Return type:

None

abipy.scripts.abistruct.check_ordered_structure(structure)[source]

Check if the structure is ordered and exit if fractional occupancies are found.

Parameters:

structure – Structure object to check.

Return type:

None

abipy.scripts.abistruct.get_epilog()[source]

Return the epilog string for the command-line parser.

Return type:

str

abipy.scripts.abistruct.get_parser(with_epilog=False)[source]

Return the ArgumentParser object for the script.

Parameters:

with_epilog – If True, include the epilog in the parser.

abipy.scripts.abistruct.serve_kwargs_from_options(options)[source]

Build and return a dictionary with keyword arguments for serving the panel app.

Parameters:

options – Namespace object containing command-line options.

Return type:

dict

abipy.scripts.abistruct.main()[source]

Main entry point for the script.

abipy.scripts.abiview module

Command-line tool to visualize and analyze Abinit results.

This script provides specialized visualization tools for various Abinit output formats (GSR, DDB, PHBST, HIST, DEN/POT, etc.). It supports generating plots using Matplotlib or Plotly, and can export data to external applications like VESTA, XCrySDen, and OVITO.

Main Categories:

Structure: Visualize crystal structures and relaxation/MD trajectories. Electrons: Plot band structures, DOS, and Fermi surfaces. Phonons: Analyze vibrational properties, IR spectra, and elastic tensors from DDBs. Fields: Visualize volumetric data like electronic density and potentials. Timing: Analyze Abinit timer data and memory logs.

Examples

Plot electron bands from a GSR file:

$ abiview.py ebands out_GSR.nc

Visualize a structural relaxation trajectory in HIST.nc:

$ abiview.py hist out_HIST.nc

Compute and plot phonon bands and DOS from a DDB file:

$ abiview.py ddb out_DDB

Visualize the electronic density (DEN.nc) in VESTA:

$ abiview.py denpot out_DEN.nc -a vesta

Analyze the Abinit timer from an output file:

$ abiview.py timer out_ABO

abipy.scripts.abiview.handle_overwrite(path, options)[source]

Exit 1 if file path exists and not options.force else return path.

abipy.scripts.abiview.df_to_clipboard(options, df)[source]

Copy dataframe to clipboard if options.clipboard.

Return type:

None

class abipy.scripts.abiview.NegateAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None, deprecated=False)[source]

Bases: Action

Argparse action to negate a boolean option.

abipy.scripts.abiview.abiview_structure(options)[source]

Visualize a crystal structure with an external application.

Parameters:

options – Namespace object containing command-line options (must have filepath and appname).

Returns:

System exit code.

Return type:

int

abipy.scripts.abiview.abiview_input(options)[source]

Read input file from netcdf file and print it to terminal.

abipy.scripts.abiview.abiview_hist(options)[source]

Visualize a structural relaxation or molecular dynamics run.

Parameters:

options – Namespace object containing command-line options.

Returns:

System exit code.

Return type:

int

abipy.scripts.abiview.abiview_data(options)[source]

Extract data from a generic text file with results in tabular format and plot data with matplotlib. Multiple datasets are supported. No attempt is made to handle metadata (e.g. column name)

abipy.scripts.abiview.abiview_timer(options)[source]

Plot the ABINIT timer reported in the main output file. Requires timopt != 0.

abipy.scripts.abiview.abiview_memlog(options)[source]

Analyze the ABINIT log file to extract virtual memory info (requires Linux).

abipy.scripts.abiview.abiview_dirviz(options)[source]

Visualize directory tree with graphviz.

Return type:

int

abipy.scripts.abiview.abiview_ebands(options)[source]

Plot electronic bands if file contains high-symmetry k-path or DOS if k-sampling. Accept any file with ElectronBands e.g. GSR.nc, WFK.nc, …

Return type:

int

abipy.scripts.abiview.abiview_effmass(options)[source]

Compute electron effective masses with finite differences using energies along a k-path Accept any file with ElectronBands e.g. GSR.nc, WFK.nc, …

Return type:

int

abipy.scripts.abiview.abiview_skw(options)[source]

Interpolate energies in k-space along a k-path with the star-function method. Note that the interpolation will likely fail if there are symmetric k-points in the input set of k-points so it is highly recommended to call this method with energies obtained in the IBZ. Accept any file with ElectronBands e.g. GSR.nc, WFK.nc, …

Return type:

int

abipy.scripts.abiview.abiview_fs(options)[source]

Extract eigenvalues in the IBZ from file and visualize Fermi surface with the external application specified via –appname

Return type:

int

abipy.scripts.abiview.abiview_ifermi_fs(options)[source]

Use ifermi package to visualize the Fermi surface. Requires netcdf file with energies in the IBZ. See <https://fermisurfaces.github.io/IFermi/>

Return type:

int

abipy.scripts.abiview.abiview_ddb(options)[source]

Invoke anaddb to compute phonon bands and DOS from the DDB, plot the results.

Return type:

int

abipy.scripts.abiview.abiview_ddb_becs(options)[source]

Invoke anaddb to compute eps_inf and Born effective charges.

Return type:

int

abipy.scripts.abiview.abiview_ddb_vs(options)[source]

Compute speed of sound by fitting phonon frequencies along selected directions.

Return type:

int

abipy.scripts.abiview.abiview_ddb_ir(options)[source]

Compute infra-red spectrum from DDB. Plot results.

Return type:

int

abipy.scripts.abiview.abiview_ddb_asr(options)[source]

Compute phonon band structure from DDB with/without acoustic sum rule. Plot results.

Return type:

int

abipy.scripts.abiview.abiview_ddb_dipdip(options)[source]

Compute phonon band structure from DDB with/without dipole-dipole interaction. Plot results.

Return type:

int

abipy.scripts.abiview.abiview_ddb_quad(options)[source]

Compute phonon band structure from DDB with/without quadrupole terms. Plot results.

Return type:

int

abipy.scripts.abiview.abiview_ddb_isodistort_ph(options)[source]

Compute ph-freqs for given q-point (default: Gamma), produce CIF files for unperturbed and distorded structure that can be used with ISODISTORT (https://stokes.byu.edu/iso/isodistort.php) to analyze the symmetry of phonon modes. See README.me file produced in output directory.

Return type:

int

abipy.scripts.abiview.abiview_ddb_qpt(options)[source]

Compute ph-frequencies at the selected q-point without passing through the Fourier interpolation of the interatomic force constants.

Return type:

int

abipy.scripts.abiview.abiview_ddb_ifc(options)[source]

Visualize interatomic force constants in real space.

Return type:

int

abipy.scripts.abiview.abiview_ddb_elastic(options)[source]

Invoke anaddb to compute elastic and piezoelectric tensors. Require DDB with strain terms.

Return type:

int

abipy.scripts.abiview.abiview_phbands(options)[source]

Plot phonon bands. Accept any file with PhononBands e.g. PHBST.nc, …

Return type:

int

abipy.scripts.abiview.abiview_denpot(options)[source]

Visualize netcdf DEN/POT files with –appname (default: Vesta). NB: Application must be installed and in $PATH.

Return type:

int

abipy.scripts.abiview.abiview_lobster(options)[source]

Analyze lobster output files in directory.

Return type:

int

abipy.scripts.abiview.abiview_xrd_traj(options)[source]

Compare XRD spectra using the first and the last structure read from a trajectory file.

Return type:

int

abipy.scripts.abiview.get_epilog()[source]

Return the epilog string for the command-line parser.

Return type:

str

abipy.scripts.abiview.get_parser(with_epilog=False)[source]

Return the ArgumentParser object for the script.

Parameters:

with_epilog – If True, include the epilog in the parser.

abipy.scripts.abiview.main()[source]

Main entry point for the script.

abipy.scripts.oncv module

Command-line tool to generate, analyze, and plot ONCVPSP pseudopotentials.

This script provides a comprehensive interface to the ONCVPSP code for generating norm-conserving pseudopotentials. It includes tools for running the generator, parsing and printing output results, plotting logarithmic derivatives and wavefunctions, and comparing different PS files. It also features an interactive Panel-based GUI for real-time PS generation.

Main Commands:

run: Execute ONCVPSP on an input file and generate PS files (psp8, UPF). plot: Visualize logarithmic derivatives, potentials, and wavefunctions. compare: Compare results from multiple ONCVPSP output files. gui: Start an interactive web application for PS generation. print: Parse and display summary info from ONCVPSP output.

Examples

Generate a pseudopotential from an input file (scalar-relativistic):

$ oncv.py run H.in

Plot results from an ONCVPSP output file using Matplotlib:

$ oncv.py plot H.out

Compare two different ONCVPSP runs:

$ oncv.py compare run1.out run2.out

Start the interactive GUI for a specific input file:

$ oncv.py gui H.in

abipy.scripts.oncv.oncv_notebook(options)[source]

Generate jupyter notebook to plot data. Requires oncvpsp output file.

abipy.scripts.oncv.oncv_gnuplot(options)[source]

Plot data with gnuplot.

abipy.scripts.oncv.oncv_print(options)[source]

Parse oncvps output file and print results to terminal.

Return type:

int

abipy.scripts.oncv.oncv_plot(options)[source]

Plot data with matplotlib. Requires oncvpsp output file.

Return type:

int

abipy.scripts.oncv.oncv_plot_pseudo(options)[source]

Plot data with matplotlib. Requires pseudopotential file (UPF2 or pawxml).

Return type:

int

abipy.scripts.oncv.oncv_compare(options)[source]

Compare multiple oncvpsp output files.

Return type:

int

abipy.scripts.oncv.oncv_run(options)[source]

Run oncvpsp, generate djrepo file, plot results. Requires oncvps input file.

abipy.scripts.oncv.oncv_ghost(options)[source]

Scan directories for oncvpsp output files and build dataframe with ghost position.

Return type:

int

abipy.scripts.oncv.oncv_gui(options)[source]

Start a panel web app to generate pseudopotentials.

abipy.scripts.oncv.get_epilog()[source]

Return the epilog string for the command-line parser.

Return type:

str

abipy.scripts.oncv.get_parser(with_epilog=False)[source]

Return the ArgumentParser object for the script.

Parameters:

with_epilog – If True, include the epilog in the parser.

abipy.scripts.oncv.main()[source]

Main entry point for the script.