def eigenvectors_from_displacements(disp,masses):
    """
    Calculate the eigenvectors from the atomic displacements
    """
    nphonons,natoms,ndirections = disp.shape
    sqrt_masses = np.sqrt(masses)
    return np.einsum("nax,a->nax",disp,sqrt_masses)
Calculate the eigenvectors from the atomic displacements