Exemplo n.º 1
0
    def __init__(self, structure, element):
        """
        Initializes an Interstitial generator using structure motifs
        Args:
            structure (Structure): pymatgen structure object
            element (str or Element or Species): element for the interstitial
        """
        self.structure = structure
        self.element = element
        interstitial_finder = StructureMotifInterstitial(
            self.structure, self.element)

        self.unique_defect_seq = []
        # eliminate sublattice equivalent defects which may
        # have slipped through interstitial finder
        pdc = PointDefectComparator()

        for poss_site in interstitial_finder.enumerate_defectsites():
            now_defect = Interstitial(self.structure, poss_site)
            append_defect = True
            for unique_defect in self.unique_defect_seq:
                if pdc.are_equal(now_defect, unique_defect):
                    append_defect = False
            if append_defect:
                self.unique_defect_seq.append(now_defect)

        self.count_def = 0  # for counting the index of the generated defect
Exemplo n.º 2
0
    def __init__(self, structure, element):
        """
        Initializes an Interstitial generator using structure motifs
        Args:
            structure (Structure): pymatgen structure object
            element (str or Element or Specie): element for the interstitial
        """
        self.structure = structure
        self.element = element
        interstitial_finder = StructureMotifInterstitial(self.structure, self.element)

        self.unique_defect_seq = []
        # eliminate sublattice equivalent defects which may
        # have slipped through interstitial finder
        pdc = PointDefectComparator()

        for poss_site in interstitial_finder.enumerate_defectsites():
            now_defect = Interstitial( self.structure, poss_site)
            append_defect = True
            for unique_defect in self.unique_defect_seq:
                if pdc.are_equal( now_defect, unique_defect):
                    append_defect = False
            if append_defect:
                self.unique_defect_seq.append( now_defect)

        self.count_def = 0  # for counting the index of the generated defect
Exemplo n.º 3
0
    def __init__(self, structure, element):
        """
        Initializes an Interstitial generator using structure motifs
        Args:
            structure (Structure): pymatgen structure object
            element (str or Element or Specie): element for the interstitial
        """
        self.structure = structure
        self.element = element
        interstitial_finder = StructureMotifInterstitial(self.structure, self.element)
        self.defect_sites = list(interstitial_finder.enumerate_defectsites())

        # for multiplicity, neccessary to get prim_structure
        spa = SpacegroupAnalyzer(self.structure, symprec=1e-2)
        prim_struct = spa.get_primitive_standard_structure()
        conv_prim_rat = int(self.structure.num_sites / prim_struct.num_sites)
        self.multiplicities = [
            int(interstitial_finder.get_defectsite_multiplicity(def_ind) / conv_prim_rat)
            for def_ind in range(len(self.defect_sites))
        ]
        self.count_def = 0  # for counting the index of the generated defect
Exemplo n.º 4
0
    def __init__(self, structure, element):
        """
        Initializes an Interstitial generator using structure motifs
        Args:
            structure (Structure): pymatgen structure object
            element (str or Element or Specie): element for the interstitial
        """
        self.structure = structure
        self.element = element
        interstitial_finder = StructureMotifInterstitial(
            self.structure, self.element)
        self.defect_sites = list(interstitial_finder.enumerate_defectsites())

        # for multiplicity, neccessary to get prim_structure
        spa = SpacegroupAnalyzer(self.structure, symprec=1e-2)
        prim_struct = spa.get_primitive_standard_structure()
        conv_prim_rat = int(self.structure.num_sites / prim_struct.num_sites)
        self.multiplicities = [
            int(
                interstitial_finder.get_defectsite_multiplicity(def_ind) /
                conv_prim_rat) for def_ind in range(len(self.defect_sites))
        ]
        self.count_def = 0  # for counting the index of the generated defect
Exemplo n.º 5
0
def create_interstitial_supercells(structure,element,size=2):
    
    '''
    Create interstitial structures with InFiT (Interstitialcy Finding Tool) algorithm with Pymatgen.
    
    Parameters
    ----------
    structure: (Pymatgen Structure)
        Bulk structure.
    element: (str or Element)
        interstitial element.
    
    Returns
    -------
    interstitials: (dict)
        Dictionary with sites (Site object) and supercell structures (Structure object)
    '''
    
    int_object = StructureMotifInterstitial(structure,element)
    int_sites = int_object.enumerate_defectsites()
    int_supercells = int_object.make_supercells_with_defects([[size,0,0],[0,size,0],[0,0,size]])
    
    interstitials = {}
    interstitial_sites =  {}
    interstitial_structures = {}

    for i in range(0,len(int_sites)):        
        int_coord_type = int_object.get_motif_type(i)
        interstitial_sites[int_coord_type] = int_sites[i]
        struct_int = int_supercells[i+1]
        interstitial_structures[int_coord_type] = struct_int
        
        interstitials['sites'] = interstitial_sites
        interstitials['structures'] = interstitial_structures
        
    return interstitials
Exemplo n.º 6
0
class StructureMotifInterstitialTest(PymatgenTest):
    def setUp(self):
        self.silicon = Structure(
            Lattice.from_lengths_and_angles([5.47, 5.47, 5.47],
                                            [90.0, 90.0, 90.0]),
            ["Si", "Si", "Si", "Si", "Si", "Si", "Si", "Si"],
            [[0.000000, 0.000000, 0.500000], [0.750000, 0.750000, 0.750000],
             [0.000000, 0.500000, 1.000000], [0.750000, 0.250000, 0.250000],
             [0.500000, 0.000000, 1.000000], [0.250000, 0.750000, 0.250000],
             [0.500000, 0.500000, 0.500000], [0.250000, 0.250000, 0.750000]],
            validate_proximity=False,
            to_unit_cell=False,
            coords_are_cartesian=False,
            site_properties=None)
        self.smi = StructureMotifInterstitial(
            self.silicon,
            "Si",
            motif_types=["tetrahedral", "octahedral"],
            op_threshs=[0.3, 0.5],
            dl=0.4,
            doverlap=1.0,
            facmaxdl=1.51)
        self.diamond = Structure(
            Lattice([[2.189, 0, 1.264], [0.73, 2.064, 1.264], [0, 0, 2.528]]),
            ["C0+", "C0+"], [[2.554, 1.806, 4.423], [0.365, 0.258, 0.632]],
            validate_proximity=False,
            to_unit_cell=False,
            coords_are_cartesian=True,
            site_properties=None)
        self.nacl = Structure(Lattice([[3.485, 0,
                                        2.012], [1.162, 3.286, 2.012],
                                       [0, 0, 4.025]]), ["Na1+", "Cl1-"],
                              [[0, 0, 0], [2.324, 1.643, 4.025]],
                              validate_proximity=False,
                              to_unit_cell=False,
                              coords_are_cartesian=True,
                              site_properties=None)
        self.cscl = Structure(Lattice([[4.209, 0, 0], [0, 4.209, 0],
                                       [0, 0, 4.209]]), ["Cl1-", "Cs1+"],
                              [[2.105, 2.105, 2.105], [0, 0, 0]],
                              validate_proximity=False,
                              to_unit_cell=False,
                              coords_are_cartesian=True,
                              site_properties=None)
        self.square_pyramid = Structure(Lattice([[100, 0, 0], [0, 100, 0],
                                                 [0, 0, 100]]),
                                        ["C", "C", "C", "C", "C", "C"],
                                        [[0, 0, 0], [1, 0, 0], [-1, 0, 0],
                                         [0, 1, 0], [0, -1, 0], [0, 0, 1]],
                                        validate_proximity=False,
                                        to_unit_cell=False,
                                        coords_are_cartesian=True,
                                        site_properties=None)
        self.trigonal_bipyramid = Structure(
            Lattice([[100, 0, 0], [0, 100, 0],
                     [0, 0, 100]]), ["P", "Cl", "Cl", "Cl", "Cl", "Cl"],
            [[0, 0, 0], [0, 0, 2.14], [0, 2.02, 0], [1.74937, -1.01, 0],
             [-1.74937, -1.01, 0], [0, 0, -2.14]],
            validate_proximity=False,
            to_unit_cell=False,
            coords_are_cartesian=True,
            site_properties=None)

    def test_all(self):
        self.assertIsInstance(self.smi, StructureMotifInterstitial)
        self.assertEqual(len(self.smi.enumerate_defectsites()), 1)
        self.assertIsInstance(self.smi.enumerate_defectsites()[0],
                              PeriodicSite)
        self.assertEqual("Si",
                         self.smi.enumerate_defectsites()[0].species_string)
        self.assertEqual("tetrahedral", self.smi.get_motif_type(0))

        elem_cn_dict = self.smi.get_coordinating_elements_cns(0)
        self.assertEqual(len(list(elem_cn_dict.keys())), 1)
        self.assertEqual(list(elem_cn_dict.keys())[0], "Si")
        self.assertEqual(elem_cn_dict["Si"], 4)

        structs = self.smi.make_supercells_with_defects(np.array([1, 1, 1]))
        self.assertEqual(len(structs), 2)
        self.assertIsInstance(structs[0], Structure)

    def tearDown(self):
        del self.smi
        del self.silicon
        del self.diamond
        del self.nacl
        del self.cscl
Exemplo n.º 7
0
class StructureMotifInterstitialTest(PymatgenTest):
    def setUp(self):
        self.silicon = Structure(
            Lattice.from_lengths_and_angles([5.47, 5.47, 5.47],
                                            [90.0, 90.0, 90.0]),
            ["Si", "Si", "Si", "Si", "Si", "Si", "Si", "Si"],
            [[0.000000, 0.000000, 0.500000], [0.750000, 0.750000, 0.750000],
             [0.000000, 0.500000, 1.000000],
             [0.750000, 0.250000, 0.250000], [0.500000, 0.000000, 1.000000],
             [0.250000, 0.750000, 0.250000],
             [0.500000, 0.500000, 0.500000], [0.250000, 0.250000, 0.750000]],
            validate_proximity=False,
            to_unit_cell=False,
            coords_are_cartesian=False,
            site_properties=None)
        self.smi = StructureMotifInterstitial(
            self.silicon,
            "Si",
            motif_types=["tetrahedral", "octahedral"],
            op_threshs=[0.3, 0.5],
            dl=0.4,
            doverlap=1.0,
            facmaxdl=1.51)
        self.diamond = Structure(
            Lattice([[2.189, 0, 1.264], [0.73, 2.064, 1.264], [0, 0, 2.528]]),
            ["C0+", "C0+"],
            [[2.554, 1.806, 4.423], [0.365, 0.258, 0.632]],
            validate_proximity=False,
            to_unit_cell=False,
            coords_are_cartesian=True,
            site_properties=None)
        self.nacl = Structure(
            Lattice([[3.485, 0, 2.012], [1.162, 3.286, 2.012], [0, 0, 4.025]]),
            ["Na1+", "Cl1-"],
            [[0, 0, 0], [2.324, 1.643, 4.025]],
            validate_proximity=False,
            to_unit_cell=False,
            coords_are_cartesian=True,
            site_properties=None)
        self.cscl = Structure(
            Lattice([[4.209, 0, 0], [0, 4.209, 0], [0, 0, 4.209]]),
            ["Cl1-", "Cs1+"],
            [[2.105, 2.105, 2.105], [0, 0, 0]],
            validate_proximity=False,
            to_unit_cell=False,
            coords_are_cartesian=True,
            site_properties=None)
        self.square_pyramid = Structure(
            Lattice([[100, 0, 0], [0, 100, 0], [0, 0, 100]]),
            ["C", "C", "C", "C", "C", "C"],
            [[0, 0, 0], [1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0],
             [0, 0, 1]],
            validate_proximity=False,
            to_unit_cell=False,
            coords_are_cartesian=True,
            site_properties=None)
        self.trigonal_bipyramid = Structure(
            Lattice([[100, 0, 0], [0, 100, 0], [0, 0, 100]]),
            ["P", "Cl", "Cl", "Cl", "Cl", "Cl"],
            [[0, 0, 0], [0, 0, 2.14], [0, 2.02, 0], [1.74937, -1.01, 0],
             [-1.74937, -1.01, 0], [0, 0, -2.14]],
            validate_proximity=False,
            to_unit_cell=False,
            coords_are_cartesian=True,
            site_properties=None)

    def test_all(self):
        self.assertIsInstance(self.smi, StructureMotifInterstitial)
        self.assertEqual(len(self.smi.enumerate_defectsites()), 1)
        self.assertIsInstance(self.smi.enumerate_defectsites()[0], PeriodicSite)
        self.assertEqual("Si",
                         self.smi.enumerate_defectsites()[0].species_string)
        self.assertEqual("tetrahedral", self.smi.get_motif_type(0))

        elem_cn_dict = self.smi.get_coordinating_elements_cns(0)
        self.assertEqual(len(list(elem_cn_dict.keys())), 1)
        self.assertEqual(list(elem_cn_dict.keys())[0], "Si")
        self.assertEqual(elem_cn_dict["Si"], 4)

        structs = self.smi.make_supercells_with_defects(np.array([1, 1, 1]))
        self.assertEqual(len(structs), 2)
        self.assertIsInstance(structs[0], Structure)

    def tearDown(self):
        del self.smi
        del self.silicon
        del self.diamond
        del self.nacl
        del self.cscl