Example #1
0
def test_sites_for_bio2():
    bio2_structure = Structure.from_str("""Bi4 O8
    1.0
    4.880207 0.000000 -2.019673
             -0.667412 5.402283 -1.612690
                       -0.040184 -0.016599 6.808846
    Bi O
    4 8
    direct
    0.729106 0.250000 1.000000 Bi
    0.270894 0.750000 0.000000 Bi
    0.000000 0.000000 0.500000 Bi
    0.500000 0.500000 0.500000 Bi
    0.321325 0.021684 0.814642 O
    0.114894 0.650123 0.351314 O
    0.885106 0.349877 0.648686 O
    0.763580 0.849877 0.648686 O
    0.236420 0.150123 0.351314 O
    0.493318 0.521684 0.814642 O
    0.506682 0.478316 0.185358 O
    0.678675 0.978316 0.185358 O""",
                                        fmt="POSCAR")
    symmetrizer = StructureSymmetrizer(bio2_structure)
    actual = symmetrizer.sites
    expected = \
        {'Bi1': Site(element='Bi', wyckoff_letter='e', site_symmetry='2', equivalent_atoms=[0, 1]),
         'Bi2': Site(element='Bi', wyckoff_letter='c', site_symmetry='-1', equivalent_atoms=[2, 3]),
         'O1': Site(element='O', wyckoff_letter='f', site_symmetry='1', equivalent_atoms=[4, 9, 10, 11]),
         'O2': Site(element='O', wyckoff_letter='f', site_symmetry='1', equivalent_atoms=[5, 6, 7, 8])}
    assert actual == expected
def test_sites(complex_monoclinic_structure):
    symmetrizer = StructureSymmetrizer(complex_monoclinic_structure)
    actual = symmetrizer.sites
    expected = {"H1": Site("H", "a", "2/m", [0]),
                "He1": Site("He", "m", "m", [1, 2]),
                "He2": Site("He", "m", "m", [3, 4])}
    assert actual == expected
Example #3
0
def test_local_extrema_append_sites_to_supercell_info2(local_extrema,
                                                       simple_cubic):
    sites = {
        "H1":
        Site(element="H",
             wyckoff_letter="a",
             site_symmetry="mmm",
             equivalent_atoms=[0, 1, 2, 3, 4, 5, 6, 7])
    }
    actual_cubic = Structure.from_dict(simple_cubic.as_dict())
    supercell_info = SupercellInfo(actual_cubic * [2, 2, 2], "Pm-3m",
                                   [[2, 0, 0], [0, 2, 0], [0, 0, 2]], sites,
                                   [])

    actual_2 = local_extrema.append_sites_to_supercell_info(supercell_info,
                                                            indices=[2])

    interstitials = [
        Interstitial(frac_coords=[0.05, 0.0, 0.0],
                     site_symmetry="4mm",
                     info="test #2")
    ]
    expected_2 = SupercellInfo(actual_cubic * [2, 2, 2], "Pm-3m",
                               [[2, 0, 0], [0, 2, 0], [0, 0, 2]], sites,
                               interstitials)
    assert actual_2 == expected_2
Example #4
0
    def _generate_supercell_info(self):
        multiplicity = int(round(det(self.transformation_matrix)))

        sites = {}
        for site_name, site in self.symmetrizer.sites.items():
            atoms = []
            for i in site.equivalent_atoms:
                atoms.extend(
                    list(range(i * multiplicity, (i + 1) * multiplicity)))
            sites[site_name] = Site(element=site.element,
                                    wyckoff_letter=site.wyckoff_letter,
                                    site_symmetry=site.site_symmetry,
                                    equivalent_atoms=atoms)

        self.supercell_info = \
            SupercellInfo(structure=self.supercell.structure,
                          space_group=self.sg_symbol,
                          transformation_matrix=self.transformation_matrix,
                          sites=sites,
                          unitcell_structure=self.primitive_structure)
Example #5
0
def site():
    return Site(element="H",
                wyckoff_letter="a",
                site_symmetry="m3m",
                equivalent_atoms=[0, 1, 2, 3, 5, 6])