geometric/step.py
def calc_drms_dmax(Xnew, Xold, align=True):
    """
    Align and calculate the RMSD for two geometries.

    Xnew : np.ndarray
        First set of coordinates as a flat array in a.u.
    Xold : np.ndarray
        Second set of coordinates as a flat array in a.u.
    align : bool
        Align before calculating RMSD or no?

    Returns
    -------
    float, float
        RMS and maximum displacements in Angstrom
    """
    # Shift to the origin
    Xold = Xold.copy().reshape(-1, 3)
    Xold -= np.mean(Xold, axis=0)
    Xnew = Xnew.copy().reshape(-1, 3)
    Xnew -= np.mean(Xnew, axis=0)
    # Obtain the rotation
    if align:
        U = get_rot(Xnew, Xold)
        # Xrot = np.array((U*np.matrix(Xnew).T).T).flatten()
        Xrot = np.dot(U, Xnew.T).T.flatten()
        Xold = np.array(Xold).flatten()
        displacement = np.sqrt(np.sum((((Xrot-Xold)*bohr2ang).reshape(-1,3))**2, axis=1))
    else:
        displacement = np.sqrt(np.sum((((Xnew-Xold)*bohr2ang).reshape(-1,3))**2, axis=1))
    rms_displacement = np.sqrt(np.mean(displacement**2))
    max_displacement = np.max(displacement)
    return rms_displacement, max_displacement

    Align and calculate the RMSD for two geometries.

    Xnew : np.ndarray
        First set of coordinates as a flat array in a.u.
    Xold : np.ndarray
        Second set of coordinates as a flat array in a.u.
    align : bool
        Align before calculating RMSD or no?

    Returns
    -------
    float, float
        RMS and maximum displacements in Angstrom
    
Align and calculate the RMSD for two geometries.
Xnew : np.ndarray
First set of coordinates as a flat array in a.u.
Xold : np.ndarray
Second set of coordinates as a flat array in a.u.

Returns

float, float
RMS and maximum displacements in Angstrom
Align and calculate the RMSD for two geometries . Xnew : np . ndarray First set of coordinates as a flat array in a . u . Xold : np . ndarray Second set of coordinates as a flat array in a . u . Returns float float RMS and maximum displacements in Angstrom
def calc_drms_dmax(Xnew, Xold, align=True):
    Xold = Xold.copy().reshape(-1, 3)
    Xold -= np.mean(Xold, axis=0)
    Xnew = Xnew.copy().reshape(-1, 3)
    Xnew -= np.mean(Xnew, axis=0)
    if align:
        U = get_rot(Xnew, Xold)
        Xrot = np.dot(U, Xnew.T).T.flatten()
        Xold = np.array(Xold).flatten()
        displacement = np.sqrt(np.sum((((Xrot-Xold)*bohr2ang).reshape(-1,3))**2, axis=1))
    else:
        displacement = np.sqrt(np.sum((((Xnew-Xold)*bohr2ang).reshape(-1,3))**2, axis=1))
    rms_displacement = np.sqrt(np.mean(displacement**2))
    max_displacement = np.max(displacement)
    return rms_displacement, max_displacement
def calc_drms_dmax ( Xnew , Xold , align = True ) : Xold = Xold . copy ( ) . reshape ( - 1 , 3 ) Xold -= np . mean ( Xold , axis = 0 ) Xnew = Xnew . copy ( ) . reshape ( - 1 , 3 ) Xnew -= np . mean ( Xnew , axis = 0 ) if align : U = get_rot ( Xnew , Xold ) Xrot = np . dot ( U , Xnew . T ) . T . flatten ( ) Xold = np . array ( Xold ) . flatten ( ) displacement = np . sqrt ( np . sum ( ( ( ( Xrot - Xold ) * bohr2ang ) . reshape ( - 1 , 3 ) ) ** 2 , axis = 1 ) ) else : displacement = np . sqrt ( np . sum ( ( ( ( Xnew - Xold ) * bohr2ang ) . reshape ( - 1 , 3 ) ) ** 2 , axis = 1 ) ) rms_displacement = np . sqrt ( np . mean ( displacement ** 2 ) ) max_displacement = np . max ( displacement ) return rms_displacement , max_displacement
Align and calculate the RMSD for two geometries.
Align and calculate the RMSD for two geometries .
"""
    Align and calculate the RMSD for two geometries.

    Xnew : np.ndarray
        First set of coordinates as a flat array in a.u.
    Xold : np.ndarray
        Second set of coordinates as a flat array in a.u.
    align : bool
        Align before calculating RMSD or no?

    Returns
    -------
    float, float
        RMS and maximum displacements in Angstrom
    """ # Shift to the origin # Obtain the rotation # Xrot = np.array((U*np.matrix(Xnew).T).T).flatten()
Xnew
Xold
align