Fix some warnings caught by gfortran
Fix warnings generated by gfortran when using the following flags:
-Wcharacter-truncation. Some of these problems were actual bugs.
Fix some warnings caught by gfortran.
- I have checked that my code follows the Octopus coding standards
- I have added tests for all the new features added in this request.