def test_analyze_exceptions(): latt = LatticeStructure(np.eye(2)) with pytest.raises(NoAtomsError): latt.analyze() latt.add_atom() with pytest.raises(NoConnectionsError): latt.analyze()
def test_add_connection(): latt = LatticeStructure(np.eye(2)) latt.add_atom([0.0, 0.0], atom="A") latt.add_atom([0.5, 0.5], atom="B") latt.add_connection("A", "A", 1) latt.add_connection("A", "B", 1) latt.analyze() # Assert neighbor atom index is right assert all(latt.get_neighbors(alpha=0, distidx=0)[:, -1] == 1) assert all(latt.get_neighbors(alpha=0, distidx=1)[:, -1] == 0) assert all(latt.get_neighbors(alpha=1, distidx=0)[:, -1] == 0)