Automated construction of order parameters for analyzing simulations of protein folding and water dynamics