Describe the bug
POSIX-like systems expect files to end with the newline character (\n in Python). The toolkit does not do this. This leads to quirks with common tools, a simple case being that cating two files squishes them together.
To Reproduce.
In [1]: from openff.toolkit import ForceField
In [2]: ForceField().to_file("x.offxml")
In [3]: !cat x.offxml x.offxml
<?xml version="1.0" encoding="utf-8"?>
<SMIRNOFF version="0.3" aromaticity_model="OEAroModel_MDL"></SMIRNOFF><?xml version="1.0" encoding="utf-8"?>
<SMIRNOFF version="0.3" aromaticity_model="OEAroModel_MDL"></SMIRNOFF>
In [4]: ForceField().to_string()
Out[4]: '<?xml version="1.0" encoding="utf-8"?>\n<SMIRNOFF version="0.3" aromaticity_model="OEAroModel_MDL"></SMIRNOFF>'
Note the \n between lines but not at the end of the file. (Whether or not the newline should be added to the stringified version, it's not modified in XMLParameterIOHandler.to_file.)
Describe the bug
POSIX-like systems expect files to end with the newline character (
\nin Python). The toolkit does not do this. This leads to quirks with common tools, a simple case being thatcating two files squishes them together.To Reproduce.
Note the
\nbetween lines but not at the end of the file. (Whether or not the newline should be added to the stringified version, it's not modified inXMLParameterIOHandler.to_file.)