當前位置: 首頁>>代碼示例>>Python>>正文


Python LaunchPad.auto_load方法代碼示例

本文整理匯總了Python中fireworks.LaunchPad.auto_load方法的典型用法代碼示例。如果您正苦於以下問題:Python LaunchPad.auto_load方法的具體用法?Python LaunchPad.auto_load怎麽用?Python LaunchPad.auto_load使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在fireworks.LaunchPad的用法示例。


在下文中一共展示了LaunchPad.auto_load方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from fireworks import LaunchPad [as 別名]
# 或者: from fireworks.LaunchPad import auto_load [as 別名]
    def __init__(self, *args, **kwargs):
        super(OptTask, self).__init__(*args, **kwargs)

        # Configuration attrs
        lp = self.get("launchpad", LaunchPad.auto_load())
        if isinstance(lp, LaunchPad):
            lp = lp.to_dict()
        self.lpad = LaunchPad.from_dict(lp)
        self.opt_label = self.get("opt_label", "opt_default")
        self.c = getattr(self.lpad.db, self.opt_label)
        self.config = self.c.find_one({"doctype": "config"})
        if self.config is None:
            raise NotConfiguredError("Please use MissionControl().configure to "
                                     "configure the optimization database "
                                     "({} - {}) before running OptTask."
                                     "".format(self.lpad.db, self.opt_label))
        self.wf_creator = deserialize(self.config["wf_creator"])
        self.x_dims = self.config["dimensions"]
        self._xdim_types = self.config["dim_types"]
        self.is_discrete_all = self.config["is_discrete_all"]
        self.is_discrete_any = self.config["is_discrete_any"]
        self.wf_creator_args = self.config["wf_creator_args"] or []
        self.wf_creator_kwargs = self.config["wf_creator_kwargs"] or {}
        self.predictor = self.config["predictor"]
        self.predictor_args = self.config["predictor_args"] or []
        self.predictor_kwargs = self.config["predictor_kwargs"] or {}
        self.maximize = self.config["maximize"]
        self.n_search_pts = self.config["n_search_pts"]
        self.n_train_pts = self.config["n_train_pts"]
        self.n_bootstraps = self.config["n_bootstraps"]
        self.acq = self.config["acq"]
        self.space_file = self.config["space_file"]
        self.onehot_categorical = self.config["onehot_categorical"]
        self.duplicate_check = self.config["duplicate_check"]
        self.get_z = self.config["get_z"]
        if self.get_z:
            self.get_z = deserialize(self.config['get_z'])
        else:
            self.get_z = lambda *ars, **kws: []
        self.get_z_args = self.config["get_z_args"] or []
        self.get_z_kwargs = self.config["get_z_kwargs"] or {}
        self.z_file = self.config["z_file"]
        self.enforce_sequential = self.config["enforce_sequential"]
        self.tolerances = self.config["tolerances"]
        self.batch_size = self.config["batch_size"]
        self.timeout = self.config["timeout"]

        # Declared attrs
        self.n_objs = None
        plist = [RandomForestRegressor, GaussianProcessRegressor,
                 ExtraTreesRegressor, GradientBoostingRegressor]
        self.builtin_predictors = {p.__name__: p for p in plist}
        self._n_cats = 0
        self._encoding_info = []

        # Query formats
        self._completed = {'x': {'$exists': 1}, 'y': {'$exists': 1,
                                                      '$ne': 'reserved'},
                           'z': {'$exists': 1}}
        self._manager = {'lock': {'$exists': 1}, 'queue': {'$exists': 1}}
開發者ID:ardunn,項目名稱:TurboWorks,代碼行數:62,代碼來源:task.py

示例2: test_get_lp_and_fw_id_from_task

# 需要導入模塊: from fireworks import LaunchPad [as 別名]
# 或者: from fireworks.LaunchPad import auto_load [as 別名]
    def test_get_lp_and_fw_id_from_task(self):
        """
        Tests the get_lp_and_fw_id_from_task. This test relies on the fact that the LaunchPad loaded from auto_load
        will be different from what is defined in TESTDB_NAME. If this is not the case the test will be skipped.
        """
        lp = LaunchPad.auto_load()

        if not lp or lp.db.name == TESTDB_NAME:
            raise unittest.SkipTest("LaunchPad lp {} is not suitable for this test. Should be available and different"
                                    "from {}".format(lp, TESTDB_NAME))

        task = LpTask()
        # this will pass the lp
        fw1 = Firework([task], spec={'_add_launchpad_and_fw_id': True}, fw_id=1)
        # this will not have the lp and should fail
        fw2 = Firework([task], spec={}, fw_id=2, parents=[fw1])
        wf = Workflow([fw1, fw2])
        self.lp.add_wf(wf)

        rapidfire(self.lp, self.fworker, m_dir=MODULE_DIR, nlaunches=1)

        fw = self.lp.get_fw_by_id(1)

        assert fw.state == "COMPLETED"

        rapidfire(self.lp, self.fworker, m_dir=MODULE_DIR, nlaunches=1)

        fw = self.lp.get_fw_by_id(2)

        assert fw.state == "FIZZLED"
開發者ID:gmatteo,項目名稱:abiflows,代碼行數:32,代碼來源:test_fw_utils.py

示例3: Workflow

# 需要導入模塊: from fireworks import LaunchPad [as 別名]
# 或者: from fireworks.LaunchPad import auto_load [as 別名]
        if scan:
            wf_name += " - SCAN"
        wf = Workflow(fws, name=wf_name)

        wf = add_additional_fields_to_taskdocs(wf, {"wf_meta": self.wf_meta})

        tag = "magnetic_orderings group: >>{}<<".format(self.uuid)
        wf = add_tags(wf, [tag, ordered_structure_origins])

        return wf


if __name__ == "__main__":

    # for trying workflows

    from fireworks import LaunchPad

    latt = Lattice.cubic(4.17)
    species = ["Ni", "O"]
    coords = [[0.00000, 0.00000, 0.00000], [0.50000, 0.50000, 0.50000]]
    NiO = Structure.from_spacegroup(225, latt, species, coords)

    wf_deformation = get_wf_magnetic_deformation(NiO)

    wf_orderings = MagneticOrderingsWF(NiO).get_wf()

    lpad = LaunchPad.auto_load()
    lpad.add_wf(wf_orderings)
    lpad.add_wf(wf_deformation)
開發者ID:montoyjh,項目名稱:MatMethods,代碼行數:32,代碼來源:magnetism.py

示例4: get_wf_density

# 需要導入模塊: from fireworks import LaunchPad [as 別名]
# 或者: from fireworks.LaunchPad import auto_load [as 別名]
"""

# Parameters:
box_scale = 8.9 # edge length of MD box in Angstroms, can also be a numpy array that scales the lattice
packmol_path = "~/packmol/packmol/packmol" # Revise as appropriate
structure = {'H2O':20} # "structure" in this context can be a dict of number of atoms or molecules.
temperature = 320

# Note one can use a pymatgen Structure object also
# E.g. p = Poscar.from_file("POSCAR")
#      structure = p.structure

copy_calcs = True # MD runs can be backed up in a desired location
calc_home = '~/test_H2O_wflows' # This is the location to copy the calculations if copy_calcs=True

# Since we specified a molecule, we must also give the path to xyz
# file of a single sample molecule.
xyz_paths = ['H2O.xyz']
name = 'H2O_df_'+str(temperature)


from mpmorph.workflow.workflows import get_wf_density
from fireworks import LaunchPad

amorphous_maker_params = {'box_scale':box_scale, 'packmol_path':packmol_path, 'xyz_paths': xyz_paths, 'tol': 2.0}

wf = get_wf_density(structure, temperature=temperature, pressure_threshold=0.5, nsteps=1000, wall_time=19200, max_rescales=5,
                    amorphous_maker_params=amorphous_maker_params, copy_calcs=copy_calcs, calc_home=calc_home, name=name)

lp = LaunchPad.auto_load()
lp.add_wf(wf)
開發者ID:aykol,項目名稱:mpmorph,代碼行數:33,代碼來源:water1.py


注:本文中的fireworks.LaunchPad.auto_load方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。