pymatgen.command_line.bader_caller module

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

Bases: object

Bader analysis for a CHGCAR.

Initializes the Bader caller.

Parameters:
  • chgcar_filename (str) – The filename of the CHGCAR.
  • potcar_filename (str) – Optional: the filename of the corresponding POTCAR file. Used for calculating the charge transfer. If None, the get_charge_transfer method will raise a ValueError.
  • chgref_filename (str) – Optional. The filename of the reference CHGCAR, which calculated by AECCAR0 + AECCAR2. (See http://theory.cm.utexas.edu/henkelman/code/bader/ for details.)
  • 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.

Parameters:atom_index – Index of atom.
Returns:Charge associated with atom from the Bader analysis.
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.

Returns:Returns an oxidation state decorated structure. Requires POTCAR to be supplied.
classmethod rebuild_chgcar(atomic_densities)[source]
summary
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