コード例 #1
0
def get_stk_bond_angle(mol, atom1_id, atom2_id, atom3_id):
    # TODO: Fill in the doc string for this including defintiions.
    atom1_pos, = mol.get_atomic_positions(atom_ids=atom1_id)
    atom2_pos, = mol.get_atomic_positions(atom_ids=atom2_id)
    atom3_pos, = mol.get_atomic_positions(atom_ids=atom3_id)
    v1 = atom1_pos - atom2_pos
    v2 = atom3_pos - atom2_pos
    return stk.vector_angle(v1, v2)
コード例 #2
0
    def inner(functional_group):
        position = building_block.get_centroid(
            atom_ids=functional_group.get_placer_ids(), )
        fg_direction = position - centroid
        theta = stk.vector_angle(fg0_direction, fg_direction)

        projection = fg_direction @ axis
        if theta > 0 and projection < 0:
            return 2 * np.pi - theta
        return theta
コード例 #3
0
def is_rotated(original, rotated, angle):
    """
    Check that `rotated` is `original` with a rotation of `angle`.

    Parameters
    ----------
    original : :class:`numpy.ndarray`
        The position matrix of a molecule before rotation.

    rotated : :class:`numpy.ndarray`
        The position matrix of a molecule after rotation.

    angle : :class:`float`
        The rotational angle.

    Returns
    -------
    None : :class:`NoneType`

    """

    for atom_id in range(max(len(original), len(rotated))):
        # No rotation is expected if the atom was located at the
        # origin of the rotation.
        if np.allclose(original[atom_id], [0, 0, 0], 1e-13):
            assert np.allclose(
                a=original[atom_id],
                b=rotated[atom_id],
                atol=1e-13,
            )
        else:
            applied_rotation = stk.vector_angle(
                vector1=original[atom_id],
                vector2=rotated[atom_id],
            )
            assert abs(abs(angle) - applied_rotation) < 1e-13
コード例 #4
0
ファイル: test_cof_topologies.py プロジェクト: fiszczyp/stk
 def inner(fg_id):
     fg = bb.func_groups[fg_id]
     fg_vector = (bb.get_centroid(fg.get_bonder_ids()) -
                  bb.get_centroid(bb.get_bonder_ids()))
     return stk.vector_angle(fg_vector, edge_vector)