Prevent N_monomer > 3 in AM algorithm, and fix errors in python tools #18
+37
−40
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request is primarily to patch a bug in
src/iterate_mod.fp.f90
. The bug was that the Anderson Mixing algorithm permitted the use of N_monomer > 3, but did not properly calculate the residuals for this system, resulting in quick but wrong conversion to an answer with 0 error from the residuals. This edit simply stops the execution of the code if a user tries to use N_monomer > 3 rather than allowing the answer to be calculated.I am also including in this pull request a fixed version of the python tools in the directory tools/python/pscf/, because the versions of the tools that exist in the current github directory do not work for me in either python2 or python3. This is an issue I hoped to fix because, if you've added these tools to your PYTHONPATH and they are broken, you can't do anything in python until they're all fixed because python gives you errors for the files in your PYTHONPATH even if you aren't importing/using them.
The amendments included in this pull request fix all of the errors that I have run into when using the python tools, allowing them to be run by users without being fixed beforehand. The issues I ran into were the following:
\t
tabs rather than spaces like they should be, and python gave me errors that saidinconsistent use of tabs and spaces
. In each place where this occurred, I replaced the tabs with spaces.io.py
is seemingly used for something else somewhere in python, because I ran into a bug once working on an entirely unrelated python project due to overlapping files namedio.py
. So, I renamed itio_pscf.py
.if self.__dict__.has_key(name)
, and I replaced these withif name in self.__dict__
because the former is specific to python2 but the latter works in both python2 and python3.true
toTrue
andfalse
toFalse
in a few places for proper syntax.The python tools were initially written for python2.7, but I am able to run them in python3.8 after having made the above changes. However, the changes shouldn't prevent them from still working properly in python2.7 as well, since none of the changes break compatibility with python2.7.
Changes:
modified: src/iterate_mod.fp.f90
modified: tools/python/pscf/fieldfile.py
renamed/modified: tools/python/pscf/io.py -> tools/python/pscf/io_pscf.py
modified: tools/python/pscf/outfile.py
modified: tools/python/pscf/paramfile.py
modified: tools/python/pscf/sweep.py
modified: tools/python/pscf/version.py