Wake up earlier and go to the gym. If you know you aren't productive when you wake up, it's best not to force it and do something else instead.
These days I feel so groggy in the morning that there's just no chance. After 3 cups of coffee I might feel sort of okay and awake by 11am.