Exemplo n.º 1
0
 def test_arg_equivalent_vectors(self):
     structure = StructureFactory().ase.bulk('Al', cubic=True).repeat(2)
     self.assertEqual(np.unique(structure.get_symmetry().arg_equivalent_vectors).squeeze(), 0)
     x_v = structure.positions[0]
     del structure[0]
     arg_v = structure.get_symmetry().arg_equivalent_vectors
     dx = structure.get_distances_array(structure.positions, x_v, vectors=True)
     dx_round = np.round(np.absolute(dx), decimals=3)
     self.assertEqual(len(np.unique(dx_round + arg_v)), len(np.unique(arg_v)))
Exemplo n.º 2
0
 def test_get_arg_equivalent_sites(self):
     a_0 = 4.0
     structure = StructureFactory().ase.bulk('Al', cubic=True, a=a_0).repeat(2)
     sites = structure.get_wrapped_coordinates(structure.positions + np.array([0, 0, 0.5 * a_0]))
     v_position = structure.positions[0]
     del structure[0]
     pairs = np.stack((
         structure.get_symmetry().get_arg_equivalent_sites(sites),
         np.unique(np.round(structure.get_distances_array(v_position, sites), decimals=2), return_inverse=True)[1]
     ), axis=-1)
     unique_pairs = np.unique(pairs, axis=0)
     self.assertEqual(len(unique_pairs), len(np.unique(unique_pairs[:, 0])))
     with self.assertRaises(ValueError):
         structure.get_symmetry().get_arg_equivalent_sites([0, 0, 0])