コード例 #1
0
ファイル: test_molecule.py プロジェクト: ecurtin2/quantized
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)])
コード例 #2
0
 def with_atom_aligned_to(self, atom: Atom, x: float, y: float,
                          z: float) -> "Molecule":
     r = atom.rotation_matrix_to(x=x, y=y, z=z)
     return self.rotated(r)
コード例 #3
0
ファイル: test_atom.py プロジェクト: ecurtin2/quantized
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)