Resolve "implement Hamiltonian variables check"#566
Resolve "implement Hamiltonian variables check"#566ALF-Import-Bot wants to merge 25 commits intomasterfrom
Conversation
This reverts commit 9941d91
…k.uni-wuerzburg.de:ALF/ALF into 316-implement-hamiltonian-variables-check
|
In GitLab by @lidiastocker on Jul 23, 2025, 08:53 UTC: requested review from @johanneshofmann87 |
|
In GitLab by @lidiastocker on Aug 4, 2025, 12:25 UTC: added 3 commits
|
|
In GitLab by @lidiastocker on Aug 4, 2025, 13:24 UTC: added 1 commit
|
|
In GitLab by @lidiastocker on Aug 4, 2025, 13:33 UTC: added 1 commit
|
|
In GitLab by @lidiastocker on Aug 4, 2025, 13:50 UTC: I created a separate file QMC_runtime_var, which is used by main and can also be accessed by Hamiltonian_##NAME##_smod (or any other file) to read QMC variables. As of now, if, for example, a Hamiltonian does not support the sequential update scheme, yet "Sequential": true is set (using pyalf notation), one should add the following lines to Hamiltonian_##NAME##_smod.F90: This is not the most elegant solution, as it raises an error only when calling .run(), but I do not think we can overcome this (as the filename suggest, we are dealing with runtime variables and, even if in this case one could stop the code at compile time already, this would imply a mix of the two types). |
|
In GitLab by @lidiastocker on Aug 4, 2025, 14:00 UTC: added 1 commit
|
|
In GitLab by @lidiastocker on Aug 4, 2025, 14:08 UTC: added 1 commit
|
|
In GitLab by @jonasschwab on Aug 5, 2025, 08:59 UTC: I would move the reading and MPI broadcast of the variables to the module. This will clean up For added cleanliness, one could even make most of the variables private and access them via getters, e.g. functions like |
|
Discussion in GitLab: In GitLab by @jonasschwab on Aug 5, 2025, 09:08 UTC: Should we move all these variable in there? Giving the Hamiltonian access to so many variables opens avenues for breaking backwards compatibility and additional ways for user to shoot themselves in the foot. Especially things like There are also a few things that don't belong in such a big scope, like In GitLab by @johanneshofmann87 on Aug 5, 2025, 09:28 UTC: Yes, this is a very early stage of the draft. |
|
In GitLab by @johanneshofmann87 on Aug 5, 2025, 09:26 UTC: @jonasschwab and @lidiastocker , |
|
In GitLab by @johanneshofmann87 on Sep 12, 2025, 14:42 UTC: approved this merge request |
|
In GitLab by @johanneshofmann87 on Sep 12, 2025, 14:43 UTC: requested review from @johanneshofmann87 and removed approval |
|
In GitLab by @johanneshofmann87 on Sep 12, 2025, 14:43 UTC: requested review from @jonasschwab and removed review request for @johanneshofmann87 |
|
Discussion in GitLab: In GitLab by @jonasschwab on Sep 23, 2025, 11:28 UTC: Looks good to me. Though, I would also move the reading of In GitLab by @johanneshofmann87 on Sep 23, 2025, 11:32 UTC: Sure, please feel free to go ahead. I was considering it at some point as well. In GitLab by @jonasschwab on Sep 23, 2025, 12:45 UTC: Done. I've also moved In GitLab by @lidiastocker on Sep 23, 2025, 13:11 UTC: I initially did the same. But after discussing with Johannes, we concluded that keeping them in the main is the better option. |
|
In GitLab by @jonasschwab on Sep 23, 2025, 12:31 UTC: added 1 commit
|
|
In GitLab by @jonasschwab on Sep 23, 2025, 12:35 UTC: added 1 commit
|
|
In GitLab by @jonasschwab on Sep 23, 2025, 13:26 UTC: added 1 commit
|
|
In GitLab by @jonasschwab on Sep 23, 2025, 14:42 UTC: approved this merge request |
|
In GitLab by @johanneshofmann87 on Sep 29, 2025, 12:52 UTC: resolved all threads |
|
In GitLab by @fassaad on Sep 29, 2025, 13:01 UTC: This is of course much cleaner. Have we really checked all the environment variables? |
|
In GitLab by @fassaad on Oct 28, 2025, 15:56 UTC: Put a lock on the variables. You can only change the variable once. Setters and getters. Variables have to be private, and write routines to update them. These routines can issue warnings! |
|
In GitLab by @jonasschwab on Oct 28, 2025, 18:33 UTC: added 1 commit
|
|
In GitLab by @jonasschwab on Oct 28, 2025, 18:41 UTC: added 1 commit
|
|
In GitLab by @jonasschwab on Oct 28, 2025, 18:42 UTC: I took the liberty to add setters and getters (with a little help from ChatGPT). We could now add something like a bool |
|
In GitLab by @jonasschwab on Oct 28, 2025, 18:45 UTC: added 76 commits
|
|
@lidiastocker @jonasschwab @fassaad I have added a lock which blocks any change to the QMC runtime variables once the initialisation is completed. Thanks to Jonas' work on the get/set functions, this was straight forward. I also merged the current master to resolve any merge conflicts. This should be ready now, as far as I'm concerned. |
There was a problem hiding this comment.
Pull request overview
This pull request implements a dedicated module for QMC (Quantum Monte Carlo) runtime variables, addressing issues #316 and #276. The PR enables Hamiltonian files to access QMC settings by refactoring all QMC-related variables from main.F90 into a new QMC_runtime_var_mod.F90 module. The refactoring introduces a getter/setter pattern with a locking mechanism to prevent modifications after initialization, ensuring configuration consistency during runtime.
Changes:
- Created new
QMC_runtime_var_mod.F90module with getter/setter accessors for all QMC runtime variables, including support for conditional compilation (MPI, TEMPERING) - Refactored
main.F90to use the new module via getter/setter functions instead of direct variable access - Updated
Makefileto include the new module in the build process
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| Prog/QMC_runtime_var_mod.F90 | New module that encapsulates all QMC runtime variables with getter/setter accessors, locking mechanism, and read/broadcast functions for MPI environments |
| Prog/main.F90 | Removed QMC variable declarations and updated all references to use getters/setters from QMC_runtime_var module; reorganized imports for better clarity |
| Prog/Makefile | Added QMC_runtime_var_mod.o to OBJS and QMC_runtime_var_mod.mod to MODS for build dependencies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot open a new pull request to apply changes based on the comments in this thread |
|
@johanneshofmann87 I've opened a new pull request, #600, to work on those changes. Once the pull request is ready, I'll request review from you. |
… spelling and indentation Co-authored-by: johanneshofmann87 <129625831+johanneshofmann87@users.noreply.github.com>
Fix code review issues: missing imports, duplicate lock, and MPI file I/O
In GitLab by @lidiastocker on Jul 23, 2025, 08:53 UTC:
Closes #316
Closes #276
Assignees: @lidiastocker
Reviewers: @jonasschwab
Approved by: @jonasschwab
Migrated from GitLab: https://git.physik.uni-wuerzburg.de/ALF/ALF/-/merge_requests/236