Fix: Fix several bugs in KEDF get_energy functions - #7169
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes several KEDF-related get_energy implementations so the returned value matches the reduced/stored member energy, and makes small ML-related output/formatting adjustments to improve correctness/consistency when these codepaths are used in the future.
Changes:
- Return reduced member energy (
this->*_energy) from multiple KEDFget_energyfunctions instead of returning the unreduced localenergy. - Add braces around
if (PARAM.inp.of_ml_feg == 1)in ML KEDF / ML EXX parameter setup for clearer, safer control flow. - Adjust ML descriptor output pathing for
p.npy(currently introduces a path-join bug; see comment).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
source/source_pw/module_ofdft/kedf_xwm.cpp |
Return reduced xwm_energy from get_energy. |
source/source_pw/module_ofdft/kedf_wt.cpp |
Return reduced wt_energy from get_energy. |
source/source_pw/module_ofdft/kedf_vw.cpp |
Return reduced vw_energy from get_energy. |
source/source_pw/module_ofdft/kedf_tf.cpp |
Return reduced tf_energy from get_energy. |
source/source_pw/module_ofdft/kedf_lkt.cpp |
Return reduced lkt_energy from get_energy. |
source/source_pw/module_ofdft/kedf_ml.cpp |
Add braces around ML-FEG softplus branch in set_para. |
source/source_io/module_ml/write_mlkedf_descriptors.cpp |
Change p.npy output path to use out_dir (currently missing /). |
source/source_estate/module_pot/pot_ml_exx.cpp |
Add braces around ML-FEG softplus branch in set_para. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.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.
Reminder
Linked Issue
Fix #...
Unit Tests and/or Case Tests for my changes
What's changed?
These functions are currently unused, but this PR corrects the issues to ensure they work properly when called in the future.
Any changes of core modules? (ignore if not applicable)