def get_wf_single(structure, WORKFLOW="get_wf_gibbs", settings={}, db_file=None): """ Get a single workflow Parameters structure: pymatgen.Structure The structure WORKFLOW: str The name of the workflow, now only gibbs energy workflow(get_wf_gibbs) is supported settings: dict User settings for the workflow Return """ ################ PARAMETERS FOR WF ############################# #str, the absolute path of db.json file, e.g. /storage/home/mjl6505/atomate/config/db.json # If None, it will use the configuration in fireworks if db_file is None: db_file = settings.get('db_file', None) #list, the MAGMOM of the structure, e.g. [4.0, 4.0, -4.0, -4.0] magmom = settings.get('magmom', None) magmom = parse_magmom(magmom=magmom, nvalue=len(structure.sites)) #int, the number of initial deformations, e.g. 7 num_deformations = settings.get('num_deformations', 7) #list/tuple(min, max) or float(-max, max), the maximum amplitude of deformation, e.g. (-0.15, 0.15) means (0.95, 1.1) in volume deformation_fraction = settings.get('deformation_fraction', (-0.15, 0.20)) #float, minimum ratio of Volumes spacing, e.g. 0.05 volume_spacing_min = settings.get('volume_spacing_min', 0.05) #bool, run phonon(True) or not(False) phonon = settings.get('phonon', False) #list(3x3), the supercell matrix for phonon, e.g. [[2.0, 0, 0], [0, 2.0, 0], [0, 0, 2.0]] phonon_supercell_matrix = settings.get('phonon_supercell_matrix', None) phonon_supercell_matrix_min = settings.get('phonon_supercell_matrix_min', None) phonon_supercell_matrix_max = settings.get('phonon_supercell_matrix_max', None) optimize_sc = settings.get('optimize_sc', False) #run phonon always, no matter ISIF=4 passed or not force_phonon = settings.get('force_phonon', False) #The tolerance for phonon stable stable_tor = settings.get('stable_tor', 0.01) #float, the mimimum of temperature in QHA process, e.g. 5 t_min = settings.get('t_min', 5) #float, the maximum of temperature in QHA process, e.g. 2000 t_max = settings.get('t_max', 2000) #float, the step of temperature in QHA process, e.g. 5 t_step = settings.get('t_step', 5) #float, acceptable value for average RMS, recommend >= 0.005 eos_tolerance = settings.get('eos_tolerance', 0.01) #str, the vasp command, if None then find in the FWorker configuration vasp_cmd = settings.get('vasp_cmd', None) #dict, metadata to be included, this parameter is useful for filter the data, e.g. metadata={"phase": "BCC_A2", "tag": "AFM"} metadata = settings.get('metadata', None) #It is for RobustOptimizeFW, if run ISIF=4 followed ISIF=7 isif4 = settings.get('isif4', False) #The level for robust optimization level = settings.get('level', 1) #float, the tolerannce for symmetry, e.g. 0.05 symmetry_tolerance = settings.get('symmetry_tolerance', 0.05) #bool, set True to pass initial VASP running if the results exist in DB, use carefully to keep data consistent. passinitrun = settings.get('passinitrun', False) #bool, Whether run isif=2 calculation before isif=4 running run_isif2 = settings.get('run_isif2', False) #bool, Whether pass isif=4 calculation. pass_isif4 = settings.get('pass_isif4', False) #Set the path already exists for new static calculations; if set as '', will try to get the path from db_file relax_path = settings.get('relax_path', '') #The symmetry tolerance, including three keys, #e.g. override_symmetry_tolerances={'tol_strain': 0.05, 'tol_energy': 0.025, 'tol_bond': 0.10} override_symmetry_tolerances = settings.get('override_symmetry_tolerances', None) #Global settings for all vasp job, e.g. #override_default_vasp_params = {'user_incar_settings': {}, 'user_kpoints_settings': {}, 'user_potcar_functional': str} #If some value in 'user_incar_settings' is set to None, it will use vasp's default value override_default_vasp_params = settings.get('override_default_vasp_params', {}) #dict, dict of class ModifyIncar with keywords in Workflow name. e.g. """ modify_incar_params = { 'Full relax': {'incar_update': {"LAECHG":False,"LCHARG":False,"LWAVE":False}}, 'PreStatic': {'incar_update': {"LAECHG":False,"LCHARG":False,"LWAVE":False}}, 'PS2': {'incar_update': {"LAECHG":False,"LCHARG":False,"LWAVE":False}}, 'static': {'incar_update': {"LAECHG":False,"LCHARG":False,"LWAVE":False}}, """ modify_incar_params = settings.get('modify_incar_params', {}) #check if fworker_name is assigned powerups = settings.get('powerups', {}) """ if len(powerups)>0: if 'user_incar_settings' not in override_default_vasp_params: override_default_vasp_params.update({'user_incar_settings':{}}) override_default_vasp_params['user_incar_settings'].update({'powerups':powerups}) modify_incar_params.update({'powerups':powerups}) """ #dict, dict of class ModifyKpoints with keywords in Workflow name, similar with modify_incar_params modify_kpoints_params = settings.get('modify_kpoints_params', {}) #bool, print(True) or not(False) some informations, used for debug verbose = settings.get('verbose', False) #Save the volume data or not ("chgcar", "aeccar0", "aeccar2", "elfcar", "locpot") store_volumetric_data = settings.get('store_volumetric_data', False) ## The following settings only work for elastic constants workflow strain_states = settings.get('strain_states', None) stencils = settings.get('stencils', None) analysis = settings.get('analysis', True) sym_reduce = settings.get('sym_reduce', False) order = settings.get('order', 2) conventional = settings.get('conventional', False) """ stencils = settings.get('stencils', [0.01]) #sym_reduce = settings.get('sym_reduce', True) stencils = settings.get('stencils', [-0.01,0.01]) #conventional = settings.get('conventional', True) """ #Set the default value for phonon_supercell_matrix_min/max if isinstance(phonon_supercell_matrix, str) and (phonon_supercell_matrix_min is None): if phonon_supercell_matrix.lower().startswith('a'): phonon_supercell_matrix_min = 60 phonon_supercell_matrix_max = 130 elif phonon_supercell_matrix.lower().startswith('l'): phonon_supercell_matrix_min = 8 phonon_supercell_matrix_max = 12 elif phonon_supercell_matrix.lower().startswith('v'): phonon_supercell_matrix_min = 512 phonon_supercell_matrix_max = 1728 else: raise ValueError( "Unknown parameters for phonon_supercell_matrix({}), support 'atoms', 'lattice' or 'volume' or 3x3 list." .format(phonon_supercell_matrix)) uis = override_default_vasp_params.get('user_incar_settings', {}) if magmom: structure.add_site_property('magmom', magmom) elif 'MAGMOM' in uis: magmom = uis['MAGMOM'] if isinstance(magmom, str): magmom = Incar.from_string( 'MAGMOM={}'.format(magmom)).as_dict()['MAGMOM'] magmom = parse_magmom(magmom=magmom, nvalue=len(structure.sites)) structure.add_site_property('magmom', magmom) if not db_file: #from fireworks.fw_config import config_to_dict #db_file = loadfn(config_to_dict()["FWORKER_LOC"])["env"]["db_file"] db_file = ">>db_file<<" """ if WORKFLOW == "get_wf_gibbs": #Currently, only this workflow is supported wf = get_wf_gibbs(structure, num_deformations=num_deformations, deformation_fraction=deformation_fraction, phonon=phonon, phonon_supercell_matrix=phonon_supercell_matrix, t_min=t_min, t_max=t_max, t_step=t_step, eos_tolerance=eos_tolerance, volume_spacing_min=volume_spacing_min,vasp_cmd=vasp_cmd, db_file=db_file, metadata=metadata, name='EV_QHA', symmetry_tolerance=symmetry_tolerance, run_isif2=run_isif2, pass_isif4=pass_isif4, passinitrun=passinitrun, relax_path=relax_path, modify_incar_params=modify_incar_params, modify_kpoints_params=modify_kpoints_params, verbose=verbose, store_volumetric_data=store_volumetric_data) elif WORKFLOW == "eos": """ if WORKFLOW == "eos": wf = get_wf_EV_bjb( structure, deformation_fraction=deformation_fraction, store_volumetric_data=store_volumetric_data, num_deformations=num_deformations, settings=settings, override_symmetry_tolerances=override_default_vasp_params, metadata=metadata) elif WORKFLOW == "singleV": wf = get_wf_singleV( structure, store_volumetric_data=store_volumetric_data, metadata=metadata, override_default_vasp_params=override_default_vasp_params, settings=settings) elif WORKFLOW == "crosscom": wf = get_wf_crosscom(structure, metadata=metadata, settings=settings) elif WORKFLOW == "robust" or WORKFLOW == "get_wf_gibbs": wf = get_wf_gibbs_robust( structure, num_deformations=num_deformations, deformation_fraction=deformation_fraction, phonon=phonon, phonon_supercell_matrix=phonon_supercell_matrix, t_min=t_min, t_max=t_max, t_step=t_step, eos_tolerance=eos_tolerance, volume_spacing_min=volume_spacing_min, vasp_cmd=">>vasp_cmd<<", db_file=">>db_file<<", isif4=isif4, metadata=metadata, name='EV_QHA', override_symmetry_tolerances=override_symmetry_tolerances, override_default_vasp_params=override_default_vasp_params, modify_incar_params=modify_incar_params, modify_kpoints_params=modify_kpoints_params, verbose=verbose, phonon_supercell_matrix_min=phonon_supercell_matrix_min, phonon_supercell_matrix_max=phonon_supercell_matrix_max, optimize_sc=optimize_sc, level=level, force_phonon=force_phonon, stable_tor=stable_tor, store_volumetric_data=store_volumetric_data, settings=settings) elif WORKFLOW == "born": wf = get_wf_borncharge( structure=structure, metadata=metadata, db_file=db_file, isif=2, name="born charge", vasp_cmd=">>vasp_cmd<<", override_default_vasp_params=override_default_vasp_params, modify_incar=modify_incar_params, settings=settings) elif WORKFLOW == 'elastic': wf = get_wf_elastic( structure=structure, metadata=metadata, vasp_cmd=">>vasp_cmd<<", db_file=">>db_file<<", name="elastic", override_default_vasp_params=override_default_vasp_params, settings=settings, strain_states=strain_states, stencils=stencils, analysis=analysis, sym_reduce=sym_reduce, order=order, conventional=conventional) else: raise ValueError( "Currently, only the gibbs energy workflow is supported.") return wf
###################### DO NOT CHANGE THE FOLLOWING LINES ############################## from pymatgen import Structure from dfttk.wflows import get_wf_gibbs_robust from fireworks.fw_config import config_to_dict from monty.serialization import loadfn, dumpfn from fireworks import LaunchPad structure = Structure.from_file(TEMPLATE_STRUCTURE_FILENAME) if magmom: structure.add_site_property('magmom', magmom) if not db_file: db_file = loadfn(config_to_dict()["FWORKER_LOC"])["env"]["db_file"] wf = get_wf_gibbs_robust(structure, num_deformations=num_deformations, deformation_fraction=deformation_fraction, phonon=phonon, phonon_supercell_matrix=phonon_supercell_matrix, t_min=t_min, t_max=t_max, t_step=t_step, eos_tolerance=eos_tolerance, volume_spacing_min=volume_spacing_min, vasp_cmd=vasp_cmd, db_file=db_file, isif4=isif4, metadata=metadata, name='EV_QHA', override_symmetry_tolerances=override_symmetry_tolerances, override_default_vasp_params=override_default_vasp_params, modify_incar_params=modify_incar_params, modify_kpoints_params=modify_kpoints_params, verbose=verbose, phonon_supercell_matrix_min=phonon_supercell_matrix_min, phonon_supercell_matrix_max=phonon_supercell_matrix_max, optimize_sc=optimize_sc, level=level, force_phonon=force_phonon, stable_tor=stable_tor) if not DRY_RUN: lpad = LaunchPad.auto_load() lpad.add_wf(wf) if WRITE_OUT_WF: dumpfn(wf.to_dict(), 'dfttk_wf.yaml')