diff --git a/CrystalStructure/crystal/base.py b/CrystalStructure/crystal/base.py index e25cabb..acdb13e 100644 --- a/CrystalStructure/crystal/base.py +++ b/CrystalStructure/crystal/base.py @@ -36,17 +36,6 @@ def calculate_atomic_volume(self) -> float: def get_non_void_sites(self) -> list[AtomicSite]: return [site for site in self if not site.is_nonstandard()] - def as_site_dictionaries(self) -> dict: - coordinate_map = {} - for atom_site in self: - coords = (atom_site.x, atom_site.y, atom_site.z) - if not coords in coordinate_map: - coordinate_map[coords] = {} - coordinate_map[coords][atom_site.atom_type] = atom_site.occupancy - - print(f'Coordinate map = {coordinate_map}') - return coordinate_map - def is_empty(self) -> bool: return len(self) == 0 diff --git a/tests/t_base.py b/tests/t_base.py index 62a851f..c802cc6 100644 --- a/tests/t_base.py +++ b/tests/t_base.py @@ -16,29 +16,9 @@ def test_scattering_params(self): for p in params: self.assertIsInstance(p, float) if not atomic_site.atom_type in seen_species: - print(f'Scattering params for species \"{atomic_site.atom_type}\" a1, a2, a3, a4, b1, b2, b3, b4 = {params}') + print(f'Scattering params for species \"{atomic_site.species_str}:\n a1, a2, a3, a4, b1, b2, b3, b4 = {params}') seen_species.add(atomic_site.atom_type) - def test_site_dictionaries(self): - base = CrystalExamples.get_base(mute=False) - site_dictionaries = base.as_site_dictionaries() - coordinates = list(site_dictionaries.keys()) - - max_err = 10**(-2) - target_coordinate = (0.931,0.25,0) - def dist(coor1, coord2): - return sum([(x-y)**2 for x,y in zip(coor1, coord2)])**(1/2) - - match = None - for coord in coordinates: - match_found = any([dist(coord, target_coordinate) < max_err]) - if match_found: - match = coord - - self.assertIsNotNone(match) - self.assertIn(Species(f'Al0+'), site_dictionaries[match]) - - if __name__ == '__main__': TestCrystalBase.execute_all() \ No newline at end of file