Copied over constants and grad_iterate function, need to change more, current sim will NOT compile