Nitrogen fixation is when: