Slab force update#215
Conversation
…ency with the recent Cylinder update
There was a problem hiding this comment.
Pull request overview
This PR updates the slab force/basis implementation to match current conventions (isothermal slab profile normalization, cache versioning, and a self_consistent “frozen potential” mode) and adds compile-time parsing of the EXP version string for internal version-dependent logic.
Changes:
- Switch isothermal slab model normalization to use a
sech^2(z/2H)form and warn users when running older EXP versions. - Add a
self_consistentconfiguration flag to SlabSL to support freezing the potential coefficients. - Add compile-time EXP version parsing (
EXPversion.H,exp_build) and a small test utility; add slab cache version attribute.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| utils/Test/version_test.cc | Adds a small example program that prints VERSION and parsed major/minor/patch. |
| utils/Test/CMakeLists.txt | Builds the new vtest utility. |
| utils/ICs/bonnerebert.cc | Removes the local VERSION macro and the -V version flag handling. |
| src/SlabSL.H | Documents self_consistent and adds storage for frozen coefficients. |
| src/SlabSL.cc | Adds YAML parsing for self_consistent and uses frozen coefficients during force evaluation. |
| src/cudaSlabSL.cu | Uses frozen coefficients when copying coefficients to the GPU if self_consistent=false. |
| include/SLGridMP2.H | Adds cache versioning for slab cache and improves internal grouping/comments. |
| include/libvars.H | Exposes exp_build as a compile-time parsed {major,minor,patch} version triple. |
| include/EXPversion.H | Introduces a constexpr version-string parser. |
| exputil/SLGridMP2.cc | Updates isothermal slab profile functions and adds slab cache version checks/write. |
| exputil/libvars.cc | Ensures config header is included in libvars translation unit. |
| expui/BiorthBasis.cc | Allows self_consistent as a recognized YAML key for the slab basis config. |
Comments suppressed due to low confidence (1)
utils/ICs/bonnerebert.cc:404
- The
-V/--versionoption was removed fromgetopt_longparsing, butlong_optionsstill defines aversionentry andusage()still advertises-V. This makes the CLI help incorrect and--versionwill likely behave unexpectedly (depending ongetopt_longbehavior). Either restore handling for-V/--versionor remove it consistently fromlong_optionsand the usage text.
"R:" /* runit */
"N:" /* number */
"S:" /* seed */
"h", /* help */
long_options, (int *) 0)) != EOF)
{
switch (c)
{
case 'o': /* --output */
oname = string(optarg);
break;
case 'd': /* --xstep */
h = atof(optarg);
break;
case 'r': /* --ratio */
Rratio = atof(optarg);
break;
case 'R': /* --runit */
R = atof(optarg);
break;
case 'M': /* --munit */
Munit = atof(optarg);
break;
case 'm': /* --mass */
M = atof(optarg);
break;
case 'T': /* --temp */
T = atof(optarg);
break;
case 'N': /* --number */
N = atoi(optarg);
break;
case 'S': /* --seed */
S = atoi(optarg);
break;
case 'h':
usage (0);
default:
usage (-1);
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@michael-petersen I am probably the only one that uses the slab stuff and these changes implement some of the standard features from the other force classes. So no need for you to spend time on most of this. It's all tested and seems to work. However, note that this PR adds a compile-time function that parses the CMake-generated |
Agent-Logs-Url: https://github.com/EXP-code/EXP/sessions/a9b4ee92-2327-4580-968b-23dded26f6e2 Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
The |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/EXP-code/EXP/sessions/61daa681-8beb-4cbd-877f-f58ff1d18b1a Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/EXP-code/EXP/sessions/61aca825-1c82-4e34-af64-6de5d2314370 Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
… option Agent-Logs-Url: https://github.com/EXP-code/EXP/sessions/437a8908-e2a0-48c1-9224-8263a765ef4e Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
|
@copilot The slab force is implemented in |
Here are the three differences I found that could lead to significantly different results: 1. Texture lookup: missing (kx, ky) swap when The textures are initialized for the upper-triangular set if (iix >= iiy) grid->get_pot(zpot, zz, iix, iiy);
else grid->get_pot(zpot, zz, iiy, iix);The CUDA kernels omit this swap. For every int kx = max(abs(ii), abs(jj));
int ky = min(abs(ii), abs(jj));
int offset = 1 + (kx*(kx+1)/2 + ky)*slabNumZ;2. Opposite sign convention for the potential term at z < 0 —
if (pos[2]<0 && 2*(n/2)!=n) sign = -1; // odd n
if (pos[2]<0 && 2*(n/2)==n) sign = -1; // even nThat sign is correct for the z-force int signV = 1, signF = 1;
if (pos[2]<0 && 2*(n/2)!=n) signV = -1; // potential: flip odd modes
if (pos[2]<0 && 2*(n/2)==n) signF = -1; // z-force: flip even modesand apply 3. Missing CPU ( double adb = cC->Adiabatic();
double mm = -4.0*M_PI * cC->Mass(i) * adb;CUDA ( cuFP_t mm = - p.mass * 2.0*slabDfac; // = -4π * mass, no Adiabatic()For standard runs Minor additional discrepancies (bookkeeping/subsampling only):
|
…tures changes proposed by Copilot
…efficient creation in pyEXP
Updates for consistency with the current conventions
SlablSLnow implements theself_consistentflag for enabling a frozen potentialOne general development support feature
Added compile -time parsing of the EXP version string into major, minor, patch for internal version control logic. E.g.
This will make future version-dependent toggles easier to implement. We have a usage example in both
SLGridSlaband inutils/Test.