RBM with free energy implemented