James Magnussen has been forced to settle for silver in the final of the men's 100 metre freestyle.