Skip to content

Feature: use a completed job's final MOs as the initial guess for a follow-on calculation #75

Open

Description

@ohlincha

Cross-code feature request from Andy (not specific to ORCA or any single code) — capture it now while it's fresh, design/implementation deferred.

When starting a new calculation from an existing completed one (e.g. duplicating a job to run a follow-on calculation, or restarting after changing theory/basis), it should be possible to ask ECCE to read the final converged molecular orbitals from the prior calculation's output and use them as the initial guess ("read wavefunction from previous job" / restart-from-MOs), rather than always starting from a generic initial guess (core Hamiltonian, atomic superposition, etc.).

Each code that supports this natively has its own mechanism and file format:

  • NWChem: vectors input <file> / MOs stored in a .movecs file.
  • Gaussian: Guess=Read with a checkpoint (.chk) file carried over.
  • ORCA: %moinp "<file>.gbw" pointing at a prior .gbw file, or the simpler ! MOREAD keyword.

Needs, at minimum:

  • A UI affordance in the calc editor / theory dialog for "use MOs from calculation X" (or "use MOs from the calculation this was duplicated from"), probably per-code since the underlying mechanism differs.
  • The relevant orbital file to be retained/copied alongside a job's other outputs (currently these binary MO files, where they exist at all per code, may not be treated as first-class retained outputs the same way .gbw/.movecs/.chk would need to be).
  • Each code's ai.<code> input generator to emit the correct restart directive when this is requested, pointing at the correct local copy of the prior job's MO file.

No design decisions made yet on the UI or the cross-code abstraction (if any) -- this issue is just to record the ask before it's forgotten, for whoever picks it up.

Activity

  1. ohlincha commented on Sep 22, 2026

    @ohlincha
    CollaboratorAuthor

    Investigated 2026-09-22. Recording what the work actually is, since it is
    larger than it looks and spans three layers.

    Current state

    No generator supports reading MOs. Zero references to vectors input/movecs in ai.nwchem, guess=read/oldchk in ai.gauss16, or
    MORead/moinp in ai.orca. NWChem's Initial Guess dropdown offers only
    "NWChem Atomic Guess" and "Core Hamiltonian".

    The files are partly available already. <DataFiles> declares
    auxiliary MO outputs for NWChem (movec.nw_mo) and Gaussian 16
    (fort.7), so those are uploaded to the data server when a job finishes.
    ORCA declares none — its .gbw would have to be added.

    The duplicate machinery is clean and extensible.
    CalcMgr::OnDuplicate2Click is duplicate() followed by
    resetWithLastGeom(dup), and resetWithLastGeom is a self-contained
    function that rewrites the duplicate's fragment from GEOMTRACE. A third
    variant would follow the same shape.

    So the work is four pieces

    1. Menu and handler — a third entry alongside "Duplicate for Rerun"
      and "Duplicate Setup with Last Geometry", per the maintainer's
      suggestion. Mechanically the easiest part.
    2. Carry the MO file across — copy the source job's auxiliary MO
      output into the duplicate, and record where it landed. This is the
      part with no precedent: resetWithLastGeom only moves numbers that
      are already in the calculation's properties, whereas this moves a
      file between calculations on the data server.
    3. Per-code generator support, which is three different mechanisms:
      NWChem vectors input <file>; Gaussian guess=read with the
      checkpoint carried over (note ECCE currently declares fort.7, the
      text MO dump, not a .chk — so Gaussian may need a different
      auxiliary file than the one declared); ORCA ! MORead plus
      %moinp "<file>.gbw", with the .gbw added to <DataFiles> first.
    4. Dialog option — an "initial guess: previous MOs" choice, which
      must be offered only when the duplicate actually has an MO file, or
      it becomes another silently-dropped setting.

    Suggestion

    Do NWChem first and alone. It is the only code where the auxiliary file
    declared is the one actually needed, nwchem is installed here so the
    whole chain can be verified by running it, and it proves or disproves
    piece 2 — which is the one with no existing pattern to copy. Gaussian and
    ORCA then follow with their own file handling.

    Worth checking early whether the uploaded movec.nw_mo is genuinely
    reusable: NWChem's MO vectors are basis-set dependent, so the follow-on
    calculation has to use the same basis or the read fails. That constraint
    should probably be enforced in the UI rather than discovered at run time.

  2. ohlincha commented on Oct 9, 2026

    @ohlincha
    CollaboratorAuthor

    Extension: basis set projection. The follow-on calculation may use a different (usually larger) basis than the one the MOs come from. The guess is then the old orbitals projected onto the new basis, a standard way to converge large-basis or difficult cases from a cheap small-basis run.

    The main use is unrestricted DFT on large systems that are hard to converge: open-shell transition-metal complexes, radicals, broken-symmetry states. The small-basis run settles the spin state and occupation pattern cheaply, and the projection carries both into the large basis, both α and β sets. Requirements:

    • Projection must work for UHF/UKS (two MO sets).
    • The occupation and spin of the source calculation are kept.
    • The source may use a different functional, for example converge with a pure functional and continue with a hybrid.

    What each code offers natively:

    • NWChem: vectors input project <old basis name> <file.movecs>. The old basis must be defined in the same input under that name, so the generator also writes the old basis block.
    • ORCA: ! MORead with %moinp "old.gbw". ORCA projects automatically when the basis differs (%scf GuessMode FMatrix|CMatrix end).
    • Gaussian 16: Guess=Read with %OldChk=old.chk. It projects automatically when the basis differs.
    • ECCE-QM: to implement. Project with the cross overlap, C' = S'⁻¹ S'ᵒ C (S' the new basis overlap, S'ᵒ the new–old cross overlap from libcint), then orthonormalise the occupied orbitals (Löwdin). This takes about a page of code and is useful for teaching: projecting STO-3G orbitals onto 6-31G* shows what the larger basis adds.
    • MOPAC, Quantum ESPRESSO: not applicable (fixed minimal basis; plane waves).

    UI: in the Calculation Editor, "Initial guess: MOs from ". When that calculation's basis differs from the current one, show "projected from ", so the user knows projection is used.

  3. ohlincha commented on Oct 15, 2026

    @ohlincha
    CollaboratorAuthor

    Stage 1 (ORCA only) is on branch wip/75-moread and is not merged. It is planned for 9.2.

    • Organizer → Edit → Duplicate with Final Orbitals:
      • The finished job's .gbw is kept in its outputs.
      • The duplicate gets the job's last geometry and a copy of the .gbw as guess.gbwin.
      • The generator writes ! MORead and %moinp "guess.gbwin".
    • Calculation Editor: shows "Initial guess: MOs from ", plus "(projected from )" when the basis differs. Use Default Guess drops it.
    • Tested with real ORCA through Launch, the job monitor and the job store, both locally and through a data server (tests/launch/orca_guess_test.py).
      • Water, HF, def2-SVP: 11 SCF cycles with the default guess, 2 from the def2-SVP orbitals.
      • def2-TZVP projected from def2-SVP: 13 cycles, against 12 with the default guess, and the same energy. Projection is meant for hard open-shell cases, not easy ones like this.

    Correction to the investigation above: declaring a file in <DataFiles> does not upload it. The job monitor sends only the parse and output files plus filesToTransfer. NWChem's movec.nw_mo is therefore probably not kept either. ORCA now opts in with <RetainAuxiliaryOutput>.

    Not yet verified:

    • Staging the binary guess file to a remote machine over ssh.
    • The menu and editor appearance on a real display.

    Still to do: NWChem, Gaussian 16 and ECCE-QM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions