def test_add_interstitial(cubic_supercell_info_wo_int): primitive = Structure(Lattice.rhombohedral(7.071068, 60), species=["H", "He"], coords=[[0.0] * 3, [0.5] * 3]) new_supercell_info = append_interstitial(cubic_supercell_info_wo_int, primitive, [1 / 4, 1 / 4, 1 / 4]) expected = Interstitial(frac_coords=[1 / 8, 1 / 8, 1 / 8], wyckoff_letter="d", site_symmetry="-43m") assert new_supercell_info.interstitials[0] == expected
def cubic_supercell_info_wo_int(mocker, cubic_supercell): mock = mocker.patch("pydefect.util.structure_tools.defaults") mock.same_distance_criterion = defaults.same_distance_criterion mock.cutoff_distance_factor = 1.7 sites = { "H1": Site(element="H", wyckoff_letter="a", site_symmetry="m-3m", equivalent_atoms=[0, 1, 2, 3]), "He1": Site(element="He", wyckoff_letter="b", site_symmetry="m-3m", equivalent_atoms=[4, 5, 6, 7]) } unitcell = Structure(Lattice.rhombohedral(7.071068, 60), species=["H", "He"], coords=[[0.0] * 3, [0.5] * 3]) return SupercellInfo(cubic_supercell, "Fm-3m", [[-2, 2, 2], [2, -2, 2], [2, 2, -2]], sites, unitcell_structure=unitcell)
def rhombohedral(): lattice = Lattice.rhombohedral(a=1, alpha=45) coords = [[0.0, 0.0, 0.0]] return IStructure(lattice=lattice, species=["H"], coords=coords)