diff --git a/a3fe/_version.py b/a3fe/_version.py index b3f4756..ae73625 100644 --- a/a3fe/_version.py +++ b/a3fe/_version.py @@ -1 +1 @@ -__version__ = "0.1.2" +__version__ = "0.1.3" diff --git a/a3fe/read/_process_somd_files.py b/a3fe/read/_process_somd_files.py index 02ac843..685fce6 100644 --- a/a3fe/read/_process_somd_files.py +++ b/a3fe/read/_process_somd_files.py @@ -68,7 +68,14 @@ def write_simfile_option( logger.warning( f"Option {option} not found in simfile {simfile}. Appending new option to the end of the file." ) + + # First, ensure that the previous line terminates with a newline + # (Otherwise we'll end up adding the new option to the end of the previous line) + if lines[-1][-1] != "\n": + lines[-1] += "\n" + lines.append(f"{option} = {value}\n") + # Otherwise, replace the line with the new value else: lines[option_line_idx] = f"{option} = {value}\n" diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst index 53f2f0b..5741ad0 100644 --- a/docs/CHANGELOG.rst +++ b/docs/CHANGELOG.rst @@ -2,6 +2,11 @@ Change Log =============== +0.1.3 +==================== + +- Ensured that config options are written correctly when the template config file does not terminate in a new line. Previously, new options would be appended to the last line of the file if it did not end with \n, which could happen if the user manually edited the file. + 0.1.2 ====================