3D Vacuum Part 1: Reorganizing vacuum file structure and force_wv_symmetry bugfix#145
3D Vacuum Part 1: Reorganizing vacuum file structure and force_wv_symmetry bugfix#145
Conversation
…d to mathutils file
…ry because we forgot to convert part of the fortran. This fixes it
logan-nc
left a comment
There was a problem hiding this comment.
This is going to cause me headaches for #119 but you are doing the right thing by chunking work into digestible PRa so I am going to reward that and merge - dealing with the headache on the other end.
Please note that an issue should be opened that requests we move as many basic "mathematical utilities" to a shared top level directory. I've created it in #119, but after that is merged the task should be to go through each directory (ForceFreeStates, Vacuum, etc.) and pull things out as appropriate. Part of this will be migrating some things. For example, we don't need to reinvent FFTs for vacuum - we can use a standard package.
PR ReviewThis PR reorganizes the Vacuum module file structure and fixes a bug in the symmetry enforcement. The changes are well-structured and the bugfix is mathematically correct. File ReorganizationPositives:
Considerations:
Bugfix: force_wv_symmetryThe bug: The Julia conversion was missing the second nested loop from the Fortran code that copies the upper triangle to the lower triangle. The fix: Replacing the incomplete implementation with
Issues identified:
Minor Issues
Recommendations
The file reorganization is solid. The bugfix approach is on the right track, but needs verification of the complex matrix symmetrization behavior before merging. |
This is part of a series of PRs for 3D vacuum that I am breaking up to be more manageable. Starting off is two things.
TL;DR - I changed file names + moved some functions around, and fixed a small bug. @logan-nc this should be a quick review, basically just if you agree with my file naming.
File reorganization
Removes
Vacuum...jlnaming convention, since this isn't what we did for DCON and isn't required for Julia standard. Furthermore,VacuumInternals.jlwas massive and contained a bunch of unrelated functionality.New proposed structure. NO CODE WAS CHANGED in this process, only moved from file to file.
DataTypes.jlMathUtils.jlDataTypes.jlto hereKernel2D.jlKernel3D.jlKernel2D.jlBUGFIX - force_wv_symmetry was not working properly
I chose to include this in this PR since it slightly changes the outputs of the vacuum code, and will make comparing PRs to develop annoying if I tried to do them all at once.
The original fortran for this section is
However, our Julia conversion was
we clearly left out the second do loop here. Adding this second loop in Julia is equivalent to just calling the
hermitianpart!()function, which allows a very simple lineforce_wv_symmetry && hermitianpart!(wv)As documentation that these do the same thing:

and we can see that these matrices are in fact Hermitian now as expected, which is not occurring in the existing code.