Molecular motions in aromatic polyamides and polyimides