Exemplo n.º 1
0
 def test_get_stability(self):
     entries = self.rester.get_entries_in_chemsys(["Fe", "O"])
     modified_entries = []
     for entry in entries:
         # Create modified entries with energies that are 0.01eV higher
         # than the corresponding entries.
         if entry.composition.reduced_formula == "Fe2O3":
             modified_entries.append(
                 ComputedEntry(entry.composition,
                               entry.uncorrected_energy + 0.01,
                               parameters=entry.parameters,
                               entry_id="mod_{}".format(entry.entry_id)))
     rest_ehulls = self.rester.get_stability(modified_entries)
     all_entries = entries + modified_entries
     compat = MaterialsProjectCompatibility()
     all_entries = compat.process_entries(all_entries)
     pd = PhaseDiagram(all_entries)
     for e in all_entries:
         if str(e.entry_id).startswith("mod"):
             for d in rest_ehulls:
                 if d["entry_id"] == e.entry_id:
                     data = d
                     break
             self.assertAlmostEqual(pd.get_e_above_hull(e),
                                    data["e_above_hull"])
Exemplo n.º 2
0
def prepare_entry(structure_type, tot_e, species):
    """
    Prepare entries from total energy and species.

    Args:
        structure_type(str): "garnet" or "perovskite"
        tot_e (float): total energy in eV/f.u.
        species (dict): species in dictionary.

    Returns:
        ce (ComputedEntry)
    """

    formula = spe2form(structure_type, species)
    composition = Composition(formula)
    elements = [el.name for el in composition]

    potcars = ["pbe %s" % CONFIG['POTCAR'][el] for el in elements]

    parameters = {"potcar_symbols": list(potcars), "oxide_type": 'oxide'}

    for el in elements:
        if el in LDAUU:
            parameters.update({"hubbards": {el: LDAUU[el]}})

    ce = ComputedEntry(composition=composition,
                       energy=0,
                       parameters=parameters)
    ce.uncorrected_energy = tot_e
    compat = MaterialsProjectCompatibility()
    ce = compat.process_entry(ce)  # Correction added

    return ce
Exemplo n.º 3
0
Arquivo: gsr.py Projeto: gonzex/abipy
    def get_computed_entry(self,
                           inc_structure=True,
                           parameters=None,
                           data=None):
        """
        Returns a pymatgen :class:`ComputedStructureEntry` from the GSR file.
        Same API as the one used in vasp_output.get_computed_entry.

        Args:
            inc_structure (bool): Set to True if you want
                ComputedStructureEntries to be returned instead of ComputedEntries.
            parameters (list): Input parameters to include. It has to be one of
                the properties supported by the GSR object. If
                parameters is None, a default set of parameters that are
                necessary for typical post-processing will be set.
            data (list): Output data to include. Has to be one of the properties
                supported by the GSR object.

        Returns:
            ComputedStructureEntry/ComputedEntry
        """
        # TODO
        #param_names = {"is_hubbard", "hubbards", "potcar_symbols", "run_type"}
        if inc_structure:
            return ComputedStructureEntry(self.structure,
                                          self.energy,
                                          correction=0.0,
                                          parameters=parameters,
                                          data=data)
        else:
            return ComputedEntry(self.structure.composition,
                                 self.energy,
                                 parameters=parameters,
                                 data=data)
Exemplo n.º 4
0
    def assimilate(self, path):
        """
        Assimilate data in a directory path into a ComputedEntry object.

        Args:
            path: directory path

        Returns:
            ComputedEntry
        """
        try:
            gaurun = GaussianOutput(path)
        except Exception as ex:
            logger.debug("error in {}: {}".format(path, ex))
            return None
        param = {}
        for p in self._parameters:
            param[p] = getattr(gaurun, p)
        data = {}
        for d in self._data:
            data[d] = getattr(gaurun, d)
        if self._inc_structure:
            entry = ComputedStructureEntry(gaurun.final_structure,
                                           gaurun.final_energy,
                                           parameters=param,
                                           data=data)
        else:
            entry = ComputedEntry(
                gaurun.final_structure.composition,
                gaurun.final_energy,
                parameters=param,
                data=data,
            )
        return entry
Exemplo n.º 5
0
    def test_to_from_dict(self):

        # test round-trip for other entry types such as ComputedEntry
        entry = ComputedEntry("H", 0.0, 0.0, entry_id="test")
        pd = PhaseDiagram([entry])
        d = pd.as_dict()
        pd_roundtrip = PhaseDiagram.from_dict(d)
        self.assertEqual(pd.all_entries[0].entry_id, pd_roundtrip.all_entries[0].entry_id)
Exemplo n.º 6
0
 def setUp(self):
     # comp = Composition("Mn2O3")
     self.solentry = ComputedEntry("Mn2O3", 49)
     ion = Ion.from_formula("MnO4-")
     self.ionentry = IonEntry(ion, 25)
     self.PxIon = PourbaixEntry(self.ionentry)
     self.PxSol = PourbaixEntry(self.solentry)
     self.PxIon.concentration = 1e-4
Exemplo n.º 7
0
 def test_conflicting_correction_adjustment(self):
     """
     Should raise a ValueError if a user tries to manually set both the correction
     and energy_adjustment, even if the values match.
     """
     ea = ConstantEnergyAdjustment(-10, name="Dummy adjustment")
     with pytest.raises(ValueError, match="Argument conflict!"):
         ComputedEntry("Fe6O9", 6.9, correction=-10, energy_adjustments=[ea])
Exemplo n.º 8
0
    def test_U_values(self):
        #Wrong U value
        entry = ComputedEntry(
            'Fe2O3', -1, 0.0,
            parameters={'is_hubbard': True,
                        'hubbards': {'Fe': 5.2, 'O': 0}, 'run_type': 'GGA+U',
                        'potcar_spec': [{'titel':'PAW_PBE Fe_pv 06Sep2000',
                                         'hash': '994537de5c4122b7f1b77fb604476db4'},
                                        {'titel': 'PAW_PBE O 08Apr2002',
                                         'hash': '7a25bc5b9a5393f46600a4939d357982'}]})
        self.assertIsNone(self.compat.process_entry(entry))

        #GGA run of U
        entry = ComputedEntry(
            'Fe2O3', -1, 0.0,
            parameters={'is_hubbard': False, 'hubbards': None,
                        'run_type': 'GGA',
                        'potcar_spec': [{'titel':'PAW_PBE Fe_pv 06Sep2000',
                                         'hash': '994537de5c4122b7f1b77fb604476db4'},
                                        {'titel': 'PAW_PBE O 08Apr2002',
                                         'hash': '7a25bc5b9a5393f46600a4939d357982'}]})
        self.assertIsNone(self.compat.process_entry(entry))

        #GGA+U run of non-U
        entry = ComputedEntry(
            'Al2O3', -1, 0.0,
            parameters={'is_hubbard': True, 'hubbards': {'Al': 5.3, 'O': 0},
                        'run_type': 'GGA+U',
                        'potcar_spec': [{'titel': 'PAW_PBE Al 06Sep2000',
                                         'hash': '805c888bbd2793e462311f6a20d873d9'},
                                           {'titel': 'PAW_PBE O 08Apr2002',
                                         'hash': '7a25bc5b9a5393f46600a4939d357982'}]})
        self.assertIsNone(self.compat.process_entry(entry))

        #Materials project should not have a U for sulfides
        entry = ComputedEntry(
            'FeS2', -2, 0.0,
            parameters={'is_hubbard': True, 'hubbards': {'Fe': 5.3, 'S': 0},
                        'run_type': 'GGA+U',
                        'potcar_spec': [{'titel':'PAW_PBE Fe_pv 06Sep2000',
                                            'hash': '994537de5c4122b7f1b77fb604476db4'},
                                           {"titel": 'PAW_PBE S 08Apr2002',
                                            'hash': "f7f8e4a74a6cbb8d63e41f4373b54df2"}]})
        self.assertIsNone(self.compat.process_entry(entry))
Exemplo n.º 9
0
    def setUp(self):
        self.entry_Li = ComputedEntry("Li", -1.90753119)
        self.entry_Ca = ComputedEntry("Ca", -1.99689568)

        with open(os.path.join(PymatgenTest.TEST_FILES_DIR, "LiTiO2_batt.json")) as f:
            self.entries_LTO = json.load(f, cls=MontyDecoder)

        with open(os.path.join(PymatgenTest.TEST_FILES_DIR, "MgVO_batt.json")) as file:
            self.entries_MVO = json.load(file, cls=MontyDecoder)

        with open(os.path.join(PymatgenTest.TEST_FILES_DIR, "Mg_batt.json")) as file:
            self.entry_Mg = json.load(file, cls=MontyDecoder)

        with open(os.path.join(PymatgenTest.TEST_FILES_DIR, "CaMoO2_batt.json")) as f:
            self.entries_CMO = json.load(f, cls=MontyDecoder)

        self.ie_LTO = InsertionElectrode.from_entries(self.entries_LTO, self.entry_Li)
        self.ie_MVO = InsertionElectrode.from_entries(self.entries_MVO, self.entry_Mg)
        self.ie_CMO = InsertionElectrode.from_entries(self.entries_CMO, self.entry_Ca)
Exemplo n.º 10
0
 def test_no_struct_compat(self):
     lio2_entry_nostruct = ComputedEntry(Composition("Li2O4"), -3,
                                         data={"oxide_type": "superoxide"},
                                         parameters={'is_hubbard': False,
                                       'hubbards': None,
                                       'run_type': 'GGA',
                                       'potcar_symbols':
     ['PAW_PBE Fe 06Sep2000', 'PAW_PBE O 08Apr2002']})
     lio2_entry_corrected = self.compat.process_entry(lio2_entry_nostruct)
     self.assertAlmostEqual(lio2_entry_corrected.energy, -3 - 0.13893*4, 4)
Exemplo n.º 11
0
 def as_entry(self, energies):
     """
     Returns a ComputedEntry representation of the reaction.
     :return:
     """
     relevant_comp = [comp * abs(coeff) for coeff, comp in zip(self._coeffs, self._all_comp)]
     comp = sum(relevant_comp, Composition())
     entry = ComputedEntry(0.5 * comp, self.calculate_energy(energies))
     entry.name = self.__str__()
     return entry
Exemplo n.º 12
0
 def test_element_processing(self):
     #Testing processing of elements.
     entry = ComputedEntry(
         'O', -1, 0.0,
         parameters={'is_hubbard': False, 'hubbards': {},
                     'potcar_spec': [{'titel': 'PAW_PBE O 08Apr2002',
                                      'hash': '7a25bc5b9a5393f46600a4939d357982'}],
                     'run_type': 'GGA'})
     entry = self.compat.process_entry(entry)
     self.assertAlmostEqual(entry.energy, -1)
Exemplo n.º 13
0
 def setUp(self):
     self.entry1 = ComputedEntry(
         'Fe2O3', -1, 0.0,
         parameters={'is_hubbard': True, 'hubbards': {'Fe': 5.3, 'O': 0},
                     'run_type': 'GGA+U',
                     'potcar_symbols': ['PAW_PBE Fe_pv 06Sep2000',
                                        'PAW_PBE O 08Apr2002']})
     self.entry2 = ComputedEntry(
         'Fe3O4', -2, 0.0,
         parameters={'is_hubbard': True, 'hubbards': {'Fe': 5.3, 'O': 0},
                     'run_type': 'GGA+U',
                     'potcar_symbols': ['PAW_PBE Fe_pv 06Sep2000',
                                        'PAW_PBE O 08Apr2002']})
     self.entry3 = ComputedEntry(
         'FeO', -2, 0.0,
         parameters={'is_hubbard': True, 'hubbards': {'Fe': 4.3, 'O': 0},
                     'run_type': 'GGA+U',
                     'potcar_symbols': ['PAW_PBE Fe_pv 06Sep2000',
                                        'PAW_PBE O 08Apr2002']})
Exemplo n.º 14
0
    def setUp(self):
        self.entry_Li = ComputedEntry("Li", -1.90753119)
        self.entry_Ca = ComputedEntry("Ca", -1.99689568)

        with open(os.path.join(test_dir, "LiTiO2_batt.json"), "r") as f:
            self.entries_LTO = json.load(f, cls=MontyDecoder)

        with open(os.path.join(test_dir, "MgVO_batt.json"), "r") as file:
            self.entries_MVO = json.load(file, cls=MontyDecoder)

        with open(os.path.join(test_dir, "Mg_batt.json"), "r") as file:
            self.entry_Mg = json.load(file, cls=MontyDecoder)

        with open(os.path.join(test_dir, "CaMoO2_batt.json"), "r") as f:
            self.entries_CMO = json.load(f, cls=MontyDecoder)

        self.ie_LTO = InsertionElectrode(self.entries_LTO, self.entry_Li)
        self.ie_MVO = InsertionElectrode(self.entries_MVO, self.entry_Mg)
        self.ie_CMO = InsertionElectrode(self.entries_CMO, self.entry_Ca)
Exemplo n.º 15
0
    def assimilate(self, path):
        files = os.listdir(path)
        if "relax1" in files and "relax2" in files:
            filepath = glob.glob(os.path.join(path, "relax2",
                                              "vasprun.xml*"))[0]
        else:
            vasprun_files = glob.glob(os.path.join(path, "vasprun.xml*"))
            filepath = None
            if len(vasprun_files) == 1:
                filepath = vasprun_files[0]
            elif len(vasprun_files) > 1:
                """
                This is a bit confusing, since there maybe be multi-steps. By
                default, assimilate will try to find a file simply named
                vasprun.xml, vasprun.xml.bz2, or vasprun.xml.gz.  Failing which
                it will try to get a relax2 from an aflow style run if
                possible. Or else, a randomly chosen file containing
                vasprun.xml is chosen.
                """
                for fname in vasprun_files:
                    if os.path.basename(fname) in [
                            "vasprun.xml", "vasprun.xml.gz", "vasprun.xml.bz2"
                    ]:
                        filepath = fname
                        break
                    if re.search("relax2", fname):
                        filepath = fname
                        break
                    filepath = fname

        try:
            vasprun = Vasprun(filepath)
        except Exception as ex:
            logger.debug("error in {}: {}".format(filepath, ex))
            return None
        param = {}
        for p in self._parameters:
            param[p] = getattr(vasprun, p)

        param["history"] = _get_transformation_history(path)

        data = {}
        for d in self._data:
            data[d] = getattr(vasprun, d)
        if self._inc_structure:
            entry = ComputedStructureEntry(vasprun.final_structure,
                                           vasprun.final_energy,
                                           parameters=param,
                                           data=data)
        else:
            entry = ComputedEntry(vasprun.final_structure.composition,
                                  vasprun.final_energy,
                                  parameters=param,
                                  data=data)
        return entry
Exemplo n.º 16
0
 def test_wrong_psp(self):
     #Wrong psp
     entry = ComputedEntry(
         'Fe2O3', -1, 0.0,
         parameters={'is_hubbard': True, 'hubbards': {'Fe': 5.3, 'O': 0},
                     'run_type': 'GGA+U',
                     'potcar_spec': [{'titel':'PAW_PBE Fe 06Sep2000',
                                      'hash': '9530da8244e4dac17580869b4adab115'},
                                     {'titel': 'PAW_PBE O 08Apr2002',
                                      'hash': '7a25bc5b9a5393f46600a4939d357982'}]})
     self.assertIsNone(self.compat.process_entry(entry))
Exemplo n.º 17
0
    def test_potcar_spec_is_none(self):

        compat = MITCompatibility(check_potcar_hash=True)
        entry = ComputedEntry(
            'Li2O3', -1, 0.0,
            parameters={'is_hubbard': True,
                        'hubbards': {'Fe': 4.0, 'O': 0},
                        'run_type': 'GGA+U',
                        'potcar_spec': [None, None]})

        self.assertIsNone(compat.process_entry(entry))
Exemplo n.º 18
0
 def test_per_atom_props(self):
     entry = ComputedEntry("Fe6O9", 6.9)
     entry.energy_adjustments.append(CompositionEnergyAdjustment(-0.5, 9, uncertainty_per_atom=0.1, name="O"))
     self.assertAlmostEqual(entry.energy, 2.4)
     self.assertAlmostEqual(entry.energy_per_atom, 2.4 / 15)
     self.assertAlmostEqual(entry.uncorrected_energy, 6.9)
     self.assertAlmostEqual(entry.uncorrected_energy_per_atom, 6.9 / 15)
     self.assertAlmostEqual(entry.correction, -4.5)
     self.assertAlmostEqual(entry.correction_per_atom, -4.5 / 15)
     self.assertAlmostEqual(entry.correction_uncertainty, 0.9)
     self.assertAlmostEqual(entry.correction_uncertainty_per_atom, 0.9 / 15)
Exemplo n.º 19
0
 def test_normalize_energy_adjustments(self):
     ealist = [ManualEnergyAdjustment(5),
               ConstantEnergyAdjustment(5),
               CompositionEnergyAdjustment(1, 5, uncertainty_per_atom=0, name="Na"),
               TemperatureEnergyAdjustment(0.005, 100, 10, uncertainty_per_degK=0)
               ]
     entry = ComputedEntry("Na5Cl5", 6.9, energy_adjustments=ealist)
     assert entry.correction == 20
     entry.normalize()
     assert entry.correction == 4
     for ea in entry.energy_adjustments:
         assert ea.value == 1
Exemplo n.º 20
0
def worker(paths):
    cwd = os.getcwd()
    for path in paths:
        os.chdir(path)
        nume = map(int, path.split('/')[-2].split('-')[1].split('_'))
        comp0 = 'Mg' + str(nume[1]) + 'Al' + str(nume[0]) + '-new.json'
        comp1 = 'Al' + str(nume[0]) + 'Mg' + str(nume[1]) + '-new.json'
        if os.path.exists(comp0) or os.path.exists(comp1):
            os.chdir(cwd)
            return

        (sysname, name_ele, npop, mol, hard, vsc, vsce, d2, cl, hm, lsur, bg,
         xrd, ts, num_neb) = readinput()
        struct = parseStruct()
        structure = struct[:]
        structure.sort(key=lambda x: x[0])
        ele_num = structure[0][4][2]
        ele_tol = sum(ele_num)
        ele = ["Al", "Mg"]
        sp = []
        for el, num in zip(ele, ele_num):
            sp.extend([el] * num)
        comp = ele[0] + str(ele_num[0]) + ele[1] + str(ele_num[1])
        E_al = -3.744576  # dft-3.74654110;
        E_mg = -1.5358274444444444  #
        fa = 0.02  # 20 meV/atom
        energies = [st[0] for st in structure]

        ef = np.array([
            (ii * ele_tol - ele_num[0] * E_al - ele_num[1] * E_mg) / ele_tol
            for ii in energies
        ])
        idx = np.where(ef < fa)
        sel_sts = [structure[i] for i in idx[0].tolist()]
        print('effect_struct')
        print(len(sel_sts))
        entries = []
        for st in sel_sts:
            pst = Structure(st[4][0], sp, st[4][1], coords_are_cartesian=False)
            comp = str(pst.composition).replace(' ', '')
            entry = ComputedEntry(
                comp,
                st[0] * ele_tol,
                parameters={"potcar_symbols": ['pbe Al', 'pbe Mg']},
                data={
                    'path': '.',
                    'st': pst
                })
            entries.append(entry)
            #pos=Poscar(pst, str(st[0]))
        dumpfn(entries, comp + '-new.json')
        os.chdir(cwd)
    print('------------count is %s-----------------' % df)
Exemplo n.º 21
0
    def setUp(self):
        entry_Li = ComputedEntry("Li", -1.90753119)

        with open(os.path.join(test_dir, "LiTiO2_batt.json"), "r") as f:
            entries_LTO = json.load(f, cls=MontyDecoder)
            self.ie_LTO = InsertionElectrode.from_entries(
                entries_LTO, entry_Li)

        with open(os.path.join(test_dir, "FeF3_batt.json"), "r") as fid:
            entries = json.load(fid, cls=MontyDecoder)
            self.ce_FF = ConversionElectrode.from_composition_and_entries(
                Composition("FeF3"), entries)
Exemplo n.º 22
0
 def test_normalize(self):
     entry = ComputedEntry("Fe6O9", 6.9, correction=1)
     entry.normalize()
     self.assertEqual(entry.composition.formula, "Fe2 O3")
     self.assertAlmostEqual(entry.uncorrected_energy, 6.9/3)
     self.assertAlmostEqual(entry.correction, 1/3)
     self.assertAlmostEqual(entry.energy * 3, 6.9 + 1)
     entry.normalize("atom")
     self.assertEqual(entry.composition.formula, "Fe0.4 O0.6")
     self.assertAlmostEqual(entry.uncorrected_energy, 6.9/15)
     self.assertAlmostEqual(entry.correction, 1/15)
     self.assertAlmostEqual(entry.energy * 15, 6.9 + 1)
Exemplo n.º 23
0
    def test_potcar_doenst_match_structure(self):

        compat = MITCompatibility()
        entry = ComputedEntry(
            'Li2O3', -1, 0.0,
            parameters={'is_hubbard': True,
                        'hubbards': {'Fe': 4.0, 'O': 0},
                        'run_type': 'GGA+U',
                        'potcar_symbols': ['PAW_PBE Fe_pv 06Sep2000',
                                           'PAW_PBE O 08Apr2002']})

        self.assertIsNone(compat.process_entry(entry))
Exemplo n.º 24
0
 def test_to_from_dict(self):
     # test round-trip for other entry types such as ComputedEntry
     entry = ComputedEntry("H", 0.0, 0.0, entry_id="test")
     pd = PhaseDiagram([entry])
     d = pd.as_dict()
     pd_roundtrip = PhaseDiagram.from_dict(d)
     self.assertEqual(pd.all_entries[0].entry_id, pd_roundtrip.all_entries[0].entry_id)
     dd = self.pd.as_dict()
     new_pd = PhaseDiagram.from_dict(dd)
     new_dd = new_pd.as_dict()
     self.assertEqual(new_dd, dd)
     self.assertIsInstance(pd.to_json(), str)
Exemplo n.º 25
0
 def test_wrong_psp(self):
     #Wrong psp
     entry = ComputedEntry(
         'Fe2O3', -1, 0.0,
         parameters={'is_hubbard': True,
                     'hubbards': {'Fe': 4.0, 'O': 0},
                     'run_type': 'GGA+U',
                     'potcar_spec': [{'titel':'PAW_PBE Fe_pv 06Sep2000',
                                      'hash': '994537de5c4122b7f1b77fb604476db4'},
                                     {'titel': 'PAW_PBE O 08Apr2002',
                                      'hash': '7a25bc5b9a5393f46600a4939d357982'}]})
     self.assertIsNone(self.compat.process_entry(entry))
Exemplo n.º 26
0
 def test_dont_error_on_weird_elements(self):
     entry = ComputedEntry('AmSi',-1, 0.0,
         parameters={
             "potcar_spec": [{
                 "titel": "PAW_PBE Am 08May2007",
                 "hash": "ed5eebd8a143e35a0c19e9f8a2c42a93"
             }, {
                 "titel": "PAW_PBE Si 05Jan2001",
                 "hash": "b2b0ea6feb62e7cde209616683b8f7f5"
             }]
         })
     self.assertIsNone(self.compat.process_entry(entry))
Exemplo n.º 27
0
 def calculate_stability(self, d):
     m = MPRester(self.mapi_key)
     functional = d["pseudo_potential"]["functional"]
     syms = ["{} {}".format(functional, l)
             for l in d["pseudo_potential"]["labels"]]
     entry = ComputedEntry(Composition(d["unit_cell_formula"]),
                           d["output"]["final_energy"],
                           parameters={"hubbards": d["hubbards"],
                                       "potcar_symbols": syms})
     data = m.get_stability([entry])[0]
     for k in ("e_above_hull", "decomposes_to"):
         d["analysis"][k] = data[k]
Exemplo n.º 28
0
    def run(self):
        print("MaterialsEhullBuilder starting...")
        self._build_indexes()

        q = {"thermo.energy": {"$exists": True}}
        if not self.update_all:
            q["stability"] = {"$exists": False}

        mats = [
            m for m in self._materials.find(
                q, {
                    "calc_settings": 1,
                    "structure": 1,
                    "thermo.energy": 1,
                    "material_id": 1
                })
        ]
        pbar = tqdm(mats)
        for m in pbar:
            pbar.set_description("Processing materials_id: {}".format(
                m['material_id']))
            try:
                params = {}
                for x in ["is_hubbard", "hubbards", "potcar_spec"]:
                    params[x] = m["calc_settings"][x]

                structure = Structure.from_dict(m["structure"])
                energy = m["thermo"]["energy"]
                my_entry = ComputedEntry(structure.composition,
                                         energy,
                                         parameters=params)
                self._materials.update_one({"material_id": m["material_id"]}, {
                    "$set": {
                        "stability": self.mpr.get_stability([my_entry])[0]
                    }
                })

                mpids = self.mpr.find_structure(structure)
                self._materials.update_one({"material_id": m["material_id"]},
                                           {"$set": {
                                               "mpids": mpids
                                           }})

            except:
                import traceback
                print("<---")
                print(
                    "There was an error processing material_id: {}".format(m))
                traceback.print_exc()
                print("--->")

        print("MaterialsEhullBuilder finished processing.")
Exemplo n.º 29
0
 def setUp(self):
     self.entry = ComputedEntry(vasprun.final_structure.composition,
                                vasprun.final_energy,
                                parameters=vasprun.incar)
     self.entry2 = ComputedEntry({"Fe": 2, "O": 3}, 2.3)
     self.entry3 = ComputedEntry("Fe2O3", 2.3)
     self.entry4 = ComputedEntry("Fe2O3", 2.3, entry_id=1)
     self.entry5 = ComputedEntry("Fe6O9", 6.9)
     ea = ConstantEnergyAdjustment(-5, name="Dummy adjustment")
     self.entry6 = ComputedEntry("Fe6O9", 6.9, correction=-10)
     self.entry7 = ComputedEntry("Fe6O9", 6.9, energy_adjustments=[ea])
Exemplo n.º 30
0
    def test_normalize_not_in_place(self):
        ealist = [
            ManualEnergyAdjustment(5),
            ConstantEnergyAdjustment(5),
            CompositionEnergyAdjustment(1, 5, uncertainty_per_atom=0, name="Na"),
            TemperatureEnergyAdjustment(0.005, 100, 10, uncertainty_per_deg=0),
        ]
        entry = ComputedEntry("Na5Cl5", 6.9, energy_adjustments=ealist)

        normed_entry = entry.normalize(inplace=False)
        entry.normalize()

        self.assertEqual(normed_entry.as_dict(), entry.as_dict())