def test_supercell_info_distances(supercell_info): assert supercell_info.coords("H1") == Coordination( { "H": [3.91], "He": [2.5, 3.0, 3.5] }, 4.25, {1, 4, 5, 6}) assert supercell_info.coords("He1") == Coordination( { "H": [2.5, 3.0, 3.5], "He": [3.91] }, 4.25, {0, 2, 3, 7})
def test_coord_distances(mocker, ortho_conventional): mock = mocker.patch("pydefect.util.structure_tools.defaults") mock.cutoff_distance_factor = 3.9051248 / 2.5 + 1e-5 # = 1.562 distances = Distances(ortho_conventional, center_coord=[0.5, 0.5, 0.5]) actual = distances.coordination(include_on_site=True) expected = Coordination({"H": [2.5, 3.0, 3.5], "He": [0.0, 3.91]}, 3.905, neighboring_atom_indices=[1, 2, 3, 4, 7]) assert actual == expected actual = distances.coordination() expected = Coordination({"H": [2.5, 3.0, 3.5], "He": [3.91]}, 3.905, neighboring_atom_indices=[1, 2, 3, 4]) assert actual == expected
def test_find_inequivalent_coords(simple_cubic): df = DataFrame( [[0.1, 0.0, 0.0, 1.0], [0.0, 0.1, 0.0, 1.0], [0.0, 0.0, 0.1, 1.0], [0.9, 0.0, 0.0, 1.0], [0.0, 0.9, 0.0, 1.0], [0.0, 0.0, 0.9, 1.0]], columns=["a", "b", "c", "value"]) actual = find_inequivalent_coords(simple_cubic, df) expected = CoordInfo(site_symmetry="4mm", coordination=Coordination({"H": [0.1]}, 0.13, [0]), frac_coords=[(0.1, 0.0, 0.0), (0.0, 0.1, 0.0), (0.0, 0.0, 0.1), (0.9, 0.0, 0.0), (0.0, 0.9, 0.0), (0.0, 0.0, 0.9)], quantities=[1.0] * 6) assert actual[0] == expected
def local_extrema(simple_cubic, vol_params): coordination = Coordination({"Mn": [1.0, 2.0]}, cutoff=4.0, neighboring_atom_indices=[1, 2]) local_extremum = CoordInfo(site_symmetry="3m", coordination=coordination, frac_coords=[(0.1, 0.1, 0.1)], quantities=[1.234]) coordination = Coordination({"Mn": [1.0, 2.0]}, cutoff=4.0, neighboring_atom_indices=[1, 2]) local_extremum2 = CoordInfo(site_symmetry="4mm", coordination=coordination, frac_coords=[(0.1, 0.0, 0.0)], quantities=[2.101]) return VolumetricDataLocalExtrema( unit_cell=simple_cubic, is_min=True, extrema_points=[local_extremum, local_extremum2], info="test", params=vol_params)
def test_supercell_info_interstitials_distances(supercell_info): assert supercell_info.interstitial_coords(0) == Coordination( { 'H': [2.62, 2.62, 2.62, 2.62], 'He': [2.62, 2.62, 2.62, 2.62] }, 4.457, {0, 1, 2, 3, 4, 5, 6, 7})
def test_coordination_msonable(tmpdir): assert_msonable(Coordination({"H": [2.5, 3.0, 3.5]}, 3.905, [1]))