def test_eels_wflow_abatom_by_symbol(self):
     wf_prim =get_wf_eels("O", self.structure, feff_input_set="ELNES",
                     edge="L1", user_tag_settings=self.user_tag_settings, use_primitive=True)
     wf = get_wf_eels("O", self.structure, feff_input_set="ELNES",
                     edge="L1", user_tag_settings=self.user_tag_settings, use_primitive=False)
     self.assertEqual(len(wf_prim.as_dict()["fws"]), 1)
     self.assertEqual(len(wf.as_dict()["fws"]), 2)
 def test_eels_wflow_abatom_by_symbol(self):
     wf_prim =get_wf_eels("O", self.structure, feff_input_set="ELNES",
                     edge="L1", user_tag_settings=self.user_tag_settings, use_primitive=True)
     wf = get_wf_eels("O", self.structure, feff_input_set="ELNES",
                     edge="L1", user_tag_settings=self.user_tag_settings, use_primitive=False)
     self.assertEqual(len(wf_prim.as_dict()["fws"]), 1)
     self.assertEqual(len(wf.as_dict()["fws"]), 1)
    def test_elnes_vs_exelfs(self):
        wf_elnes = get_wf_eels(
            self.absorbing_atom,
            self.structure,
            feff_input_set="ELNES",
            edge="L1",
            user_tag_settings=self.user_tag_settings,
            use_primitive=True,
        )
        wf_exelfs = get_wf_eels(
            self.absorbing_atom,
            self.structure,
            feff_input_set="EXELFS",
            edge="L1",
            user_tag_settings=self.user_tag_settings,
            use_primitive=True,
        )

        self.assertEqual(
            wf_elnes.as_dict()["fws"][0]["spec"]["_tasks"][0]["feff_input_set"]
            ["@class"],
            "MPELNESSet",
        )
        self.assertEqual(
            wf_exelfs.as_dict()["fws"][0]["spec"]["_tasks"][0]
            ["feff_input_set"]["@class"],
            "MPEXELFSSet",
        )
    def test_elnes_vs_exelfs(self):
        wf_elnes = get_wf_eels(self.absorbing_atom, self.structure, feff_input_set="ELNES",
                        edge="L1", user_tag_settings=self.user_tag_settings, use_primitive=True)
        wf_exelfs = get_wf_eels(self.absorbing_atom, self.structure, feff_input_set="EXELFS",
                        edge="L1", user_tag_settings=self.user_tag_settings, use_primitive=True)

        self.assertEqual(wf_elnes.as_dict()["fws"][0]["spec"]['_tasks'][0]['feff_input_set'][
                             '@class'], 'MPELNESSet')
        self.assertEqual(wf_exelfs.as_dict()["fws"][0]["spec"]['_tasks'][0]['feff_input_set'][
                             '@class'], 'MPEXELFSSet')
    def test_eels_wflow_abatom_by_idx(self):
        # for the sake of test just copy xmu to eels
        xmu_file_path = os.path.abspath(
            os.path.join(module_dir, "../../test_files/xmu.dat"))
        feff_bin = f"cp {xmu_file_path} eels.dat"
        wf = get_wf_eels(
            self.absorbing_atom,
            self.structure,
            feff_input_set="ELNES",
            edge="L1",
            user_tag_settings=self.user_tag_settings,
            use_primitive=False,
            feff_cmd=feff_bin,
            db_file=">>db_file<<",
        )
        self.assertEqual(len(wf.as_dict()["fws"]), 1)

        self.lp.add_wf(wf)
        # run
        rapidfire(
            self.lp,
            fworker=FWorker(env={"db_file": os.path.join(db_dir, "db.json")}))

        d = self.get_task_collection().find_one({"spectrum_type": "ELNES"})
        self._check_run(d)
    def test_eels_wflow_abatom_by_idx(self):
        # for the sake of test just copy xmu to eels
        xmu_file_path = os.path.abspath(os.path.join(module_dir, "../../test_files/xmu.dat"))
        feff_bin = "cp {} eels.dat".format(xmu_file_path)
        wf = get_wf_eels(self.absorbing_atom, self.structure, feff_input_set="ELNES",
                        edge="L1", user_tag_settings=self.user_tag_settings, use_primitive=False,
                         feff_cmd=feff_bin, db_file=">>db_file<<")
        self.assertEqual(len(wf.as_dict()["fws"]), 1)

        self.lp.add_wf(wf)
        # run
        rapidfire(self.lp, fworker=FWorker(env={"db_file": os.path.join(db_dir, "db.json")}))

        d = self.get_task_collection().find_one({"spectrum_type": "ELNES"})
        self._check_run(d)