def __init__(self, structure, supercell_matrix, t_min=5, t_max=2000, t_step=5, name="phonon", vasp_input_set=None, override_default_vasp_params=None, vasp_cmd="vasp", metadata=None, tag=None, qpoint_mesh=(50, 50, 50), prev_calc_loc=True, db_file=None, parents=None, stable_tor=0.01, **kwargs): metadata = metadata or {} tag = tag or metadata.get('tag') # generate a tag with a warning if tag is None: tag = str(uuid4()) warnings.warn('No ``tag`` was passed explicitly or in ``metadata`` to PhononFW. In order to find this Firework later, you should assign one. This was assigned: {}'.format(tag)) metadata['tag'] = tag override_default_vasp_params = override_default_vasp_params or {} ncell = int(0.5+np.linalg.det(supercell_matrix)) tmp = copy.deepcopy(override_default_vasp_params) if 'user_incar_settings' in tmp: if 'magmom' in tmp['user_incar_settings']: mag = tmp['user_incar_settings']['magmom'] supermag = [] for site in mag: n = str(site).split('*') if len(n)==1: supermag.append('{}*{}'.format(ncell,float(n[0]))) else: supermag.append('{}*{}'.format(ncell*int(n[0]),float(n[1]))) tmp['user_incar_settings']['magmom']=supermag print("phonon setting", tmp) vasp_input_set = vasp_input_set or ForceConstantsSet(structure, **tmp) supercell_structure = deepcopy(structure) supercell_structure.make_supercell(supercell_matrix) supercell_site_properties = deepcopy(supercell_structure.site_properties) t = [] # We need to get the POSCAR from the previous run or from the passed Structure # so it can be transformed to a supercell in the next step if parents: if prev_calc_loc: t.append(CopyVaspOutputs(calc_loc=prev_calc_loc, contcar_to_poscar=True)) else: # write the input set first, just to get the POSCAR file in the directory # the other inputs will get overridden by WriteVaspFromIOSetPrevStructure t.append(WriteVaspFromIOSetPrevStructure(structure=structure, vasp_input_set=vasp_input_set, site_properties=site_properties)) t.append(SupercellTransformation(supercell_matrix=supercell_matrix)) t.append(WriteVaspFromIOSetPrevStructure(vasp_input_set=vasp_input_set, site_properties=supercell_site_properties)) t.append(RunVaspCustodianNoValidate(vasp_cmd=vasp_cmd, auto_npar=">>auto_npar<<", gzip_output=False)) # we skipped the validation so we can potentially fix the vasprun.xml file. # Fix and validate here. t.append(PyTask(func='dfttk.vasprun_fix.fix_vasprun', args=['vasprun.xml'])) t.append(PassCalcLocs(name=name)) t.append(CalculatePhononThermalProperties(supercell_matrix=supercell_matrix, t_min=t_min, t_max=t_max, t_step=t_step, db_file=">>db_file<<", tag=tag, metadata=metadata)) t.append(PhononStable(supercell_matrix=supercell_matrix, db_file=">>db_file<<", tag=tag, metadata=metadata, qpoint_mesh=qpoint_mesh, stable_tor=stable_tor)) super(PhononFW, self).__init__(t, parents=parents, name="{}-{}".format( structure.composition.reduced_formula, name), **kwargs)
def __init__(self, structure, supercell_matrix, t_min=5, t_max=2000, t_step=5, name="phonon", vasp_input_set=None, vasp_cmd="vasp", metadata=None, tag=None, prev_calc_loc=True, db_file=None, parents=None, **kwargs): metadata = metadata or {} tag = tag or metadata.get('tag') # generate a tag with a warning if tag is None: tag = str(uuid4()) warnings.warn( 'No ``tag`` was passed explicitly or in ``metadata`` to PhononFW. In order to find this Firework later, you should assign one. This was assigned: {}' .format(tag)) metadata['tag'] = tag vasp_input_set = vasp_input_set or ForceConstantsSet(structure) supercell_structure = deepcopy(structure) supercell_structure.make_supercell(supercell_matrix) supercell_site_properties = deepcopy( supercell_structure.site_properties) t = [] # We need to get the POSCAR from the previous run or from the passed Structure # so it can be transformed to a supercell in the next step if parents: if prev_calc_loc: t.append( CopyVaspOutputs(calc_loc=prev_calc_loc, contcar_to_poscar=True)) else: # write the input set first, just to get the POSCAR file in the directory # the other inputs will get overridden by WriteVaspFromIOSetPrevStructure t.append( WriteVaspFromIOSet(structure=structure, vasp_input_set=vasp_input_set)) t.append(SupercellTransformation(supercell_matrix=supercell_matrix)) t.append( WriteVaspFromIOSetPrevStructure( vasp_input_set=vasp_input_set, site_properties=supercell_site_properties)) t.append( RunVaspCustodianNoValidate(vasp_cmd=vasp_cmd, auto_npar=">>auto_npar<<", gzip_output=False)) # we skipped the validation so we can potentially fix the vasprun.xml file. # Fix and validate here. t.append( PyTask(func='dfttk.vasprun_fix.fix_vasprun', args=['vasprun.xml'])) t.append(PassCalcLocs(name=name)) t.append( CalculatePhononThermalProperties(supercell_matrix=supercell_matrix, t_min=t_min, t_max=t_max, t_step=t_step, db_file=db_file, tag=tag, metadata=metadata)) super(PhononFW, self).__init__(t, parents=parents, name="{}-{}".format( structure.composition.reduced_formula, name), **kwargs)