def test_atom_basic(): a = Atom(1) assert a.get_nuclear_charge() == 1 assert a.get_idx() == -1 c = a.get_coordinate() assert c.dot(c) == 0.0 with pytest.raises(TypeError): a.set_formal_charge(1.0)
def test_atom_coordinates(): a = Atom(8, xyz=[0.0, 0.0, 2.0]) assert a.get_nuclear_charge() == 8 with pytest.raises(TypeError): a.set_idx(2.0) a.set_idx(2) assert a.get_idx() == 2 r = numpy.array([0.0, 0.0, 1.0]) with pytest.raises(TypeError): a.set_coordinate([]) with pytest.raises(TypeError): a.set_coordinate(1.0) with pytest.raises(ValueError): a.set_coordinate(r[0:1]) a.set_coordinate(r) c = a.get_coordinate() assert c.dot(c) == 1.0