A theoretical prediction of the threshold for chaos in a Josephson junction