def parse_args_main_util(args): parser = argparse.ArgumentParser(epilog=epilog, description=description + """ This command provide some utilities related to the VASP calculations""") subparsers = parser.add_subparsers() dirs_parser = add_sub_parser(argparse, name="dirs") unitcell_parser = add_sub_parser(argparse, name="unitcell") si_parser = add_sub_parser(argparse, name="supercell_info") no_calc_results = add_sub_parser(argparse, name="no_calc_results_check") # -- composition energies from mp ------------------------------------------ parser_comp_es_from_mp = subparsers.add_parser( name="composition_energies_from_mp", description="Retrieve composition energies from Materials Project.", formatter_class=argparse.ArgumentDefaultsHelpFormatter, aliases=['cefm']) parser_comp_es_from_mp.add_argument( "-e", "--elements", type=str, nargs="+", help="Element names considered in chemical potential diagram. Used for " "creating the diagram from mp data with atom energy alignment.") parser_comp_es_from_mp.add_argument( "-a", "--atom_energy_yaml", type=str, help="Yaml file storing atom energies for energy alignment.") parser_comp_es_from_mp.set_defaults(func=composition_energies_from_mp) # -- add interstitials from local extrema ---------------------------------- parser_ai = subparsers.add_parser( name="add_interstitials_from_local_extrema", description="Add interstitials via volumetric_data_local_extrema.json " "file.", parents=[si_parser], formatter_class=argparse.ArgumentDefaultsHelpFormatter, aliases=['ai']) parser_ai.add_argument( "--local_extrema", required=True, type=loadfn, help="volumetric_data_local_extrema.json file name.") parser_ai.add_argument( "-i", "--indices", required=True, type=int, nargs="+", help="Indices starting from 1 to be added to SupercellInfo.") parser_ai.set_defaults(func=add_interstitials_from_local_extrema) # -- make defect vesta file ------------------------------------------------ parser_dvf = subparsers.add_parser( name="defect_vesta_file", description="Generate VESTA file for visualizing defect structure.", parents=[dirs_parser], formatter_class=argparse.ArgumentDefaultsHelpFormatter, aliases=['dvf']) parser_dvf.add_argument( "--cutoff", type=float, default=defaults.show_structure_cutoff, help="Cutoff radius in which atoms are shown in VESTA files.") parser_dvf.add_argument( "--min_displace_w_arrows", type=float, default=0.1, help="Minimum displacement that shows arrows to visualize " "displacements.") parser_dvf.add_argument("--arrow_factor", type=float, default=3.0, help="Factor to enhance the displacements.") parser_dvf.add_argument("--title", type=str, help="Title to be shown in VESTA files.") parser_dvf.set_defaults(func=make_defect_vesta_file) # -- gkfo correction ------------------------------------------------------- parser_gkfo = subparsers.add_parser( name="gkfo", description="Generate GKFO correction files.", parents=[unitcell_parser], formatter_class=argparse.ArgumentDefaultsHelpFormatter, aliases=['gkfo']) parser_gkfo.add_argument( "-iefnv", "--initial_efnv_correction", required=True, type=loadfn, help="Path to the initial efnv correction.json file.") parser_gkfo.add_argument( "-icr", "--initial_calc_results", required=True, type=loadfn, help="Path to the initial calc_results.json file.") parser_gkfo.add_argument("-fcr", "--final_calc_results", required=True, type=loadfn, help="Path to the final calc_results.json file.") parser_gkfo.add_argument( "-cd", "--charge_diff", required=True, type=int, help="Charge difference of final state from initial state.") parser_gkfo.set_defaults(func=make_gkfo_correction_from_vasp) # ------------------------------------------------------------------------ return parser.parse_args(args)
def parse_args_main_vasp_util(args): parser = argparse.ArgumentParser(epilog=epilog, description=description + """ This command provides some utilities related to the VASP calculations""") subparsers = parser.add_subparsers() dir_parser = add_sub_parser(argparse, name="dir") # -- calc charge state ----------------------------------------------------- parser_calc_charge_state = subparsers.add_parser( name="calc_charge_state", description="Calc defect charge states from INCAR, POSCAR and POTCAR" "files.", parents=[dir_parser], formatter_class=argparse.ArgumentDefaultsHelpFormatter, aliases=['ccs']) parser_calc_charge_state.set_defaults(func=calc_charge_state) # -- make defect entry ----------------------------------------------------- parser_make_defect_entry = subparsers.add_parser( name="make_defect_entry", description="Make defect entry from INCAR, POSCAR and POTCAR" "files.", parents=[dir_parser], formatter_class=argparse.ArgumentDefaultsHelpFormatter, aliases=['de']) parser_make_defect_entry.add_argument( "-n", "--name", type=str, required=True, help="Name used for plotting energy diagram.") parser_make_defect_entry.add_argument( "-p", "--perfect", type=Structure.from_file, required=True, help="Perfect supercell POSCAR file name.") parser_make_defect_entry.set_defaults(func=make_defect_entry_main) # -- make parchg dir ----------------------------------------------- parser_make_parchg_dir = subparsers.add_parser( name="parchg_dir", description="Make parchg directory containing a set of VASP files " "required for generating PARCHG files.", parents=[dir_parser], formatter_class=argparse.ArgumentDefaultsHelpFormatter, aliases=['pd']) parser_make_parchg_dir.set_defaults(func=make_parchg_dir) # -- make refine defect poscar --------------------------------------------- parser_make_refine_defect_poscar = subparsers.add_parser( name="refine_defect_poscar", description="Refine defect structure POSCAR.", formatter_class=argparse.ArgumentDefaultsHelpFormatter, aliases=['rdp']) parser_make_refine_defect_poscar.add_argument("-p", "--poscar", dest="structure", type=Structure.from_file) parser_make_refine_defect_poscar.add_argument("-d", "--defect_entry", type=loadfn) parser_make_refine_defect_poscar.add_argument("-n", "--poscar_name", type=str) parser_make_refine_defect_poscar.set_defaults( func=make_refine_defect_poscar) # -- calc grids ------------------------------------------------------------ parser_calc_grids = subparsers.add_parser( name="calc_grids", description="Calc Grids.", formatter_class=argparse.ArgumentDefaultsHelpFormatter, aliases=['cg']) parser_calc_grids.add_argument("-c", "--chgcar", type=Chgcar.from_file, required=True) parser_calc_grids.set_defaults(func=calc_grids) # -- calc defect charge info ----------------------------------------------- parser_calc_def_charge_info = subparsers.add_parser( name="calc_defect_charge_info", description="Calc defect charge info.", formatter_class=argparse.ArgumentDefaultsHelpFormatter, aliases=['cdc']) parser_calc_def_charge_info.add_argument("-p", "--parchgs", type=str, nargs="+", required=True, help="PARCHG files.") parser_calc_def_charge_info.add_argument("-b", "--bin_interval", type=float, default=0.2) parser_calc_def_charge_info.add_argument("-g", "--grids", type=Grids.from_file, required=True) parser_calc_def_charge_info.set_defaults(func=make_defect_charge_info_main) return parser.parse_args(args)
def parse_args_main_vasp(args): parser = argparse.ArgumentParser(epilog=epilog, description=description + """ The command is used for creating and analyzing VASP input and output files.""") subparsers = parser.add_subparsers() dirs_parser = add_sub_parser(argparse, name="dirs") perfect_band_edge_parser = add_sub_parser(argparse, name="perfect_band_edge_state") # -- unitcell ------------------------------------------------ parser_unitcell = subparsers.add_parser( name="unitcell", description="Parse unitcell info from vasp output files and create " "unitcell.yaml.", formatter_class=argparse.ArgumentDefaultsHelpFormatter, aliases=['u']) parser_unitcell.add_argument( "-vb", "--vasprun_band", required=True, type=Vasprun, help="vasprun.xml file of band structure calculation.") parser_unitcell.add_argument( "-ob", "--outcar_band", required=True, type=Outcar, help="OUTCAR file of band structure calculation.") parser_unitcell.add_argument( "-odc", "--outcar_dielectric_clamped", required=True, type=Outcar, help="OUTCAR file of ion-clamped dielectric constant calculation.") parser_unitcell.add_argument( "-odi", "--outcar_dielectric_ionic", required=True, type=Outcar, help="OUTCAR file for calculating dielectric constant of ionic " "contribution.") parser_unitcell.add_argument( "-n", "--name", type=str, help="System name used for plotting defect formation energies.") parser_unitcell.set_defaults(func=make_unitcell) # -- make_poscars ------------------------------------------------ parser_make_poscars = subparsers.add_parser( name="make_poscars", description="Make directories and poscar files in these that are " "retrieved via the Materials Project API.", formatter_class=argparse.ArgumentDefaultsHelpFormatter, aliases=['mp']) parser_make_poscars.add_argument( "-e", "--elements", required=True, nargs="+", type=str, help="Element names involved. ") parser_make_poscars.add_argument( "--e_above_hull", default=defaults.e_above_hull, type=float, help="Allowed energy above hull in eV/atom.") parser_make_poscars.set_defaults(func=make_competing_phase_dirs) # -- make_composition_energies --------------------------------------------- parser_make_composition_energies = subparsers.add_parser( name="make_composition_energies", description="Make composition energies from the directories in which " "competing phases are calculated. ", formatter_class=argparse.ArgumentDefaultsHelpFormatter, parents=[dirs_parser], aliases=['mce']) parser_make_composition_energies.add_argument( "-y", "--yaml_file", type=str, help="composition_energies.yaml to be overwritten.") parser_make_composition_energies.set_defaults( func=make_composition_energies) # -- make_local_extrema ---------------------------------------------------- parser_make_local_extrema = subparsers.add_parser( name="local_extrema", description="Make local volumetric_data_local_extrema.json file.", formatter_class=argparse.ArgumentDefaultsHelpFormatter, aliases=['le']) parser_make_local_extrema.add_argument( "-v", "--volumetric_data", type=Chgcar.from_file, required=True, nargs="+", help="File names such as CHGCAR or LOCPOT. When multiple files are " "provided, the summed data (e.g., AECCAR0 + AECCAR2) will be " "parsed.") parser_make_local_extrema.add_argument( "--find_max", dest="find_max", action="store_true", help="Set when local maxima are searched instead of local minima.") parser_make_local_extrema.add_argument( "-i", "--info", type=str, help="Information related to the parsed volumetric data written" "as the name in volumetric_data_local_extrema.json.") parser_make_local_extrema.add_argument( "--threshold_frac", default=None, type=float, help="""Optional fraction of extrema shown, which returns `threshold_frac * tot_num_extrema` extrema fractional coordinates based on highest/lowest intensity. For example, there are 3 extrema with 0.1, 0.2, 0.3, and if threshold_frac is set to 0.5, then those with 0.2 and 0.3 are shown as the threshold is now 0.3 * 0.5 = 0.15. It takes from 0 to 1, and default is 1.""") parser_make_local_extrema.add_argument( "--threshold_abs", default=None, type=float, help="""Optional filter. When searching for local minima, intensity <= threshold_abs returns; when searching for local maxima, intensity >= threshold_abs returns. Caveat: threshold_abs and threshold_frac should be set exclusively.""") parser_make_local_extrema.add_argument( "--min_dist", type=float, metavar="Angstrom", default=0.5, help="""Used to remove the predicted sites that are too close to *existing atoms* in the structure. The minimum distance that a vertex needs to be from existing atoms. Set 0 when switch off this flag.""") parser_make_local_extrema.add_argument( "--tol", type=float, metavar="Angstrom", default=0.5, help="""Group interstitials that are too close together using a tol. Set 0 when switch off this flag.""") parser_make_local_extrema.add_argument( "--radius", type=float, default=0.4, help="Radius of sphere around each site to evaluate the average " "quantity.") parser_make_local_extrema.set_defaults(func=make_local_extrema) # -- defect_entries ------------------------------------------------ parser_defect_entries = subparsers.add_parser( name="defect_entries", description="Make POSCAR files and defect entries in defect " "directories", formatter_class=argparse.ArgumentDefaultsHelpFormatter, aliases=['de']) parser_defect_entries.set_defaults(func=make_defect_entries) # -- calc_results ------------------------------------------------ parser_calc_results = subparsers.add_parser( name="calc_results", description="Generate calc_results.json files. " "Run after VASP calculations.", parents=[dirs_parser], formatter_class=argparse.ArgumentDefaultsHelpFormatter, aliases=['cr']) parser_calc_results.set_defaults(func=make_calc_results) # -- perfect band edge state ---------------------------------------------- parser_perf_band_edge_state = subparsers.add_parser( name="perfect_band_edge_state", description="Generate band_edge_orbital_infos.json and " "eigenvalues.pdf.", formatter_class=argparse.ArgumentDefaultsHelpFormatter, aliases=['pbes']) parser_perf_band_edge_state.add_argument( "-d", "--dir", type=Path, help="Directory path to the perfect supercell calculation.") parser_perf_band_edge_state.set_defaults(func=make_perfect_band_edge_state) # -- band edge orbital infos ---------------------------------------------- parser_band_edge_orb_infos = subparsers.add_parser( name="band_edge_orbital_infos", description="Generate band_edge_orbital_infos.json and " "eigenvalues.pdf.", parents=[dirs_parser, perfect_band_edge_parser], formatter_class=argparse.ArgumentDefaultsHelpFormatter, aliases=['beoi']) parser_band_edge_orb_infos.add_argument( "-y", "--y_range", nargs=2, type=float, help="Energy range in y-axis for eigenvalue.pdf") parser_band_edge_orb_infos.set_defaults( func=make_band_edge_orb_infos_and_eigval_plot) # ------------------------------------------------------------------------ return parser.parse_args(args)