Code from Baldwin-Brown, Long, and Thornton (2014) Mol Biol Evol