sponge.function.calc_torsion
================================

.. image:: https://mindspore-website.obs.cn-north-4.myhuaweicloud.com/website-images/r2.2/resource/_static/logo_source.svg
    :target: https://gitee.com/mindspore/mindscience/blob/r0.5/MindSPONGE/docs/api/api_python/function/sponge.function.calc_torsion.rst
    :alt: 查看源文件


.. py:function:: sponge.function.calc_torsion(position_a: Tensor, position_b: Tensor, position_c: Tensor, position_d: Tensor, pbc_box: Tensor = None, keepdims: bool = False)

    计算由四个位置A,B,C,D形成的扭转角。

    参数:
        - **position_a** (Tensor) - 位置a,shape为 :math:`(..., D)`,数据类型为float。
        - **position_b** (Tensor) - 位置b,shape为 :math:`(..., D)`,数据类型为float。
        - **position_c** (Tensor) - 位置c,shape为 :math:`(..., D)`,数据类型为float。
        - **position_d** (Tensor) - 位置d,shape为 :math:`(..., D)`,数据类型为float。
        - **pbc_box** (Tensor) - PBC box,shape为 :math:`(D)` 或 :math:`(B, D)`,其中B表示batch size,D表示模拟系统的维度,一般为3,数据类型为float。PBC box尺寸为 :math:`\vec{L}`。默认值 ``"None"``。
        - **keepdims** (bool) - 如果被设置为 ``"True"``,则最后一个轴将作为大小为 1 的维度保留在结果中。默认值 ``"False"``。

    返回:
        Tensor。计算所得扭转角。shape为 :math:`(...)` 或者 :math:`(..., 1)` ,数据类型为float。
    
    支持平台:
        ``Ascend`` ``GPU``