def test_ctor(self): sut = Atom(id=1, x=0, y=0, z=0) assert (sut.position._data == np.array((0, 0, 0))).all()
def test_property_get(self): sut = Atom(id=1, x=1, y=2, z=3) assert sut.x == 1 assert sut.y == 2 assert sut.z == 3
def test_euclidian_distance_array2(self, params1, params2): expect = np.sum((np.array(params1) - np.array(params2))**2) a = Atom(id=1, *params1) b = Coordinate(*params2) assert a.euclidian_dist2(b) == expect
def test_atom_exception(self): """test that exception is raised for invalid atoms""" with pytest.raises(ValueError): assert Atom(0, 0, 0)
def test_euclidian_distance_array(self, params1, params2): expect = np.sum((np.array(params1) - np.array(params2))**2) a = Atom(*params1) assert a.euclidian_dist2(np.array(params2)) == expect
def test_property_get(self): sut = Atom(1, 2, 3) assert sut.x == 1 assert sut.y == 2 assert sut.z == 3
def test_euclidian_distance_array(self, params1, params2): expect = np.sum((np.array(params1) - np.array(params2))**2) a = Atom(field_name="ATOM", id=1, *params1) assert a.euclidian_dist2(np.array(params2)) == expect
def test_property_get(self): sut = Atom(field_name="ATOM", id=1, x=1, y=2, z=3) assert sut.x == 1 assert sut.y == 2 assert sut.z == 3