added code to create potential distribution matrices