featurebox.cli package¶
The cli part include:
bandgap,dbc,bader,cohp,dos,general,diff,converge
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
Run in python.
>>> from featurebox.cli.vasp_dos import DosxyzPathOut
>>> dosxyz = DosxyzPathOut(n_jobs=4, store_single=True)
>>> result = dosxyz.transform(paths_list)
Submodules¶
featurebox.cli.vasp_bader module¶
- class featurebox.cli.vasp_bader.BaderStartInter(n_jobs: int = 1, tq: bool = True, store_single=False)¶
Bases:
BaderStartZeroGet 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
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
tar -zcvf data.tar.gz ACF.dat POTCAR POSCAR.
Move to other system and run ‘tar -zxvf data.tar.gz’.
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)¶
Bases:
BaderStartZeroGet 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)¶
Bases:
_BasePathOutGet 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)¶
Organize batch of data in tabular form, return one or more csv file. (force!!!).
- static extract(data: DataFrame, atoms, format_path: Optional[Callable] = None)¶
The last process! Extract the message in data, and formed it to be one table or ML or plot.
- Parameters:
data (pd.DateFrame) – to transform data.
format_path (Callable) – function to deal with each path, for better shown.
- Returns:
res_data – extracted and formed data.
- Return type:
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)¶
Bases:
_BasePathOutGet band gap from vasprun.xml by pymatgen.
- batch_after_treatment(paths, res_code)¶
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)¶
Bases:
BandGapStartZeroFor some system can’t run this BandGapStartZero. Download vaspkit from https://vaspkit.com/installation.html#download
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
tar -zcvf data.tar.gz BAND_GAP.
Move to other system and run ‘tar -zxvf data.tar.gz’.
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)¶
Bases:
BandGapStartZeroAvoid 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)¶
Bases:
_BasePathOutGet 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)¶
Organize batch of data in tabular form, return one or more csv file. (force!!!).
- static extract(data, *args, format_path: Optional[Callable] = None, **kwargs)¶
Extract the message in data, and formed it.
- Parameters:
data (pd.DateFrame) – transformed data.
format_path (Callable) – function to deal with each path, for better shown.
- Returns:
res_data – extracted and formed data.
- Return type:
pd.DateFrame
- static read(path, store=False, store_name='bgp_kit_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)¶
Bases:
COHPStartZeroFor some system can’t run this COHPStartZero. Download lobster from http://www.cohp.de/
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 lobster > look sleep 20m cd $old_path done
tar -zcvf data.tar.gz “ICOHPLIST.lobster”, “COHPCAR.lobster”.
Move to other system and run ‘tar -zxvf data.tar.gz’.
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)¶
Bases:
COHPStartInterAvoid 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)¶
Bases:
_BasePathOutGet d band center from paths and return csv file. Download lobster from http://www.cohp.de/
- batch_after_treatment(paths, res_code)¶
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)¶
Bases:
_BasePathOutGet energy from paths and return csv file. VASPKIT Version: 1.2.1 or below.
- batch_after_treatment(paths, res_code)¶
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.
- Parameters:
pt – (str, path.Path, os.PathLike,pathlib.Path), path
msg – (list of str), message.
- Returns:
(tuple), bool and msg list
- Return type:
res
featurebox.cli.vasp_dbc module¶
- class featurebox.cli.vasp_dbc.DBCPy(n_jobs: int = 1, tq: bool = True, store_single=False, method='ele')¶
Bases:
_BasePathOutGet d band center by pymatgen and return csv file. pymatgen>=2022.5.26
- batch_after_treatment(paths, res_code)¶
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)¶
Bases:
DBCStartZeroFor some system can’t run this DBCStartZero.
Download vaspkit from https://vaspkit.com/installation.html#download
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
tar -zcvf data.tar.gz D_BAND_CENTER.
Move to other system and run ‘tar -zxvf data.tar.gz’.
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)¶
Bases:
DBCStartZeroAvoid 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)¶
Bases:
_BasePathOutGet 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)¶
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.
>>> self.extract(res, ele=["O1","C1",...], join_ele=[f'{i}1' if i !='Mo' else 'Mo18' for i in self.doping], )
- 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')¶
Bases:
_BasePathOutGet d band center by code and return csv file.
- batch_after_treatment(paths, res_code)¶
Organize batch of data in tabular form, return one or more csv file. (force!!!).
- static extract(data: DataFrame, atoms, orbit=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')¶
Bases:
_BasePathOutGet d band center from paths and return csv file.
- batch_after_treatment(paths, res_code)¶
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)¶
Bases:
objectRead DOSCAR and get pdos and band centor.
Create a Doscar object from a VASP DOSCAR file.
- Parameters:
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')¶
Bases:
_BasePathOutGet dos from paths and return csv file.
- batch_after_treatment(paths, res_code)¶
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')¶
Bases:
_BasePathOut2Get 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)¶
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')¶
Bases:
_BasePathOutGet 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)¶
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.