pymatgen.command_line.bader_caller module

This module implements an interface to the Henkelmann et al.’s excellent Fortran code for calculating a Bader charge analysis.

This module depends on a compiled bader executable available in the path. Please download the library at http://theory.cm.utexas.edu/vasp/bader/ and follow the instructions to compile the executable.

If you use this module, please cite the following:

G. Henkelman, A. Arnaldsson, and H. Jonsson, “A fast and robust algorithm for Bader decomposition of charge density”, Comput. Mater. Sci. 36, 254-360 (2006).

class BaderAnalysis(chgcar_filename=None, potcar_filename=None, chgref_filename=None, parse_atomic_densities=False, cube_filename=None)[source]

Bases: object

Bader analysis for Cube files and VASP outputs.

Initializes the Bader caller.

Parameters
  • chgcar_filename (str) – The filename of the CHGCAR.

  • parse_atomic_densities (bool) – Optional. turns on atomic partition of the charge density charge densities are atom centered

classmethod from_path(path, suffix='')[source]

Convenient constructor that takes in the path name of VASP run to perform Bader analysis.

Parameters
  • path (str) – Name of directory where VASP output files are stored.

  • suffix (str) – specific suffix to look for (e.g. ‘.relax1’ for ‘CHGCAR.relax1.gz’).

get_charge(atom_index)[source]

Convenience method to get the charge on a particular atom. If the cube file is a spin-density file, then this will return the spin density per atom with positive being spin up and negative being spin down.

Parameters

atom_index – Index of atom.

Returns

Charge associated with atom from the Bader analysis.

get_charge_decorated_structure()[source]

Returns an charge decorated structure

Note, this assumes that the Bader analysis was correctly performed on a file with electron densities

get_charge_transfer(atom_index)[source]

Returns the charge transferred for a particular atom. Requires POTCAR to be supplied.

Parameters

atom_index – Index of atom.

Returns

Charge transfer associated with atom from the Bader analysis. Given by final charge on atom - nelectrons in POTCAR for associated atom.

get_oxidation_state_decorated_structure()[source]

Returns an oxidation state decorated structure based on bader analysis results.

Note, this assumes that the Bader analysis was correctly performed on a file with electron densities

get_spin_state_decorated_structure()[source]

Returns a structure decorated with spins.

Note, this assumes that the Bader analysis was correctly performed on a file with spin densities

property summary

Dict summary of key analysis, e.g., atomic volume, charge, etc.

Type

return

bader_analysis_from_objects(chgcar, potcar=None, aeccar0=None, aeccar2=None)[source]

Convenience method to run Bader analysis from a set of pymatgen Chgcar and Potcar objects.

This method will:

1. If aeccar objects are present, constructs a temporary reference file as AECCAR0 + AECCAR2 2. Runs Bader analysis twice: once for charge, and a second time for the charge difference (magnetization density).

Parameters
  • chgcar – Chgcar object

  • potcar – (optional) Potcar object

  • aeccar0 – (optional) Chgcar object from aeccar0 file

  • aeccar2 – (optional) Chgcar object from aeccar2 file

Returns

summary dict

bader_analysis_from_path(path, suffix='')[source]

Convenience method to run Bader analysis on a folder containing typical VASP output files.

This method will:

1. Look for files CHGCAR, AECAR0, AECAR2, POTCAR or their gzipped counterparts. 2. If AECCAR* files are present, constructs a temporary reference file as AECCAR0 + AECCAR2 3. Runs Bader analysis twice: once for charge, and a second time for the charge difference (magnetization density).

Parameters
  • path – path to folder to search in

  • suffix – specific suffix to look for (e.g. ‘.relax1’ for ‘CHGCAR.relax1.gz’

Returns

summary dict

get_filepath(filename, warning, path, suffix)[source]
Parameters
  • filename – Filename

  • warning – Warning message

  • path – Path to search

  • suffix – Suffixes to search.