def setUp(self): struct = Structure.from_file(f"{dir_path}/full_path_files/MnO2_full_Li.vasp") self.fpm_li = MigrationGraph.with_distance(structure=struct, migrating_specie="Li", max_distance=4) # Particularity difficult pathfinding since both the starting and ending positions are outside the unit cell struct = Structure.from_file(f"{dir_path}/full_path_files/Mg_2atom.vasp") self.fpm_mg = MigrationGraph.with_distance(structure=struct, migrating_specie="Mg", max_distance=2)
def setUp(self): self.lifepo = self.get_structure("LiFePO4") migration_graph = MigrationGraph.with_distance(self.lifepo, max_distance=4.0, migrating_specie="Li") gen = iter(migration_graph.migration_graph.graph.edges(data=True)) u, v, d = next(gen) i_site = PeriodicSite("Li", coords=d["ipos"], lattice=self.lifepo.lattice) e_site = PeriodicSite("Li", coords=d["epos"], lattice=self.lifepo.lattice) a = SpacegroupAnalyzer(self.lifepo) symm_structure = a.get_symmetrized_structure() self.m_hop = MigrationHop(i_site, e_site, symm_structure)
def test_m_graph_construction(self): self.assertEqual(self.full_struct.composition["Li"], 8) mg = MigrationGraph.with_distance(self.full_struct, migrating_specie="Li", max_distance=4.0) self.assertEqual(len(mg.m_graph.structure), 8)
def setUp(self): struct = Structure.from_file( f"{dir_path}/full_path_files/MnO2_full_Li.vasp") self.fpm = MigrationGraph.with_distance(structure=struct, migrating_specie="Li", max_distance=4)
def test_not_matching_first(self): structure = Structure.from_file( f"{dir_path}/pathfinder_files/Li6MnO4.json") fpm_lmo = MigrationGraph.with_distance(structure, "Li", max_distance=4) for u, v, d in fpm_lmo.m_graph.graph.edges(data=True): self.assertIn(d["hop"].eindex, {0, 1})
test_dir = os.path.dirname(os.path.realpath(__file__)) __author__ = "Haoming Li" __version__ = "1.0" __date__ = "February 17, 2021" uc_full_sites = Structure.from_file(f"{test_dir}/test_files/Li4Sr3Fe2O7_uc.vasp") input_struct_i = Structure.from_file(f"{test_dir}/test_files/Sr3Fe2O7_sc_i.vasp") input_struct_e = Structure.from_file(f"{test_dir}/test_files/Sr3Fe2O7_sc_e.vasp") mg_uc_full_sites = Structure.from_file(f"{test_dir}/test_files/Mg3VOPO4_uc.vasp") mg_input_struct_i = Structure.from_file(f"{test_dir}/test_files/Mg3VOPO4_sc_i.vasp") mg_input_struct_e = Structure.from_file(f"{test_dir}/test_files/Mg3VOPO4_sc_e.vasp") mg_Li = MigrationGraph.with_distance(structure=uc_full_sites, migrating_specie="Li", max_distance=5) mg_Mg = MigrationGraph.with_distance(structure=mg_uc_full_sites, migrating_specie="Mg", max_distance=4) def test_add_edge_data_from_sc(): errors = [] test_key = "test_key" test_array = [0, 1, 2, 3, 4] add_edge_data_from_sc( mg_Li, i_sc=input_struct_i, e_sc=input_struct_e, data_array=test_array, key=test_key, )