Skip to content

Commit eaa394f

Browse files
andyclaude
andcommitted
nwchem.scalar: fix S2 regex matching any line containing digit 2
The active S2 branch was "elsif ( /S*2/ )" (S* matches empty, so this is really just "line contains a 2 anywhere") -- not the commented-out "/S\s*2/" above it, and not what real NWChem output actually prints either (the real tag is literally "S^2", confirmed against a real UHF ecce_print trace). Worked "by luck" only because no other property routed through this shared script (EGRAD/CPUSEC/ETIME/NNREPUL/DELTAE/ RESIDNORM/ONEELEC/TWOELEC/CORRELTN/COULOMB/EXCHANGE) has a literal "2" in its header tag text -- S2 extraction itself was never actually gated on the S2 marker matching. Fixed to /S\^2/, matching the evident original intent. Verified: real NWChem 7.2.3 UHF OH/STO-3G run extracts S2=0.753263362179062, matching Gaussian's S2=0.753262 for the same system/basis (independent cross- code sanity check). Also documents NWChem's ecce_print mechanism in CLAUDE.md -- found while auditing nwchem.desc, whose Begin patterns look meaningless against raw stdout because they're not matched against stdout at all; they match a separate trace file NWChem writes via its own built-in ecce_print directive. Non-obvious enough to mislead a future session auditing this file without discovering it first (this session initially didn't either). Part of a broader Gaussian-16/NWChem parser audit (real g16/nwchem jobs, eccejobmonitor's actual Begin/Skip/Lines/End/Frequency algorithm simulated against real captured output) that found no other live bugs -- several confirmed-dead-but-harmless .desc entries documented in the issue tracker/session notes rather than "fixed" (e.g. gaussian-16.desc's EMP21/EMP22 Begin collision produces identical output either way; gaussian-16.desc's standalone CPUSEC entry never fires but the same data is already extracted via a different code path, gaussian-16.db). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent dd29afa commit eaa394f

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎CLAUDE.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ accurate) for the full pipeline; short version:
7474
close to what you need rather than inventing a new shape).
7575
- **`scripts/gensub`** / **`scripts/eccejobmonitor`** — job-submission
7676
script generation and remote progress reporting.
77+
- **NWChem's `.desc` `Begin` patterns (`%begin%`/`%end%`/`task_*`) don't
78+
match raw NWChem stdout at all, and look bizarre if you try** — they
79+
match a *separate*, machine-tagged trace file that NWChem writes via
80+
its own built-in `ecce_print <file>` directive (still supported as of
81+
NWChem 7.2.3, confirmed live), wired up by `nwch.tpl`'s `ecce_print
82+
##parseFile##` line and `nwchem.launchpp` (rewrites that line to an
83+
absolute path at launch time). This *is* the file `eccejobmonitor`
84+
actually reads for NWChem — auditing `nwchem.desc` against plain
85+
stdout instead will wrongly conclude the whole file is dead.
7786
- **The one gotcha that has bitten this project repeatedly**: every file
7887
under `scripts/*` needs its own `install()` rule in `CMakeLists.txt`,
7988
or it's simply absent from the packaged `.deb` — correct in the repo,

‎scripts/parsers/nwchem.scalar‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ if ( /begin\%gradient norm/ ) {
6161
$unit = "units:\nHartree\n";
6262
# } elsif ( /S\s*2/ ) {
6363
# $propKey = "S2";
64-
} elsif ( /S*2/ ) {
64+
} elsif ( /S\^2/ ) {
6565
$propKey = "S2";
6666
}
6767
$value = <STDIN>;

0 commit comments

Comments
 (0)