Replace implicit loop for copy to reduce stack usage in F90