def test_rotate(): atom = Atom(H, 0, 2, 0) r = atom.rotation_matrix_to(x=4, y=0, z=0) rotated = atom.rotated(r) expected = Atom(H, 2, 0, 0) assert rotated == expected m = Molecule([atom]) assert m.with_atom_aligned_to(atom, x=1.0, y=0.0, z=0.0) == Molecule([expected]) assert m.rotated_about_z(np.pi / 2) == Molecule(atoms=[Atom(H, -2.0, 0.0, 0.0)])
def test_atom_rotated(): a = Atom(H, 0.0, 2.0, 0.0) r = a.rotation_matrix_to(1, 0, 0) assert a.rotated(r) == Atom(H, 2.0, 0.0, 0.0)