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_molecule_rotated_about_z(): a1 = Atom(H, -1, 0, 100) a2 = Atom(H, 0, -1, 200) m = Molecule([a1, a2]) expected = Molecule([Atom(H, 0, -1, 100), Atom(H, 1, 0, 200)]) assert m.rotated_about_z(np.pi / 2) == expected