added function to calculate DKL and test