Open
Conversation
- Replace wildcard imports with explicit imports in __init__.py - Fix boolean comparisons (== True/False) to use truthiness - Remove empty else: pass blocks in plotting.py - Remove commented-out code in plotting.py - Fix float comparison in tests to use assertAlmostEqual Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix electric field sign: E = -grad(V), not grad(V) (plotting.py) - Fix gradient magnitude: use sqrt(x^2+y^2+z^2) not x*y*z (plotting.py) - Fix cube file lattice vectors: cell[0] not cell[1] for vector_a (plotting.py) - Fix GULP potential reading: remove reversed() that inverted grid (io.py) - Fix macroscopic_average normalization in else branch (averages.py) - Fix periodic wrapping: use modulo instead of round() (averages.py) - Fix np.append: use np.vstack with assignment (tools.py) - Fix diff_potentials: rewrite to fix negative size and index bugs (tools.py) - Fix matched_spline_generate: use interpolated A_new not original A (tools.py) - Fix gradient_magnitude: vectorize, don't modify input array (density.py) - Fix plane orientation: implement zoz and ozz cases (tools.py) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
New function to remove artificial electric fields in slab calculations caused by periodic boundary conditions. The function: - Auto-detects vacuum region by finding flat areas of the potential - Fits a line to measure the electric field slope - Subtracts a linear ramp to flatten the potential Usage: corrected, field, vacuum = md.dipole_correction(planar_avg, lattice_z) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add get_layer_sites() function for identifying slab surface layers - Update module docstrings to be cleaner and more descriptive - Fix plt.savefig to fig.savefig for explicit figure saving Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Move JOSSpaper directory to docs/JOSSpaper - Add badges to README (CI, PyPI, docs, license) - Add quick usage examples to README - Add CITATION.cff for proper citation support Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update to latest GitHub Actions versions (checkout@v4, setup-python@v5) - Add Python 3.12 to test matrix - Trigger on all PRs to master/main (not just specific branches) - Add basic linting with ruff (lenient for legacy code) - Make codecov optional (don't fail without token) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 introduces several improvements and fixes across the codebase, focusing on enhancing usability, maintainability, and correctness. Major updates include revamping the CI workflow, improving documentation and citation support, refining plotting and numerical routines, and cleaning up code style and logic.
Continuous Integration and Quality Assurance:
.github/workflows/ci.yamlworkflow: updated Python and action versions, expanded testing to Python 3.12, added a dedicated lint job usingruff, adjusted branch triggers, and improved Codecov upload logic.Documentation and Citation:
CITATION.cfffile to provide standardized citation information for the project.README.mdwith project badges, a quick usage example, and improved introductory text. [1] [2]API and Code Quality Improvements:
macrodensity/__init__.pyto explicitly import only public API functions and classes, improving clarity and maintainability.macrodensity/plotting.pyandmacrodensity/tools.pyfor better clarity and consistency. [1] [2]Numerical and Plotting Fixes:
macrodensity/averages.pyfor more accurate results. [1] [2]macrodensity/density.pyand plotting routines, ensuring correct visualization of vector fields and potential gradients. [1] [2] [3] [4] [5]Code Logic and Style Cleanups:
macrodensity/tools.pyfor functions likematch_resolution,matched_spline_generate, anddiff_potentials, ensuring correct numerical behavior. [1] [2] [3]read_gulp_potentialto ensure all grid points are read.These changes collectively improve the reliability, maintainability, and user experience of the MacroDensity package.