SOF-8005: emit RESTART from NWChemInputDataManager - #163
Open
VsevolodX wants to merge 1 commit into
Open
Conversation
The provider already received workflowHasRelaxation from Workflow.render via Subworkflow.buildExternalContext and ignored it, so an NWChem unit following a relaxation re-declared the original geometry and computed the property on the unrelaxed molecule. Mirrors the RESTART_MODE line in QEPWXInputDataManager. Deliberately NOT `jobHasParent || workflowHasRelaxation` as espresso does. Espresso's prepare_restart symlinks the parent job's whole outdir; rupy's NWChem one (src/software/modeling/nwchem/unit.py) symlinks only the parent's perm/, while nwchem.db sits at the work-dir root because no permanent_dir is set. A child job would therefore render ` restart nwchem` with no geometry block and no database to restart from -- an input deck NWChem cannot run. Units of a single job share a work_dir, so the workflowHasRelaxation half is sound and is the one that ships. Co-Authored-By: Claude Opus 5 (1M context) <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 PR (wode)
NWChemInputDataManageralready receivedworkflowHasRelaxationfromWorkflow.renderviaSubworkflow.buildExternalContext— and ignored it. So an NWChem unit following a relaxation re-declared the original geometry and computed the property on the unrelaxed molecule. This emits theRESTARTflag the template consumes, mirroring theRESTART_MODEline inQEPWXInputDataManager.Deliberately not
jobHasParent || workflowHasRelaxation, as espresso does. Espresso'sprepare_restartsymlinks the parent job's wholeoutdir; rupy's NWChem one (src/software/modeling/nwchem/unit.py) symlinks only the parent'sperm/, whilenwchem.dbsits at the work-dir root because nopermanent_diris set. A child job would therefore renderrestart nwchemwith no geometry block and no database to restart from — an input deck NWChem cannot run. Units of a single job share awork_dir, so theworkflowHasRelaxationhalf is sound and is the one that ships. The comment in the source says this, so nobody "restores parity with espresso" later; the unit test pins both halves.JobExternalContextstays in the external-context union — the third test case needs it — but the unusedjobHasParentfield is gone.Everything under
dist/is build output; this repo commits it by convention, and a git pin installs the committeddist/, not a build.Follow-up this does not do: relaxation resolves by application name alone (
Workflow.ts:352), not by what the workflow computes, which is why the frequency template needed the same restart switch in the standata PR. wode#100 already pointed at resolving viaSubworkflowStandatainstead.Tests: 50 passing, including three new cases.
Part of SOF-8005 — [Standata] Relaxation SWF/WF for NWChem. One ticket, five repos; this is one of five PRs that land together.
total_energycomputed HOMO/LUMO on whatever geometry was uploaded — nothing in the NWChem workflows relaxed anything, andget_relaxation_by_application("nwchem")returned{}, so Toggle Relaxation silently no-opped. These PRs close the four gaps between NWChem and what VASP/Espresso already do.MaterialEvidence
Acceptance test
job-nwchem-relaxation-total-energy.featurepasses against a live cluster — takes the unrelaxedH2O.poscar, toggles relaxation in the real UI, runs one job:homo_energylumo_energyTolerance is 0.02 eV, not the 0.1 eV the other nwchem features use: relaxed and unrelaxed HOMO differ by only 0.053 eV, so 0.1 would pass on an unrelaxed molecule — precisely what this test exists to catch. LUMO differs by 0.341 eV and is the discriminating assertion.
The sharpest evidence is not in the assertions. The relaxation unit reported
total_energy = -2078.5728586862333and the total-energy unit-2078.5728586879750— agreeing to 2e-9 eV. The second unit reproduced the first's final energy, which it can only do by computing on the relaxed geometry; astart-from-scratch unit would have recomputed the original upload.Manual checks
restart nwchemwith nogeometryblock — read from a real job atjob.workflow.subworkflows[].units[].input[0].rendered.Optimization convergedstring was not read; job files are in object storage behind the authenticated API.Materialappears with a resolvablematerialId— still absent, and deploying express will not fully fix it.is_non_periodicappears nowhere in rupy andMaterial.__init__defaults it toFalse, so the relaxed molecule builds throughCrystalParser: cubic lattice type yes,isNonPeriodicno. Timur asked for exactly this on this exact file in express#55 (2020-12-08): "Are we able to retain the fact that this is an isolated molecule, rather than a periodic system…". Needs a rupy change; scoped out here and filed as a follow-up.{nwchem, 7.0.2, GNU, isDefaultVersion: true}.Geometry Relaxation.Frequency (nwchem)with no relaxation rendersstart nwchem, byte-identically to before.Review
Two
tb-reviewerpasses. The first found two blockers — localfile:tarball pins in web-app, and ajobHasParent ||half that would have rendered a deck NWChem cannot run — both fixed. The second, grounded against the precedent corpus (12,340 comments / 73 repos), found that Toggle Relaxation had become reachable onFrequency (nwchem)while that template still declared its own geometry: it would have relaxed, discarded the result, and reported frequencies for the original molecule, silently. Fixed here.Known and deliberately not fixed
is_non_periodic— above; needs a rupy change.isRelaxedwill readFalseon every NWChem relaxation once express is deployed._is_relaxed()derives it frompressureandatomic_forces, andNwchemParserimplements neither. Unreachable today because extraction fails first.wode Workflow.ts:352), not by what the workflow computes. wode#100 already pointed this way.🤖 Generated with Claude Code