Пример #1
0
    def run(self):
        logger.info("MaterialsDescriptorBuilder starting...")
        self._build_indexes()

        q = {}
        if not self.update_all:
            q["descriptors.density"] = {"$exists": False}

        mats = [
            m for m in self._materials.find(q, {
                "structure": 1,
                "material_id": 1
            })
        ]

        pbar = tqdm(mats)
        for m in pbar:
            pbar.set_description("Processing materials_id: {}".format(
                m['material_id']))
            struct = Structure.from_dict(m["structure"])
            d = {"descriptors": {}}
            d["descriptors"]["dimensionality"] = get_dimensionality(struct)
            d["descriptors"]["density"] = struct.density
            d["descriptors"]["nsites"] = len(struct)
            d["descriptors"]["volume"] = struct.volume

            self._materials.update_one({"material_id": m["material_id"]},
                                       {"$set": d})
Пример #2
0
def list_dimensionality(list_struc):
    get_list = []
    for structure in list_struc:
        print(structure.formula)
        try:
            get_list.append(
                get_dimensionality(structure,
                                   max_hkl=2,
                                   el_radius_updates=None,
                                   min_slab_size=5,
                                   min_vacuum_size=5,
                                   standardize=True,
                                   bonds=None))
        except:
            get_list.append("N/A")
            continue
    return get_list
Пример #3
0
    def run(self):
        logger.info("MaterialsDescriptorBuilder starting...")
        self._build_indexes()

        q = {}
        if not self.update_all:
            q["descriptors.density"] = {"$exists": False}

        mats = [m for m in self._materials.find(q, {"structure": 1, "material_id": 1})]

        pbar = tqdm(mats)
        for m in pbar:
            pbar.set_description("Processing materials_id: {}".format(m['material_id']))
            struct = Structure.from_dict(m["structure"])
            d = {"descriptors": {}}
            d["descriptors"]["dimensionality"] = get_dimensionality(struct)
            d["descriptors"]["density"] = struct.density
            d["descriptors"]["nsites"] = len(struct)
            d["descriptors"]["volume"] = struct.volume

            self._materials.update_one({"material_id": m["material_id"]}, {"$set": d})
Пример #4
0
 def test_get_dimensionality_with_bonds(self):
     s = self.get_structure('CsCl')
     self.assertEqual(get_dimensionality(s), 1)
     self.assertEqual(get_dimensionality(s, bonds={("Cs", "Cl"): 3.7}), 3)
Пример #5
0
    def test_get_dimensionality(self):
        s = self.get_structure('LiFePO4')
        self.assertEqual(get_dimensionality(s), 3)

        s = self.get_structure('Graphite')
        self.assertEqual(get_dimensionality(s), 2)
Пример #6
0
 def test_get_dimensionality_with_bonds(self):
     s = self.get_structure('CsCl')
     self.assertEqual(get_dimensionality(s), 1)
     self.assertEqual(get_dimensionality(s, bonds={("Cs", "Cl"): 3.7}), 3)
Пример #7
0
    def test_get_dimensionality(self):
        s = self.get_structure('LiFePO4')
        self.assertEqual(get_dimensionality(s), 3)

        s = self.get_structure('Graphite')
        self.assertEqual(get_dimensionality(s), 2)
Пример #8
0
def plug_in(symbol_values):
    structure = symbol_values['structure']
    return {'dimensionality': get_dimensionality(structure)}