Exemplo n.º 1
0
def PCV4(r : VecR, ro : VecR, v : VecR, a : VecR, a1 : VecR, a2 : VecR, \
         wv : float, cv : float, deltaT : float) -> None:
    v.x = (r.x - ro.x) / deltaT + wv * (cv[0] * a.x + cv[1] * a1.x +
                                        cv[2] * a2.x)
    v.y = (r.y - ro.y) / deltaT + wv * (cv[0] * a.y + cv[1] * a1.y +
                                        cv[2] * a2.y)
    v.z = (r.z - ro.z) / deltaT + wv * (cv[0] * a.z + cv[1] * a1.z +
                                        cv[2] * a2.z)
Exemplo n.º 2
0
def PCR4(r : VecR, ro : VecR, v : VecR, a : VecR, a1 : VecR, a2 : VecR, \
         wr : float, cr : float, deltaT : float) -> None:
    r.x = ro.x + deltaT * v.x + wr * (cr[0] * a.x + cr[1] * a1.x +
                                      cr[2] * a2.x)
    r.y = ro.y + deltaT * v.y + wr * (cr[0] * a.y + cr[1] * a1.y +
                                      cr[2] * a2.y)
    r.z = ro.z + deltaT * v.z + wr * (cr[0] * a.z + cr[1] * a1.z +
                                      cr[2] * a2.z)
def vecr_copy(a_to: VecR, b_from: VecR) -> None:
    """Copy VecR objects component-wise.
    Parameters
    ----------
    a_to : VecR, molecule to copy to.
    b_from : VecR, molecule to copy from.
    """
    a_to.x = b_from.x
    a_to.y = b_from.y
    a_to.z = b_from.z
def _VCell_wrap_all(vc: VecI, cells: VecI, rs: VecR, region: VecR):
    # Wrap the x-coordinate
    if vc.x >= cells.x:
        vc.x = 0
        rs.x = region.x
    elif vc.x < 0:
        vc.x = cells.x - 1
        rs.x = -region.x

    # Wrap the y-coordinate
    if vc.y >= cells.y:
        vc.y = 0
        rs.y = region.y
    elif vc.y < 0:
        vc.y = cells.y - 1
        rs.y = -region.y

    # Wrap the z-coordinate
    if vc.z >= cells.z:
        vc.z = 0
        rs.z = region.z
    elif vc.z < 0:
        vc.z = cells.z - 1
        rs.z = -region.z