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})
Example #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
    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})
Example #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)
Example #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)
 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)
    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)
def plug_in(symbol_values):
    structure = symbol_values['structure']
    return {'dimensionality': get_dimensionality(structure)}