featurebox.cli package

The cli part include:

bandgap, dbc, bader, cohp, dos, general, diff, converge

  1. Run in command line mode (suggested). All message (help) could get by '-h' .

Examples:

$ featurebox bandgap -h

$ fbx bandgap -h

$ featurebox bandgap -p /home/parent_dir

$ featurebox bandgap -f /home/parent_dir/paths.temp
  1. Run in python.

>>> from featurebox.cli.vasp_dos import DosxyzPathOut
>>> dosxyz = DosxyzPathOut(n_jobs=4, store_single=True)
>>> result = dosxyz.transfrom(paths_list)

Submodules

featurebox.cli.vasp_bader module

class featurebox.cli.vasp_bader.BaderStartInter(n_jobs: int = 1, tq: bool = True, store_single=False)

基类:BaderStartZero

Get bader from paths and return csv file. For some system can’t run BaderStartZero.

Download bader from http://theory.cm.utexas.edu/henkelman/code/bader/

Download chgsum.pl from http://theory.cm.utexas.edu/vtsttools/download.html

  1. Copy follow code to form one ”badertoACF.sh“ file, and ‘sh badertoACF.sh’:

Notes:

#!/bin/bash

old_path=$(cd "$(dirname "$0")"; pwd)

for i in $(cat paths.temp)

do

cd $i

echo $(cd "$(dirname "$0")"; pwd)

chgsum.pl AECCAR0 AECCAR2

bader CHGCAR -ref CHGCAR_sum

cd $old_path

done
  1. tar -zcvf data.tar.gz ACF.dat POTCAR POSCAR.

  2. Move to other system and run ‘tar -zxvf data.tar.gz’.

  3. Run with this class (-j 1).

run(path: Path, files: Optional[List] = None)

3.Run with software and necessary file and get data. (1) Return result in code, or (2) Both return file to each path and in code.

class featurebox.cli.vasp_bader.BaderStartSingleResult(n_jobs: int = 1, tq: bool = True, store_single=False)

基类:BaderStartZero

Get bader from paths and return csv file. Avoid Double Calculation. Just reproduce the ‘results_all’ from a ‘result_single’ files. keeping the ‘result_single.csv’ files exists.

read(path, **kwargs)

Run linux cmd and return result, make sure the bader is installed.

run(path: Path, files: Optional[List] = None)

3.Run with software and necessary file and get data. (1) Return result in code, or (2) Both return file to each path and in code.

class featurebox.cli.vasp_bader.BaderStartZero(n_jobs: int = 1, tq: bool = True, store_single=False)

基类:_BasePathOut

Get bader from paths and return csv file.

1.Download bader from http://theory.cm.utexas.edu/henkelman/code/bader/

2. Download chgsum.pl from http://theory.cm.utexas.edu/vtsttools/download.html

batch_after_treatment(paths, res_code)
  1. Organize batch of data in tabular form, return one or more csv file. (force!!!).

static extract(data: DataFrame, atoms, format_path: Optional[Callable] = None)

Extract the message in data, and formed it.

参数:
  • data (pd.DateFrame) – transformed data.

  • format_path (Callable) – function to deal with each path, for better shown.

返回:

res_data – extracted and formed data.

返回类型:

pd.DateFrame

static read(path, store=False, store_name='bader_single.csv')

Run linux cmd and return result, make sure the bader is installed.

run(path: Path, files: Optional[List] = None)

3.Run with software and necessary file and get data. (1) Return result in code, or (2) Both return file to each path and in code.

featurebox.cli.vasp_bgp module

class featurebox.cli.vasp_bgp.BandGapPy(n_jobs: int = 1, tq: bool = True, store_single=False)

基类:_BasePathOut

Get band gap from vasprun.xml by pymatgen.

batch_after_treatment(paths, res_code)
  1. Organize batch of data in tabular form, return one or more csv file. (force!!!).

run(path: Path, files: Optional[List] = None)

3.Run with software and necessary file and get data. (1) Return result in code, or (2) Both return file to each path and in code.

class featurebox.cli.vasp_bgp.BandGapStartInter(n_jobs: int = 1, tq: bool = True, store_single=False)

基类:BandGapStartZero

For some system can’t run this BandGapStartZero. Download vaspkit from https://vaspkit.com/installation.html#download

  1. Copy follow code to form one ”bg.sh“ file, and ‘sh bg.sh’:

Notes:

#!/bin/bash

old_path=$(cd "$(dirname "$0")"; pwd)

for i in $(cat paths.temp)

do

cd $i

echo $(cd "$(dirname "$0")"; pwd)

vaspkit -task 911 > BAND_GAP

cd $old_path

done
  1. tar -zcvf data.tar.gz BAND_GAP.

  2. Move to other system and run ‘tar -zxvf data.tar.gz’.

  3. Run with this class.

run(path: Path, files: Optional[List] = None)

3.Run with software and necessary file and get data. (1) Return result in code, or (2) Both return file to each path and in code.

class featurebox.cli.vasp_bgp.BandGapStartSingleResult(n_jobs: int = 1, tq: bool = True, store_single=False)

基类:BandGapStartZero

Avoid Double Calculation. Just reproduce the ‘results_all’ from a ‘result_single’ files. keeping the ‘result_single.csv’ files exists.

read(path, **kwargs)
run(path: Path, files: Optional[List] = None)

3.Run with software and necessary file and get data. (1) Return result in code, or (2) Both return file to each path and in code.

class featurebox.cli.vasp_bgp.BandGapStartZero(n_jobs: int = 1, tq: bool = True, store_single=False)

基类:_BasePathOut

Get band gap from paths and return csv file. VASPKIT Version: 1.2.1 or below. Download vaspkit from https://vaspkit.com/installation.html#download

batch_after_treatment(paths, res_code)
  1. Organize batch of data in tabular form, return one or more csv file. (force!!!).

static read(path, store=False, store_name='bgp_single.csv')
run(path: Path, files: Optional[List] = None)

3.Run with software and necessary file and get data. (1) Return result in code, or (2) Both return file to each path and in code.

featurebox.cli.vasp_chg_diff module

Due to the CHGCAR file are large, We don’t use python code to get chg_diff. (CHGCAR2-CHGCAR1) Result = f2 - f1, make sure the rank of paths in two files are matching.

file1

p1

p2

file2

p1’

p2’

featurebox.cli.vasp_cohp module

class featurebox.cli.vasp_cohp.COHPStartInter(n_jobs: int = 1, tq: bool = True, store_single=True)

基类:COHPStartZero

For some system can’t run this COHPStartZero. Download lobster from http://www.cohp.de/

  1. Copy follow code to form one ”lob.sh“ file, and ‘sh lob.sh’ (change the atoms couple):

Notes:

#!/bin/bash

old_path=$(cd "$(dirname "$0")"; pwd)

for i in $(cat paths.temp)

do

cd $i

echo $(cd "$(dirname "$0")"; pwd)

echo COHPStartEnergy -10 > lobsterin

echo COHPEndEnergy 5 >> lobsterin

echo cohpBetween atom 45 atom 31 >> lobsterin

sleep 30m

lobster > look

cd $old_path


done
  1. tar -zcvf data.tar.gz “ICOHPLIST.lobster”, “COHPCAR.lobster”.

  2. Move to other system and run ‘tar -zxvf data.tar.gz’.

  3. Run with this class.

run(path: Path, files: Optional[List] = None)

3.Run with software and necessary file and get data. (1) Return result in code, or (2) Both return file to each path and in code.

class featurebox.cli.vasp_cohp.COHPStartSingleResult(n_jobs: int = 1, tq: bool = True, store_single=False)

基类:COHPStartInter

Avoid Double Calculation. Just reproduce the ‘results_all’ from a ‘result_single’ files. keeping the ‘result_single.csv’ files exists.

read(path, **kwargs)
run(path: Path, files: Optional[List] = None)

3.Run with software and necessary file and get data. (1) Return result in code, or (2) Both return file to each path and in code.

class featurebox.cli.vasp_cohp.COHPStartZero(n_jobs: int = 1, tq: bool = True, store_single=True)

基类:_BasePathOut

Get d band center from paths and return csv file. Download lobster from http://www.cohp.de/

batch_after_treatment(paths, res_code)
  1. Organize batch of data in tabular form, return one or more csv file. (force!!!).

static read(path, store=False)
run(path: Path, files: Optional[List] = None)

3.Run with software and necessary file and get data. (1) Return result in code, or (2) Both return file to each path and in code.

featurebox.cli.vasp_converge module

class featurebox.cli.vasp_converge.ConvergeChecker(n_jobs: int = 1, tq: bool = True, store_single=False)

基类:_BasePathOut

Get energy from paths and return csv file. VASPKIT Version: 1.2.1 or below.

batch_after_treatment(paths, res_code)
  1. Organize batch of data in tabular form, return one or more csv file. (force!!!).

run(path: Path, files: Optional[List] = None)

3.Run with software and necessary file and get data. (1) Return result in code, or (2) Both return file to each path and in code.

featurebox.cli.vasp_converge.check_convergence(pt: Union[str, Path, PathLike, Path], msg=None)

Check final energy.

参数:
  • pt – (str, path.Path, os.PathLike,pathlib.Path), path

  • msg – (list of str), message.

返回:

(tuple), bool and msg list

返回类型:

res

featurebox.cli.vasp_dbc module

class featurebox.cli.vasp_dbc.DBCPy(n_jobs: int = 1, tq: bool = True, store_single=False, method='ele')

基类:_BasePathOut

Get d band center by pymatgen and return csv file. pymatgen>=2022.5.26

batch_after_treatment(paths, res_code)
  1. Organize batch of data in tabular form, return one or more csv file. (force!!!).

run(path: Path, files: Optional[List] = None)

3.Run with software and necessary file and get data. (1) Return result in code, or (2) Both return file to each path and in code.

class featurebox.cli.vasp_dbc.DBCStartInter(n_jobs: int = 1, tq: bool = True, store_single=False)

基类:DBCStartZero

For some system can’t run this DBCStartZero.

Download vaspkit from https://vaspkit.com/installation.html#download

  1. Copy follow code to form one ”dbc.sh“ file, and run ‘sh dbc.sh’:

Notes:

#!/bin/bash

old_path=$(cd "$(dirname "$0")"; pwd)

for i in $(cat paths.temp)

do

cd $i

echo $(cd "$(dirname "$0")"; pwd)

vaspkit -task 503

cd $old_path

done
  1. tar -zcvf data.tar.gz D_BAND_CENTER.

  2. Move to other system and run ‘tar -zxvf data.tar.gz’.

  3. Run with this class.

run(path: Path, files: Optional[List] = None)

3.Run with software and necessary file and get data. (1) Return result in code, or (2) Both return file to each path and in code.

class featurebox.cli.vasp_dbc.DBCStartSingleResult(n_jobs: int = 1, tq: bool = True, store_single=False)

基类:DBCStartZero

Avoid Double Calculation. Just reproduce the ‘results_all’ from a ‘result_single’ files. keeping the ‘result_single.csv’ files exists.

read(path, **kwargs)

Run linux cmd and return result, make sure the vaspkit is installed.

run(path: Path, files: Optional[List] = None)

3.Run with software and necessary file and get data. (1) Return result in code, or (2) Both return file to each path and in code.

class featurebox.cli.vasp_dbc.DBCStartZero(n_jobs: int = 1, tq: bool = True, store_single=False)

基类:_BasePathOut

Get d band center from paths and return csv file. VASPKIT Version: 1.2.1 or below. Download vaspkit from https://vaspkit.com/installation.html#download

batch_after_treatment(paths, res_code)
  1. Organize batch of data in tabular form, return one or more csv file. (force!!!).

static extract(data: DataFrame, atoms=None, ele=None, join_ele=None, format_path: Optional[Callable] = None)

atoms start from 1. This atom number are different to the structure atom number.

static read(d, store=False, store_name='dbc_single.csv')

Run linux cmd and return result, make sure the vaspkit is installed.

run(path: Path, files: Optional[List] = None)

3.Run with software and necessary file and get data. (1) Return result in code, or (2) Both return file to each path and in code.

class featurebox.cli.vasp_dbc.DBCxyzPathOut(n_jobs: int = 1, tq: bool = True, store_single=False, method='atom')

基类:_BasePathOut

Get d band center by code and return csv file.

batch_after_treatment(paths, res_code)
  1. Organize batch of data in tabular form, return one or more csv file. (force!!!).

static extract(data: DataFrame, atoms, ori=None, format_path: Optional[Callable] = None)

atoms start from 0.

run(path: Path, files: Optional[List] = None)

3.Run with software and necessary file and get data. (1) Return result in code, or (2) Both return file to each path and in code.

featurebox.cli.vasp_dbc.get_atom_pdos_center(dos: Optional[CompleteDos] = None, mark_orbital=None, mark_atom_numbers=None)
featurebox.cli.vasp_dbc.get_ele_pdos_center(dos: Optional[CompleteDos] = None, mark_orbital=None, mark_element=None)

featurebox.cli.vasp_dos module

class featurebox.cli.vasp_dos.DosPy(n_jobs: int = 1, tq: bool = True, store_single=False, method='ele')

基类:_BasePathOut

Get d band center from paths and return csv file.

batch_after_treatment(paths, res_code)
  1. Organize batch of data in tabular form, return one or more csv file. (force!!!).

run(path: Path, files: Optional[List] = None)

3.Run with software and necessary file and get data. (1) Return result in code, or (2) Both return file to each path and in code.

class featurebox.cli.vasp_dos.Dosxyz(doscar='DOSCAR', poscar='CONTCAR', vasprun='vasprun.xml', ispin=2, lmax=2, lorbit=11, spin_orbit_coupling=False, read_pdos=True, max=10, min=-10)

基类:object

Read DOSCAR and get pdos and band centor.

Create a Doscar object from a VASP DOSCAR file.

参数:
  • doscar (str) – Filename of the VASP DOSCAR file to read.

  • poscar (str) – File POSCAR/CONTCAR

  • vasprun (str) – File vasprun.xml

  • (optional (read_pdos) – int): ISPIN flag. Set to 1 for non-spin-polarised or 2 for spin-polarised calculations. (Default = 2.)

  • (optional – int): Maximum l angular momentum. (d=2, f=3). Default = 2.

  • (optional – int): The VASP LORBIT flag. (Default=11).

  • (optional – int): max value

  • (optional – int): min value

  • (optional – bool): Spin-orbit coupling (Default=False).

  • (optional – bool): Set to True to read the atom-projected density of states (Default=True).

calculate(orb='d', species: Optional[List[str]] = None, atoms: Optional[List[int]] = None, emax=2, emin=-10, m=None)

species (optional:list(str)): List of atomic species strings, e.g. [ ‘Fe’, ‘Fe’, ‘O’, ‘O’, ‘O’ ]. Default=None.

dbc_part_atom_num(path=None)
dbc_part_atom_type(path=None)
property number_of_channels
number_of_header_lines = 6
pdos_by_atom_num(spin=None)
pdos_by_atom_type(spin=None)
pdos_by_spdf(atoms=None, spin=None, l=None)
pdos_by_spdf_atom_num(spin=None, l=None)
pdos_by_spdf_atom_type(spin=None, l=None)
pdos_by_spdf_xyz_atom_num(path=None)
pdos_by_spdf_xyz_atom_type(path=None)
static pdos_column_names(lmax, ispin)
pdos_select(atoms=None, spin=None, l=None, m=None)

Returns a subset of the projected density of states array.

pdos_sum(atoms=None, spin=None, l=None, m=None)
process_header()
read_atomic_dos_as_df(atom_number)
read_header()
read_projected_dos()

Read the projected density of states data into

scale(data) DataFrame
class featurebox.cli.vasp_dos.DosxyzPathOut(n_jobs: int = 1, tq: bool = True, store_single=False, method='ele')

基类:_BasePathOut

Get dos from paths and return csv file.

batch_after_treatment(paths, res_code)
  1. Organize batch of data in tabular form, return one or more csv file. (force!!!).

run(path: Path, files: Optional[List] = None)

3.Run with software and necessary file and get data. (1) Return result in code, or (2) Both return file to each path and in code.

featurebox.cli.vasp_dos.get_atom_pdos(dos: Optional[CompleteDos] = None, mark_orbital=None, mark_atom_numbers=None, sigma=0.1, path=None)
featurebox.cli.vasp_dos.get_ele_pdos(dos: Optional[CompleteDos] = None, mark_orbital=None, mark_element=None, sigma=0.1, path=None)

featurebox.cli.vasp_general_diff module

class featurebox.cli.vasp_general_diff.GeneralDiff(n_jobs: int = 1, tq: bool = True, store_single=False, mod='pymatgen.io.vasp', cmd='Vasprun', necessary_files='vasprun.xml', prop='final_energy')

基类:_BasePathOut2

Get data from couples of paths and return csv file.

Notes:

mod="pymatgen.io.vasp"         # Module to get class.
cmd="Vasprun"                  # class to get object.
necessary_files="vasprun.xml"  # class input file.
prop="final_energy"            # class.property name.
batch_after_treatment(paths, res_code)
  1. Organize batch of data in tabular form, return one or more csv file. (force!!!).

run(paths: List[Path], files: Optional[List] = None)

3.Run with software and necessary file and get data. (1) Return result in code, or (2) Both return file to each path and in code.

featurebox.cli.vasp_general_single module

class featurebox.cli.vasp_general_single.General(n_jobs: int = 1, tq: bool = True, store_single=False, mod='pymatgen.io.vasp', cmd='Vasprun', necessary_files='vasprun.xml', prop='final_energy')

基类:_BasePathOut

Get data from paths and return csv file.

Default keys Notes:

mod="pymatgen.io.vasp"         # Module to get class.
cmd="Vasprun"                  # class to get object.
necessary_files="vasprun.xml"  # class input file.
prop="final_energy"            # class.property name.
batch_after_treatment(paths, res_code)
  1. Organize batch of data in tabular form, return one or more csv file. (force!!!).

run(path: Path, files: Optional[List] = None)

3.Run with software and necessary file and get data. (1) Return result in code, or (2) Both return file to each path and in code.