Relation between hydrogen bonding and intramolecular motions in liquid and supercritical methanol