Beispiel #1
0
    def __init__(self, structure, scale_lattice=None, isif=4, override_symmetry_tolerances=None, 
                 name="structure optimization", vasp_input_set=None, job_type="normal", vasp_cmd="vasp", 
                 metadata=None, override_default_vasp_params=None, db_file=None, record_path=False, 
                 prev_calc_loc=True, parents=None, db_insert=False, tag=None,
                 run_isif2=False, pass_isif4=False, force_gamma=True, store_volumetric_data=False,
                 modify_incar=None, modify_incar_params={}, modify_kpoints_params={}, **kwargs):

        metadata = metadata or {}
        tag = tag or metadata.get('tag')
        # generate a tag with a warning
        if tag is None:
            tag = str(uuid4())
            metadata['tag'] = tag
        metadata.update({'tag': tag})

        if isinstance(store_volumetric_data, (list, tuple)):
            store_volumetric_data = store_volumetric_data
        elif isinstance(store_volumetric_data, bool):
            if store_volumetric_data:
                store_volumetric_data = STORE_VOLUMETRIC_DATA
            else:
                store_volumetric_data = ()
        else:
            raise ValueError('The store_volumetric_data should be list or bool')

        override_default_vasp_params = override_default_vasp_params or {}
        override_symmetry_tolerances = override_symmetry_tolerances or {}
        vasp_input_set = vasp_input_set or RelaxSet(structure, isif=isif, force_gamma=force_gamma,
                                                       **override_default_vasp_params)
        site_properties = deepcopy(structure).site_properties

        t = []
        # Avoids delivery (prev_calc_loc == '' (instead by True))
        if type(prev_calc_loc) == str:
            t.append(CopyVaspOutputs(calc_dir=prev_calc_loc, contcar_to_poscar=True))
            t.append(WriteVaspFromIOSetPrevStructure(vasp_input_set=vasp_input_set, site_properties=site_properties))
        elif parents:
            if prev_calc_loc:
                t.append(CopyVaspOutputs(calc_loc=prev_calc_loc, contcar_to_poscar=True))
            t.append(WriteVaspFromIOSetPrevStructure(vasp_input_set=vasp_input_set, site_properties=site_properties))
        else:
        #vasp_input_set = vasp_input_set or RelaxSet(structure)  # ??
            t.append(WriteVaspFromIOSetPrevStructure(structure=structure, vasp_input_set=vasp_input_set, site_properties=site_properties))
        if scale_lattice is not None:
            t.append(ScaleVolumeTransformation(scale_factor=scale_lattice, structure=structure))
        t.append(ModifyIncar(incar_update=">>incar_update<<"))
        if modify_incar != None:
             t.append(ModifyIncar(incar_update=modify_incar))
        t.append(RunVaspCustodian(vasp_cmd=vasp_cmd, job_type=job_type, gzip_output=False))
        t.append(PassCalcLocs(name=name))
        if record_path:
            t.append(Record_relax_running_path(db_file = db_file, metadata = metadata, run_isif2=run_isif2, pass_isif4=pass_isif4))
        if db_insert:
            t.append(VaspToDb(db_file=db_file, additional_fields={"task_label": name, "metadata": metadata}, store_volumetric_data=store_volumetric_data))
        t.append(CheckSymmetryToDb(db_file=db_file, tag=tag, override_symmetry_tolerances=override_symmetry_tolerances, site_properties=site_properties))
        super(OptimizeFW, self).__init__(t, parents=parents, name="{}-{}".format(structure.composition.reduced_formula, name), **kwargs)
Beispiel #2
0
    def __init__(self, structure, name="infdet", input_set=None, metadata=None, prev_calc_loc=True,
                 db_file=None, parents=None, continuation=False, run_isif2=False, pass_isif4=False, **kwargs):
        metadata = metadata or {}
        input_set = input_set or ATATIDSet(structure)

        t = []

        if not continuation:
            # Copy the volume relax CONTCAR to POSCAR and the full relax CONTCAR as CONTCAR. Get the CHGCAR and WAVECAR from the fully relaxed structure
            # There are other ways to do this, but it's important to pay attention
            # to the order so that work is not destoryed because CopyVaspOutputs
            # will always give back a POSCAR (or CONTCAR as POSCAR), KPOINTS, INCAR, POTCAR, OUTCAR, and
            # vasprun.xml.
            # What we do here ensures that
            # 1. We get the the WAVECAR and CHGCAR from the full relax
            # 2. We do not overwrite the structure that we took from the full relax when we copy the volume relax
            t.append(CopyVaspOutputs(calc_loc='Full relax', contcar_to_poscar=False, additional_files=["CONTCAR"]))
            t.append(CopyVaspOutputs(calc_loc='Volume relax', contcar_to_poscar=True))
            # Move the volume relaxed POSCAR to str_beg.out
            t.append(TransmuteStructureFile(input_fname='POSCAR', output_fname='str_beg.out'))
            # Move the fully relaxed CONTCAR to str_end.out
            t.append(TransmuteStructureFile(input_fname='CONTCAR', output_fname='str_end.out'))
            # write the vaspid.wrap file
            t.append(WriteATATFromIOSet(input_set=input_set))
        else:
            # Copy all the files from the previous run.
            files_needed = ['CONTCAR', 'str_beg.out', 'str_end.out', 'str_relax.out', 'epipos.out', 'epidir.out',
                            'epipos.out', 'infdet.log', 'str_current.out']
            t.append(CopyVaspOutputs(calc_loc=prev_calc_loc, contcar_to_poscar=False, additional_files=files_needed))

        # Unfortunately, it seems that PassCalcLocs must happen before
        # running ATAT because it can return a FW action that is dynamic and will
        # skip the remaining Firetasks. We don't really want to do this (I think)
        # because if this fizzles, the calc_locs will still be changed if this is rerun.
        t.append(PassCalcLocs(name=name))
        # Run ATAT's inflection detection
        t.append(RunATATCustodian(continuation=continuation, name=name))
        t.append(Record_relax_running_path(db_file = ">>db_file<<", metadata = metadata, run_isif2=run_isif2, pass_isif4=pass_isif4))
        super(InflectionDetectionFW, self).__init__(t, parents=parents,
                                                    name="{}-{}".format(structure.composition.reduced_formula, name), **kwargs)
Beispiel #3
0
    def __init__(self,
                 structure,
                 scale_lattice=None,
                 symmetry_tolerance=None,
                 name="structure optimization",
                 vasp_input_set=None,
                 job_type="normal",
                 vasp_cmd="vasp",
                 metadata=None,
                 override_default_vasp_params=None,
                 db_file=None,
                 record_path=False,
                 modify_incar=None,
                 force_gamma=True,
                 prev_calc_loc=True,
                 parents=None,
                 db_insert=False,
                 Pos_Shape_relax=False,
                 modify_incar_params={},
                 modify_kpoints_params={},
                 **kwargs):

        metadata = metadata or {}
        override_default_vasp_params = override_default_vasp_params or {}
        vasp_input_set = vasp_input_set or RelaxSet(
            structure, force_gamma=force_gamma, **override_default_vasp_params)
        site_properties = deepcopy(structure).site_properties

        t = []
        # Avoids delivery (prev_calc_loc == '' (instead by True))
        if type(prev_calc_loc) == str:
            t.append(
                CopyVaspOutputs(calc_dir=prev_calc_loc,
                                contcar_to_poscar=True))
            t.append(
                WriteVaspFromIOSetPrevStructure(
                    vasp_input_set=vasp_input_set,
                    site_properties=site_properties))
        elif parents:
            if prev_calc_loc:
                t.append(
                    CopyVaspOutputs(calc_loc=prev_calc_loc,
                                    contcar_to_poscar=True))
            t.append(
                WriteVaspFromIOSetPrevStructure(
                    vasp_input_set=vasp_input_set,
                    site_properties=site_properties))
        else:
            #            vasp_input_set = vasp_input_set or RelaxSet(structure)  # ??
            t.append(
                WriteVaspFromIOSet(structure=structure,
                                   vasp_input_set=vasp_input_set))
        if scale_lattice is not None:
            t.append(ScaleVolumeTransformation(scale_factor=scale_lattice))
        t.append(ModifyIncar(incar_update=">>incar_update<<"))
        if modify_incar != None:
            t.append(ModifyIncar(incar_update=modify_incar))
        t.append(
            RunVaspCustodian(vasp_cmd=vasp_cmd,
                             job_type=job_type,
                             gzip_output=False))
        t.append(PassCalcLocs(name=name))
        if record_path:
            t.append(
                Record_relax_running_path(db_file=db_file,
                                          metadata=metadata,
                                          Pos_Shape_relax=Pos_Shape_relax))
        if db_insert:
            t.append(
                VaspToDb(db_file=db_file,
                         additional_fields={
                             "task_label": name,
                             "metadata": metadata
                         }))
        # This has to happen at the end because dynamically adding Fireworks if the symmetry breaks skips the rest of the tasks in the Firework.
        if symmetry_tolerance is not None:
            t.append(
                CheckSymmetry(tolerance=symmetry_tolerance,
                              vasp_cmd=vasp_cmd,
                              db_file=db_file,
                              structure=structure,
                              metadata=metadata,
                              name=name,
                              modify_incar_params=modify_incar_params,
                              modify_kpoints_params=modify_kpoints_params,
                              Pos_Shape_relax=Pos_Shape_relax))
        super(OptimizeFW,
              self).__init__(t,
                             parents=parents,
                             name="{}-{}".format(
                                 structure.composition.reduced_formula, name),
                             **kwargs)