openmopac / mopac

Molecular Orbital PACkage
http://openmopac.net
GNU Lesser General Public License v3.0
115 stars 31 forks source link

Flang-compiled MOPAC problems #109

Closed godotalgorithm closed 2 years ago

godotalgorithm commented 2 years ago

Describe the bug Flang-compiled MOPAC on Linux fails to read input files with DOS-style carriage returns.

To Reproduce This problem occurs with the version of flang classic available on conda-forge, and is likely to occur with other, similar versions.

Expected behavior DOS-style carriage returns should be ignored by Fortran read commands, and their appearance is probably a compiler bug.

Operating system I encountered this problem on Linux/x86.

Additional context Flang is under active development, so this bug will probably be resolved in a timely manner. It's also easy to avoid this bug if you aren't regularly transferring input files between Linux and Windows.

godotalgorithm commented 2 years ago

Actually, on closer inspection, this isn't strictly a bug. Flang is based on the legacy PGI Fortran compiler, and its default behavior is NOT to ignore the carriage return (CR) character in Windows-style CRLF line breaks. This compiler behavior can be adjusted, but it requires the setting of a specific environment variable at build time rather than being accessible via a compiler flag. CMake does not presently have convenient support for setting build-time environment variables, so I've added a message in the CMake script instructing users to set it for themselves when a legacy PGI compiler is detected.