Added potential energy(PE) plot, added graph library, pulled out lattice init into functions, cleaned up backward frame code.