Fixes for magnetic model and floating point errors during dilute mixing energy calculations. Performance improvements to AST construction which may negate the need to use Theano, but further study is necessary.