abistruct.py

This script reads a abipy.core.structure.Structure object from file and performs predefined operations depending on the COMMAND and the options specified on the command line. The syntax of the command is:

abistruct.py COMMAND FILE [options]

where FILE is any file from which AbiPy can extract a Structure object (this includes the majority of the nectdf output files, Abinit input and output files in text format as well as other formats supported by pymatgen e.g. CIF files, POSCAR etc.

The documentation for a given COMMAND is accessible with:

abistruct.py command --help

Use e.g.:

$ abistruct.py spglib --help

to get the list of options supported by the spglib COMMAND.

The convert command is quite useful if you need to convert the crystalline structure from one format to another one. For example, one can read a CIF file and print the corresponding Abinit variables with:

$ abistruct.py convert si.cif

Note

The script can fetch data from the materials project database and the COD database http://www.crystallography.net/cod`_ To access the materials project database, please register on <https://www.materialsproject.org> to get your personal access token. Then create a .pymrc.yaml configuration file inside your $HOME and add your token with the line:

PMG_MAPI_KEY: your_token_goes_here

It is possible to analyze the structure object either a jupyter notebook with e.g.:

abistruct.py jupter si.cif

or directly inside the ipython shell with:

abistruct.py notebook si.cif

Several other options are available. To get the full list, use

$ abistruct.py --help
usage: abistruct.py [-h] [-V]
                    {spglib,abispg,convert,print,supercell,abisanitize,primitive,irefine,conventional,proto,wyckoff,tensor_site,neighbors,interpolate,xrd,oxistate,ipython,notebook,panel,kpath,bz,ngkpt,ktables,abikmesh,lgk,kstar,keq,visualize,mp_id,mp_match,mp_search,mp_pd,mp_ebands,cod_search,cod_id,animate}
                    ...

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit

subcommands:
  Valid subcommands, use command --help for help

  {spglib,abispg,convert,print,supercell,abisanitize,primitive,irefine,conventional,proto,wyckoff,tensor_site,neighbors,interpolate,xrd,oxistate,ipython,notebook,panel,kpath,bz,ngkpt,ktables,abikmesh,lgk,kstar,keq,visualize,mp_id,mp_match,mp_search,mp_pd,mp_ebands,cod_search,cod_id,animate}
                        sub-command help
    spglib              Analyze structure with spglib.
    abispg              Extract/Compute Abinit space group from file with
                        structure.
    convert             Convert structure to the specified format.
    print               Print Structure to terminal.
    supercell           Generate supercell.
    abisanitize         Sanitize structure with abi_sanitize, compare
                        structures and save result to file.
    primitive           Use spglib to find a smaller unit cell than the input
    irefine             Refine structure with abi_sanitize iteratively, stop
                        if target space group is obtained.
    conventional        Gives a structure with a conventional cell according
                        to certain standards. The standards are defined in
                        doi:10.1016/j.commatsci.2010.05.010
    proto               Find prototype in the AFLOW LIBRARY OF
                        CRYSTALLOGRAPHIC PROTOTYPES.
                        http://doi.org/10.1016/j.commatsci.2017.01.017
    wyckoff             Print wyckoff positions. WARNING: still under
                        development!
    tensor_site         Print symmetry properties of tensors due to site-
                        symmetries. WARNING: still under development!
    neighbors           Get neighbors for each atom in the unit cell, out to a
                        distance radius.
    interpolate         Interpolate between two structures. Useful for the
                        construction of NEB inputs.
    xrd                 X-ray diffraction plot.
    oxistate            Estimate oxidation states with pymatgen bond valence
                        analysis.
    ipython             Open IPython shell for advanced operations on
                        structure object.
    notebook            Read structure from file and generate jupyter
                        notebook.
    panel               Open GUI in web browser, requires panel package.
    kpath               Read structure from file, generate k-path for band-
                        structure calculations.
    bz                  Read structure from file, plot Brillouin zone with
                        matplotlib.
    ngkpt               Return the Abinit k-point sampling variables from the
                        number of divisions used to sample the smallest
                        lattice vector of the reciprocal lattice.
    ktables             Read structure from filepath, call spglib to sample
                        the BZ, print k-points in the IBZ with weights.
    abikmesh            Read structure from file, call Abinit to sample the BZ
                        with ngkpt, shiftk, and kptopt. Print k-points in the
                        IBZ with weights.
    lgk                 Read structure from file, find little group of
                        k-point, print Bilbao character table.
    kstar               Read structure from file, print star of k-point.
    keq                 Read structure from file, check whether two k-points
                        are equivalent by symmetry.
    visualize           Visualize the structure with the specified
                        application. Requires external app or optional python
                        modules (mayavi, vtk).
    mp_id               Get structure from the pymatgen database. Export to
                        format. Requires internet connection and PMG_MAPI_KEY.
    mp_match            Get structure from the pymatgen database. Requires
                        internet connection and PMG_MAPI_KEY.
    mp_search           Get structure from the pymatgen database. Requires
                        internet connection and PMG_MAPI_KEY
    mp_pd               Generate phase diagram with entries from the Materials
                        Project. Requires internet connection and PMG_MAPI_KEY
    mp_ebands           Get structure from the pymatgen database. Export to
                        format. Requires internet connection and PMG_MAPI_KEY.
    cod_search          Get structure from COD database. Requires internet
                        connection and mysql
    cod_id              Get structure from COD database. Requires internet
                        connection and mysql
    animate             Read structures from HIST.nc or XDATCAR. Print
                        structures in Xcrysden AXSF format to stdout.

Usage example:

###################
# Space group tools
###################

  abistruct.py spglib FILE                 => Read structure from FILE and analyze it with spglib.
  abistruct.py abispg FILE                 => Read structure from FILE, and compute ABINIT space group.
  abistruct.py primitive FILE              => Read structure from FILE, use pymatgen and spglib to find primitive structure.
  abistruct.py abisanitize FILE            => Read structure from FILE, call abisanitize, compare structures
                                              and save "abisanitized" structure to file.
  abistruct.py conventional FILE           => Read structure from FILE, generate conventional structure
                                              following doi:10.1016/j.commatsci.2010.05.010
  abistruct.py proto FILE                  => Read structure from FILE, find possible crystallographic prototypes
                                              in the AFLOW library of crystallographic prototypes.
                                              See http://doi.org/10.1016/j.commatsci.2017.01.017

##################
# Conversion tools
##################

  abistruct.py convert FILE                => Print the ABINIT variables defining the structure.
  abistruct.py convert FILE -f cif         => Read structure from FILE and output CIF file
                                              (Use convert --help to get list of formats supported)
  abistruct.py convert out_HIST.nc         => Read FINAL structure from the HIST file and
                                              print the corresponding ABINIT variables.
  abistruct.py supercell FILE -s 2 2 1     => Read structure from FILE and build [2, 2, 1] supercell,
                                              print new structure using --format (default abivars).
################
# K-points tools
################

  abistruct.py kpath FILE                  => Read structure from FILE and print ABINIT variables for k-path.
  abistruct.py bz FILE                     => Read structure from FILE, plot BZ with matplotlib.
  abistruct.py ngkpt FILE -n 4             => Compute `ngkpt` and `shiftk` from the number of divisions used to sample
                                              the smallest reciprocal lattice vector.
  abistruct.py abikmesh FILE --ngkpt 2 2 2 => Read structure from FILE, call Abinit to sample the BZ
                                              with a 2, 2, 2 k-mesh, print points in IBZ with weights.
  abistruct.py ktables FILE -m 2 2 2       => Read structure from FILE, call spglib to sample the BZ
                                              with a 2, 2, 2 k-mesh, print points in IBZ with weights.
  abistruct.py lgk FILE -k 0.25 0 0        => Read structure from FILE, find little group of k-point,
                                              print Bilbao character table.
  abistruct.py kstar FILE -k 0.25 0 0      => Read structure from FILE, print star of k-point.
  abistruct.py keq FILE -k 0.5 0 0 0 0.5 0  => Read structure from FILE, test whether k1 and k2 are
                                               symmetry-equivalent k-points.

###############
# Miscelleanous
###############

  abistruct.py neighbors FILE              => Get neighbors for each atom in the unit cell, out to a distance radius.
  abistruct.py interpolate FILE1 FILE2     => Interpolate between two structures. Useful for the construction of NEB inputs.
  abistruct.py xrd FILE                    => X-ray diffraction plot.
  abistruct.py oxistate FILE               => Estimate oxidation states with pymatgen bond valence analysis.

###############
# Visualization
###############

  abistruct.py visualize FILE -a vesta     => Visualize the structure with vesta (default if -a is not given)
                                              Supports also ovito, xcrysden, vtk, mayavi, matplotlib See --help
  abistruct.py ipython FILE                => Read structure from FILE and open it in the Ipython terminal.
  abistruct.py notebook FILE               => Read structure from FILE and generate jupyter notebook.
  abistruct.py panel FILE                  => Generate GUI in web browser to interact with the structure
                                              Requires panel package.

###########
# Databases
###########

  abistruct.py cod_id 1526507              => Get structure from COD database (http://www.crystallography.net/cod).
  abistruct.py cod_search MgB2             => Search for structures in the COD database.
  abistruct.py mp_id mp-149                => Get structure from materials project database and print
                                              JSON representation. Use e.g. `-f abivars` to change format.
  abistruct.py mp_match FILE               => Read structure from FILE and find matching structures on the
                                              Materials Project site. Use e.g. `-f cif` to change output format.
  abistruct.py mp_search LiF               => Connect to the materials project database. Get structures corresponding
                                              to a chemical system or formula e.g. `Fe2O3` or `Li-Fe-O` or
                                              `Ir-O-*` for wildcard pattern matching.
                                              Print info and Abinit input files. Use e.g. `-f POSCAR`
                                              to change output format. `-f None` to disable structure output.
  abistruct.py mp_pd FILE-or-elements      => Generate phase diagram with entries from the Materials Project.
  abistruct.py mp_ebands FILE             => Fetch electron band structure from MP database. Print gaps.
                                             Accept FILE with structure if ebands from structure is wanted
                                             or mp id e.g. "mp-149 or list of elements e.g `Li-Fe-O` or chemical formula.

`FILE` is any file supported by abipy/pymatgen e.g Netcdf files, Abinit input/output, POSCAR, xsf ...
Use `abistruct.py --help` for help and `abistruct.py COMMAND --help` to get the documentation for `COMMAND`.
Use `-v` to increase verbosity level (can be supplied multiple times e.g -vv).

Complete command line reference

usage: abistruct.py [-h] [-V]
                    {spglib,abispg,convert,print,supercell,abisanitize,primitive,irefine,conventional,proto,wyckoff,tensor_site,neighbors,interpolate,xrd,oxistate,ipython,notebook,panel,kpath,bz,ngkpt,ktables,abikmesh,lgk,kstar,keq,visualize,mp_id,mp_match,mp_search,mp_pd,mp_ebands,cod_search,cod_id,animate}
                    ...

Named Arguments

-V, --version

show program’s version number and exit

subcommands

Valid subcommands, use command –help for help

command

Possible choices: spglib, abispg, convert, print, supercell, abisanitize, primitive, irefine, conventional, proto, wyckoff, tensor_site, neighbors, interpolate, xrd, oxistate, ipython, notebook, panel, kpath, bz, ngkpt, ktables, abikmesh, lgk, kstar, keq, visualize, mp_id, mp_match, mp_search, mp_pd, mp_ebands, cod_search, cod_id, animate

sub-command help

Sub-commands:

spglib

Analyze structure with spglib.

abistruct.py spglib [-h] [-v] [--loglevel LOGLEVEL] [--symprec SYMPREC]
                    [--angle-tolerance ANGLE_TOLERANCE] [--no-time-reversal] [--site-symmetry]
                    [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

--symprec

symprec (float): Tolerance for symmetry finding. Defaults to 1e-3, which is fairly strict and works well for properly refined structures with atoms in the proper symmetry coordinates. For structures with slight deviations from their proper atomic positions (e.g., structures relaxed with electronic structure codes), a looser tolerance of 0.1 (the value used in Materials Project) is often needed.

Default: 0.001

--angle-tolerance

angle_tolerance (float): Angle tolerance for symmetry finding. Default: 5.0

Default: 5.0

--no-time-reversal

Don’t use time-reversal.

Default: False

--site-symmetry

Show site symmetries i.e. the point group operations that leave the site invariant.

Default: False

abispg

Extract/Compute Abinit space group from file with structure.

abistruct.py abispg [-h] [-v] [--loglevel LOGLEVEL] [-s SAVEFILE] [-t TOLSYM] [-d {table,diff}] [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

-s, --savefile

Save final structure to file. Format is detected from file extensions e.g. out.abi for Abinit input, out.cif for CIF format.

Default: “”

-t, --tolsym

Gives the tolerance on the atomic positions (reduced coordinates), primitive vectors, or magnetization, to be considered equivalent, thanks to symmetry operations. This value is used by ABINIT in the recognition of the set of symmetries of the system, or the application of the symmetry operations to generate from a reduced set of atoms, The internal default is 1e-8. Setting tolsym to a value larger than 1e-8 will make Abinit detect the spacegroup within this tolerance and re-symmetrize the input structure. This option is useful if the structure has been taken from a CIF file that does not have enough significant digits.

-d, --diff-mode

Possible choices: table, diff

Select diff output format.

Default: “table”

convert

Convert structure to the specified format.

abistruct.py convert [-h] [-v] [--loglevel LOGLEVEL] [-f FORMAT] [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

-f, --format

Output format. Default: cif. Accept: (abivars, cif, xsf, poscar, qe, siesta, wannier90, cssr, json, None)

Default: “cif”

print

Print Structure to terminal.

abistruct.py print [-h] [-v] [--loglevel LOGLEVEL] [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

supercell

Generate supercell.

abistruct.py supercell [-h] [-v] [--loglevel LOGLEVEL] -s SCALING_MATRIX [SCALING_MATRIX ...] [-f FORMAT]
                       [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

-s, --scaling_matrix

scaling_matrix: A scaling matrix for transforming the lattice vectors. Has to be all integers. Several options are possible:

  1. A full 3x3 scaling matrix defining the linear combination the old lattice vectors. E.g., -s 2,1,0 0,3,0, 0,0,1 generates a new structure with lattice vectors a’ = 2a + b, b’ = 3b, c’ = c where a, b, and c are the lattice vectors of the original structure.

  2. An sequence of three scaling factors. E.g., -s 2, 1, 1 specifies that the supercell should have dimensions 2a x b x c.

  3. A number, which simply scales all lattice vectors by the same factor.

-f, --format

Output format. Default: abivars. Accept: (abivars, cif, xsf, poscar, qe, siesta, wannier90, cssr, json, None)

Default: “abivars”

abisanitize

Sanitize structure with abi_sanitize, compare structures and save result to file.

abistruct.py abisanitize [-h] [-v] [--loglevel LOGLEVEL] [--symprec SYMPREC]
                         [--angle-tolerance ANGLE_TOLERANCE] [--no-time-reversal] [--site-symmetry]
                         [-s SAVEFILE] [--no-primitive | --primitive-standard]
                         [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

--symprec

symprec (float): Tolerance for symmetry finding. Defaults to 1e-3, which is fairly strict and works well for properly refined structures with atoms in the proper symmetry coordinates. For structures with slight deviations from their proper atomic positions (e.g., structures relaxed with electronic structure codes), a looser tolerance of 0.1 (the value used in Materials Project) is often needed.

Default: 0.001

--angle-tolerance

angle_tolerance (float): Angle tolerance for symmetry finding. Default: 5.0

Default: 5.0

--no-time-reversal

Don’t use time-reversal.

Default: False

--site-symmetry

Show site symmetries i.e. the point group operations that leave the site invariant.

Default: False

-s, --savefile

Save final structure to file. Format is detected from file extensions e.g. out.abi for Abinit input, out.cif for CIF format.

Default: “”

--no-primitive

Do not enforce primitive cell.

Default: False

--primitive-standard

Enforce primitive standard cell.

Default: False

primitive

Use spglib to find a smaller unit cell than the input

abistruct.py primitive [-h] [-v] [--loglevel LOGLEVEL] [--symprec SYMPREC]
                       [--angle-tolerance ANGLE_TOLERANCE] [--no-time-reversal] [--site-symmetry]
                       [-s SAVEFILE]
                       [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

--symprec

symprec (float): Tolerance for symmetry finding. Defaults to 1e-3, which is fairly strict and works well for properly refined structures with atoms in the proper symmetry coordinates. For structures with slight deviations from their proper atomic positions (e.g., structures relaxed with electronic structure codes), a looser tolerance of 0.1 (the value used in Materials Project) is often needed.

Default: 0.001

--angle-tolerance

angle_tolerance (float): Angle tolerance for symmetry finding. Default: 5.0

Default: 5.0

--no-time-reversal

Don’t use time-reversal.

Default: False

--site-symmetry

Show site symmetries i.e. the point group operations that leave the site invariant.

Default: False

-s, --savefile

Save final structure to file. Format is detected from file extensions e.g. out.abi for Abinit input, out.cif for CIF format.

Default: “”

irefine

Refine structure with abi_sanitize iteratively, stop if target space group is obtained.

abistruct.py irefine [-h] [-v] [--loglevel LOGLEVEL] [--symprec SYMPREC]
                     [--angle-tolerance ANGLE_TOLERANCE] [--no-time-reversal] [--site-symmetry]
                     --target-spgnum TARGET_SPGNUM [--symprec-step SYMPREC_STEP]
                     [--angle-tolerance-step ANGLE_TOLERANCE_STEP] [--ntrial NTRIAL]
                     [--no-primitive | --primitive-standard]
                     [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

--symprec

symprec (float): Tolerance for symmetry finding. Defaults to 1e-3, which is fairly strict and works well for properly refined structures with atoms in the proper symmetry coordinates. For structures with slight deviations from their proper atomic positions (e.g., structures relaxed with electronic structure codes), a looser tolerance of 0.1 (the value used in Materials Project) is often needed.

Default: 0.001

--angle-tolerance

angle_tolerance (float): Angle tolerance for symmetry finding. Default: 5.0

Default: 5.0

--no-time-reversal

Don’t use time-reversal.

Default: False

--site-symmetry

Show site symmetries i.e. the point group operations that leave the site invariant.

Default: False

--target-spgnum

Target space group number.

--symprec-step

Increment for symprec.

Default: 0.05

--angle-tolerance-step

Increment for angle_tolerance.

Default: 0.0

--ntrial

Number of trials. Default 50.

Default: 50

--no-primitive

Do not enforce primitive cell.

Default: False

--primitive-standard

Enforce primitive standard cell.

Default: False

conventional

Gives a structure with a conventional cell according to certain standards. The standards are defined in doi:10.1016/j.commatsci.2010.05.010

abistruct.py conventional [-h] [-v] [--loglevel LOGLEVEL] [--symprec SYMPREC]
                          [--angle-tolerance ANGLE_TOLERANCE] [--no-time-reversal] [--site-symmetry]
                          [-s SAVEFILE]
                          [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

--symprec

symprec (float): Tolerance for symmetry finding. Defaults to 1e-3, which is fairly strict and works well for properly refined structures with atoms in the proper symmetry coordinates. For structures with slight deviations from their proper atomic positions (e.g., structures relaxed with electronic structure codes), a looser tolerance of 0.1 (the value used in Materials Project) is often needed.

Default: 0.001

--angle-tolerance

angle_tolerance (float): Angle tolerance for symmetry finding. Default: 5.0

Default: 5.0

--no-time-reversal

Don’t use time-reversal.

Default: False

--site-symmetry

Show site symmetries i.e. the point group operations that leave the site invariant.

Default: False

-s, --savefile

Save final structure to file. Format is detected from file extensions e.g. out.abi for Abinit input, out.cif for CIF format.

Default: “”

proto

Find prototype in the AFLOW LIBRARY OF CRYSTALLOGRAPHIC PROTOTYPES. http://doi.org/10.1016/j.commatsci.2017.01.017

abistruct.py proto [-h] [-v] [--loglevel LOGLEVEL] [--ltol LTOL] [--stol STOL] [--angle-tol ANGLE_TOL]
                   [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

--ltol

fractional length tolerance.

Default: 0.2

--stol

site tolerance.

Default: 0.3

--angle-tol

angle tolerance.

Default: 5

wyckoff

Print wyckoff positions. WARNING: still under development!

abistruct.py wyckoff [-h] [-v] [--loglevel LOGLEVEL] [--symprec SYMPREC]
                     [--angle-tolerance ANGLE_TOLERANCE] [--no-time-reversal] [--site-symmetry] [--refine]
                     [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

--symprec

symprec (float): Tolerance for symmetry finding. Defaults to 1e-3, which is fairly strict and works well for properly refined structures with atoms in the proper symmetry coordinates. For structures with slight deviations from their proper atomic positions (e.g., structures relaxed with electronic structure codes), a looser tolerance of 0.1 (the value used in Materials Project) is often needed.

Default: 0.001

--angle-tolerance

angle_tolerance (float): Angle tolerance for symmetry finding. Default: 5.0

Default: 5.0

--no-time-reversal

Don’t use time-reversal.

Default: False

--site-symmetry

Show site symmetries i.e. the point group operations that leave the site invariant.

Default: False

--refine

Use spglib to refine structure before computation

Default: False

tensor_site

Print symmetry properties of tensors due to site-symmetries. WARNING: still under development!

abistruct.py tensor_site [-h] [-v] [--loglevel LOGLEVEL] [--symprec SYMPREC]
                         [--angle-tolerance ANGLE_TOLERANCE] [--no-time-reversal] [--site-symmetry]
                         [--refine]
                         [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

--symprec

symprec (float): Tolerance for symmetry finding. Defaults to 1e-3, which is fairly strict and works well for properly refined structures with atoms in the proper symmetry coordinates. For structures with slight deviations from their proper atomic positions (e.g., structures relaxed with electronic structure codes), a looser tolerance of 0.1 (the value used in Materials Project) is often needed.

Default: 0.001

--angle-tolerance

angle_tolerance (float): Angle tolerance for symmetry finding. Default: 5.0

Default: 5.0

--no-time-reversal

Don’t use time-reversal.

Default: False

--site-symmetry

Show site symmetries i.e. the point group operations that leave the site invariant.

Default: False

--refine

Use spglib to refine structure before computation

Default: False

neighbors

Get neighbors for each atom in the unit cell, out to a distance radius.

abistruct.py neighbors [-h] [-v] [--loglevel LOGLEVEL] [-r RADIUS] [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

-r, --radius

Radius of the sphere in Angstrom.

Default: 2

interpolate

Interpolate between two structures. Useful for the construction of NEB inputs.

abistruct.py interpolate [-h] [-v] [--loglevel LOGLEVEL] [-n NIMAGES] [--autosort_tol AUTOSORT_TOL]
                         [-f FORMAT]
                         filepaths filepaths

Positional Arguments

filepaths

Files with initial and final structures.

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

-n, --nimages

No. of interpolation images. Defaults to 10.

Default: 10

--autosort_tol

A distance tolerance in Angstrom in which to automatically sort end_structure to match to the closest points in this particular structure. This is usually what you want in a NEB calculation. 0 implies no sorting. Otherwise, a 0.5 value (default) usually works pretty well.

Default: 0.5

-f, --format

Output format. Default: abivars. Accept: (abivars, cif, xsf, poscar, qe, siesta, wannier90, cssr, json, None)

Default: “abivars”

xrd

X-ray diffraction plot.

abistruct.py xrd [-h] [-v] [--loglevel LOGLEVEL] [-w WAVELENGTH] [-s SYMPREC]
                 [-t TWO_THETA_RANGE TWO_THETA_RANGE] [-nap]
                 [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

-w, --wavelength

The wavelength can be specified as a string. It must be one of the supported definitions in the WAVELENGTHS dict declared in pymatgen/analysis/diffraction/xrd.py.Defaults to ‘CuKa’, i.e, Cu K_alpha radiation.

Default: “CuKa”

-s, --symprec

Symmetry precision for structure refinement. If set to 0, no refinement is done. Otherwise, refinement is performed using spglib with provided precision.

Default: 0

-t, --two-theta-range

Tuple for range of two_thetas to calculate in degrees. Defaults to (0, 90).

Default: (0, 90)

-nap, --no-annotate-peaks

Whether to annotate the peaks with plane information.

Default: False

oxistate

Estimate oxidation states with pymatgen bond valence analysis.

abistruct.py oxistate [-h] [-v] [--loglevel LOGLEVEL] [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

ipython

Open IPython shell for advanced operations on structure object.

abistruct.py ipython [-h] [-v] [--loglevel LOGLEVEL] [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

notebook

Read structure from file and generate jupyter notebook.

abistruct.py notebook [-h] [-v] [--loglevel LOGLEVEL] [--classic-notebook] [--no-browser] [--foreground]
                      [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

--classic-notebook

Use classic notebook instead of jupyterlab.

Default: False

--no-browser

Start the jupyter server to serve the notebook but don’t open the notebook in the browser. Use this option to connect remotely from localhost to the machine running the kernel

Default: False

--foreground

Run jupyter notebook in the foreground.

Default: False

panel

Open GUI in web browser, requires panel package.

abistruct.py panel [-h] [-v] [--loglevel LOGLEVEL] [-pnt PANEL_TEMPLATE] [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

-pnt, --panel-template

Specify template for panel dasboard.Possible values are: FastList, FastGrid, Golden, Bootstrap, Material, React, Vanilla.Default: FastList

Default: “FastList”

kpath

Read structure from file, generate k-path for band-structure calculations.

abistruct.py kpath [-h] [-v] [--loglevel LOGLEVEL] [-f FORMAT] [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

-f, --format

Output format. Default: abinit. Accept: [‘abinit’, ‘wannier90’, ‘siesta’]

Default: “abinit”

bz

Read structure from file, plot Brillouin zone with matplotlib.

abistruct.py bz [-h] [-v] [--loglevel LOGLEVEL] [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

ngkpt

Return the Abinit k-point sampling variables from the number of divisions used to sample the smallest lattice vector of the reciprocal lattice.

abistruct.py ngkpt [-h] [-v] [--loglevel LOGLEVEL] -n NKSMALL [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

-n, --nksmall

Number of divisions used to sample the smallest reciprocal lattice vector.

ktables

Read structure from filepath, call spglib to sample the BZ, print k-points in the IBZ with weights.

abistruct.py ktables [-h] [-v] [--loglevel LOGLEVEL] -m MESH MESH MESH [-s IS_SHIFT [IS_SHIFT ...]]
                     [--no-time-reversal]
                     [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

-m, --mesh

Mesh divisions e.g. 2 3 4

-s, --is_shift

Three integers (spglib API). The kmesh is shifted along the axis in half of adjacent mesh points irrespective of the mesh numbers e.g. 1 1 1 Default: Unshifted mesh.

--no-time-reversal

Don’t use time-reversal.

Default: False

abikmesh

Read structure from file, call Abinit to sample the BZ with ngkpt, shiftk, and kptopt. Print k-points in the IBZ with weights.

abistruct.py abikmesh [-h] [-v] [--loglevel LOGLEVEL] [--kppa KPPA] [--ngkpt NGKPT NGKPT NGKPT]
                      [--shiftk SHIFTK [SHIFTK ...]] [--kptopt KPTOPT]
                      [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

--kppa

Number of k-points per reciprocal atom. Mutually exclusive with ngkpt.

--ngkpt

Mesh divisions e.g. 2 3 4

--shiftk

Kmesh shifts. Default: 0.5 0.5 0.5

Default: (0.5, 0.5, 0.5)

--kptopt

Kptopt input variable. Default: 1

Default: 1

lgk

Read structure from file, find little group of k-point, print Bilbao character table.

abistruct.py lgk [-h] [-v] [--loglevel LOGLEVEL] [--symprec SYMPREC] [--angle-tolerance ANGLE_TOLERANCE]
                 [--no-time-reversal] [--site-symmetry] -k KPOINT KPOINT KPOINT
                 [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

--symprec

symprec (float): Tolerance for symmetry finding. Defaults to 1e-3, which is fairly strict and works well for properly refined structures with atoms in the proper symmetry coordinates. For structures with slight deviations from their proper atomic positions (e.g., structures relaxed with electronic structure codes), a looser tolerance of 0.1 (the value used in Materials Project) is often needed.

Default: 0.001

--angle-tolerance

angle_tolerance (float): Angle tolerance for symmetry finding. Default: 5.0

Default: 5.0

--no-time-reversal

Don’t use time-reversal.

Default: False

--site-symmetry

Show site symmetries i.e. the point group operations that leave the site invariant.

Default: False

-k, --kpoint

K-point in reduced coordinates e.g. 0.25 0 0

kstar

Read structure from file, print star of k-point.

abistruct.py kstar [-h] [-v] [--loglevel LOGLEVEL] [--symprec SYMPREC] [--angle-tolerance ANGLE_TOLERANCE]
                   [--no-time-reversal] [--site-symmetry] -k KPOINT KPOINT KPOINT
                   [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

--symprec

symprec (float): Tolerance for symmetry finding. Defaults to 1e-3, which is fairly strict and works well for properly refined structures with atoms in the proper symmetry coordinates. For structures with slight deviations from their proper atomic positions (e.g., structures relaxed with electronic structure codes), a looser tolerance of 0.1 (the value used in Materials Project) is often needed.

Default: 0.001

--angle-tolerance

angle_tolerance (float): Angle tolerance for symmetry finding. Default: 5.0

Default: 5.0

--no-time-reversal

Don’t use time-reversal.

Default: False

--site-symmetry

Show site symmetries i.e. the point group operations that leave the site invariant.

Default: False

-k, --kpoint

K-point in reduced coordinates e.g. 0.25 0 0

keq

Read structure from file, check whether two k-points are equivalent by symmetry.

abistruct.py keq [-h] [-v] [--loglevel LOGLEVEL] [--symprec SYMPREC] [--angle-tolerance ANGLE_TOLERANCE]
                 [--no-time-reversal] [--site-symmetry] -k KPOINTS KPOINTS KPOINTS KPOINTS KPOINTS KPOINTS
                 [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

--symprec

symprec (float): Tolerance for symmetry finding. Defaults to 1e-3, which is fairly strict and works well for properly refined structures with atoms in the proper symmetry coordinates. For structures with slight deviations from their proper atomic positions (e.g., structures relaxed with electronic structure codes), a looser tolerance of 0.1 (the value used in Materials Project) is often needed.

Default: 0.001

--angle-tolerance

angle_tolerance (float): Angle tolerance for symmetry finding. Default: 5.0

Default: 5.0

--no-time-reversal

Don’t use time-reversal.

Default: False

--site-symmetry

Show site symmetries i.e. the point group operations that leave the site invariant.

Default: False

-k, --kpoints

K-points in reduced coordinates e.g. 0.25 0 0 0 0.25 0

visualize

Visualize the structure with the specified application. Requires external app or optional python modules (mayavi, vtk).

abistruct.py visualize [-h] [-v] [--loglevel LOGLEVEL] [-a APPNAME] [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

-a, --appname

Application name. Possible options: avogadro, ovito, v_sim, vesta, xcrysden, mpl (matplotlib), mayavi, vtk

Default: “vesta”

mp_id

Get structure from the pymatgen database. Export to format. Requires internet connection and PMG_MAPI_KEY.

abistruct.py mp_id [-h] [-v] [--loglevel LOGLEVEL] [--mapi-key MAPI_KEY] [--endpoint ENDPOINT] [-b]
                   [-f FORMAT]
                   mpid

Positional Arguments

mpid

Pymatgen identifier.

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

--mapi-key

Pymatgen PMG_MAPI_KEY. Use value in .pmgrc.yaml if not specified.

--endpoint

Pymatgen database.

Default: “https://www.materialsproject.org/rest/v2

-b, --browser

Open materials-project webpages in browser

Default: False

-f, --format

Output format. Default: cif. Accept: (abivars, cif, xsf, poscar, qe, siesta, wannier90, cssr, json, None)

Default: “cif”

mp_match

Get structure from the pymatgen database. Requires internet connection and PMG_MAPI_KEY.

abistruct.py mp_match [-h] [--mapi-key MAPI_KEY] [--endpoint ENDPOINT] [-b] [-v] [--loglevel LOGLEVEL]
                      [-nb] [--classic-notebook] [--no-browser] [--foreground] [-f FORMAT]
                      [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

--mapi-key

Pymatgen PMG_MAPI_KEY. Use value in .pmgrc.yaml if not specified.

--endpoint

Pymatgen database.

Default: “https://www.materialsproject.org/rest/v2

-b, --browser

Open materials-project webpages in browser

Default: False

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

-nb, --notebook

Generate jupyter notebook.

Default: False

--classic-notebook

Use classic notebook instead of jupyterlab.

Default: False

--no-browser

Start the jupyter server to serve the notebook but don’t open the notebook in the browser. Use this option to connect remotely from localhost to the machine running the kernel

Default: False

--foreground

Run jupyter notebook in the foreground.

Default: False

-f, --format

Output format. Default: abivars. Accept: (abivars, cif, xsf, poscar, qe, siesta, wannier90, cssr, json, None)

Default: “abivars”

mp_pd

Generate phase diagram with entries from the Materials Project. Requires internet connection and PMG_MAPI_KEY

abistruct.py mp_pd [-h] [--mapi-key MAPI_KEY] [--endpoint ENDPOINT] [-b] [-v] [--loglevel LOGLEVEL]
                   [-u SHOW_UNSTABLE]
                   file_or_elements

Positional Arguments

file_or_elements

FILE with structure or elements e.g., Li-Fe-O).

Named Arguments

--mapi-key

Pymatgen PMG_MAPI_KEY. Use value in .pmgrc.yaml if not specified.

--endpoint

Pymatgen database.

Default: “https://www.materialsproject.org/rest/v2

-b, --browser

Open materials-project webpages in browser

Default: False

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

-u, --show-unstable

Whether unstable phases will be plotted as well as red crosses. If a number > 0 is entered, all phases with ehull < show_unstable will be shown.

Default: 0

mp_ebands

Get structure from the pymatgen database. Export to format. Requires internet connection and PMG_MAPI_KEY.

abistruct.py mp_ebands [-h] [-v] [--loglevel LOGLEVEL] [--mapi-key MAPI_KEY] [--endpoint ENDPOINT] [-b]
                       chemsys_formula_id

Positional Arguments

chemsys_formula_id

A chemical system (e.g., Li-Fe-O), or formula (e.g., Fe2O3) or materials_id (e.g., mp-149).

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

--mapi-key

Pymatgen PMG_MAPI_KEY. Use value in .pmgrc.yaml if not specified.

--endpoint

Pymatgen database.

Default: “https://www.materialsproject.org/rest/v2

-b, --browser

Open materials-project webpages in browser

Default: False

cod_id

Get structure from COD database. Requires internet connection and mysql

abistruct.py cod_id [-h] [-v] [--loglevel LOGLEVEL] [--primitive] [-f FORMAT] cod_identifier

Positional Arguments

cod_identifier

COD identifier.

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”

--primitive

Convert COD cell into primitive cell.

Default: False

-f, --format

Output format. Default: abivars. Accept: (abivars, cif, xsf, poscar, qe, siesta, wannier90, cssr, json, None)

Default: “abivars”

animate

Read structures from HIST.nc or XDATCAR. Print structures in Xcrysden AXSF format to stdout.

abistruct.py animate [-h] [-v] [--loglevel LOGLEVEL] [filepath]

Positional Arguments

filepath

File with the crystalline structure (Abinit Netcdf files, CIF, Abinit input/output files, POSCAR …)

Named Arguments

-v, --verbose

verbose, can be supplied multiple times to increase verbosity

Default: 0

--loglevel

Set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG

Default: “ERROR”