diff options
author | 2022-01-11 12:12:09 -0800 | |
---|---|---|
committer | 2022-01-11 12:12:09 -0800 | |
commit | 61e5cffc5442e4704dcef4dffe6cdaaa9b9bbd0a (patch) | |
tree | 354380da75764587bd7ae6e6f0c09d3516242613 /Python/pywarpx/WarpX.py | |
parent | bd91b3d5ba42cdf867c132bfc333fac7c887de73 (diff) | |
download | WarpX-61e5cffc5442e4704dcef4dffe6cdaaa9b9bbd0a.tar.gz WarpX-61e5cffc5442e4704dcef4dffe6cdaaa9b9bbd0a.tar.zst WarpX-61e5cffc5442e4704dcef4dffe6cdaaa9b9bbd0a.zip |
Sort the argument list that Python writes to the inputs files (#2732)
Diffstat (limited to 'Python/pywarpx/WarpX.py')
-rw-r--r-- | Python/pywarpx/WarpX.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Python/pywarpx/WarpX.py b/Python/pywarpx/WarpX.py index ece837816..50e34a72a 100644 --- a/Python/pywarpx/WarpX.py +++ b/Python/pywarpx/WarpX.py @@ -93,12 +93,15 @@ class WarpX(Bucket): def write_inputs(self, filename='inputs', **kw): argv = self.create_argv_list() - with open(filename, 'w') as ff: + for k, v in kw.items(): + argv.append(f'{k} = {v}') + + # Sort the argv list to make it more human readable + argv.sort() - for k, v in kw.items(): - ff.write('{0} = {1}\n'.format(k, v)) + with open(filename, 'w') as ff: for arg in argv: - ff.write('{0}\n'.format(arg)) + ff.write(f'{arg}\n') warpx = WarpX('warpx') |